/* ==========================================================================
   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;
  --header-gap: 14px;        /* inset of the floating header from the viewport edge */

  --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) + var(--header-gap) + 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; }

/* results heading with a single #1 callout floated to its right */
.results-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); flex-wrap: wrap; margin: 0 0 var(--space-2);
}
.results-badge {
  display: flex; align-items: center; gap: 0.7rem;
  border-left: 3px solid var(--blue); padding-left: 0.9rem;
}
.results-badge-num {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em;
  font-size: clamp(2.4rem, 4vw, 3.4rem); line-height: 1; color: var(--blue);
}
.results-badge-cap {
  font-family: var(--font-sans); font-size: 1.15rem; font-weight: 500;
  color: var(--gray); max-width: 20ch; line-height: 1.3;
}
@media (max-width: 720px) {
  .results-head { justify-content: flex-start; }
}

@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); }

/* Hyphenate prose so left-aligned (ragged-right) text breaks long words at line
   ends instead of leaving a deeply jagged right edge. Limited so only words of
   6+ chars break, keeping at least 3 chars on each side of the hyphen. Headings
   and short UI labels are deliberately excluded. */
p, li, .lead, .demo-footnote, figcaption, blockquote, dd {
  -webkit-hyphens: auto;
  hyphens: auto;
  -webkit-hyphenate-limit-before: 3;
  -webkit-hyphenate-limit-after: 3;
  hyphenate-limit-chars: 6 3 3;
}
.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 ------------------------------------------------------ */
/* Floating frosted-glass "pill" header (Applied Intuition / SPACeR style):
   fixed and inset from the edges, fully rounded, and fully visible at every
   scroll position — no collapse, no dissolve. On mobile it splits into two
   standalone circular buttons (brand left, menu right) with an overlay menu. */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  padding: var(--header-gap) 16px;
  pointer-events: none;            /* let the inset margins pass clicks through */
}
.header-pill {
  position: relative;
  pointer-events: auto;
  max-width: var(--wide); margin-inline: auto;
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--space-3);
  padding-inline: 22px;
}
/* The connecting "bar" is a separate background layer; it stays fully visible
   at every scroll position (no dissolve) — the pill is a constant frosted slab. */
.header-pill::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border: 1px solid rgba(17,17,17,.07);
  box-shadow: var(--shadow);
}

/* children render above the bar background */
.brand-mark, .nav, .nav-toggle { position: relative; z-index: 1; }

.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;
  height: 100%;
  border-radius: 999px;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
}
.brand-mark::before {
  content: ""; width: 1.15em; height: 1.15em; display: inline-block;
  flex: 0 0 auto;
  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; }
.brand-word {
  max-width: 12em; overflow: hidden; white-space: nowrap;
  transition: max-width .4s cubic-bezier(.22,.61,.36,1), opacity .3s ease, margin .4s ease;
}
.site-footer .brand-mark::before { background: #fff; }

.nav { margin-left: auto; display: flex; gap: var(--space-3); align-items: center;
  transition: opacity .3s ease; }
.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: calc(var(--header-h) + var(--header-gap) + var(--space-4)); 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); }
.foot-pending { color: var(--gray); cursor: not-allowed; }

/* ----- 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 ------------------------------------------- */
/* The gallery sits in a .wide container so the VIDEO lines up with the section
   text (same left + right edges). By default the controls form a full-width
   band above the video; on wide screens (where the margin is roomy) the rail is
   lifted out of flow and hung into the left margin instead, so the video keeps
   its text-aligned left edge and the controls hang out to its left. */
.gallery {
  position: relative;
  --rail-w: clamp(190px, 12vw, 210px);
  --rail-gap: clamp(1.25rem, 2vw, var(--space-3));
}
.gallery[hidden] { display: none; }

/* default: controls band above the video */
.gallery-rail {
  display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start;
  gap: var(--space-3) var(--space-5); justify-content: flex-start;
  margin-bottom: var(--space-3); padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--gray-line);
}
.gallery-rail .opt-group { flex: 0 1 auto; }

/* wide screens: hang the rail into the left margin beside the video */
@media (min-width: 1700px) {
  .gallery-rail {
    position: absolute; top: 0; right: 100%; margin: 0 var(--rail-gap) 0 0;
    width: var(--rail-w); max-height: 100%; overflow: auto;
    flex-direction: column; flex-wrap: nowrap; gap: var(--space-3);
    padding-bottom: 0; border-bottom: 0;
  }
  .gallery-rail .opt-group { flex: 0 0 auto; }
}
.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; }

/* meta bar under the video: scene legend on the first line, location/drive
   caption on the second. Each row flows left-to-right and wraps within itself
   when the column gets narrow. */
.gallery-meta {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: var(--space-2);
}
/* two rows (Objects / Map elements). Each row flows its items left-to-right and
   wraps within itself when the column narrows, so nothing is ever clipped. A
   fixed-width title reserves the same gutter on both rows, so the first items
   line up vertically (Ego above Lane lines) while wrapped items tuck neatly
   under the group. */
.gallery-legend {
  align-self: stretch; /* fill the column so the item grid can lay out its tracks */
  display: flex; flex-direction: column; gap: 0.7em;
  font-family: var(--font-sans); font-size: var(--fs-body);
}
.leg-row { display: flex; align-items: flex-start; gap: 1.4em; }
.leg-title {
  flex: none; width: 8em; white-space: nowrap; line-height: 40px;
  font-size: var(--fs-meta); font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--gray);
}
/* items sit on a uniform-column track. Both rows are the same width (fixed
   title gutter + 1fr items), so they resolve to the same number of equal
   columns — Ego lines up above Lane lines, etc. auto-fill keeps the tracks
   even when a row has fewer items, and drops columns as the space narrows, so
   the legend reflows down instead of clipping. */
.leg-items {
  flex: 1 1 0; min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr));
  align-items: center; gap: 0.55em 0.85em;
}
.leg-item { display: inline-flex; align-items: center; gap: 0.55em; }
/* swatch sits on a dark tile matching the rendered scene background so the true
   entity colours read correctly (incl. the white lane line) on the light page.
   The glyphs are the actual render-output icons (assets/legend/*.svg), square
   and detailed, so the tile is squarer than a flat colour chip would need. */
.leg-swatch {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 40px; border-radius: 5px;
  background: #15171c; border: 1px solid var(--gray-line); flex: none;
  overflow: hidden;
}
.leg-swatch img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* labels sit on one line where they fit; long ones (e.g. "Stationary vehicle")
   wrap to a second line rather than forcing the column wider */
.leg-label { color: var(--ink); font-weight: 500; line-height: 1.15; }

/* in-prep note under the demo intro; the extra space below sets the text block
   apart from the wider gallery that follows */
.demo-footnote {
  margin: var(--space-3) 0 var(--space-4); max-width: 110ch;
  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) {
  /* controls band is the default here; just settle the video frame sizing */
  .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);
  }
}

/* ----- Integrations showcase -------------------------------------------- */
/* A single horizontal strip of tabs (the active one boxed) selects which
   integration shows in the stage below: a looping video beside its text. */
.intg { margin-top: var(--space-3); }
/* One big pill holding all options; a blue thumb (.intg-slider) slides behind
   the active option. The thumb's size/position is set in JS from the active
   button's geometry so it works for any label widths and wraps gracefully. */
.intg-tabs {
  position: relative; display: inline-flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: var(--space-3); padding: 5px;
  background: var(--gray-soft); border: 1px solid var(--gray-line); border-radius: 999px;
}
.intg-slider {
  position: absolute; top: 0; left: 0; z-index: 0;
  border-radius: 999px; background: var(--blue); box-shadow: var(--shadow);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1), width .28s cubic-bezier(.4, 0, .2, 1), height .28s;
}
.intg-tab {
  position: relative; z-index: 1; border: 0; background: transparent; cursor: pointer;
  font-family: var(--font-sans); font-size: var(--fs-meta); font-weight: 600;
  color: var(--ink); padding: 0.5em 1.1em; border-radius: 999px;
  transition: color .2s;
}
.intg-tab:hover:not(.is-active) { color: var(--blue); }
.intg-tab.is-active { color: #fff; }

.intg-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
  gap: clamp(1.5rem, 4vw, var(--space-5));
  align-items: center;
}
.intg-panel[hidden] { display: none; }
.intg-text > :first-child { margin-top: 0; }
.intg-media {
  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);
}
.intg-video { display: block; width: 100%; height: 100%; object-fit: contain; background: #0d1117; }

@media (max-width: 860px) {
  .intg-panel { grid-template-columns: 1fr; gap: var(--space-3); }
}

.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; }

/* ----- Comparison explorer ----------------------------------------------- */
.cmp { position: relative; margin: var(--space-3) 0; }
.cmp-views {
  display: grid; grid-template-columns: 1fr; gap: var(--space-4);
  align-items: center;
}
@media (min-width: 720px) {
  .cmp-views { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--space-3); }
}
/* composite-only benchmarks (no radar) let the bar chart span the full width */
.cmp-views--solo { grid-template-columns: 1fr !important; }
.cmp-views--solo .cmp-bars { width: 100%; }
.cmp-bars, .cmp-radar { min-width: 0; }
/* names can sit just left of the track — don't clip them */
.cmp-bars svg { display: block; overflow: visible; }
.cmp-radar svg { display: block; max-width: 440px; margin: 0 auto; overflow: visible; }
.cmp-axis-label {
  letter-spacing: .04em; text-transform: uppercase; font-weight: 600;
}
/* one shared, centered legend for both charts; hovering a key highlights that
   method across the bar chart and the radar at once */
.cmp-legend { justify-content: center; margin-top: var(--space-2); }
.cmp .chart-legend .key { cursor: pointer; }
/* colour now encodes the approach TYPE, so the legend titles carry the identity:
   the TerraZero accent reads as a proper name, the type families as small
   letter-spaced labels, and the reference row muted. */
/* legend title typography is applied inline (JS legend via setProperty, the
   static WOSAC legend via inline style) so it always wins over the base rule */

/* WOSAC shows two editions side by side (2023 · 2024); each panel is a solo bar
   chart with its own title, stacking on narrow screens. */
.cmp-pair { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
@media (min-width: 860px) {
  .cmp-pair { grid-template-columns: 1fr 1fr; gap: var(--space-3); align-items: start; }
}
.cmp-pair .cmp { margin: 0; }
.cmp-panel { min-width: 0; }
.cmp-panel-title {
  text-align: center; margin: 0; font-family: var(--font-sans);
  font-size: var(--fs-meta); font-weight: 700; color: var(--ink);
}
.cmp-panel-title .cmp-panel-sub { display: block; font-weight: 500; color: var(--gray); }
/* one merged legend centered beneath both WOSAC panels */
.cmp-pair-legend { margin-top: var(--space-3); }

/* ----- 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; align-items: flex-start; }
/* the footer reuses the header wordmark, but the header's height:100% + pill
   backdrop are for the sticky header only; here they make the mark fill the whole
   stretched column and shove the tagline out over the copyright line */
.site-footer .brand-mark {
  height: auto; width: auto; display: inline-flex; justify-content: flex-start;
  gap: 0.55em; margin-bottom: 0.5rem;
  background: transparent; border-color: transparent; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.site-footer .copyright { color: var(--gray); margin-top: var(--space-3); font-family: var(--font-mono); font-size: var(--fs-eyebrow); }

/* ----- BibTeX block ------------------------------------------------------ */
.bibtex {
  position: relative;
  background: #0f1115; color: #e7e9ee;
  border-radius: var(--radius);
  padding: var(--space-3);
  font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.55;
  overflow-x: auto;
}
.bibtex .copy-btn {
  position: absolute; top: 10px; right: 10px;
  font-family: var(--font-sans); font-size: 0.72rem; font-weight: 600;
  background: rgba(255,255,255,.08); color: #fff;
  border: 1px solid rgba(255,255,255,.18); border-radius: 6px;
  padding: 0.35em 0.7em; cursor: pointer;
}
.bibtex .copy-btn:hover { background: var(--blue); border-color: var(--blue); }

/* ----- Charts ------------------------------------------------------------ */
.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;
}

/* ----- Foldable demo strip (InterPlan / val14 / WOSAC) ------------------- */
/* A collapsed toggle that expands to a horizontally scrollable row of looping
   video tiles. Tiles lazy-load and play only while scrolled into the strip's
   viewport (see initDemoStrips in main.js). */
.ipg { margin: var(--space-4) 0 var(--space-5); }
.ipg[hidden] { display: none; }
.ipg-toggle {
  display: flex; width: 100%; align-items: center; gap: 0.7em; cursor: pointer;
  background: var(--gray-soft); border: 1px solid var(--gray-line);
  border-radius: 999px; padding: 0.7em 1.4em;
  font-family: var(--font-sans); font-size: var(--fs-h3); font-weight: 600;
  color: var(--ink); transition: border-color .18s, color .18s, background .18s;
}
.ipg-toggle:hover { border-color: var(--blue-muted); color: var(--blue); }
/* the caret reflects the CURRENT state: v (down) while folded, ^ (up) when open.
   A masked SVG chevron (symmetric in its viewBox) centers cleanly under
   rotation, unlike a two-border box whose corner sits off-center. */
.ipg-chevron {
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5,9L12,15L19,9' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  display: inline-block; width: 0.95em; height: 0.95em; flex: none;
  background: currentColor;
  -webkit-mask: var(--chev) center / contain no-repeat;
  mask: var(--chev) center / contain no-repeat;
  transform: rotate(0deg); transition: transform .2s ease;
}
.ipg-toggle[aria-expanded="true"] .ipg-chevron { transform: rotate(180deg); }
.ipg-count { color: var(--gray); font-weight: 500; }

.ipg-panel { margin-top: var(--space-3); }
.ipg-panel[hidden] { display: none; }
.ipg-note {
  margin: 0 0 var(--space-3); font-family: var(--font-sans);
  font-size: var(--fs-body); color: var(--gray); font-style: italic;
}
/* ~1.5 tiles across the container at most. Leading/trailing spacer flex items
   (half the leftover width each) give the first and last tile enough scroll
   room to snap to dead-center. Spacers, not padding, so the tile's own %
   width resolves against the full strip width (no circular sizing). */
.ipg-strip {
  --tile-w: clamp(280px, 48%, 600px);
  display: flex; gap: var(--space-3); overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-2);
}
.ipg-strip::before, .ipg-strip::after {
  content: ""; flex: 0 0 calc((100% - var(--tile-w)) / 2);
}
.ipg-tile {
  flex: 0 0 auto; width: var(--tile-w); margin: 0;
  scroll-snap-align: center;
}
/* Fixed box per gallery (--frame-ar, set from each manifest's "aspect" so it
   matches that gallery's clips: 1/1 for the square InterPlan renders, 16/9 for
   WOSAC). Fixed, not video-derived, so the shape is stable before the lazy
   video loads; object-fit: cover fills it exactly (same ratio, no crop). */
.ipg-frame {
  position: relative; width: 100%; aspect-ratio: var(--frame-ar, 1 / 1);
  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);
}
.ipg-frame video { display: block; width: 100%; height: 100%; object-fit: cover; background: #0d1117; }
.ipg-tile figcaption {
  margin-top: 0.7em; font-family: var(--font-sans); font-size: var(--fs-body);
  font-weight: 600; color: var(--ink);
}

/* ----- 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: 52px; }
  /* applied.co-style mobile: no connecting bar — two standalone frosted
     circles (brand left, menu right) with a full-screen overlay menu. */
  .header-pill::before { opacity: 0 !important; }
  .header-pill { padding-inline: 6px; gap: 0; }

  /* brand is always a circle on mobile */
  .brand-mark {
    width: var(--header-h); justify-content: center; gap: 0; z-index: 2;
    background: rgba(255,255,255,.82); border-color: rgba(17,17,17,.07);
    box-shadow: var(--shadow);
  }
  .brand-word { max-width: 0; opacity: 0; margin: 0; }

  /* hamburger lives in its own frosted circle and morphs into an ✕ when open */
  .nav-toggle {
    display: inline-flex; margin-left: auto; z-index: 2;
    width: var(--header-h); height: var(--header-h); border-radius: 999px;
    align-items: center; justify-content: center; flex-direction: column; gap: 5px;
    background: rgba(255,255,255,.82); border: 1px solid rgba(17,17,17,.07);
    box-shadow: var(--shadow); cursor: pointer; padding: 0;
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
  }
  .nav-toggle span {
    width: 20px; height: 2px; background: var(--ink); display: block; border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease;
  }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* full-screen frosted overlay menu (sits below the header circles) */
  .nav {
    position: fixed; inset: 0; margin: 0; z-index: 0;
    flex-direction: column; align-items: stretch; justify-content: center; gap: 0;
    padding: max(16vh, 110px) 34px calc(env(safe-area-inset-bottom) + 32px);
    background: rgba(255,255,255,.88);
    -webkit-backdrop-filter: saturate(160%) blur(22px);
    backdrop-filter: saturate(160%) blur(22px);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .28s ease, visibility 0s linear .28s;
  }
  .nav.open {
    opacity: 1; visibility: visible; pointer-events: auto;
    transition: opacity .28s ease;
  }
  .nav a {
    font-family: var(--font-display); font-size: 1.7rem; font-weight: 600;
    color: var(--ink); padding: 0.55em 0; border-bottom: 1px solid var(--gray-line);
  }
  .nav a:last-child { border-bottom: none; }

  section { padding-block: var(--space-5); }
  .hero { padding-top: calc(var(--header-h) + var(--header-gap) + var(--space-3)); }
  .card-grid.grid-2 { grid-template-columns: 1fr; }
}
body.nav-open { overflow: hidden; }

/* ----- 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) */
.series-badge {
  display: inline-block; vertical-align: middle; margin-left: 0.5em;
  font-family: var(--font-sans); font-size: var(--fs-eyebrow); font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.2em 0.6em; border-radius: 999px;
  background: #e8f0ff; color: #1a4ac4;
}
/* Resource buttons under a tab's description */
.series-links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: var(--space-2); }
.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 */
.intg-panel--wide { grid-template-columns: 1fr; align-items: start; }
.intg-showcase { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-3); }
.intg-showcase .figure img { display: block; width: 100%; border-radius: var(--radius); }
/* a single video reads better contained than stretched the full panel width */
.intg-showcase .intg-media { width: 100%; max-width: 960px; margin-inline: auto; }
.threeup { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.threeup-cell { min-width: 0; }
.threeup-vid {
  position: relative; border: 1px solid var(--gray-line); border-radius: var(--radius);
  overflow: hidden; background: #0d1117;
}
.threeup-vid video { display: block; width: 100%; height: auto; }
.threeup-cap { text-align: center; font-weight: 600; font-size: var(--fs-meta); margin: 0.4rem 0 0; }
.threeup-legend {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: rgba(255,255,255,.92); border: 1px solid var(--gray-line);
  border-radius: 6px; padding: 6px 9px; font-size: 12px;
  display: flex; flex-direction: column; gap: 5px;
}
.threeup-legend .row { display: flex; align-items: center; gap: 7px; }
.threeup-legend .sw { width: 16px; height: 11px; border: 1px solid #333; }
@media (max-width: 640px) { .threeup { grid-template-columns: 1fr; } }

/* ----- 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;
}
