/* ==========================================================================
   TerraZero project site — Applied Intuition brand design system
   Type: Applied Sans (Display for title/headings, Text for body/labels),
   XCharter serif available for figure/quote surfaces. Color: Applied Blue
   #006CFA, ink #111, gray #767676. Motifs: black-square eyebrow marker,
   ~680px reading column, full-width figure bands, blue caption labels.
   ========================================================================== */

/* ----- Fonts (vendored, local) ------------------------------------------ */
@font-face {
  font-family: "Applied Sans Display";
  src: url("../fonts/AppliedSansDisplay-Bold.ttf") format("truetype");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Applied Sans Display";
  src: url("../fonts/AppliedSansDisplay-SemiBold.ttf") format("truetype");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Applied Sans Text";
  src: url("../fonts/AppliedSansText-Regular.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Applied Sans Text";
  src: url("../fonts/AppliedSansText-Italic.ttf") format("truetype");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Applied Sans Text";
  src: url("../fonts/AppliedSansText-SemiBold.ttf") format("truetype");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Applied Sans Text";
  src: url("../fonts/AppliedSansText-SemiBoldItalic.ttf") format("truetype");
  font-weight: 600; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "XCharter";
  src: url("../fonts/XCharter-Roman.otf") format("opentype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "XCharter";
  src: url("../fonts/XCharter-Italic.otf") format("opentype");
  font-weight: 400; font-style: italic; font-display: swap;
}

/* ----- Design tokens ----------------------------------------------------- */
:root {
  /* brand color */
  --blue: #006CFA;
  --blue-dark: #0052bd;        /* AppliedBlue!70!black, approx */
  --blue-muted: #3d7fc4;       /* AppliedBlue!75!gray, approx */
  --blue-wash: #eef4ff;        /* light blue surface */
  --blue-wash-2: #e0ecff;
  --ink: #111111;
  --gray: #767676;
  --gray-line: #e4e4e4;
  --gray-soft: #f6f7f9;
  --white: #ffffff;

  /* terrabin figure palette (mirrors figure-scripts/data.py) */
  --terra-center: #006CFA;     /* lane centerlines */
  --terra-marking: #d9a300;    /* gold lane markings */
  --terra-sidewalk: #4a9d5b;   /* green sidewalks */
  --terra-crosswalk: #f2c200;  /* yellow crosswalks */

  /* type */
  --font-display: "Applied Sans Display", "Helvetica Neue", Arial, sans-serif;
  --font-sans: "Applied Sans Text", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "XCharter", Georgia, "Times New Roman", serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;

  /* type scale */
  --fs-eyebrow: 0.72rem;
  --fs-meta: 0.82rem;
  --fs-body: 1.0625rem;        /* ~17px reading */
  --fs-lead: 1.3rem;
  --fs-h3: 1.18rem;
  --fs-h2: 2.2rem;
  --fs-title: clamp(2.05rem, 5vw, 3.6rem);

  /* spacing */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;

  /* layout */
  --reading: 720px;
  --wide: 1280px;
  --header-h: 60px;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(17,17,17,.04), 0 8px 28px rgba(17,17,17,.07);
  --shadow-lift: 0 2px 6px rgba(17,17,17,.06), 0 18px 48px rgba(0,108,250,.10);
}

/* ----- Reset / base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  line-height: 1.62;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }

/* ----- Layout primitives ------------------------------------------------- */
.reading { max-width: var(--reading); margin-inline: auto; padding-inline: 24px; }
.wide { max-width: var(--wide); margin-inline: auto; padding-inline: 24px; }
/* full-bleed band for large diagrams that earn the extra width */
.bleed { width: min(1680px, 96vw); margin-inline: auto; padding-inline: 24px; }

/* Figure-and-text two-column layout (magazine rhythm). The figure column is the
   wider one so diagrams stay legible; .split--rev flips text and figure sides. */
.split {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(1.5rem, 4vw, var(--space-5));
  align-items: center;
}
.split--rev { grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr); }
/* extra separation between a wide table and its adjacent title/text */
.split--airy { gap: clamp(2.5rem, 7vw, 6rem); }
.split--rev .split-text { order: 2; }
.split-text > :first-child { margin-top: 0; }
.split .figure, .split .table-wrap { margin: 0; }

/* left-aligned readable text column inside a .wide band, so section headers and
   prose share the same left edge as wide figures/tables (no centered indent) */
.prose { max-width: 72ch; }

/* multi-column text grids for parallel subsections */
.col-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, var(--space-4));
}
.col-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, var(--space-4)) clamp(2rem, 5vw, var(--space-6));
  align-items: start;
}
.col-3 > div > :first-child, .col-3 h3:first-child,
.col-2 > div > :first-child, .col-2 h3:first-child { margin-top: 0; }

/* big stat callouts (the "fast" claim) */
.statline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin: var(--space-3) 0;
}
.statline .stat-num {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2rem, 4vw, 3rem); line-height: 1; color: var(--blue);
  letter-spacing: -0.02em;
}
.statline .stat-cap {
  font-family: var(--font-sans); font-size: var(--fs-meta);
  color: var(--gray); margin-top: 0.35em;
}
.statline > div { border-top: 2px solid var(--ink); padding-top: 0.6rem; }

@media (max-width: 860px) {
  .split, .split--rev { grid-template-columns: 1fr; gap: var(--space-3); }
  .split--airy { gap: var(--space-4); }
  .split--rev .split-text { order: 0; }
  .col-3, .col-2 { grid-template-columns: 1fr; gap: var(--space-3); }
  .statline { grid-template-columns: 1fr 1fr; }
}
/* On very small screens a long inline formula cannot line-break and would
   overflow; cap it to the line width and let it scroll within itself instead. */
@media (max-width: 480px) {
  .katex { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; }
}

section { padding-block: var(--space-6); }
section + section { border-top: 1px solid var(--gray-line); }
/* Content sections alternate tint automatically by position; the hero stays
   plain, so add/remove a section and the rhythm fixes itself. */
main > section:not(.hero):nth-of-type(odd) { background: var(--gray-soft); }

/* eyebrow + black square motif */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gray);
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin: 0 0 var(--space-2);
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 0.5em; height: 0.5em;
  background: var(--ink);
  flex: 0 0 auto;
}

/* ----- Typography -------------------------------------------------------- */
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); line-height: 1.12; }
h2 {
  font-weight: 600;
  font-size: var(--fs-h2);
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-3);
}
h3 {
  font-weight: 600;
  font-size: var(--fs-h3);
  letter-spacing: -0.005em;
  margin: var(--space-4) 0 var(--space-1);
}
p { margin: 0 0 var(--space-2); }
.lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: #2a2a2a;
}
.muted { color: var(--gray); }

/* editorial highlight: a soft marker swipe sitting under the lower half of the
   text, in the manner of a highlighter pen. used sparingly on the load-bearing
   claims so the core message reads at a glance. */
mark.hl {
  background: linear-gradient(transparent 56%, var(--blue-wash-2) 56%);
  color: inherit;
  padding: 0 0.05em;
}
.lead mark.hl { background: linear-gradient(transparent 60%, var(--blue-wash-2) 60%); }

/* math spans should sit inline cleanly */
.katex { font-size: 1.02em; }
/* overflow-x:auto scrolls only when an equation is genuinely too wide for the
   column; overflow-y:hidden stops KaTeX's few-pixel strut overhang from forcing
   a spurious per-equation vertical scrollbar (auto would otherwise be promoted). */
.eq-block { margin: var(--space-3) 0; overflow-x: auto; overflow-y: hidden; }
.eq-block .katex-display { margin: 0; }

/* ----- Header / nav ------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--gray-line);
}
.site-header .wide {
  height: 100%;
  display: flex; align-items: center; gap: var(--space-3);
}
.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: flex; align-items: center; gap: 0.55em;
  flex: 0 0 auto;
}
.brand-mark::before {
  content: ""; width: 1.15em; height: 1.15em; display: inline-block;
  background: var(--ink);
  -webkit-mask: url(../brand/icon.svg) center / contain no-repeat;
  mask: url(../brand/icon.svg) center / contain no-repeat;
}
.brand-mark:hover { text-decoration: none; }
.site-footer .brand-mark::before { background: #fff; }
.nav { margin-left: auto; display: flex; gap: var(--space-3); align-items: center; }
.nav a {
  font-family: var(--font-sans);
  font-size: var(--fs-meta);
  color: var(--gray);
  letter-spacing: 0.01em;
}
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.active { color: var(--ink); font-weight: 600; }
.nav-toggle { display: none; }

/* ----- Hero -------------------------------------------------------------- */
.hero { padding-top: var(--space-5); padding-bottom: var(--space-4); }

.hero-intro { max-width: 60rem; }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-title);
  letter-spacing: -0.02em;
  line-height: 1.04;
  color: var(--ink);
  margin: 0 0 var(--space-3);
  overflow-wrap: break-word;
  hyphens: auto;
}
.byline, .affil { overflow-wrap: break-word; }
.hero h1 .accent { color: var(--blue); }

/* the lead reads as a standfirst: larger serif on a tight measure, sitting
   close under the headline */
.hero .lead {
  max-width: 56ch;
  font-size: clamp(1.25rem, 2.2vw, 1.5rem);
  line-height: 1.45;
  color: #2a2a2a;
  margin-bottom: var(--space-4);
}

/* masthead metadata, set off from the lead by a thin editorial rule */
.hero-meta {
  border-top: 1px solid var(--gray-line);
  padding-top: var(--space-3);
}
.hero-meta > :first-child { margin-top: 0; }
.byline {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  color: var(--gray);
  margin: var(--space-3) 0 var(--space-1);
  line-height: 1.7;
}
.byline .names { color: var(--ink); }
.affil { font-family: var(--font-mono); font-size: var(--fs-eyebrow); color: var(--gray); }

/* action buttons */
.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: var(--space-3); }
.btn {
  font-family: var(--font-sans);
  font-size: var(--fs-meta);
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 0.45em;
  padding: 0.6em 1.05em;
  border-radius: 8px;
  border: 1px solid var(--gray-line);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: var(--white); }
.btn svg { width: 1em; height: 1em; }

/* greyed-out actions for resources not available yet */
.btn-disabled {
  color: var(--gray); background: var(--gray-soft);
  border-color: var(--gray-line); cursor: not-allowed; opacity: 0.75;
  user-select: none;
}
.btn-disabled:hover { color: var(--gray); border-color: var(--gray-line); }

/* ----- Figure bands / captions ------------------------------------------ */
.figure-band { padding-block: var(--space-5); }
.figure {
  margin: var(--space-3) 0;
  background: var(--white);
  border: 1px solid var(--gray-line);
  border-radius: var(--radius);
  overflow: hidden;
}
.figure-stage {
  padding: var(--space-3);
  display: flex; justify-content: center; align-items: center;
  background:
    linear-gradient(var(--gray-soft), var(--gray-soft));
}
.figure-stage svg, .figure-stage img { display: block; max-width: 100%; }
figcaption {
  font-family: var(--font-sans);
  font-size: var(--fs-meta);
  color: #333;
  line-height: 1.5;
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--gray-line);
}
figcaption .fig-label {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--blue);
  margin-right: 0.5em;
}

/* ----- Cards ------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-2);
  margin: var(--space-3) 0;
}
.card-grid.grid-2 { grid-template-columns: 1fr 1fr; }
.card {
  border: 1px solid var(--gray-line);
  border-radius: var(--radius);
  padding: var(--space-3);
  background: var(--white);
}
.card h3 { margin-top: 0; }
.card .stat {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  color: var(--blue);
  line-height: 1;
}
.card .stat-label { font-family: var(--font-sans); font-size: var(--fs-meta); color: var(--gray); }

/* contribution triad: three columns on wide screens, each with a numbered
   top rule, magazine-feature style */
.contribs {
  display: grid; gap: var(--space-3); margin: var(--space-4) 0 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.contrib { border-top: 2px solid var(--blue); padding-top: var(--space-2); }
.contrib .num {
  font-family: var(--font-display); font-weight: 700; color: var(--blue);
  font-size: 1.6rem; line-height: 1; margin-bottom: 0.4rem;
}
.contrib h3 { margin-top: 0; }
@media (max-width: 860px) {
  .contribs { grid-template-columns: 1fr; gap: var(--space-3); }
}

/* placeholder / pending cards */
.placeholder {
  border: 1px dashed var(--gray-line);
  border-radius: var(--radius);
  padding: var(--space-4);
  text-align: center;
  color: var(--gray);
  font-family: var(--font-sans);
  background:
    repeating-linear-gradient(45deg, transparent, transparent 10px,
      rgba(0,108,250,.025) 10px, rgba(0,108,250,.025) 20px);
}
.placeholder .ph-icon { font-size: 1.6rem; color: var(--blue-muted); }
.placeholder .ph-title { color: var(--ink); font-weight: 600; margin: 0.4em 0 0.2em; }

/* Abstract beside the demo showcase. Three responsive configurations:
     • Widest  (≥1160px) — abstract | controls | video   (three columns)
     • Middle  (860–1159) — abstract | [controls / video] (controls stack over video)
     • Narrow  (≤859px)  — abstract / controls / video    (all stacked)
   This section runs wider with a slimmer page margin so the video reads large. */
#abstract .bleed { width: min(1880px, 98vw); padding-inline: 14px; }
.abstract-demos {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.7fr);
  gap: clamp(1.5rem, 3vw, var(--space-5));
  align-items: start;
}
.abstract-col { border-right: 1px solid var(--gray-line); padding-right: clamp(1.5rem, 4vw, var(--space-5)); }
.abstract-col h2 { margin-top: 0; }
.abstract-col p:last-child { margin-bottom: 0; }

/* ----- Scenario video gallery ------------------------------------------- */
.gallery {
  display: grid;
  grid-template-columns: minmax(220px, 290px) minmax(0, 1fr);
  gap: clamp(1.25rem, 2vw, var(--space-3));
  align-items: start;
}
.gallery[hidden] { display: none; }

/* left rail: one labeled group per dimension. The groups spread to fill the
   full column height so the selector aligns top-and-bottom with the video. */
.gallery-rail { display: flex; flex-direction: column; gap: var(--space-3); justify-content: space-between; }
.opt-group { display: flex; flex-direction: column; gap: 0.5em; }
.opt-label {
  font-family: var(--font-sans); font-size: var(--fs-eyebrow); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--gray);
}
.opt-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.opt-pill {
  border: 1px solid var(--gray-line); background: var(--gray-soft); cursor: pointer;
  font-family: var(--font-sans); font-size: var(--fs-meta); font-weight: 600;
  color: var(--ink); padding: 0.4em 0.85em; border-radius: 999px;
  transition: background .18s, color .18s, border-color .18s, opacity .18s;
}
.opt-pill:hover:not(.is-active):not(:disabled) { border-color: var(--blue-muted); color: var(--blue); }
.opt-pill.is-active {
  background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: var(--shadow);
}
.opt-pill:disabled { opacity: .38; cursor: not-allowed; }
/* ordinal group reads as a compact numeric set */
.opt-group[data-key="ordinal"] .opt-pill { min-width: 2.4em; text-align: center; }

/* right stage: the video and its caption stacked together. */
.gallery-stage { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.gallery-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border: 1px solid var(--gray-line); border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(120% 120% at 50% 0%, rgba(0,108,250,.06), transparent 60%), #0d1117;
  box-shadow: var(--shadow);
}
/* contain (not cover) so the full 16:9 frame is always shown, never cropped */
.gallery-video { display: block; width: 100%; height: 100%; object-fit: contain; background: #0d1117; }
.gallery-caption {
  margin: 0; display: flex; flex-wrap: wrap; gap: 0.4em 0.9em;
  font-family: var(--font-sans); font-size: var(--fs-meta);
}
.cap-seg { display: inline-flex; align-items: baseline; gap: 0.4em; }
.cap-seg + .cap-seg { border-left: 1px solid var(--gray-line); padding-left: 0.9em; }
.cap-dim {
  font-size: var(--fs-eyebrow); font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--gray);
}
.cap-val { color: var(--ink); font-weight: 600; }

/* in-prep note under the demo */
.demo-footnote {
  margin: var(--space-3) 0 0; max-width: 72ch;
  font-family: var(--font-sans); font-size: var(--fs-meta); color: var(--gray);
}

/* ---- Configuration 2 + 3: controls stack ABOVE the video --------------- *
 * Below 1160px the rail no longer sits to the left of the video. It becomes a
 * full-width control band above the frame: the labelled groups flow left to
 * right and wrap, pairing up where they fit. A single hairline rule closes the
 * band off from the video so the controls read as a deliberate toolbar. */
@media (max-width: 1159px) {
  .gallery { grid-template-columns: 1fr; gap: var(--space-3); }
  .gallery-rail {
    flex-direction: row; flex-wrap: wrap; align-items: flex-start;
    gap: var(--space-3) var(--space-5); justify-content: flex-start;
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--gray-line);
  }
  .gallery-rail .opt-group { flex: 0 1 auto; }
  .gallery-frame { flex: none; min-height: 0; }
}

/* Configuration 2 (middle): abstract keeps its own column beside the stacked
   controls + video. The split tilts toward the demo so the video stays large. */
@media (min-width: 860px) and (max-width: 1159px) {
  .abstract-demos { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.55fr); }
}

/* Configuration 3 (narrow): abstract, controls, and video stack in that order. */
@media (max-width: 859px) {
  #abstract .bleed { padding-inline: 24px; }
  .abstract-demos { grid-template-columns: 1fr; gap: var(--space-4); }
  .abstract-col {
    border-right: none; padding-right: 0;
    border-bottom: 1px solid var(--gray-line); padding-bottom: var(--space-4);
  }
}

.demos-col { display: flex; flex-direction: column; }
.demo-stage { flex: 1; display: flex; }
.demo-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; flex: 1; min-height: clamp(420px, 58vh, 720px); padding: var(--space-4);
  border: 1px solid var(--gray-line); border-radius: var(--radius);
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(0,108,250,.06), transparent 60%),
    var(--white);
  box-shadow: var(--shadow);
}
.demo-panel[hidden] { display: none; }
.demo-panel .ph-icon { font-size: 2.6rem; color: var(--blue); line-height: 1; }
.demo-panel .ph-title { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--ink); margin: 0.5em 0 0.2em; }
.demo-panel .ph-sub { font-family: var(--font-sans); font-size: var(--fs-meta); color: var(--gray); max-width: 40ch; }
.demo-panel .ph-tag {
  font-family: var(--font-sans); font-size: var(--fs-eyebrow); letter-spacing: .08em;
  text-transform: uppercase; color: var(--blue); margin-top: var(--space-2);
  border: 1px solid var(--blue-muted); border-radius: 999px; padding: 0.3em 0.8em;
}

/* ----- Tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; margin: var(--space-3) 0; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: var(--fs-meta);
}
table.data caption {
  caption-side: bottom;
  text-align: left;
  color: #333;
  font-size: var(--fs-meta);
  line-height: 1.5;
  padding-top: var(--space-2);
}
table.data caption .fig-label { color: var(--blue); font-weight: 600; margin-right: 0.4em; }
table.data th, table.data td {
  padding: 0.55em 0.85em;
  text-align: right;
  border-bottom: 1px solid var(--gray-line);
  white-space: nowrap;
}
table.data th:first-child, table.data td:first-child { text-align: left; }
/* textual tables (descriptions, not numbers) read better left-aligned */
table.data.data--text th, table.data.data--text td { text-align: left; white-space: normal; }
table.data thead th {
  color: var(--ink);
  font-weight: 600;
  border-bottom: 2px solid var(--ink);
  user-select: none;
}
table.data thead th.sortable { cursor: pointer; }
table.data thead th.sortable:hover { color: var(--blue); }
table.data thead th .sort-ind { color: var(--blue); font-size: 0.85em; margin-left: 0.3em; }
table.data tbody tr:hover { background: var(--blue-wash); }
table.data tbody tr.is-best td { font-weight: 600; }
table.data .group-row th {
  text-align: left;
  background: var(--gray-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray);
}

/* a touch more breathing room beneath the dynamics-models table (Table 1) */
#tbl-dynamics { margin-bottom: var(--space-4); }

/* blank "to be filled" token */
.tbd {
  color: var(--blue-muted);
  font-style: italic;
  font-family: var(--font-sans);
  opacity: 0.75;
}
.tbd::after { content: "to be filled"; }
td .tbd { font-size: 0.92em; }

/* ----- Footer ------------------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--gray-line);
  background: var(--ink);
  color: #cfd3da;
  padding-block: var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--fs-meta);
}
.site-footer a { color: #fff; }
.site-footer .foot-grid { display: flex; flex-wrap: wrap; gap: var(--space-4); justify-content: space-between; }
.site-footer .copyright { color: var(--gray); margin-top: var(--space-3); font-family: var(--font-mono); font-size: var(--fs-eyebrow); }

.chart-wrap { position: relative; width: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-3); margin-top: var(--space-2); font-family: var(--font-sans); font-size: var(--fs-meta); }
.chart-legend .key { display: inline-flex; align-items: center; gap: 0.4em; cursor: pointer; color: var(--gray); }
.chart-legend .key.on { color: var(--ink); }
.chart-legend .swatch { width: 0.85em; height: 0.85em; border-radius: 2px; display: inline-block; }
.chart-note {
  margin: var(--space-1) 0 0; text-align: center;
  font-family: var(--font-sans); font-size: var(--fs-eyebrow); color: var(--gray);
}
.chart-tooltip {
  position: absolute; pointer-events: none; opacity: 0;
  background: var(--ink); color: #fff;
  font-family: var(--font-sans); font-size: 0.78rem;
  padding: 0.45em 0.6em; border-radius: 6px; transform: translate(-50%, -120%);
  white-space: nowrap; transition: opacity .1s; z-index: 5;
}

/* ----- NPC gallery ------------------------------------------------------- */
.npc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-2); }
.npc-cell { border: 1px solid var(--gray-line); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.npc-cell .npc-img { background: var(--gray-soft); padding: var(--space-2); display: flex; justify-content: center; }
.npc-cell .npc-cap { padding: 0.6em 0.85em; font-family: var(--font-sans); font-size: var(--fs-eyebrow); }
.npc-cell .npc-cap b { display: block; font-weight: 600; color: var(--ink); margin-bottom: 0.15em; }
.npc-cell .npc-cap span { color: var(--gray); }

/* ----- Scroll reveal (progressive enhancement: hidden only when JS is on) - */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ----- Responsive -------------------------------------------------------- */
@media (max-width: 820px) {
  :root { --header-h: 56px; }
  .nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--white); border-bottom: 1px solid var(--gray-line);
    padding: var(--space-2) 24px var(--space-3);
    transform: translateY(-130%); transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .nav.open { transform: none; }
  .nav a { padding: 0.7em 0; border-bottom: 1px solid var(--gray-line); }
  .nav-toggle {
    display: inline-flex; margin-left: auto; flex-direction: column; gap: 4px;
    background: none; border: none; cursor: pointer; padding: 6px;
  }
  .nav-toggle span { width: 22px; height: 2px; background: var(--ink); display: block; }
  section { padding-block: var(--space-5); }
  .hero { padding-top: var(--space-4); }
  .card-grid.grid-2 { grid-template-columns: 1fr; }
}

/* ----- Terra Series: status badge ---------------------------------------- */
.series-status {
  display: inline-block;
  font-family: var(--font-sans); font-size: var(--fs-eyebrow); font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.25em 0.7em;
  border-radius: 999px;
  background: var(--blue); color: var(--white);
  margin-bottom: var(--space-1);
}
.series-status--prep {
  background: var(--gray-soft); color: var(--gray);
  border: 1px solid var(--gray-line);
}
.series-status--venue {
  background: #e8f0ff; color: #1a4ac4;
}

/* Inline venue badge after a tab title (conference publications only) */
/* Resource buttons under a tab's description */
.series-note {
  font-family: var(--font-sans); font-size: var(--fs-meta); font-weight: 600;
  color: var(--gray); margin-top: var(--space-2);
}

/* Full-width tab panel: text on top, then the media showcase below */
/* a single video reads better contained than stretched the full panel width */

/* ----- Results: editorial table lead sentence ---------------------------- */
.table-lead {
  font-family: var(--font-serif);
  font-size: 1.05rem; line-height: 1.55;
  color: var(--ink);
  margin: var(--space-2) 0 var(--space-2);
  max-width: 70ch;
}

/* ----- Contribution outcome line ----------------------------------------- */
.contrib-outcome {
  margin-top: var(--space-1);
  font-family: var(--font-sans); font-size: var(--fs-meta);
  color: var(--blue);
}

/* ----- Results statline: stat-note sub-label ----------------------------- */
.stat-note {
  display: block;
  font-size: var(--fs-eyebrow);
  color: var(--gray);
  margin-top: 0.2em;
}

/* ==========================================================================
   TerraTransfer page-specific additions
   Author links in the byline and video surfaces (teaser + rollout grid),
   built from the same tokens as the shared system above.
   ========================================================================== */

/* byline author links read as ink, gaining the brand blue on hover */
.byline a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--gray-line); }
.byline a:hover { color: var(--blue); border-color: var(--blue); text-decoration: none; }

.video-frame {
  border: 1px solid var(--gray-line);
  border-radius: var(--radius);
  overflow: hidden;
  background: radial-gradient(120% 120% at 50% 0%, rgba(0,108,250,.06), transparent 60%), #0d1117;
  box-shadow: var(--shadow);
}
.video-frame video, .video-frame img { display: block; width: 100%; height: auto; background: #0d1117; }

/* teaser sits a touch wider than the reading column, centered */
.teaser-frame { max-width: 1100px; margin: var(--space-3) auto 0; }

/* rollout grid: two-up on desktop, single column on narrow screens */
.video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin: var(--space-3) 0 0; }
.video-grid figure { margin: 0; }
.video-grid figcaption {
  font-family: var(--font-sans); font-size: var(--fs-meta); color: var(--gray);
  padding: var(--space-1) 0 0; border: 0;
}
.video-grid figcaption .fig-label { color: var(--blue); font-weight: 600; margin-right: 0.4em; }
@media (max-width: 720px) { .video-grid { grid-template-columns: 1fr; } }
/* HUGSim rollouts: one block per dataset; 5.3:1 three-camera panoramas run full width */
.video-grid--wide { grid-template-columns: 1fr; gap: var(--space-2); margin-top: var(--space-1); }
.rollout-set { margin-top: var(--space-4); }
.rollout-set > h3 { margin: 0; }

/* reference row in a data table (privileged-state teacher), set apart in italic */
table.data tbody tr.is-ref td { font-style: italic; color: var(--gray); background: var(--gray-soft); }

/* ==========================================================================
   Video-style redesign: idea statement, dark diagram stages, bar charts,
   collapsed details. Mirrors the TerraTransfer explainer video.
   ========================================================================== */

/* ----- Philosophy ----- */
.idea-kinetic {
  font-family: "Applied Sans Display", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(2.2rem, 5.5vw, 4.2rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0.4rem 0 1rem;
}
.idea-kinetic .accent { color: var(--blue); }

.statline--tight { margin-top: var(--space-3); }
.statline .stat-num sup { font-size: 0.55em; }
.statline .stat-num.accent { color: var(--blue); }

/* count-up numbers: fixed-width digits, width pinned to the final value by JS */
.statline .count { display: inline-block; font-variant-numeric: tabular-nums; text-align: right; }
/* odometer counter ([data-roll]): one-digit windows over vertical digit strips */
.statline .count-roll { display: inline-flex; vertical-align: top; height: 1em; line-height: 1em; overflow: hidden; text-align: left; }
.count-roll .roll-col { display: block; height: 1em; overflow: hidden; }
.count-roll .roll-strip { display: block; will-change: transform; }
.count-roll .roll-strip > span { display: block; height: 1em; }
.count-roll .roll-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.count-roll .roll-col { user-select: none; }
/* odometer digits are blank before the count, then fade in over 3 s */
.count-roll .roll-col { opacity: 0; transition: opacity 3s ease-out; }
.count-roll.is-in .roll-col { opacity: 1; }
/* static "# 1" (Phase 2/3): an invisible tabular digit stands in for the
   odometer's blank tens slot so every ranking reads the same */
.statline .digit-gap { visibility: hidden; font-variant-numeric: tabular-nums; }
/* "×" after a stat: the glyph sits 0.10 em above the baseline in Applied Sans
   Display; drop it so its bottom lines up with the digits */
.statline .times-unit { position: relative; top: 0.1em; }
/* phones: the count-up row's widest stat ("224M miles") must fit a half-width
   column on one line, so the whole row scales with the viewport instead */
@media (max-width: 480px) {
  .statline[data-countup] .stat-num { font-size: min(2rem, 6.4vw); white-space: nowrap; }
}
/* ----- collapsed details (abstract, full table) ----- */
.abstract-details, .table-details { margin-top: var(--space-4); }
.abstract-details summary, .table-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--blue);
  padding: 0.6rem 0;
  user-select: none;
  width: fit-content;
}
.abstract-details summary:hover, .table-details summary:hover { text-decoration: underline; }
.abstract-details[open] summary, .table-details[open] summary { margin-bottom: 0.4rem; }
.abstract-details p { max-width: 68rem; }

/* ----- dark diagram stage (matches the explainer video) ----- */
.stage-dark {
  background: #0A0A0B;
  border-radius: 14px;
  padding: clamp(12px, 2.4vw, 32px);
  margin-top: var(--space-3);
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
  overflow: hidden;
}
.stage-dark .diagram { display: block; width: 100%; height: auto; }

.diagram-lead { max-width: 62rem; color: var(--gray-strong, #444); }

/* HTML panels overlaid on a diagram, positioned in % of its viewBox (1600 wide).
   Sizes use cqw so 1 viewBox unit = 100cqw / 1600 and the panel scales with the svg. */
.diagram-wrap { position: relative; container-type: inline-size; }
.fo-panel {
  position: relative; width: 100%; height: 100%;
  border-radius: 0.5cqw; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.2); background: #000;
}
.fo-panel.diagram-overlay { position: absolute; }
.fo-panel > video { display: block; width: 100%; height: 100%; object-fit: cover; }
.fo-grid2 {
  display: grid; width: 100%; height: 100%;
  grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 1px;
  background: rgba(255,255,255,0.2);
}
.fo-grid2 video { display: block; width: 100%; height: 100%; object-fit: cover; }
.fo-label {
  position: absolute; top: 0; left: 0; right: 0; height: 2.125cqw;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0.75cqw; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0.82), rgba(0,0,0,0));
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.75cqw; letter-spacing: 0.06em; color: rgba(255,255,255,0.8);
}
.fo-label .fo-meta { color: #18FFFF; }

/* diagram svg atoms */
.diagram text {
  font-family: "Applied Sans Text", system-ui, sans-serif;
  text-anchor: middle;
}
.diagram .n-title { font-size: 26px; font-weight: 600; fill: #fff; font-family: "Applied Sans Display", system-ui, sans-serif; }
/* inline math, set like LaTeX in the paper's Charter: .mi = math italic, rest upright;
   .mt = a text word inside the math, in the same mono face as the other subtitles */
.diagram .n-math { font-size: 17px; fill: rgba(255,255,255,0.88); font-family: "XCharter", Charter, Georgia, serif; }
.diagram .n-math .mi { font-style: italic; }
.diagram .n-math .mt { font-family: ui-monospace, Menlo, monospace; fill: rgba(255,255,255,0.75); }
.diagram .n-sub { font-size: 17px; fill: rgba(255,255,255,0.75); font-family: ui-monospace, Menlo, monospace; }
.diagram .n-title--sm { font-size: 21px; }
.diagram .n-sub--sm { font-size: 14px; }
.diagram .node-train rect { fill: #006CFA; }
.diagram .node-frozen rect { fill: rgba(255,255,255,0.05); stroke: rgba(255,255,255,0.28); }
.diagram .node-frozen .n-title { fill: rgba(255,255,255,0.92); }
.diagram .node-ghost rect { fill: rgba(255,255,255,0.028); stroke: rgba(255,255,255,0.16); }
.diagram .node-ghost .n-title { fill: rgba(255,255,255,0.55); }
.diagram .node-ghost .n-sub { fill: rgba(255,255,255,0.35); }
.diagram .w-blue { stroke: #4B84FF; stroke-width: 2.5; fill: none; }
.diagram .w-gray { stroke: rgba(255,255,255,0.35); stroke-width: 2.5; fill: none; }
.diagram .w-ghost { stroke: rgba(255,255,255,0.22); stroke-width: 2.5; fill: none; }
.diagram .w-loop { stroke: #4B84FF; stroke-width: 2.5; fill: none; opacity: 0.9; }
.diagram .w-loss { stroke: #4B84FF; stroke-width: 2.5; fill: none; stroke-dasharray: 7 7; opacity: 0.9; }
.diagram .ppo-chip rect { fill: #0A0A0B; stroke: rgba(0,108,250,0.65); }
.diagram .ppo-chip text { font-size: 19px; letter-spacing: 0.04em; fill: #4B84FF; font-family: ui-monospace, Menlo, monospace; }
.diagram .cont { fill: rgba(255,255,255,0.025); stroke: rgba(255,255,255,0.2); }
.diagram .cont--ghost { fill: rgba(255,255,255,0.012); stroke: rgba(255,255,255,0.1); }
.diagram .cont-label { font-size: 17px; letter-spacing: 0.12em; fill: rgba(255,255,255,0.6); text-anchor: start; font-family: ui-monospace, Menlo, monospace; }
.diagram .cont-label--ghost { fill: rgba(255,255,255,0.3); }
.diagram .chip-blue rect { fill: rgba(0,108,250,0.12); stroke: rgba(0,108,250,0.5); }
.diagram .chip-blue text { font-size: 19px; fill: #4B84FF; font-family: ui-monospace, Menlo, monospace; }
.diagram .chip-gray rect { fill: rgba(255,255,255,0.03); stroke: rgba(255,255,255,0.2); }
.diagram .chip-gray text { font-size: 19px; fill: rgba(255,255,255,0.6); font-family: ui-monospace, Menlo, monospace; }
.diagram .chip-ghost rect { fill: rgba(255,255,255,0.015); stroke: rgba(255,255,255,0.1); }
.diagram .chip-ghost text { font-size: 19px; fill: rgba(255,255,255,0.32); font-family: ui-monospace, Menlo, monospace; }
.diagram .loss-box rect { fill: rgba(10,10,11,0.92); stroke: rgba(0,108,250,0.55); }
.diagram .loss-title { font-size: 22px; font-weight: 600; fill: #4B84FF; text-anchor: start; }
.diagram .loss-sub { font-size: 16px; fill: rgba(255,255,255,0.6); text-anchor: start; }
.diagram .legend text { font-size: 16px; fill: rgba(255,255,255,0.6); text-anchor: start; font-family: ui-monospace, Menlo, monospace; }

/* ----- bar charts ----- */
.bars { margin-top: var(--space-3); }
.bars--results { max-width: 62rem; }
.bars-title { font-weight: 600; margin: 0 0 0.6rem; color: var(--ink); }
.bar-row {
  display: grid;
  grid-template-columns: minmax(9rem, 16rem) 1fr 4rem;
  align-items: center; gap: 1rem;
  padding: 0.34rem 0;
}
.bars--mini .bar-row { grid-template-columns: minmax(9rem, 15rem) 1fr 3.4rem; padding: 0.26rem 0; }
.bar-label { font-size: 0.95rem; color: #444; }
.bar-row.is-ours .bar-label { font-weight: 600; color: var(--ink); }
.bar-row.is-ref .bar-label { color: var(--gray); font-style: italic; }
.bar-label .ref-note, .bars-title .ref-note { font-size: 0.82em; color: var(--gray); }
.bars-title .ref-note { font-weight: 400; }
.bar-label .ref-note { white-space: nowrap; }
.bar-track {
  display: block; height: 18px; border-radius: 4px;
  background: rgba(17,17,17,0.06); overflow: hidden;
}
.bars--mini .bar-track { height: 13px; }
.bar-fill {
  display: block; height: 100%; border-radius: 4px;
  background: rgba(17,17,17,0.28); width: 0;
  transition: width 0.9s cubic-bezier(0.16,1,0.3,1) 0.15s;
}
.bar-row.is-ours .bar-fill { background: var(--blue); }
.bar-row.is-ref .bar-fill { background: repeating-linear-gradient(45deg, rgba(17,17,17,0.3) 0 6px, rgba(17,17,17,0.16) 6px 12px); }
.reveal.in .bar-fill { width: var(--w); }
html:not(.js) .bar-fill { width: var(--w); }
.bar-val { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.95rem; color: #444; text-align: right; }
.bar-row.is-ours .bar-val { color: var(--blue); }

/* ----- redrawn spectrum figure ----- */
.figure-stage--pad { padding: clamp(8px, 2vw, 20px); }
.spectrum { display: block; width: 100%; height: auto; }
.spectrum .sp-label { font-size: 15px; fill: #7a7f8a; text-anchor: start; font-family: "Applied Sans Text", system-ui, sans-serif; }
.spectrum .sp-label--blue { fill: var(--blue); }
.spectrum .sp-axis { font-size: 14px; fill: #9a9aa2; text-anchor: middle; font-family: "Applied Sans Text", system-ui, sans-serif; }
.spectrum .sp-note { font-size: 15px; fill: #444; text-anchor: middle; font-style: italic; font-family: "Applied Sans Text", system-ui, sans-serif; }

@media (max-width: 720px) {
  .bar-row { grid-template-columns: minmax(7rem, 10rem) 1fr 3.2rem; gap: 0.6rem; }
  .statline--tight { grid-template-columns: 1fr 1fr; }
}

/* redesign polish */
.statline .stat-cap { display: block; margin-top: 0.3rem; }
@media (min-width: 721px) {
  .statline--tight { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 721px) {
  .statline--tight.statline--n3 { grid-template-columns: repeat(3, 1fr); }
  .statline--tight.statline--n2 { grid-template-columns: repeat(2, 1fr); }
}
/* category header inside a bar chart */
.bar-group { margin: var(--space-2) 0 0.2rem; font-family: var(--font-sans); font-size: var(--fs-eyebrow); font-weight: 600; letter-spacing: .04em; color: var(--blue); }
.bar-group:first-child { margin-top: 0; }
.bars + .bars { margin-top: var(--space-4); }
/* two charts side by side (NAVSIM navtest | navhard); stacked below 860px */
.bars-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2) var(--space-5); align-items: start; margin-top: var(--space-3); }
.bars-pair .bars { margin-top: 0; max-width: none; }
.bars-pair .bar-row { grid-template-columns: minmax(7rem, 12rem) 1fr 2.8rem; gap: 0.7rem; }
@media (max-width: 860px) { .bars-pair { grid-template-columns: 1fr; row-gap: var(--space-4); } }
/* three charts side by side (HUGSim closed-loop | native | 345-scenario) from
   1240px; below that they stack (a 2 + 1 split would strand the third chart)
   and the rows fall back to the default / phone bar-row columns */
@media (min-width: 1240px) {
  .bars-pair--3 { grid-template-columns: repeat(3, 1fr); column-gap: var(--space-4); }
  .bars-pair--3 .bar-row { grid-template-columns: minmax(6rem, 10rem) 1fr 3rem; }
}
@media (max-width: 1239px) {
  .bars-pair--3 { grid-template-columns: 1fr; row-gap: var(--space-4); }
  .bars-pair--3 .bars { max-width: 62rem; }
  .bars-pair--3 .bar-row { grid-template-columns: minmax(9rem, 16rem) 1fr 4rem; gap: 1rem; }
}
@media (max-width: 720px) {
  .bars-pair--3 .bar-row { grid-template-columns: minmax(7rem, 10rem) 1fr 3.2rem; gap: 0.6rem; }
}
.diagram .chip-blue text, .diagram .chip-gray text, .diagram .chip-ghost text { font-size: 17px; }
.diagram .ppo-chip text { font-size: 17px; }

/* ==========================================================================
   TerraTransfer++ additions
   ========================================================================== */
.figure--diagram img { display: block; width: 100%; height: auto; }
.bars-legend { font-size: var(--fs-meta); margin-top: var(--space-2); }
table.data--compact th, table.data--compact td { padding: 0.32rem 0.55rem; font-size: 0.88rem; white-space: nowrap; }
table.data tbody tr.group td { font-weight: 600; color: var(--blue); background: var(--gray-soft); }
table.data tbody tr.is-ours td { background: rgba(0,108,250,.07); }
table.data tbody tr.is-ours td:first-child { font-weight: 600; color: var(--ink); }

/* ----- Hero: Terra Series header timeline --------------------------------
   Three evenly spaced releases on a horizontal rail. Static styles are the
   final frame; the intro runs once (~3 s) after JS adds .is-playing and
   holds that frame (fill-mode: both). A blue progress line sweeps the rail at
   constant speed; each dot lands as the sweep reaches it, its title rises
   above, then a highlight panel drops down beneath it. Afterwards only the
   current work keeps moving: its dot beats every --beat and a glint streaks
   through its "++" every --shine.
     dot i lands at  --t0 + i * --t-step  (0.33 s, 0.99 s, 1.65 s)
   Dots sit at 1/6, 1/2, 5/6 of the rail (equal columns, no column gap), so
   the sweep reaches 5/6 at 1.65 s when moving linearly from 0 at 0 s.        */
.tl {
  --t0: .33s;
  --t-step: .66s;
  --beat: 1.6s;
  --shine: 3s;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
  --dot: 14px;
  --date-fs: .9rem;   /* 14.4 px */
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto 28px auto;
  margin-top: var(--space-5);
}
.tl-rail { grid-row: 2; grid-column: 1 / -1; align-self: center; position: relative; height: 2px; container-type: inline-size; }
.tl-rail > span { position: absolute; inset: 0; }
.tl-rail-base {
  background: var(--gray-line);
  transform-origin: left center;
  -webkit-mask-image: linear-gradient(90deg, #000 84%, transparent);
  mask-image: linear-gradient(90deg, #000 84%, transparent);
}
.tl-rail-fill {
  background: linear-gradient(90deg, var(--blue-wash-2), var(--blue) 18%);
  transform-origin: left center;
  transform: scaleX(.8333);
}
/* glowing playhead riding the front of the sweep; gone in the final frame.
   Zero-width box moved in rail container units so it never widens the page. */
.tl-rail > .tl-rail-head { right: auto; width: 0; }
.tl-rail-head > span {
  position: absolute; left: -9px; top: -8px; width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,108,250,.55) 0%, rgba(0,108,250,0) 70%);
  opacity: 0;
}

.tl-item {
  grid-row: 1 / span 3;
  display: grid;
  grid-template-rows: subgrid;
  justify-items: center;
  text-align: center;
  padding-inline: clamp(.75rem, 2vw, 1.75rem);
  position: relative;
  z-index: 1;
  --d: calc(var(--t0) + var(--i) * var(--t-step));
}
.tl-item:nth-child(2) { grid-column: 1; }
.tl-item:nth-child(3) { grid-column: 2; }
.tl-item:nth-child(4) { grid-column: 3; }
/* no subgrid: heads are bottom-aligned, so a fixed dot row still lands on the rail */
@supports not (grid-template-rows: subgrid) {
  .tl-item { grid-template-rows: auto 28px 1fr; }
}

/* head reads top-down: title, tagline, then the date sitting right on its dot */
.tl-head { align-self: end; display: flex; flex-direction: column; padding-bottom: .55rem; }
.tl-date {
  order: 3;
  margin: .8rem 0 0;
  font-family: var(--font-mono); font-size: var(--date-fs); font-weight: 600; line-height: 1.3;
  letter-spacing: .1em; text-transform: uppercase; color: var(--blue); white-space: nowrap;
}
.tl-title {
  margin: 0;
  font-family: var(--font-display); color: var(--ink); line-height: 1.12;
  font-size: clamp(1.2rem, 2.1vw, 1.6rem); font-weight: 700; letter-spacing: -0.015em;
}
.tl-title a { color: inherit; }
.tl-title a:hover { color: var(--blue); text-decoration: none; }
.tl-title .accent { color: var(--blue); }
/* "++" of the current work: a bright glint streaks left to right through the
   glyphs every --shine (text-clipped gradient; the band rests off-glyph) */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .tl-item.is-current .tl-title .accent {
    background: linear-gradient(105deg, var(--blue) 0 40%, #7cc0ff 46%, #eaf5ff 50%, #7cc0ff 54%, var(--blue) 60% 100%);
    background-size: 300% 100%;
    background-position: 100% 0;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
  }
}
.tl-tag { margin: .3rem 0 0; font-family: var(--font-sans); font-size: var(--fs-meta); color: var(--gray); }

.tl-dot {
  grid-row: 2; align-self: center; position: relative;
  width: var(--dot); height: var(--dot); border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px var(--white);   /* knocks the rail out around the dot */
}
/* one-shot ripple on landing (hidden at rest) */
.tl-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--blue); opacity: 0;
}
/* the current work keeps a soft halo, which breathes once the intro is over */
.tl-item.is-current .tl-dot::before {
  content: ""; position: absolute; inset: -7px; border-radius: 50%;
  background: rgba(0,108,250,.16);
}

.tl-drop { display: flex; flex-direction: column; align-items: center; width: 100%; align-self: stretch; }
.tl-stem { width: 2px; height: 1.25rem; border-radius: 1px; background: var(--blue); transform-origin: top center; }
/* gradient border (blue at the top fading to gray at the bottom, on all
   sides): fill on the padding box, gradient on the border box */
.tl-panel {
  --panel-fill: var(--white);
  flex: 1;                                  /* equal-height panels across the row */
  display: flex; align-items: flex-start; justify-content: flex-start; text-align: left;
  width: 100%; max-width: 22rem;
  padding: .95rem 1.2rem;
  border: 1px solid transparent;
  border-top-width: 2px;
  border-radius: var(--radius);
  background:
    linear-gradient(var(--panel-fill), var(--panel-fill)) padding-box,
    linear-gradient(180deg, var(--blue) 0%, var(--gray-line) 85%) border-box;
  box-shadow: var(--shadow);
  font-size: 1.0306rem; line-height: 1.5; color: #2a2a2a;
  clip-path: inset(0 -48px -48px -48px);   /* final frame: let the shadow show */
}
/* highlight bullets: blue dot markers echo the timeline dots */
.tl-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.tl-panel li { position: relative; padding-left: 1.05rem; line-height: 1.45; }
.tl-panel li::before {
  content: ""; position: absolute; left: 0; top: .6em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--blue);
}
.tl-panel > ul > li { --k: 0; }
.tl-panel > ul > li:nth-child(2) { --k: 1; }
.tl-panel > ul > li:nth-child(3) { --k: 2; }
.tl-panel > ul > li:nth-child(4) { --k: 3; }
.tl-item.is-current .tl-panel { box-shadow: var(--shadow-lift); }
/* priority call-out inside a panel ("First of its kind") */
.tl-panel .tl-first { color: var(--blue); }

/* ---- choreography (JS only; pre-roll state hidden, then fill-mode both).
   The rail plays with .tl.is-playing; each work plays with .tl-item.is-playing
   (JS adds both at once on wide screens, per item as it scrolls in when stacked). */
.js .tl:not(.is-playing) .tl-rail,
.js .tl-item:not(.is-playing) :is(.tl-head, .tl-dot, .tl-stem, .tl-panel) { opacity: 0; }
.tl.is-playing .tl-rail-base { animation: tl-draw .9s var(--ease-out) both; }
.tl.is-playing .tl-rail-fill { animation: tl-sweep calc(var(--t0) + 2 * var(--t-step)) linear both; }
.tl.is-playing .tl-rail-head { animation: tl-sweep-head calc(var(--t0) + 2 * var(--t-step)) linear both; }
.tl.is-playing .tl-rail-head > span { animation: tl-head-fade calc(var(--t0) + 2 * var(--t-step) + .25s) linear both; }
.tl-item.is-playing .tl-dot { animation: tl-pop .5s var(--ease-pop) var(--d) both; }
.tl-item.is-playing .tl-dot::after { animation: tl-ripple .9s var(--ease-out) var(--d) both; }
/* heartbeat on the current work: after the intro, the halo swells and a ring
   is sent outward every beat, indefinitely */
.tl-item.is-current.is-playing .tl-dot::after {
  animation: tl-ripple .9s var(--ease-out) var(--d) both,
             tl-ripple var(--beat) cubic-bezier(.2, .6, .35, 1) calc(var(--d) + 1.35s) infinite;
}
.tl-item.is-current.is-playing .tl-dot::before {
  animation: tl-fade .6s ease calc(var(--d) + .75s) both,
             tl-breathe var(--beat) ease-in-out calc(var(--d) + 1.35s) infinite;
}
.tl-item.is-playing .tl-head { animation: tl-rise .7s var(--ease-out) calc(var(--d) + .04s) both; }
.tl-item.is-playing .tl-stem { animation: tl-stem .3s var(--ease-out) calc(var(--d) + .18s) both; }
.tl-item.is-playing .tl-panel { animation: tl-unfold .7s var(--ease-out) calc(var(--d) + .32s) both; }
.tl-item.is-playing .tl-panel > ul > li { animation: tl-settle .5s var(--ease-out) calc(var(--d) + .48s + var(--k) * .06s) both; }
.tl-item.is-current.is-playing .tl-title .accent { animation: tl-shine var(--shine) linear calc(var(--d) + .9s) infinite; }

@keyframes tl-draw { from { transform: scaleX(0); } to { transform: none; } }
@keyframes tl-sweep { from { transform: scaleX(0); } to { transform: scaleX(.8333); } }
@keyframes tl-sweep-head { from { transform: translateX(0); } to { transform: translateX(83.33cqw); } }
@keyframes tl-shine {
  0%       { background-position: 100% 0; filter: none; animation-timing-function: cubic-bezier(.45, 0, .3, 1); }
  25%      { filter: drop-shadow(0 0 6px rgba(0,108,250,.55)); }
  50%, 100% { background-position: 0% 0; filter: none; }
}
@keyframes tl-head-fade { 0% { opacity: 0; } 10% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes tl-pop { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: none; } }
@keyframes tl-ripple { from { opacity: .55; transform: scale(1); } to { opacity: 0; transform: scale(3.2); } }
@keyframes tl-breathe { 0%, 100% { transform: scale(1); } 18% { transform: scale(1.35); } 55% { transform: scale(1); } }
@keyframes tl-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tl-rise { from { opacity: 0; transform: translateY(12px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes tl-stem { from { opacity: 0; transform: scaleY(0); } to { opacity: 1; transform: none; } }
@keyframes tl-unfold {
  from { opacity: 0; transform: translateY(-10px); clip-path: inset(0 -48px 100% -48px); }
  to   { opacity: 1; transform: none;              clip-path: inset(0 -48px -48px -48px); }
}
@keyframes tl-settle { from { opacity: 0; transform: translateY(-6px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }

/* narrow screens: same story on a vertical rail (dots left, text right).
   Breakpoint mirrored in main.js (initTimeline). */
@media (max-width: 760px) {
  .tl { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; padding-left: 2rem; margin-top: var(--space-4); }
  .tl-rail { position: absolute; grid-row: auto; grid-column: auto; align-self: stretch; left: calc(var(--dot) / 2 - 1px); top: .4rem; bottom: 0; width: 2px; height: auto; }
  .tl-rail-base { transform-origin: center top; -webkit-mask-image: linear-gradient(180deg, #000 80%, transparent); mask-image: linear-gradient(180deg, #000 80%, transparent); }
  .tl-rail-fill { display: none; }
  .tl-rail-head { display: none; }
  .tl-item, .tl-item:nth-child(n) { grid-row: auto; grid-column: 1; display: block; justify-items: start; text-align: left; padding: 0 0 var(--space-3); }
  .tl-item:last-child { padding-bottom: 0; }
  .tl-head { padding-bottom: .6rem; }
  .tl-date { order: 0; margin: 0 0 .35rem; }   /* date first, level with the dot */
  .tl-dot { position: absolute; left: -2rem; top: calc((var(--date-fs) * 1.3 - var(--dot)) / 2); }  /* centred on the date line */
  .tl-drop { align-items: stretch; }
  .tl-stem { display: none; }
  .tl-panel { max-width: none; justify-content: flex-start; }
  .tl.is-playing .tl-rail-base { animation: tl-draw-v calc(var(--t0) + 2 * var(--t-step)) var(--ease-out) both; }
  @keyframes tl-draw-v { from { transform: scaleY(0); } to { transform: none; } }
}

@media (prefers-reduced-motion: reduce) {
  .js .tl:not(.is-playing) .tl-rail,
  .js .tl-item:not(.is-playing) :is(.tl-head, .tl-dot, .tl-stem, .tl-panel) { opacity: 1; }
  .tl *, .tl *::before, .tl *::after { animation: none !important; }
}
