/* Martian Mono, SIL Open Font License 1.1 — see /assets/fonts/martian-mono-OFL.txt */
@font-face {
  font-display: swap;
  font-family: "Martian Mono";
  font-stretch: 75% 112.5%;
  font-weight: 100 800;
  src: url("/assets/fonts/martian-mono-latin-f9c1655c2c.woff2") format("woff2");
}

/* The same file pinned to its widest, heaviest cut, so the wordmark and the
   canvas that redraws it always agree on the letterforms. */
@font-face {
  font-display: block;
  font-family: "Martian Display";
  font-stretch: 112.5%;
  font-weight: 800;
  src: url("/assets/fonts/martian-mono-latin-f9c1655c2c.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #030706;
  --panel: rgba(6, 17, 14, 0.74);
  --panel-strong: rgba(4, 12, 11, 0.96);
  --veil: rgba(3, 7, 6, 0.8);
  --ink: #e9fff3;
  --muted: #9dbdae;
  --faint: #6f9080;
  --green: #00ff88;
  --green-soft: #62f7ae;
  --cyan: #6de5ff;
  --line: rgba(0, 255, 136, 0.16);
  --line-strong: rgba(0, 255, 136, 0.5);
  --shadow: 0 18px 80px rgba(0, 0, 0, 0.48);
  --mono: "Martian Mono", ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --display: "Martian Display", "Martian Mono", ui-monospace, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --gutter: clamp(1rem, 3.2vw, 3rem);
  --shell: 1560px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-x: clip;
}

/* A quiet grid and glow: the whole backdrop when the canvas is unavailable. */
body::before {
  background-image: linear-gradient(rgba(0, 255, 136, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 255, 136, 0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  content: "";
  inset: 0;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
  opacity: 0.55;
  pointer-events: none;
  position: fixed;
  z-index: -2;
}

body::after {
  background: radial-gradient(circle at 50% -10%, rgba(0, 255, 136, 0.13), transparent 46%), radial-gradient(circle at 92% 62%, rgba(109, 229, 255, 0.05), transparent 30%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: -3;
}

::selection { background: rgba(0, 255, 136, 0.85); color: #00140b; }

a { color: var(--green-soft); }
a:hover { color: var(--ink); }

button, input { font: inherit; }
button { border: 0; cursor: pointer; }

.skip-link {
  background: var(--green);
  color: #00140b;
  left: 1rem;
  padding: 0.5rem 0.8rem;
  position: fixed;
  top: -5rem;
  z-index: 20;
}
.skip-link:focus { top: 1rem; }

#matrix-canvas {
  height: 100vh;
  height: 100lvh;
  inset: 0;
  pointer-events: none;
  position: fixed;
  width: 100vw;
  z-index: -1;
}

.site-shell { margin-inline: auto; width: min(100% - 2 * var(--gutter), var(--shell)); }

/* ---------- Header ---------- */

.site-header {
  align-items: center;
  display: flex;
  gap: 2rem;
  justify-content: space-between;
  padding: 1.25rem 0;
}

.brand {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-decoration: none;
}
.brand-mark { color: var(--green); }

.site-nav { align-items: center; display: flex; gap: 1.4rem; white-space: nowrap; }
.site-nav a {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  position: relative;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 160ms ease;
}
.site-nav a::after {
  background: var(--green);
  bottom: -0.35rem;
  content: "";
  height: 1px;
  left: 0;
  position: absolute;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 260ms var(--ease);
  width: 100%;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a:hover::after { transform: scaleX(1); }

.motion-toggle,
.button-secondary,
.button-primary,
.gallery-control {
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 0.45rem;
  display: inline-flex;
  font-family: var(--mono);
  font-size: 0.72rem;
  gap: 0.6rem;
  justify-content: center;
  letter-spacing: 0.04em;
  min-height: 2.75rem;
  padding: 0.6rem 1rem;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 200ms ease, color 160ms ease, transform 160ms ease;
}

.motion-toggle, .button-secondary, .gallery-control { background: rgba(0, 255, 136, 0.05); color: var(--green-soft); }
.motion-toggle { border-color: var(--line); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; }
.button-primary { background: var(--green); color: #00140b; font-weight: 700; text-decoration: none; }
.motion-toggle:hover, .button-secondary:hover, .gallery-control:hover { background: rgba(0, 255, 136, 0.14); border-color: var(--green); box-shadow: 0 0 26px rgba(0, 255, 136, 0.14); color: var(--ink); }
.button-primary:hover, .archive:hover .button-primary { background: var(--ink); box-shadow: 0 0 34px rgba(0, 255, 136, 0.35); color: #00140b; }
/* Arrows are not in the bundled face; give them the text face at a matching size. */
.button-primary span, .archive-action span, .scroll-cue span { display: inline-block; font-family: var(--sans); font-size: 1.25em; line-height: 1; }
.button-primary span, .archive-action span { transition: transform 200ms var(--ease); }
.button-primary:hover span, .archive:hover .archive-action span { transform: translateX(4px); }
.motion-toggle:focus-visible, .button-secondary:focus-visible, .button-primary:focus-visible, .gallery-control:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.eyebrow, .terminal-label {
  color: var(--green-soft);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  margin: 0;
  text-transform: uppercase;
}

/* ---------- Hero ---------- */

.hero { display: flex; min-height: calc(100vh - 5.25rem); min-height: calc(100svh - 5.25rem); padding: clamp(1.5rem, 7vh, 5rem) 0 1.5rem; }
.hero-inner { container-type: inline-size; display: flex; flex-direction: column; }
.hero-eyebrow { margin-bottom: clamp(0.7rem, 1.6vh, 1.2rem); }

.hero-name {
  --askew-rest: 3.4;
  font-family: var(--display);
  font-size: calc((100vw - 2 * var(--gutter) - 1rem) / 7.07);
  font-size: calc(100cqi / 7.07);
  font-stretch: 112.5%;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.9;
  margin: 0;
  position: relative;
  text-shadow: 0 0 46px rgba(0, 255, 136, 0.28);
  text-transform: uppercase;
  white-space: nowrap;
}
.name-word, .name-ink { display: inline-block; }
.name-first { color: var(--ink); }
.name-last { color: var(--green); }
/* One corner has given way. JavaScript animates --askew; this is its resting state. */
.name-tilt { transform: rotate(var(--askew, calc(var(--askew-rest) * 1deg))); transform-origin: 0 0; }

/* With scripting, the name waits for the rain to draw it (or for the fallback). */
.js .hero-name { opacity: 0; }
.js.no-fx .hero-name { opacity: 1; transition: opacity 700ms ease; }
.js.fx .hero-name { cursor: pointer; opacity: 1; text-shadow: none; -webkit-user-select: none; user-select: none; }
.js.fx .name-ink { color: transparent; }
.js:not(.fx):not(.no-fx) .hero-name { animation: name-failsafe 500ms 3.5s forwards; }

.hero-body {
  align-items: end;
  display: grid;
  gap: 3rem;
  grid-template-columns: minmax(0, 1.3fr) minmax(250px, 0.5fr);
  margin-top: clamp(2.4rem, 8vh, 5rem);
}
.hero-lede { color: var(--muted); font-size: clamp(1.05rem, 1.5vw, 1.38rem); line-height: 1.55; margin: 0; max-width: 41rem; text-shadow: 0 0 18px var(--bg), 0 0 6px var(--bg); text-wrap: pretty; }
.hero-lede strong { color: var(--ink); font-weight: 600; }

.hero-console { border-left: 1px solid var(--line-strong); padding: 0.2rem 0 0.2rem 1.4rem; }
.hero-console p { color: var(--muted); font-family: var(--mono); font-size: 0.74rem; margin: 0.75rem 0 0; text-shadow: 0 0 12px var(--bg); }
.hero-console strong { color: var(--ink); font-weight: 500; }
.cursor { animation: blink 1.1s steps(2, jump-none) infinite; color: var(--green); }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 1.6rem 0 0; padding: 0; }
.tag-list li { backdrop-filter: blur(4px); background: rgba(3, 7, 6, 0.55); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.04em; padding: 0.32rem 0.7rem; transition: border-color 160ms ease, color 160ms ease; }
.tag-list li:hover { border-color: var(--green); color: var(--ink); }

.lab-entry {
  align-items: center;
  backdrop-filter: blur(6px);
  background: linear-gradient(110deg, rgba(0, 255, 136, 0.1), rgba(3, 14, 10, 0.86));
  border: 1px solid var(--line-strong);
  border-radius: 0.5rem;
  color: var(--ink);
  display: grid;
  font-family: var(--mono);
  gap: 1rem;
  grid-template-columns: 42px minmax(0, 1fr) 20px;
  margin-top: 1.9rem;
  max-width: 31rem;
  overflow: hidden;
  padding: 1rem 1.15rem;
  position: relative;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 200ms ease, color 160ms ease;
}
.lab-entry::before { background: var(--green); bottom: 1rem; content: ""; left: 0; position: absolute; top: 1rem; width: 2px; }
/* A glint crosses the entrance on hover. */
.lab-entry::after {
  background: linear-gradient(100deg, transparent 30%, rgba(210, 255, 232, 0.16) 50%, transparent 70%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
  transform: translateX(-110%);
}
.lab-entry-rabbit { color: #f1fff7; display: block; filter: drop-shadow(0 0 7px rgba(165, 255, 208, 0.3)); height: 42px; width: 42px; }
.lab-entry-copy { display: flex; flex-direction: column; gap: 0.4rem; }
.lab-entry-title { font-size: clamp(0.82rem, 1.2vw, 0.98rem); font-weight: 600; line-height: 1.4; }
.lab-entry-destination { color: var(--green-soft); font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; }
.lab-entry-arrow { color: var(--green); font-size: 1.2rem; transition: transform 200ms var(--ease); }
.lab-entry:hover, .lab-entry:focus-visible { border-color: var(--green); box-shadow: 0 0 40px rgba(0, 255, 136, 0.16); color: #fff; }
.lab-entry:hover .lab-entry-arrow { transform: translateX(4px); }
.lab-entry:hover::after { transform: translateX(110%); transition: transform 700ms var(--ease); }
.lab-entry:hover .lab-entry-rabbit { animation: hop 520ms steps(4, jump-none) 2; }

.scroll-cue {
  align-self: flex-start;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  margin-top: auto;
  padding-top: clamp(1.6rem, 5vh, 3rem);
  text-decoration: none;
  text-transform: uppercase;
}
.scroll-cue span { color: var(--green); display: inline-block; margin-left: 0.5rem; }
.scroll-cue:hover { color: var(--ink); }

/* ---------- Sections ---------- */

.section {
  background: linear-gradient(to bottom, transparent, var(--veil) 5rem, var(--veil) calc(100% - 5rem), transparent);
  padding: clamp(4rem, 11vh, 7.5rem) 0;
  position: relative;
}
.section-grid {
  align-items: start;
  border-top: 1px solid var(--line);
  display: grid;
  gap: clamp(1.5rem, 4vw, 5rem);
  grid-template-columns: minmax(230px, 0.34fr) minmax(0, 1fr);
  padding-top: clamp(1.6rem, 3.5vh, 2.6rem);
  position: relative;
}
.section-grid::before { background: var(--green); content: ""; height: 2px; left: 0; position: absolute; top: -1px; width: 3rem; }
.section-head { position: sticky; top: 1.75rem; }
.section h2, .gallery-heading h1 {
  font-family: var(--mono);
  font-size: clamp(1.4rem, 2.2vw, 2.05rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.08;
  margin: 0.7rem 0 1rem;
}
.section h2::before, .gallery-heading h1::before { color: var(--green); content: "// "; }
.section-note { color: var(--muted); font-size: 0.95rem; margin: 0 0 1.5rem; max-width: 24rem; }

.about-controls { align-items: center; display: flex; flex-wrap: wrap; gap: 0.9rem 1.2rem; }
.toggle-label { align-items: center; color: var(--muted); cursor: pointer; display: inline-flex; font-family: var(--mono); font-size: 0.68rem; gap: 0.55rem; letter-spacing: 0.04em; }
.toggle-label input { accent-color: var(--green); height: 1.05rem; width: 1.05rem; }

.fragments, .exhibits { list-style: none; margin: 0; padding: 0; }
.fragments:focus { outline: none; }
.fragment {
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  padding: 1.05rem 0.25rem 1.05rem 0;
  position: relative;
  transition: background 200ms ease, padding 260ms var(--ease);
}
.fragment:first-child { border-top: 1px solid var(--line); }
.fragment:hover { background: linear-gradient(90deg, rgba(0, 255, 136, 0.06), transparent 70%); padding-left: 0.6rem; }
.fragment-meta { color: var(--green-soft); display: flex; font-family: var(--mono); font-size: 0.62rem; gap: 0.9rem; letter-spacing: 0.14em; text-transform: uppercase; }
.fragment-index { color: var(--faint); }
.fragment-text { color: var(--ink); font-size: clamp(1.02rem, 1.22vw, 1.2rem); line-height: 1.5; max-width: 64ch; text-wrap: pretty; }
.fragment[data-kind="sign-off"] { border-bottom: 0; padding-top: 1.6rem; }
.fragment[data-kind="sign-off"] .fragment-text { color: var(--green); font-family: var(--mono); font-size: clamp(0.98rem, 1.3vw, 1.22rem); font-weight: 500; letter-spacing: -0.03em; line-height: 1.55; }

/* A new transmission wipes in, left to right. */
.fragment.is-arriving .fragment-text {
  animation: arrive 620ms var(--arrival, 0ms) var(--ease) both;
  -webkit-mask-image: linear-gradient(90deg, #000 0 50%, transparent 58%);
  mask-image: linear-gradient(90deg, #000 0 50%, transparent 58%);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 300% 100%;
  mask-size: 300% 100%;
}
.fragment.is-arriving .fragment-meta { animation: fade-in 300ms var(--arrival, 0ms) both; }

.exhibit {
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  color: inherit;
  display: grid;
  gap: 1.3rem;
  grid-template-columns: 2.2rem minmax(11rem, 0.42fr) minmax(0, 1fr) 1.5rem;
  padding: 1.15rem 0.6rem 1.15rem 0;
  position: relative;
  text-decoration: none;
  transition: padding 260ms var(--ease);
}
.exhibits li:first-child .exhibit { border-top: 1px solid var(--line); }
.exhibit::before {
  background: linear-gradient(90deg, rgba(0, 255, 136, 0.1), rgba(0, 255, 136, 0.02) 75%, transparent);
  content: "";
  inset: 0;
  position: absolute;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 420ms var(--ease);
  z-index: -1;
}
.exhibit-index { color: var(--faint); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em; }
.exhibit-title { color: var(--ink); font-family: var(--mono); font-size: clamp(1rem, 1.4vw, 1.3rem); font-weight: 600; letter-spacing: -0.04em; line-height: 1.25; transition: color 160ms ease; }
.exhibit-copy { color: var(--muted); font-size: 0.98rem; line-height: 1.5; text-wrap: pretty; }
.exhibit-arrow { color: var(--green); justify-self: end; opacity: 0.45; transition: opacity 160ms ease, transform 260ms var(--ease); }
.exhibit:hover, .exhibit:focus-visible { color: inherit; padding-left: 0.7rem; }
.exhibit:hover::before, .exhibit:focus-visible::before { transform: scaleX(1); }
.exhibit:hover .exhibit-title { color: var(--green); }
.exhibit:hover .exhibit-arrow { opacity: 1; transform: translateX(5px); }

.archive {
  backdrop-filter: blur(8px);
  background: linear-gradient(140deg, rgba(10, 31, 25, 0.7), var(--panel));
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: inherit;
  display: grid;
  gap: 1.4rem 2rem;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: clamp(1.1rem, 2.4vw, 2rem);
  text-decoration: none;
  transition: border-color 200ms ease, box-shadow 260ms ease;
}
.archive:hover { border-color: var(--line-strong); box-shadow: var(--shadow), 0 0 50px rgba(0, 255, 136, 0.1); color: inherit; }
.archive-frames { display: grid; gap: 0.8rem; grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
/* Real thumbnails from the gallery, cropped to a common shape. The frame's own
   pattern shows while a photo loads, and stands alone if the archive is empty. */
.archive-frame {
  aspect-ratio: 4 / 3;
  background: repeating-linear-gradient(0deg, rgba(0, 255, 136, 0.045) 0 1px, transparent 1px 4px), linear-gradient(150deg, #0b1f19, #030807);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  display: flex;
  overflow: hidden;
  padding: 0.45rem;
  position: relative;
  transition: border-color 200ms ease, box-shadow 300ms ease, transform 300ms var(--ease);
  transition-delay: calc(var(--frame, 0) * 60ms);
}
.archive-frame picture { inset: 0; position: absolute; }
.archive-frame img { display: block; height: 100%; object-fit: cover; transition: transform 700ms var(--ease); width: 100%; }
.archive-frame span { align-self: flex-end; background: rgba(3, 7, 6, 0.72); border-radius: 0.25rem; color: var(--green-soft); font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.14em; padding: 0.12rem 0.38rem; position: relative; }
.archive-frame svg { color: var(--green); height: 46%; left: 50%; opacity: 0.3; position: absolute; top: 46%; transform: translate(-50%, -50%); width: auto; }
.archive:hover .archive-frame { border-color: var(--green); box-shadow: 0 0 24px rgba(0, 255, 136, 0.16); transform: translateY(-3px); }
.archive:hover .archive-frame img { transform: scale(1.05); }
.archive-copy { align-self: center; color: var(--muted); font-size: 1.03rem; max-width: 46ch; text-wrap: pretty; }
.archive-action { align-self: center; }

.home-footer { align-items: center; color: var(--faint); display: flex; font-family: var(--mono); font-size: 0.64rem; gap: 1.5rem; justify-content: space-between; letter-spacing: 0.06em; padding: 2.5rem 0; }
.home-footer a { text-decoration: none; }

/* ---------- Scroll reveal (enabled by site.js) ---------- */

.reveals-on:not(.motion-off) .reveal { opacity: 0; transform: translateY(28px); transition: opacity 900ms var(--ease), transform 900ms var(--ease); }
.reveals-on:not(.motion-off) .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Gallery ---------- */

.gallery-heading { align-items: end; display: flex; gap: 2rem; justify-content: space-between; padding: clamp(2.5rem, 8vh, 5rem) 0 2rem; }
.gallery-heading h1 { font-size: clamp(1.8rem, 4vw, 3.4rem); margin-bottom: 0; }
.gallery-heading p { color: var(--muted); margin: 0; max-width: 36rem; }
.gallery-tools { align-items: center; display: flex; gap: 0.7rem; justify-content: space-between; margin-bottom: 1.2rem; }
.album-nav { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.album-nav a { border-bottom: 1px solid transparent; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.04em; padding: 0.3rem 0; text-decoration: none; }
.album-nav a[aria-current="page"] { border-color: var(--green); color: var(--ink); }
.gallery-note { color: var(--faint); font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; }

.photo-grid { display: grid; gap: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; }
.photo-card { min-width: 0; }
.photo-link { background: #07100e; border: 1px solid var(--line); border-radius: 0.65rem; display: block; overflow: hidden; position: relative; text-decoration: none; transition: border-color 200ms ease, box-shadow 260ms ease, transform 300ms var(--ease); }
.photo-link:hover { border-color: var(--green); box-shadow: 0 0 34px rgba(0, 255, 136, 0.2); transform: translateY(-4px); }
.photo-frame { aspect-ratio: 4 / 3; background: linear-gradient(135deg, #0b1c18, #020504); display: block; overflow: hidden; }
.photo-frame picture { display: block; height: 100%; }
.photo-frame img { display: block; height: 100%; object-fit: cover; transition: transform 500ms var(--ease); width: 100%; }
.photo-link:hover img { transform: scale(1.045); }
.photo-caption { background: linear-gradient(transparent, rgba(0, 0, 0, 0.86)); bottom: 0; color: var(--ink); font-family: var(--mono); font-size: 0.66rem; left: 0; padding: 2.7rem 0.7rem 0.65rem; position: absolute; right: 0; }
.photo-number { color: var(--green-soft); font-size: 0.6rem; margin-right: 0.35rem; }

.pagination { align-items: center; display: flex; gap: 0.7rem; justify-content: center; padding: 2.2rem 0 3.5rem; }
.pagination a, .pagination span { align-items: center; border: 1px solid var(--line); border-radius: 0.4rem; display: inline-flex; font-family: var(--mono); font-size: 0.72rem; justify-content: center; min-height: 2.5rem; min-width: 2.5rem; padding: 0.35rem 0.7rem; text-decoration: none; }
.pagination span { background: rgba(0, 255, 136, 0.16); border-color: var(--green); color: var(--ink); }

.photo-dialog { background: var(--panel-strong); border: 1px solid var(--line-strong); border-radius: 0.7rem; color: var(--ink); height: min(92vh, 900px); max-height: 92vh; max-width: min(1100px, calc(100vw - 2rem)); padding: 0; width: min(1100px, calc(100vw - 2rem)); }
.photo-dialog::backdrop { backdrop-filter: blur(10px); background: rgba(0, 4, 3, 0.88); }
.dialog-layout { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
.dialog-header, .dialog-footer { align-items: center; display: flex; justify-content: space-between; padding: 0.8rem 1rem; }
.dialog-header { border-bottom: 1px solid var(--line); }
.dialog-title { font-family: var(--mono); font-size: 0.72rem; }
.dialog-close, .dialog-arrow { align-items: center; background: rgba(0, 255, 136, 0.08); border: 1px solid var(--line-strong); border-radius: 0.4rem; color: var(--green-soft); display: inline-flex; justify-content: center; min-height: 2.75rem; min-width: 2.75rem; }
.dialog-close:hover, .dialog-arrow:hover { background: var(--green); color: #00140b; }
.dialog-stage { align-items: center; display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) 3.5rem; min-height: 0; padding: 0.8rem; }
.dialog-image-wrap { align-items: center; display: flex; height: 100%; justify-content: center; min-height: 220px; overflow: hidden; position: relative; }
.dialog-image { display: block; max-height: 100%; max-width: 100%; object-fit: contain; }
.js:not(.motion-off) .dialog-image { opacity: 0; transition: opacity 320ms ease; }
.js:not(.motion-off) .dialog-image.is-loaded { opacity: 1; }
.dialog-status { color: var(--muted); font-family: var(--mono); font-size: 0.68rem; left: 50%; position: absolute; top: 50%; transform: translate(-50%, -50%); }
.dialog-status[hidden] { display: none; }
.dialog-footer { border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 0.66rem; gap: 1rem; }
.dialog-caption { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty-state { color: var(--muted); padding: 3rem 0; text-align: center; }
.sr-only { clip: rect(0, 0, 0, 0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }

/* ---------- Motion ---------- */

@keyframes blink { 50% { opacity: 0; } }
@keyframes name-failsafe { to { opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes hop { 50% { transform: translateY(-6px); } }
@keyframes drift { 50% { transform: translateY(5px); } }
@keyframes arrive {
  from { color: var(--green); -webkit-mask-position: 100% 0; mask-position: 100% 0; }
  to { -webkit-mask-position: 0 0; mask-position: 0 0; }
}

@keyframes leave-world { to { filter: blur(6px); opacity: 0; transform: scale(1.08); } }
@keyframes enter-world { from { opacity: 0; transform: scale(0.965); } }

@media (prefers-reduced-motion: no-preference) {
  /* Moving between pages, and down the rabbit hole: the old world falls away
     as the next comes forward. Browsers without view transitions simply navigate.
     The opt-in itself (@view-transition) is inline in the page head, so it is
     always known before first paint. */
  ::view-transition-old(root) { animation: 340ms ease-in both leave-world; }
  ::view-transition-new(root) { animation: 620ms var(--ease) 120ms both enter-world; }

  .js:not(.motion-off) .hero-eyebrow,
  .js:not(.motion-off) .hero-lede,
  .js:not(.motion-off) .tag-list,
  .js:not(.motion-off) .lab-entry,
  .js:not(.motion-off) .hero-console,
  .js:not(.motion-off) .scroll-cue { animation: rise 900ms var(--ease) both; }
  .js:not(.motion-off) .hero-eyebrow { animation-delay: 120ms; }
  .js:not(.motion-off) .hero-lede { animation-delay: 320ms; }
  .js:not(.motion-off) .tag-list { animation-delay: 430ms; }
  .js:not(.motion-off) .lab-entry { animation-delay: 540ms; }
  .js:not(.motion-off) .hero-console { animation-delay: 650ms; }
  .js:not(.motion-off) .scroll-cue { animation-delay: 1300ms; }
  .js:not(.motion-off) .scroll-cue span { animation: drift 1.8s ease-in-out infinite; }
}

/* ---------- Smaller screens ---------- */

@media (max-width: 980px) {
  .hero-body { gap: 2rem; grid-template-columns: 1fr; }
  .hero-console { border-left: 0; border-top: 1px solid var(--line); padding: 1rem 0 0; }
  .section-grid { grid-template-columns: 1fr; }
  .section-head { position: static; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .exhibit { grid-template-columns: 2.2rem minmax(0, 1fr) 1.5rem; }
  .exhibit-copy { grid-column: 2 / 3; grid-row: 2; }
  .exhibit-arrow { grid-column: 3; grid-row: 1; }
}

@media (max-width: 760px) {
  /* The wordmark stacks, and each word fills the width. */
  .hero-name { font-size: calc((100vw - 2 * var(--gutter)) / 3.54); font-size: calc(100cqi / 3.54); line-height: 0.92; }
  .name-word { display: block; }
  .hero { min-height: auto; padding-top: 2.2rem; }
  .hero-body { margin-top: 2.6rem; }
  .scroll-cue { margin-top: 2.5rem; }
  .fragment { gap: 0.4rem; grid-template-columns: 1fr; }
  .archive { grid-template-columns: 1fr; }
  .archive-action { justify-self: start; }
}

@media (max-width: 640px) {
  .site-header { gap: 0.8rem; }
  .site-nav { gap: 0.85rem; }
  .site-nav a { font-size: 0.6rem; letter-spacing: 0.08em; }
  .motion-toggle { font-size: 0.58rem; letter-spacing: 0.06em; min-height: 2.5rem; padding-inline: 0.6rem; }
  .gallery-heading { align-items: start; flex-direction: column; gap: 0.6rem; }
  .gallery-tools { align-items: start; flex-direction: column; }
  .photo-grid { gap: 0.65rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-caption { font-size: 0.6rem; padding-left: 0.45rem; }
  .dialog-stage { grid-template-columns: 2.8rem minmax(0, 1fr) 2.8rem; padding: 0.35rem; }
  .dialog-footer { align-items: start; flex-direction: column; gap: 0.3rem; }
  .dialog-caption { max-width: 100%; width: 100%; }
  .home-footer { align-items: start; flex-direction: column; gap: 0.6rem; }
}

@media (max-width: 420px) {
  .brand { font-size: 0.68rem; letter-spacing: 0.02em; }
  .site-nav { gap: 0.7rem; }
  .site-nav a { font-size: 0.56rem; letter-spacing: 0.05em; }
  .lab-entry { gap: 0.7rem; grid-template-columns: 34px minmax(0, 1fr) 16px; padding: 0.9rem; }
  .lab-entry-rabbit { height: 34px; width: 34px; }
  .lab-entry-destination { font-size: 0.54rem; letter-spacing: 0.06em; }
}

@media print {
  .reveal { opacity: 1 !important; transform: none !important; }
  #matrix-canvas { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.001ms !important; }
}

.motion-off *, .motion-off *::before, .motion-off *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.001ms !important; }
