@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 300;
  src:
    local("IBM Plex Mono Light"),
    local("IBMPlexMono-Light"),
    url("fonts/IBMPlexMono-Light.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  src:
    local("IBM Plex Mono"),
    local("IBMPlexMono"),
    url("fonts/IBMPlexMono-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  src:
    local("IBM Plex Mono SemiBold"),
    local("IBMPlexMono-SemiBold"),
    url("fonts/IBMPlexMono-SemiBold.woff2") format("woff2");
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #faf6f2;
  --fg: #1a1a2e;
  --accent: #e85a00;
  --muted: #6b6b6b;
  --border: #d4d4d4;
  --grid: rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080b14;
    --fg: #e2e8f0;
    --accent: #00d4ff;
    --muted: #64748b;
    --border: #1a2332;
    --grid: rgba(255, 255, 255, 0.03);
  }
}

[data-theme="light"] {
  --bg: #faf6f2;
  --fg: #1a1a2e;
  --accent: #e85a00;
  --muted: #6b6b6b;
  --border: #d4d4d4;
  --grid: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
  --bg: #080b14;
  --fg: #e2e8f0;
  --accent: #00d4ff;
  --muted: #64748b;
  --border: #1a2332;
  --grid: rgba(255, 255, 255, 0.03);
}

html {
  /* --col is one character cell: the font's real glyph advance. It is 0.6em
	   for IBM Plex Mono (advanceWidth / unitsPerEm = 600 / 1000). Do not use 1ch
	   here: Chrome rounds 1ch to 9.5938px while a glyph actually advances 9.6px,
	   so a 1ch grid slowly slides out from under the text along each line. */
  --col: 0.6em;
  --row: 1.6em;
  --content-width: calc(81 * var(--col));
  font-family:
    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--col) var(--row);
  /* Anchor a gridline to the text's left edge. Use 50% (resolved against the
	   padding box, which excludes the scrollbar) and not 50vw (which includes it),
	   so the grid stays centered on the same axis as the margin-auto body even when
	   a scrollbar is present. The +1.5 (rather than +1) offsets the half-column that
	   a percentage background-position subtracts for the tile's own width. */
  background-position: max(
      var(--col),
      calc(50% - var(--content-width) / 2 + 1.5 * var(--col) - 0.5px)
    )
    0;
  background-attachment: local;
  color: var(--fg);
  min-height: 100%;
}

body {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 3.2em var(--col);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

header {
  /* margin-bottom: 1.6em; */
}

header h1 {
  font-size: 1.6em;
  font-weight: 600;
  line-height: 3.2rem;
}

header h1::before {
  content: "# ";
  color: var(--muted);
  margin-left: calc(-2 * var(--col));
}

.pronouns {
  font-weight: 400;
  font-size: 1rem;
  color: var(--muted);
  position: relative;
  top: -0.1em;
  line-height: 0;
}

.subtitle {
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 60ch) {
  html {
    font-size: 0.875em;
  }

  body {
    padding: 1.6em var(--col);
  }

  header {
    display: inline-block;
  }

  header nav {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }

  header nav a {
    padding: 0;
  }

  header nav a:nth-child(2) {
    margin-right: var(--col);
  }

  header nav a:first-child {
    padding-left: 0;
  }

  header nav a:hover {
    background: none;
    color: var(--muted);
  }

  header nav a svg {
    display: none;
  }
}

.theme-toggle {
  position: fixed;
  bottom: 1.6em;
  right: calc(2 * var(--col));
  background: var(--bg);
  border: none;
  box-shadow:
    inset 1px 0 0 0 var(--border),
    inset 0 1px 0 0 var(--border),
    1px 0 0 0 var(--border),
    0 1px 0 0 var(--border),
    1px 1px 0 0 var(--border);
  color: var(--fg);
  padding: 0.8em var(--col);
  font-family: inherit;
  font-size: 1em;
  line-height: 1.6;
  cursor: pointer;
  border-radius: 0;
  z-index: 100;
  display: none;
}

.theme-toggle:hover {
  box-shadow:
    inset 1px 0 0 0 var(--accent),
    inset 0 1px 0 0 var(--accent),
    1px 0 0 0 var(--accent),
    0 1px 0 0 var(--accent),
    1px 1px 0 0 var(--accent);
}

nav {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 1.6em;
}

nav a {
  display: inline-flex;
  align-items: center;
  height: 1.6rem;
  gap: var(--col);
  padding: 0 var(--col);
  line-height: 1.6;
  color: var(--muted);
}

nav a:hover {
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
}

nav a svg {
  width: var(--col);
  height: 1em;
  fill: currentColor;
}

section {
  margin-bottom: 1.6em;
}

section h2 {
  font-size: 1.6em;
  font-weight: 600;
  line-height: 3.2rem;
  margin-bottom: 0;
}

section h2::before {
  content: "## ";
  color: var(--muted);
  margin-left: calc(-3 * var(--col));
}

section > h3 {
  font-size: 1em;
  font-weight: 600;
  line-height: 1.6rem;
}

section > h3::before {
  content: "### ";
  color: var(--muted);
  margin-left: calc(-4 * var(--col));
}

section > p {
  line-height: 1.6;
}

section > p + p {
  margin-top: var(--row);
}

section {
  counter-reset: footnote-ref -1;
}

.footnote-ref {
  display: inline-block;
  width: calc(2 * var(--col) / 0.75);
  font-size: 0.75em;
  position: relative;
  top: -0.4em;
  color: var(--accent);
  counter-increment: footnote-ref;
  text-align: center;
  line-height: 0;
}

.footnote-ref::before {
  content: "ˆ" counter(footnote-ref);
}

.footnotes {
  margin-top: 1.6rem;
  font-size: 0.875em;
  line-height: 1.6rem;
  color: var(--muted);
}

.footnotes ol {
  list-style: none;
  counter-reset: footnote -1;
}

.footnotes li {
  counter-increment: footnote;
  line-height: 1.6rem;
}

.footnotes li::before {
  content: "ˆ" counter(footnote) ". ";
  color: var(--accent);
}

.footnotes a {
  color: var(--accent);
}

.footnotes a.back {
  color: var(--muted);
  text-decoration: none;
}

.project-group {
  margin: 1.6em 0;
}

.group-label {
  font-size: 1em;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.6;
}

.project-list {
  list-style: none;
  margin-left: calc(2 * var(--col));
}

.project-list li {
  display: grid;
  grid-template-columns: calc(15 * var(--col)) 1fr;
  line-height: 1.6;
}

.project-list a {
  color: var(--fg);
  justify-self: start;
}

.project-list a:hover {
  color: var(--accent);
}

.project-list .desc {
  color: var(--muted);
}

.contrib {
  line-height: 1.6;
  color: var(--muted);
  margin-left: calc(2 * var(--col));
}

.contrib a {
  color: var(--fg);
}

.contrib a:not(:first-child)::before {
  content: ", ";
  color: var(--muted);
}

.contrib a:hover {
  color: var(--accent);
}

/* Hidden until snake.js reveals it, so a JavaScript-less browser is never
   left staring at an inert board. */
#snake {
  display: none;
}

.snake-wrap {
  margin-top: 1.6em;
  container-type: inline-size;
}

.snake-board {
  display: block;
  width: 100%;
  /* The 64x16 play area wants a height of a quarter of the board width. Snap
	   that to the nearest character row so the board's edges sit on the page's
	   background grid; the renderer letterboxes the sub-row remainder and keeps
	   the cells square. */
  height: round(25cqw, var(--row));
  outline: 1px solid var(--border);
  outline-offset: -1px;
  cursor: pointer;
  touch-action: none;
}

.snake-board:focus {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.snake-status {
  margin-top: 1.6em;
  color: var(--muted);
  line-height: 1.6;
  min-height: 1.6em;
}

.photos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 12.8rem;
  grid-auto-flow: dense;
  gap: var(--col);
  row-gap: 1.6em;
  margin-top: 1.6em;
}

@media (max-width: 48ch) {
  .photos {
    grid-template-columns: 1fr;
  }
}

.photo-note {
  /* max-width: 60ch; */
  margin: 1.6em 0;
  color: var(--muted);
  line-height: 1.6;
}

.photos figure {
  margin: 0;
  position: relative;
}

.photos figure.pano {
  grid-column: span 2;
}

.photos figure.featured {
  grid-column: span 2;
  grid-row: span 2;
}

.photos figure.portrait {
  grid-row: span 2;
}

/* On a single-column mobile grid, a leftover "span 2" forces a phantom implicit
   column (the grid resolves to 0px + a full column) and the photos spill past the
   edge. This sits after the span rules above so it wins on equal specificity. */
@media (max-width: 48ch) {
  .photos figure.pano,
  .photos figure.featured {
    grid-column: auto;
  }
}

.photos figure .spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--accent);
  font-size: 2em;
  outline: 1px solid var(--border);
  outline-offset: -1px;
  z-index: 0;
}

.photos figure .spinner::before {
  content: "⣾";
  animation: spin 0.64s steps(8) infinite;
}

@keyframes spin {
  0% {
    content: "⣾";
  }
  12.5% {
    content: "⣷";
  }
  25% {
    content: "⣯";
  }
  37.5% {
    content: "⣟";
  }
  50% {
    content: "⡿";
  }
  62.5% {
    content: "⢿";
  }
  75% {
    content: "⣻";
  }
  87.5% {
    content: "⣽";
  }
}

.photos img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  outline: 1px solid var(--border);
  outline-offset: -1px;
}

.photos figcaption {
  position: absolute;
  bottom: 0.8em;
  left: 0.8em;
  padding: 0.2em calc(0.5 * var(--col));
  font-size: 0.875em;
  line-height: 1.6;
  background: var(--bg);
  color: var(--fg);
  z-index: 2;
}

footer {
  margin-top: 3.2em;
  box-shadow: 0 -1px 0 0 var(--border);
  font-size: 1em;
  color: var(--muted);
  line-height: 1.6;
}

.footer-socials {
  float: right;
  display: flex;
}

.footer-socials a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--col);
  height: 1.6em;
  color: var(--muted);
}

.footer-socials a:hover {
  background: var(--accent);
  color: var(--bg);
}

.footer-socials svg {
  width: calc(2 * var(--col));
  height: 1em;
  fill: currentColor;
}
