/* Learning to Swim — three-act story site.
   ==========================================================================
   Light + dark both ship. That is a Kyle ruling for THIS site only
   (2026-08-14, reaffirmed 2026-09-07); the project's 2026-07-27 dark-only rule
   still governs reports and decks. Do NOT "restore" dark-only here. The theme
   switch is the nav toggle: first visit follows the OS, a manual choice
   persists (localStorage "story-theme") and overrides the OS, and
   index.html's inline head script applies data-theme before first paint.

   SHAPE, not cards. The page is three acts and two convergences, each opening
   with a full-bleed scene and a large title, then narrowing to a ~68ch reading
   column. Campaign and experiment results are *evidence inside an act* — a
   stacked single column of claim / caveat / evidence blocks — never a grid of
   equivalent tiles. If this file ever grows a
   `grid-template-columns: repeat(auto-fill, …)` around the evidence, the
   redesign has been undone.

   frame.css is a SEPARATE, SHARED stylesheet, injected into every deployed
   report page, and it styles only `.wrap` and `.nav`. It loads after this file
   and its width rules win. Never fold it in here, and never drop those two
   class hooks. */

/* ==========================================================================
   1 · Tokens
   ========================================================================== */

:root {
  color-scheme: dark;

  /* --bg was #0a0a0a. Near-pure black under #f5f5f5 text produces halation —
     optical bleeding of the glyphs, worst for readers with astigmatism, and
     this site is long-form reading. #121212 is the researched soft-dark floor.
     Measured: #ededed on #121212 = 16.00:1, still ~3.5x the AA bar. */
  --bg: #121212;
  --surface: #1a1a1a;         /* raised with the floor so the step stays visible */
  --surface-2: #202020;
  --glass: rgba(26, 26, 26, 0.62);
  --glass-edge: rgba(255, 255, 255, 0.14);
  --border: rgba(255, 255, 255, 0.09);
  --border-bright: rgba(255, 255, 255, 0.18);

  /* --text 96% -> 93% white: the other half of the halation pairing.
     16.00:1 on --bg. */
  --text: #ededed;
  --body: #a3a3a3;            /* 7.43:1 on --bg */
  /* --dim was #737373 = 3.95:1, which FAILED WCAG AA for normal text and is
     the colour every `source:` line uses. #8a8a8a = 5.43:1. */
  --dim: #8a8a8a;

  --accent: #38bdf8;          /* 8.74:1 */
  --accent-dim: rgba(56, 189, 248, 0.14);

  --curee: #00c1d4;           /* 8.54:1 */
  --hippocampus: #5affc5;     /* 14.76:1 */
  --bluerov2: #ff7e15;        /* 7.36:1 */

  /* Verdict colours. --fail stays #f87171 (6.77:1, OKLCH C=0.166): the
     research names red-on-NEAR-BLACK as the highest-fatigue pairing, and the
     near-black half is what --bg just fixed. The other half is handled
     structurally — every failure carries a glyph AND a border-style AND a
     screen-reader word, so colour is never the only channel. See §6. */
  --pass: #4ade80;            /* 10.75:1, C=0.182 */
  --fail: #f87171;            /* 6.77:1,  C=0.166 */
  --neutral: #94a3b8;         /* 7.31:1,  C=0.035 */

  --hover-bg: rgba(255, 255, 255, 0.06);
  --chip-bg: rgba(255, 255, 255, 0.035);
  --grid-line: rgba(255, 255, 255, 0.07);
  --refchip-bg: #161616;
  --note-text: #cfeafd;
  --err-bg: #451a1a;
  --err-border: #7f1d1d;
  --err-text: #fecaca;

  /* Series colours for the comparison charts. Every one is <= 0.20 OKLCH
     chroma, which is the sRGB gamut-safety bound this project holds. */
  --s1: #38bdf8;
  --s2: #5affc5;
  --s3: #ff9d4d;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 14px;

  /* 4px vertical rhythm. Every block margin in this file is a multiple. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;

  /* Act-to-act space, so three acts are FELT as three. */
  --act-gap: clamp(96px, 13vh, 176px);
  --measure: 68ch;
}

/* ---------- light theme (token redefinitions only) ---------- */

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #e9eef4;
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --border: rgba(15, 23, 42, 0.1);
  --border-bright: rgba(15, 23, 42, 0.2);
  --text: #0f172a;            /* 15.30:1 on --bg */
  --body: #3d4b5e;            /* 7.61:1 */
  --dim: #55637a;             /* 5.21:1 (was #5b6b80 = 4.66:1 — tight for source lines) */
  --accent: #0369a1;          /* 5.28:1 */
  --accent-dim: rgba(3, 105, 161, 0.1);
  --curee: #0e7490;           /* 4.77:1 */
  --hippocampus: #047857;     /* 4.88:1 */
  --bluerov2: #be3f0b;  /* 4.44 -> 4.61 on --bg; measured AA fix 2026-09-07 */        /* 4.61:1 */
  --pass: #147a3a;  /* 4.30 -> 4.65 on --bg; measured AA fix 2026-09-07 */            /* 4.46:1, C=0.137 */
  --fail: #b91c1c;            /* 5.76:1, C=0.190 */
  --neutral: #475569;         /* 6.74:1 */
  --hover-bg: rgba(15, 23, 42, 0.06);
  --chip-bg: rgba(15, 23, 42, 0.04);
  --grid-line: rgba(15, 23, 42, 0.08);
  --refchip-bg: #f1f5f9;
  --note-text: #075985;
  --err-bg: #fef2f2;
  --err-border: #fca5a5;
  --err-text: #991b1b;
  --s1: #0369a1;
  --s2: #047857;
  --s3: #c2410c;
}

/* ==========================================================================
   2 · Base
   ========================================================================== */

* { box-sizing: border-box; }

/* 106.25% = 17px at the browser's 16px default. 17px, not 16, per the
   halation research: on a dark ground a slightly larger glyph loses less of
   its counters to bleed. A percentage, so a reader's own font-size setting is
   still respected. */
html {
  font-size: 106.25%;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: 1rem;
  /* >= 400 on dark: a 300 weight thins into the halo. The webfont request in
     index.html no longer even ships a 300. */
  font-weight: 400;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 var(--sp-4);
}

p { margin: 0 0 var(--sp-4); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

img, video, canvas, iframe { max-width: 100%; }

/* `.wrap` is a frame.css hook — it must keep this exact class name. The width
   below is what frame.css overrides on deployed pages. */
.wrap { max-width: 1100px; margin-inline: auto; padding-inline: var(--sp-6); }

/* The reading column. Full-bleed media and scenes break OUT of it. */
.measure { max-width: var(--measure); }

/* Mono is reserved for numbers, ids and file paths. That reservation is what
   makes a number read as data rather than as prose. Do not set var(--mono) on
   a heading, an eyebrow or a nav label. */
.mono { font-family: var(--mono); font-variant-ligatures: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* A cited file path. Used everywhere a claim names its source. */
.src {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--dim);
  overflow-wrap: anywhere;
  margin: 0;
}

/* An uppercase label. Sans, letterspaced — NOT mono (see the reservation). */
.eyebrow {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--sp-3);
}

/* ---------- background ---------- */

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(700px 520px at 10% -6%, rgba(56, 189, 248, 0.08), transparent 70%),
    radial-gradient(760px 560px at 92% 30%, rgba(0, 193, 212, 0.055), transparent 70%),
    radial-gradient(700px 520px at 45% 104%, rgba(90, 255, 197, 0.045), transparent 70%);
}

:root[data-theme="light"] .bg-glow {
  background:
    radial-gradient(700px 520px at 10% -6%, rgba(2, 132, 199, 0.14), transparent 70%),
    radial-gradient(760px 560px at 92% 30%, rgba(8, 145, 178, 0.1), transparent 70%),
    radial-gradient(700px 520px at 45% 104%, rgba(5, 150, 105, 0.09), transparent 70%);
}

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--border);
  border-top-color: var(--glass-edge);
  border-radius: var(--radius);
}

/* On a light ground the dark theme's free separation disappears and a dark top
   border reads as a shadow pressed INTO the page. Keep the lip a highlight and
   lift the panel instead. Light scope only. */
:root[data-theme="light"] .glass {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 28px rgba(15, 23, 42, 0.07);
}

/* ==========================================================================
   3 · Shell — skip link, nav, footer
   ========================================================================== */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

main:focus { outline: none; }

/* `.nav` is the second frame.css hook. Keep the class name. */
.nav {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: min(1100px - 48px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 9px 16px;
}
.nav .brand {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}
.nav .brand span { color: var(--accent); }
.nav ul {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav a {
  display: block;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 0.86rem;
  color: var(--body);
}
.nav a:hover { color: var(--text); background: var(--hover-bg); text-decoration: none; }

.theme-toggle {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border-bright);
  background: transparent;
  color: var(--body);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s, background 0.3s;
}
.theme-toggle::after { content: "\2600"; }
:root[data-theme="light"] .theme-toggle::after { content: "\263E"; }
.theme-toggle:hover { color: var(--text); border-color: var(--accent); background: var(--accent-dim); }

/* The theme flip must not drag every hover transition on the page with it. */
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after { transition: none !important; }

footer {
  border-top: 1px solid var(--border);
  margin-top: var(--act-gap);
  padding-block: var(--sp-10) var(--sp-16);
  font-size: 0.86rem;
  color: var(--dim);
}

/* ==========================================================================
   4 · Hero
   ========================================================================== */

.hero { padding-block: 152px var(--sp-16); }
.hero .kicker {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--sp-5);
}
.hero h1 {
  font-size: clamp(2.75rem, 8vw, 5.5rem);
  letter-spacing: -0.035em;
  font-weight: 800;
  margin-bottom: var(--sp-5);
}
.hero .tagline {
  max-width: var(--measure);
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  color: var(--text);
  font-weight: 400;
  margin-bottom: var(--sp-6);
}
/* The thesis is the one sentence the whole site answers to. Given a rule and
   real size so it cannot be mistaken for a subtitle. */
.hero .thesis {
  max-width: var(--measure);
  border-left: 3px solid var(--accent);
  padding-left: var(--sp-5);
  font-size: 1.06rem;
  color: var(--text);
  margin-bottom: var(--sp-8);
}
.hero .lead { max-width: var(--measure); margin-bottom: var(--sp-5); }
.hero .attribution { max-width: var(--measure); font-size: 0.92rem; color: var(--dim); }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  margin-bottom: var(--sp-8);
}
.daterange {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--body);
  background: var(--chip-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--neutral);
}
.chip[data-v="curee"]::before { background: var(--curee); }
.chip[data-v="hippocampus"]::before { background: var(--hippocampus); }
.chip[data-v="bluerov2"]::before { background: var(--bluerov2); }

/* The four hero numbers. This is the ONE place a tile grid is right: four
   equivalent figures, deliberately equivalent. */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat { background: var(--surface); padding: var(--sp-5) var(--sp-5) var(--sp-4); }
.stat-value {
  display: block;
  font-family: var(--mono);
  font-size: clamp(1.5rem, 3.4vw, 1.9rem);
  font-weight: 500;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.stat-label {
  display: block;
  font-size: 0.87rem;
  color: var(--body);
  margin-top: var(--sp-2);
}
.stat .src { margin-top: var(--sp-3); }

/* ==========================================================================
   5 · Acts — the page's rhythm
   ========================================================================== */

.act { padding-block: 0 var(--act-gap); }
/* A hairline the full width of the viewport: the acts are separated by the
   page itself, not by card edges. Act-to-act space is 2x --act-gap (this act's
   bottom padding plus the next opener's top padding) — deliberately generous,
   so three acts are felt as three. */
.act + .act { border-top: 1px solid var(--border); }

.act-open { padding-top: var(--act-gap); }
.act-eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--sp-4);
}
.act-title {
  /* The typographic contrast that carries the whole structure: this against
     17px body. */
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  max-width: 20ch;
  margin-bottom: var(--sp-6);
}
.act-lead {
  max-width: var(--measure);
  font-size: clamp(1.05rem, 1.8vw, 1.2rem);
  color: var(--text);
  font-weight: 400;
  margin-bottom: 0;
}

/* The act body narrows back to the reading column. */
.act-body { padding-top: var(--sp-16); }

/* ---------- full-bleed scene ---------- */

/* Breaks out of every wrap: the scene is the widest thing on the page. */
.scene-figure { margin: var(--sp-16) 0 0; }

.scene {
  position: relative;
  width: 100%;
  /* svh/dvh, NOT vh: on mobile the address bar showing and hiding changes vh
     continuously, which turns a canvas resize handler into a resize storm. */
  height: 62vh;
  height: 62svh;
  min-height: 320px;
  max-height: 680px;
  overflow: hidden;
  background:
    linear-gradient(180deg, var(--surface-2), var(--surface));
  border-block: 1px solid var(--border);
  contain: layout paint;
}
/* The poster sits UNDER the canvas, always painted, so there is no flash on
   mount and no blank box when WebGL is refused or motion is off. */
.scene-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  display: block;
}
/* scenes.js appends its canvas here and needs no positioning knowledge. */
.scene canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.scene-cap { padding-top: var(--sp-5); }
.scene-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 var(--sp-4);
}
/* The on-canvas labels are ALSO rendered here as text, unconditionally. A
   scene can otherwise assert a verdict as geometry with no number printed, and
   a reader with WebGL off would never see the sentence at all. */
.scene-labels {
  list-style: none;
  margin: 0 0 var(--sp-4);
  padding: 0;
  max-width: var(--measure);
  display: grid;
  gap: var(--sp-3);
}
.scene-labels li {
  border-left: 2px solid var(--border-bright);
  padding-left: var(--sp-4);
}
.scene-labels p { margin: 0 0 var(--sp-1); color: var(--text); font-size: 0.95rem; }
.scene-caption { max-width: var(--measure); margin-bottom: var(--sp-2); }

/* ---------- the cast (Act 1's three robots) ---------- */

.cast {
  display: grid;
  gap: var(--sp-6);
  margin: 0 0 var(--sp-12);
  padding: 0;
  list-style: none;
}
.cast li {
  border-left: 3px solid var(--neutral);
  padding-left: var(--sp-5);
  max-width: var(--measure);
}
.cast li[data-v="curee"] { border-left-color: var(--curee); }
.cast li[data-v="hippocampus"] { border-left-color: var(--hippocampus); }
.cast li[data-v="bluerov2"] { border-left-color: var(--bluerov2); }
.cast h3 { font-size: 1.05rem; margin-bottom: var(--sp-2); }
.cast h3[data-v="curee"] { color: var(--curee); }
.cast h3[data-v="hippocampus"] { color: var(--hippocampus); }
.cast h3[data-v="bluerov2"] { color: var(--bluerov2); }
.cast p { margin: 0; font-size: 0.95rem; }

/* ==========================================================================
   6 · Evidence — a claim, its caveat, then its numbers, in that order
   ==========================================================================
   NOT a card. A stacked block in one column, separated by a hairline, carrying
   a kind rule down its left edge. Three independent channels encode the
   verdict — colour, BORDER-STYLE (solid / dashed / dotted) and a glyph plus a
   screen-reader word — so a failure is never colour alone. That matters here
   more than usual: the middle of this story is a negative result. */

.ev-list { display: grid; gap: 0; }

.ev {
  --kind: var(--neutral);
  border-left: 3px solid var(--kind);
  border-top: 1px solid var(--border);
  padding: var(--sp-10) 0 var(--sp-10) var(--sp-6);
  max-width: 900px;
}
.ev:first-child { border-top: 0; padding-top: var(--sp-4); }
.ev[data-kind="pass"] { --kind: var(--pass); border-left-style: solid; }
.ev[data-kind="fail"] { --kind: var(--fail); border-left-style: dashed; }
.ev[data-kind="neutral"] { --kind: var(--neutral); border-left-style: dotted; }

.ev-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.ev-id {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--dim);
  letter-spacing: 0.01em;
}
.ev-name { font-size: 1.3rem; margin-bottom: var(--sp-3); max-width: var(--measure); }
.ev-purpose { max-width: var(--measure); color: var(--body); margin-bottom: var(--sp-5); }

/* 1 — the claim */
.ev-verdict {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  margin: 0 0 var(--sp-5);
}
.ev-glyph {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--kind);
  color: var(--kind);
  font-size: 12px;
  line-height: 19px;
  text-align: center;
  transform: translateY(2px);
}
.ev-verdict-text {
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--kind);
}

/* 2 — the caveat. Load-bearing, so it is given body size and a ground of its
   own. A caveat set as small grey afterthought text defeats its purpose. */
.ev-caveat {
  max-width: var(--measure);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--border-bright);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: var(--sp-4) var(--sp-5);
  margin: 0 0 var(--sp-5);
  color: var(--text);
  font-size: 0.98rem;
}
.ev-caveat-tag {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: var(--sp-2);
}

/* 3 — the evidence. Mono, because these are measurements. */
.ev-evidence {
  max-width: var(--measure);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--body);
  margin: 0 0 var(--sp-3);
}

.ev .src { margin-bottom: var(--sp-5); }

/* 4 — media and report links, last */
.ev-media { display: grid; gap: var(--sp-5); margin: var(--sp-5) 0 0; }
.media-label {
  font-size: 0.8rem;
  color: var(--dim);
  margin: 0 0 var(--sp-2);
}
.pose-video,
.ev-figure img {
  display: block;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #000;
}

/* The pose animations and several localization figures are matplotlib output
   on a WHITE canvas. Left at full column width they are ~650px of white per
   card, six of them, and on a dark page the reading rhythm becomes: paragraph,
   headlight, paragraph, headlight. Capping the height turns each one back into
   a figure sitting IN the page instead of a panel the page happens to contain.
   Height rather than width, because these plots are near-square: capping width
   would leave the same white area with more margin around it. `svh`, not `vh`,
   so a mobile address bar appearing does not resize every figure on the page. */
.pose-video {
  width: auto;
  max-width: 100%;
  max-height: min(46svh, 420px);
  margin-inline: auto;
  background: var(--surface-2);
}
.ev-figure img { max-height: min(34svh, 300px); }
/* 2-up, not 3-up: these are raw matplotlib panels whose axis text is
   unreadable below about 450px, and each is a white rectangle on a dark page -
   three across made them the brightest, least legible objects on the screen. */
.ev-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--sp-4);
  margin: var(--sp-5) 0 0;
}
.ev-figure { margin: 0; }
.ev-figure img { background: var(--surface-2); aspect-ratio: 4 / 3; object-fit: cover; }
.ev-figure figcaption { font-size: 0.78rem; color: var(--dim); margin-top: var(--sp-2); }

.ev-links {
  margin-top: var(--sp-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  font-size: 0.88rem;
}

/* Pointer devices get the project's grayscale-until-hover signature; touch
   devices, which have no hover, get colour immediately. */
@media (hover: hover) {
  .pose-video, .ev-figure img { filter: grayscale(1); transition: filter 0.9s ease; }
  .pose-video:hover, .pose-video.playing, .ev-figure img:hover { filter: grayscale(0); }
}

/* ==========================================================================
   7 · Folds — <details> whose summary line carries its own verdict
   ==========================================================================
   Every fold reads as a complete sentence closed, so the page still tells the
   whole story with everything shut. */

.fold { margin: 0 0 var(--sp-12); }
.fold > summary {
  display: flex;
  align-items: baseline;
  gap: var(--sp-4);
  cursor: pointer;
  list-style: none;
  padding-block: var(--sp-4);
  border-top: 1px solid var(--border-bright);
  border-bottom: 1px solid var(--border);
}
.fold > summary::-webkit-details-marker { display: none; }
.fold-label {
  flex: 0 0 auto;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
}
.fold-verdict {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--dim);
  letter-spacing: 0.02em;
}
.toggle-pill {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--body);
  border: 1px solid var(--border-bright);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
  transition: color 0.3s, border-color 0.3s, background 0.3s;
}
.toggle-pill::after { content: "Show \25BE"; }
.fold[open] > summary .toggle-pill::after { content: "Hide \25B4"; }
@media (hover: hover) {
  .fold > summary:hover .toggle-pill {
    color: var(--text);
    border-color: var(--accent);
    background: var(--accent-dim);
  }
}

/* A native <details> toggles instantly; the grid-row transition gives it a
   calm, reversible open/close with no JS measurement (and therefore no forced
   synchronous layout). */
.collapse-body {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition:
    grid-template-rows 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.36s ease;
}
.fold[open] > .collapse-body {
  grid-template-rows: 1fr;
  opacity: 1;
  pointer-events: auto;
}
.fold.closing > .collapse-body {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}
.collapse-body > * { min-height: 0; }
.fold[open] > .collapse-body > * { padding-top: var(--sp-6); }

/* ==========================================================================
   8 · Charts — inline SVG drawn from the numbers in data.js
   ========================================================================== */

.chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-8) var(--sp-8) var(--sp-6);
  margin-bottom: var(--sp-6);
}
.chart h3 { font-size: clamp(1.15rem, 2.2vw, 1.4rem); }
.c-lead { max-width: var(--measure); margin: 0 0 var(--sp-5); }
.c-panels { display: grid; gap: var(--sp-6); }
.c-panels.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.c-panel { min-width: 0; }
.c-plabel {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: var(--sp-2);
}
.c-scroll { overflow-x: auto; }
.c-scroll svg { display: block; width: 100%; min-width: 380px; height: auto; }

.c-grid { stroke: var(--grid-line); stroke-width: 1; }
.c-axis, .c-cat, .c-val, .c-reflabel { fill: var(--dim); font-family: var(--mono); font-size: 13px; }
.c-cat { fill: var(--body); font-size: 14px; }
.c-val { fill: var(--text); font-size: 13px; }
.c-bar { fill: var(--accent); opacity: 0.85; }
.c-dot { stroke: var(--surface); stroke-width: 1.5; }
.c-link { stroke: var(--border-bright); stroke-width: 1.5; }
.c-ref { stroke: var(--fail); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: 0.85; }
.c-ref.soft { stroke: var(--dim); stroke-dasharray: 2 4; }
.c-refchip { fill: var(--refchip-bg); fill-opacity: 0.92; }
.c-reflabel { fill: var(--fail); }
.c-reflabel.soft { fill: var(--dim); }

.c-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-top: var(--sp-3);
  font-size: 0.8rem;
  color: var(--dim);
}
.c-li { display: inline-flex; align-items: center; gap: 6px; }
.c-li i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.c-note {
  max-width: var(--measure);
  margin: var(--sp-5) 0 var(--sp-2);
  font-size: 0.92rem;
  color: var(--note-text);
  border-left: 2px solid var(--accent);
  padding-left: var(--sp-4);
}
.c-src { margin: 0; font-family: var(--mono); font-size: 0.76rem; color: var(--dim); }

/* ==========================================================================
   9 · Colophon and sources
   ========================================================================== */

.tail { padding-block: var(--act-gap) 0; }
.tail h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); margin-bottom: var(--sp-8); }

.colophon-list { display: grid; gap: var(--sp-8); margin: 0 0 var(--sp-12); padding: 0; }
.colophon-list > div { max-width: var(--measure); }
.colophon-list h3 {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: var(--sp-3);
}
.colophon-list p { margin: 0; color: var(--text); }

/* The honest negatives are not a footnote. They get a real block. */
.negatives {
  max-width: var(--measure);
  border: 1px solid var(--border);
  border-left: 3px dashed var(--fail);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
  padding: var(--sp-6);
}
.negatives h3 {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fail);
  margin-bottom: var(--sp-4);
}
.negatives ul { margin: 0; padding-left: var(--sp-5); }
.negatives li { margin-bottom: var(--sp-3); color: var(--text); }
.negatives li:last-child { margin-bottom: 0; }

.sources { margin: 0; display: grid; gap: 0; }
.source-row {
  display: grid;
  grid-template-columns: minmax(180px, 22%) 1fr;
  gap: var(--sp-6);
  padding-block: var(--sp-5);
  border-top: 1px solid var(--border);
}
.source-row:last-child { border-bottom: 1px solid var(--border); }
.source-row dt { color: var(--text); font-weight: 600; font-size: 0.95rem; }
/* Prose, so NOT mono and NOT unbounded: this file's own rule above is that
   mono is reserved for numbers and ids. A whole sentence set in mono stops the
   numbers reading as data, which is the opposite of the intent. */
.source-row dd {
  margin: 0;
  font-size: 0.88rem;
  max-width: var(--measure);
  overflow-wrap: anywhere;
}
.source-row dd code, .source-row dd .mono { font-family: var(--mono); }

/* ==========================================================================
   10 · Error banner (always visible — never depends on animation or JS)
   ========================================================================== */

.error-banner {
  margin: 96px auto 0;
  max-width: 800px;
  background: var(--err-bg);
  border: 1px solid var(--err-border);
  color: var(--err-text);
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: var(--sp-4) var(--sp-5);
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
noscript .error-banner {
  background: var(--surface);
  border-color: var(--border-bright);
  color: var(--body);
}

/* ==========================================================================
   11 · Motion
   ==========================================================================
   Entrances and the three scenes only. No parallax, no scroll-jacking, no
   counters.

   Hiding content is opt-in THREE times over: JS present (`html.js-anim`), the
   media query says no-preference, AND the single motion channel is not "off".
   That last one is why `?motion=off` works at all — a URL parameter cannot
   change what a CSS media query evaluates to, so app.js funnels BOTH the query
   parameter and the reduced-motion query into `data-motion="off"` at boot. Drop
   the `:not([data-motion="off"])` and `?motion=off` renders a blank page at
   opacity 0. */

@media (prefers-reduced-motion: no-preference) {
  html.js-anim:not([data-motion="off"]) { scroll-behavior: smooth; }

  html.js-anim:not([data-motion="off"]) .reveal {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(3px);
    transition:
      opacity 0.9s ease,
      transform 0.9s cubic-bezier(0.22, 1, 0.36, 1),
      filter 0.9s ease;
  }
  html.js-anim:not([data-motion="off"]) .reveal.in {
    opacity: 1;
    transform: none;
    filter: none;
  }

  /* Content inside a CLOSED <details> is never rendered, so it never crosses
     the viewport and the reveal observer never marks it `.in` — it would open
     at opacity 0, a section full of blank space. Fold bodies are therefore
     exempt from the hide/reveal cycle entirely: opening the fold IS the
     animation. Summaries stay in the cycle; they are always on the page.
     This rule is easy to lose in a rewrite and expensive to rediscover. */
  html.js-anim:not([data-motion="off"]) .collapse-body .reveal {
    opacity: 1;
    transform: none;
    filter: none;
  }

  html.js-anim:not([data-motion="off"]) .hero .reveal { transition-duration: 1.05s; }
}

/* Belt and braces: with reduced motion requested, kill the fold transition too. */
@media (prefers-reduced-motion: reduce) {
  .fold > summary,
  .collapse-body { transition: none; animation: none; }
}
/* Same, via the switch channel, which the media query above cannot see. */
:root[data-motion="off"] .fold > summary,
:root[data-motion="off"] .collapse-body { transition: none; animation: none; }

/* ==========================================================================
   12 · Small screens
   ========================================================================== */

/* The brand is decorative — the hero says the same thing one screen down — so
   it yields to the links as soon as they would wrap.
   Below the same breakpoint the links get the whole bar and stop wrapping: a
   two-row nav is fixed to the viewport, so every extra row is space the reader
   never gets back. They pack left and scroll sideways instead. The right-edge
   fade is the affordance; packing LEFT is what stops that fade from dimming
   the last link when everything already fits (the spare width sits under the
   fade, not a link). Above the breakpoint the brand returns and the links go
   back to hugging the right edge, where a fade would dim "Talk". */
@media (max-width: 1150px) {
  .nav .brand { display: none; }
  .nav ul {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    /* The fade says "there is more to the right". Applied unconditionally it
       lies: at 768 the whole list fits and the last link reads as disabled.
       .is-scrollable is set by app.js only when the list actually overflows. */
    -webkit-mask-image: none;
    mask-image: none;
  }
  .nav ul.is-scrollable {
    -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent);
    mask-image: linear-gradient(90deg, #000 90%, transparent);
  }
  .nav ul.is-scrolled-end {
    -webkit-mask-image: none;
    mask-image: none;
  }
  .nav ul::-webkit-scrollbar { display: none; }
  .nav ul li { flex: 0 0 auto; }
}

@media (max-width: 860px) {
  .c-panels.two { grid-template-columns: minmax(0, 1fr); }
  .source-row { grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
}

@media (max-width: 640px) {
  /* 17px stays 17px on a phone — that is where the halation reading applies
     most, and clamp() already shrinks the headings. */
  /* The nav's one-row scroller is set up at the 1150px breakpoint above. */
  .nav { top: 8px; padding: 8px 10px; }
  .nav a { padding: 5px 7px; font-size: 0.84rem; }
  .hero { padding-top: 104px; }
  .scene { height: 52vh; height: 52svh; min-height: 260px; }
  .act-body { padding-top: var(--sp-12); }
  .ev { padding-left: var(--sp-4); padding-block: var(--sp-8); }
  .chart { padding: var(--sp-5) var(--sp-4) var(--sp-4); }
  /* Side by side, the pill steals ~90px from an already narrow summary line —
     stack it under the label instead. */
  .fold > summary { display: block; }
  .fold-verdict { display: block; margin-top: var(--sp-1); }
  .toggle-pill { display: inline-block; margin-top: var(--sp-3); }
}

/* Temperature evidence needs full-width axes and uncropped time histories. */
#c-004-hippocampus_scattered-hot-voxels .ev-figures {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-8);
}
#c-004-hippocampus_scattered-hot-voxels .ev-figure img {
  height: auto;
  max-height: none;
  aspect-ratio: auto;
  object-fit: contain;
  filter: none;
}
#c-004-hippocampus_scattered-hot-voxels .ev-figure figcaption {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  max-width: 75ch;
}
