/* ==========================================================================
   Autonomous Trail Racing
   Flat, Swiss technical-report language on a light paper surface.
   Ink is RAI navy, the single accent is RAI violet. One family: Archivo.
   ========================================================================== */

:root {
  --paper: oklch(98.7% 0.003 290);
  --paper-2: oklch(96.2% 0.006 290);
  --paper-3: oklch(93.4% 0.008 290);
  --rule: oklch(88% 0.009 290);
  --ink: oklch(19% 0.062 289);          /* ~ RAI navy #130c2c */
  --ink-2: oklch(36% 0.04 289);
  --muted: oklch(49% 0.022 289);
  --accent: oklch(55% 0.235 285);       /* ~ RAI violet #6c48fc */
  --accent-ink: oklch(45% 0.21 285);
  --accent-soft: oklch(93% 0.04 285);
  --off: oklch(78% 0.012 289);

  --font: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --cond: 68%;

  --wrap: 1320px;
  --gutter: clamp(16px, 3.4vw, 48px);
  --gap: clamp(16px, 2vw, 28px);
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }   /* width/height attributes reserve space; CSS decides the size */
a { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
::selection { background: var(--accent); color: var(--paper); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

p { margin: 0 0 1em; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }

.num { font-variant-numeric: tabular-nums lining-nums; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }

/* Type scale: 13 / 15 / 17 / 21 / 28 / 44 / display */
.display {
  font-stretch: var(--cond);
  font-weight: 760;
  letter-spacing: -0.012em;
  line-height: 0.9;
}
.h2 {
  font-stretch: var(--cond);
  font-size: clamp(36px, 4.4vw, 60px);
  font-weight: 720;
  line-height: 0.98;
  letter-spacing: -0.01em;
}
.h3 { font-size: 21px; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
.lede { font-size: clamp(19px, 1.6vw, 22px); line-height: 1.5; color: var(--ink-2); max-width: 46ch; }
.label { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.small { font-size: 14.5px; line-height: 1.55; color: var(--muted); }

/* Sections: a full-width hairline starts each one. Spacing varies with content. */
.section { padding: clamp(80px, 10vw, 136px) 0; border-top: 1px solid var(--rule); }
.hero + .section { padding-top: clamp(56px, 7vw, 96px); }   /* the rule sits midway between the hero and the abstract */
.section.tight { padding: clamp(56px, 7vw, 96px) 0; }
.section-head { grid-column: 1 / span 8; margin-bottom: clamp(36px, 4.5vw, 64px); }
.section-head .lede { margin-top: 18px; }

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.nav.stuck { border-bottom-color: var(--rule); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 24px; }
.wordmark { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-stretch: var(--cond); font-size: 19px; color: var(--ink); text-decoration: none; letter-spacing: 0.005em; white-space: nowrap; }
.brand-mark { width: 22px; height: 25px; flex: none; overflow: visible; }
.brand-mark path { fill: none; stroke-linecap: butt; }
.bm-edge { stroke: var(--ink); stroke-width: 44; }
.bm-halo { stroke: var(--paper); stroke-width: 92; }   /* cuts the leaf where the trail crosses */
.bm-trail { stroke: var(--accent); stroke-width: 54; }
.wordmark:hover { color: var(--ink); }
.nav-links { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block;
  padding: 6px 10px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
@media (max-width: 900px) { .nav-links { display: none; } }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero { padding: clamp(24px, 3vw, 44px) 0 clamp(56px, 7vw, 96px); }
.hero-title { grid-column: 1 / span 9; grid-row: 1; font-size: clamp(60px, 9.4vw, 144px); }
.hero-side {
  grid-column: 10 / span 3;
  grid-row: 1;
  align-self: start;
  padding-top: 4px;
}
.venue { font-size: 14.5px; line-height: 1.45; color: var(--ink-2); margin: 0 0 10px; }
.venue b { font-weight: 600; color: var(--ink); }
.linklist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.linklist li { border-bottom: 1px solid var(--rule); }
.linklist a, .linklist .pending {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 15px;
  font-weight: 550;
  color: var(--ink);
  text-decoration: none;
}
.linklist .ll { display: inline-flex; align-items: center; gap: 10px; }
.ph { width: 1em; height: 1em; flex: none; fill: currentColor; vertical-align: -0.125em; }   /* inline Phosphor icons */
.linklist .ph { font-size: 18px; }
.linklist .ll .ph { color: var(--accent-ink); }
.linklist .go { font-size: 15px; color: var(--muted); transition: color 0.2s; }   /* movement: Motion springs (interact.js) */
.linklist a:hover { color: var(--accent-ink); }
.linklist a:hover .go { color: var(--accent-ink); }
.linklist .pending { color: var(--muted); font-weight: 500; }
.linklist .pending .ll .ph { color: var(--muted); }
.linklist .pending em { font-style: normal; font-size: 13px; }
/* Below the title row: byline and lede on the left, the racing loop on the right, so the video is in
   the first screen. On narrow screens everything stacks and the video comes before the links. */
.hero-lede { grid-column: 1 / span 5; grid-row: 3; margin-top: clamp(16px, 1.6vw, 22px); font-size: clamp(17px, 1.4vw, 20px); }
.hero-photo {
  --w: 145;   /* diagonal wipe position; 145 = fully open */
  grid-column: 6 / -1;
  grid-row: 2 / span 2;
  align-self: start;
  margin: clamp(18px, 1.8vw, 26px) 0 0;
  overflow: hidden;
  clip-path: polygon(0 0, calc(var(--w) * 1%) 0, calc((var(--w) - 45) * 1%) 100%, 0 100%);
}
.hero-photo img, .hero-photo video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; object-position: 50% 45%; background: var(--paper-3); }

@media (max-width: 900px) {
  .hero-title, .hero-lede, .hero-photo { grid-column: 1 / -1; grid-row: auto; }
  .hero-photo { order: -1; grid-row: 2; }   /* right under the title, so phones see it first too */
  .hero-title { order: -2; }
  .hero-side { grid-column: 1 / -1; grid-row: auto; order: 3; margin-top: 28px; padding-top: 0; }
}

/* --------------------------------------------------------------------------
   Byline (inside the hero, under the title)
   -------------------------------------------------------------------------- */
.hero-byline { grid-column: 1 / span 5; grid-row: 2; margin-top: clamp(18px, 1.8vw, 26px); }
.authors {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 3px 16px;
  font-size: 14.5px;
  font-weight: 550;
  line-height: 1.5;
  max-width: 64ch;
}
.authors li { white-space: nowrap; }
.authors sup, .affils sup { font-size: 10px; font-weight: 500; color: var(--accent-ink); margin-left: 2px; }
.orgs { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 32px; margin-top: 14px; }
.org { display: block; line-height: 0; }
.org img { height: 26px; width: auto; }
.org + .org img { height: 34px; }
.affils { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 12.5px; color: var(--muted); flex-basis: 100%; }
.affils sup { margin: 0 3px 0 0; }
@media (max-width: 900px) {
  .hero-byline { grid-column: 1 / -1; grid-row: auto; }
  .org img { height: 24px; }
  .org + .org img { height: 32px; }
}

/* --------------------------------------------------------------------------
   Abstract
   -------------------------------------------------------------------------- */
.abstract-label { grid-column: 1 / span 3; }
.abstract-body { grid-column: 4 / span 7; max-width: 68ch; }
.abstract-body .claim {
  font-size: clamp(23px, 2.2vw, 30px);
  line-height: 1.3;
  font-weight: 560;
  letter-spacing: -0.012em;
  margin-bottom: 1.1em;
  color: var(--ink);
}
.abstract-body p { color: var(--ink-2); }
@media (max-width: 900px) {
  .abstract-label, .abstract-body { grid-column: 1 / -1; }
  .abstract-label { margin-bottom: 20px; }
}

/* --------------------------------------------------------------------------
   Figures
   -------------------------------------------------------------------------- */
figure { margin: 0; }
.fig { grid-column: 1 / -1; margin-top: clamp(56px, 7vw, 96px); }
.fig a { display: block; cursor: zoom-in; }
.fig img { width: 100%; height: auto; background: #fff; }
.fig figcaption, .caption {
  margin-top: 14px;
  max-width: 78ch;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--muted);
}
.fig figcaption b, .caption b { color: var(--ink); font-weight: 650; }
.fig.inset figcaption { margin-left: calc((100% + var(--gap)) / 12 * 3); }
@media (max-width: 900px) { .fig.inset figcaption { margin-left: 0; } }

/* --------------------------------------------------------------------------
   Key facts row (definition list, not a metric strip)
   -------------------------------------------------------------------------- */
.facts {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--gap);
  margin: 0 0 clamp(48px, 6vw, 80px);
  padding-top: 14px;
  border-top: 1px solid var(--ink);
}
.facts dt { font-size: 13.5px; color: var(--muted); }
.facts dd { margin: 4px 0 0; font-size: 28px; font-weight: 650; font-stretch: var(--cond); font-variant-numeric: tabular-nums; letter-spacing: -0.005em; line-height: 1.1; }
.facts dd small { font-size: 15px; font-weight: 500; font-stretch: 100%; color: var(--muted); margin-left: 3px; }
@media (max-width: 900px) { .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 20px; } }

/* --------------------------------------------------------------------------
   Ride along (scroll-synced trail map)
   -------------------------------------------------------------------------- */
.ride-map-col { grid-column: 1 / span 6; }
.ride-map { position: sticky; top: 76px; height: calc(100svh - 104px); max-height: 880px; min-height: 480px; display: flex; flex-direction: column; }
.readout { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; align-items: end; padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.readout-where { font-size: 13.5px; color: var(--muted); margin: 0; }
.readout-name { font-size: 22px; font-weight: 650; line-height: 1.2; margin: 2px 0 0; letter-spacing: -0.01em; }
.readout-run { display: flex; gap: 22px; margin: 0; }
.readout-run div { display: flex; flex-direction: column; }
.readout-run dt { font-size: 12.5px; color: var(--muted); }
.readout-run dd { margin: 0; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.readout-run dd.v { color: var(--accent-ink); }
.ride-map svg { flex: 1; width: 100%; min-height: 0; margin-top: 8px; }

.basemap { opacity: 0.45; }   /* swisstopo summer aerial, washed out: orientation only */
.route-base { fill: none; stroke: var(--paper-3); stroke-width: 15; stroke-linecap: round; stroke-linejoin: round; }
.route-progress { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.run-line { stroke-width: 7; stroke-linecap: round; opacity: 0.4; transition: opacity 0.4s var(--ease); }
.run-line.on { opacity: 1; }
.map-key { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.map-key .ramp { display: inline-block; width: 64px; height: 6px; vertical-align: middle; margin: 0 6px; background: linear-gradient(90deg, rgb(196,191,210), var(--accent)); }
.ped-halo { fill: none; stroke: var(--paper); stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; opacity: 0.75; }
.ped-path { fill: none; stroke: var(--ink); stroke-width: 5; stroke-dasharray: 2 13; stroke-linecap: round; }
.cp { cursor: pointer; }
.cp circle { fill: var(--paper); stroke: var(--ink); stroke-width: 3; transition: fill 0.25s, stroke 0.25s; }
.cp text { fill: var(--ink); font-family: var(--font); font-size: 24px; font-weight: 650; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.cp.passed circle { fill: var(--ink); }
.cp.passed text { fill: var(--paper); }
.cp.current circle { fill: var(--accent); stroke: var(--accent); }
.cp.current text { fill: var(--paper); }
.cp:hover circle { stroke: var(--accent); }
.rider { fill: var(--paper); stroke: var(--accent); stroke-width: 6; }
.map-label {
  fill: var(--ink); font-family: var(--font); font-size: 24px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  /* cartographic halo so labels stay legible on the aerial */
  paint-order: stroke; stroke: var(--paper); stroke-width: 9px; stroke-linejoin: round; stroke-opacity: 0.92;
}
.marker-start { fill: var(--ink); }
.map-hover-dot { fill: var(--paper); stroke: var(--ink); stroke-width: 5; pointer-events: none; }
.map-tip {
  position: absolute; z-index: 3; pointer-events: none;
  transform: translate(14px, -50%);
  padding: 5px 9px; background: var(--ink); color: var(--paper);
  font-size: 12.5px; line-height: 1.35; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.map-tip.flip { transform: translate(calc(-100% - 14px), -50%); }
.map-tip b { display: block; font-size: 14px; font-weight: 650; }
.marker-end { fill: var(--paper); stroke: var(--ink); stroke-width: 5; }

.ride-steps { grid-column: 8 / span 5; padding: 8vh 0 24vh; }
.step { margin-bottom: 20vh; opacity: 0.32; transition: opacity 0.45s var(--ease); }
.step.active, .step.note { opacity: 1; }
.step img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.step-head { display: grid; grid-template-columns: 44px 1fr; gap: 0 12px; margin-top: 16px; align-items: baseline; }
.step-num { font-size: 30px; font-weight: 700; font-stretch: var(--cond); color: var(--accent-ink); line-height: 1; font-variant-numeric: tabular-nums; }
.step-head .h3 { font-size: 22px; }
.step-run { grid-column: 2; font-size: 13.5px; color: var(--muted); margin: 2px 0 0; }
.step p.body { margin: 10px 0 0 56px; color: var(--ink-2); font-size: 16px; }
.step.note p { font-size: 18px; line-height: 1.5; color: var(--ink-2); }
.runs { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 15px; font-variant-numeric: tabular-nums; }
.runs th { text-align: left; font-weight: 500; font-size: 13px; color: var(--muted); padding: 0 8px 8px 0; border-bottom: 1px solid var(--ink); }
.runs td { padding: 7px 8px 7px 0; }
.runs td:nth-child(n+3), .runs th:nth-child(n+3) { text-align: right; }
.runs tr.part td { padding-top: 14px; }
.runs tr.total td { border-top: 1px solid var(--ink); font-weight: 650; padding-top: 10px; }

@media (max-width: 900px) {
  .ride-map-col { display: contents; }
  .ride-map { grid-column: 1 / -1; top: 56px; height: 48svh; min-height: 320px; background: var(--paper); z-index: 2; padding-top: 8px; border-bottom: 1px solid var(--rule); }
  .readout-name { font-size: 17px; }
  .readout-run { gap: 14px; }
  .readout-run div:nth-child(n+3) { display: none; }
  .ride-steps { grid-column: 1 / -1; padding-top: 4vh; }
  .step { margin-bottom: 12vh; }
  .step p.body { margin-left: 0; }
}

/* --------------------------------------------------------------------------
   Replay (three.js)
   -------------------------------------------------------------------------- */
.runbar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0; border-top: 1px solid var(--ink); margin-bottom: 20px; }
.runbar button {
  flex: 1 1 0;
  min-width: 120px;
  text-align: left;
  padding: 12px 14px 12px 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  cursor: pointer;
}
.runbar button + button { padding-left: 14px; border-left: 1px solid var(--rule); }
.runbar button b { display: block; font-size: 19px; font-weight: 700; font-stretch: var(--cond); color: var(--ink); }
.runbar button span { font-size: 13.5px; color: var(--muted); }
.runbar button[aria-pressed="true"] { border-bottom: 3px solid var(--accent); }
.runbar button[aria-pressed="true"] b { color: var(--accent-ink); }
.runbar button:hover b { color: var(--accent-ink); }

.replay-main { grid-column: 1 / span 8; display: flex; flex-direction: column; }
/* the 3D view fills the height of the side column, so the controls sit right under it */
.replay-stage { flex: 1 1 auto; min-height: 440px; position: relative; background: var(--paper-2); }
.replay-stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.replay-status { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; color: var(--muted); pointer-events: none; }
.replay-status[hidden] { display: none; }
.replay-legend { position: absolute; left: 14px; right: 14px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); pointer-events: none; }
.replay-legend span { display: flex; align-items: center; gap: 6px; }
.replay-legend i { width: 12px; height: 12px; display: inline-block; }
.replay-view { position: absolute; right: 12px; top: 12px; display: flex; border: 1px solid var(--ink); background: var(--paper); }
.replay-view button { border: 0; background: transparent; font: inherit; font-size: 13.5px; font-weight: 550; padding: 6px 12px; cursor: pointer; color: var(--ink-2); }
.replay-view button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.replay-side { grid-column: 9 / span 4; display: flex; flex-direction: column; gap: 18px; }
.cam video { width: 100%; aspect-ratio: 512 / 320; background: var(--paper-3); object-fit: cover; }
.cam figcaption { margin-top: 6px; font-size: 13px; color: var(--muted); }
.readings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding-top: 10px; border-top: 1px solid var(--ink); }
.readings dt { font-size: 12.5px; color: var(--muted); }
.readings dd { margin: 2px 0 0; font-size: 26px; font-weight: 680; font-stretch: var(--cond); font-variant-numeric: tabular-nums; line-height: 1.05; }
.readings dd small { font-size: 14px; font-weight: 500; font-stretch: 100%; color: var(--muted); margin-left: 2px; }
.readings dd.v { color: var(--accent-ink); }
.scanmats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scanmats canvas { width: 100%; aspect-ratio: 1; image-rendering: pixelated; background: var(--paper-3); }
.scanmats { position: relative; }
.scan-empty { position: absolute; inset: 0 0 26px; display: grid; place-items: center; text-align: center; padding: 12px; margin: 0; background: var(--paper-2); }
.scan-empty[hidden] { display: none; }
.scan-recon { grid-column: 1 / -1; margin: 4px 0 0; color: var(--muted); }
.scan-recon[hidden] { display: none; }
.scanmats figcaption { margin-top: 6px; font-size: 13px; color: var(--muted); }
.trace { position: relative; cursor: crosshair; touch-action: none; outline-offset: 4px; }
.trace svg { width: 100%; height: 72px; overflow: visible; }
.trace svg * { vector-effect: non-scaling-stroke; }
.trace .axis { stroke: var(--rule); stroke-width: 1; }
.trace .line { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.trace .head { stroke: var(--accent); stroke-width: 2; }
.trace .hover { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.trace.hovering .hover { opacity: 0.55; }
.trace:hover .line { stroke: var(--ink-2); }
.trace-ref { position: absolute; right: 0; transform: translateY(-120%); font-size: 11.5px; color: var(--muted); pointer-events: none; }
.trace-tip {
  position: absolute; top: calc(100% + 4px); transform: translateX(-50%);   /* below the trace, over the hint */
  padding: 3px 8px; background: var(--ink); color: var(--paper);
  font-size: 12.5px; white-space: nowrap; pointer-events: none; font-variant-numeric: tabular-nums;
}
.trace-tip b { font-weight: 650; margin-right: 4px; }
.trace-hint { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.trace.hovering + .trace-hint { visibility: hidden; }

.transport { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; margin-top: 14px; }
.play {
  width: 44px; height: 44px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  display: grid; place-items: center; cursor: pointer; font: inherit; font-size: 15px;
}
.play:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.scrub { width: 100%; accent-color: var(--accent); }
.clock { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 9ch; text-align: right; }
.replay-note { margin: 18px 0 0; }

@media (max-width: 1000px) {
  .replay-main, .replay-side { grid-column: 1 / -1; }
  .replay-stage { flex: none; min-height: 0; aspect-ratio: 1 / 1; }
  .replay-side { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; }
  .replay-side .cam, .replay-side .readings, .replay-side .trace { grid-column: 1 / -1; }
}
@media (max-width: 560px) { .replay-side { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   Method
   -------------------------------------------------------------------------- */
.contrib { grid-column: span 6; padding-top: 16px; border-top: 1px solid var(--ink); }
.contrib h3 { font-size: clamp(44px, 4.8vw, 68px); font-stretch: var(--cond); font-weight: 760; line-height: 0.95; }
.contrib .expand { font-size: 15px; color: var(--muted); margin: 6px 0 20px; }
.contrib p { color: var(--ink-2); max-width: 58ch; }
.contrib dl { display: grid; grid-template-columns: 110px 1fr; gap: 10px 18px; margin: 22px 0 0; font-size: 15px; }
.contrib dt { color: var(--muted); }
.contrib dd { margin: 0; color: var(--ink); }
@media (max-width: 900px) { .contrib { grid-column: 1 / -1; } .contrib + .contrib { margin-top: 48px; } }

.reward { grid-column: 1 / -1; margin-top: clamp(56px, 7vw, 88px); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: baseline; }
.reward .eq { grid-column: 1 / span 5; font-size: clamp(24px, 2.4vw, 32px); font-weight: 500; letter-spacing: -0.01em; }
.reward .eq i { font-style: italic; }
.reward .eq sub { font-size: 0.55em; }
.reward .eq .w { color: var(--accent-ink); font-weight: 650; }
.reward ul { grid-column: 6 / span 7; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); font-size: 15px; color: var(--ink-2); }
.reward li b { display: block; color: var(--ink); font-weight: 650; }
.reward p { grid-column: 6 / span 7; margin-top: 18px; font-size: 15px; color: var(--muted); }
@media (max-width: 900px) {
  .reward .eq, .reward ul, .reward p { grid-column: 1 / -1; }
  .reward ul { grid-template-columns: 1fr; margin-top: 20px; }
}

/* --------------------------------------------------------------------------
   Validation staircase
   -------------------------------------------------------------------------- */
.ladder { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.rung { border-top: 1px solid var(--ink); padding-top: 14px; }
.rung:nth-child(1) { margin-top: 192px; }
.rung:nth-child(2) { margin-top: 144px; }
.rung:nth-child(3) { margin-top: 96px; }
.rung:nth-child(4) { margin-top: 48px; }
.rung:nth-child(5) { border-top: 3px solid var(--accent); padding-top: 12px; }
.rung .kpi { font-size: clamp(36px, 3.6vw, 52px); font-weight: 760; font-stretch: var(--cond); line-height: 0.95; font-variant-numeric: tabular-nums; }
.rung .kpi small { font-size: 15px; font-weight: 500; font-stretch: 100%; color: var(--muted); margin-left: 4px; }
.rung h3 { font-size: 18px; margin: 12px 0 6px; }
.rung p { font-size: 14.5px; line-height: 1.5; color: var(--muted); margin: 0 0 14px; }
.rung img, .rung video { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: var(--paper-3); }
.ladder-axis { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; margin-top: 22px; font-size: 13.5px; color: var(--muted); }
.ladder-axis > span:not(.axis-arrow) { flex: 0 1 auto; }
/* a hairline with an open arrowhead: simulation on the left, the real world on the right */
.axis-arrow { flex: 1; min-width: 40px; height: 1px; background: currentColor; position: relative; transform-origin: left center; }
.axis-arrow::after {
  content: ""; position: absolute; right: 0; top: 50%; width: 7px; height: 7px;
  border-top: 1px solid; border-right: 1px solid; transform: translateY(-50%) rotate(45deg);
}
@media (max-width: 1000px) {
  .ladder { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 40px; }
  .rung { margin-top: 0 !important; }
  .rung:last-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) { .ladder { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   Speed number line
   -------------------------------------------------------------------------- */
.nl { grid-column: 1 / -1; }
.nl-row { display: grid; grid-template-columns: 200px 1fr; gap: var(--gap); align-items: center; min-height: 128px; }
.nl-row + .nl-row { border-top: 1px solid var(--rule); }
.nl-name b { display: block; font-weight: 650; }
.nl-name span { font-size: 14px; color: var(--muted); }
.nl-track { position: relative; height: 112px; }
.nl-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--ink); }
.mark { position: absolute; top: 50%; left: calc(var(--v) / 10 * 100%); transform: translate(-50%, -50%); }
.mark i { display: block; width: 13px; height: 13px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); }
.mark.ours i { background: var(--accent); border-color: var(--accent); width: 15px; height: 15px; }
.mark.sim i { border-style: dashed; }
.mark .tag { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); white-space: nowrap; text-align: center; font-size: 13.5px; line-height: 1.25; color: var(--ink-2); }
.mark.below .tag { bottom: auto; top: 20px; }
.mark.end .tag { left: auto; right: -6px; transform: none; text-align: right; }
.mark .tag b { display: block; font-size: 17px; font-weight: 680; color: var(--ink); font-variant-numeric: tabular-nums; }
.mark.ours .tag b { color: var(--accent-ink); }
.span { position: absolute; top: calc(50% + 18px); left: calc(var(--a) / 10 * 100%); width: calc((var(--b) - var(--a)) / 10 * 100%); height: 10px; border: 1px solid var(--accent); border-top: 0; }
.span b { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); font-size: 17px; font-weight: 700; color: var(--accent-ink); white-space: nowrap; }
.nl-axis { display: grid; grid-template-columns: 200px 1fr; gap: var(--gap); border-top: 1px solid var(--rule); padding-top: 8px; }
.nl-ticks { position: relative; height: 20px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nl-ticks span { position: absolute; transform: translateX(-50%); }
.nl-ticks span:first-child { transform: none; }
.nl-ticks span:last-child { transform: translateX(-100%); }
.nl-note { grid-column: 1 / span 8; margin-top: 24px; }
@media (max-width: 700px) {
  .nl-row, .nl-axis { grid-template-columns: 1fr; }
  .nl-axis > div:first-child { display: none; }
  .nl-row { padding-top: 16px; }
  .mark .tag { font-size: 12px; }
  .mark .tag b { font-size: 15px; }
}

/* --------------------------------------------------------------------------
   Results
   -------------------------------------------------------------------------- */
.tabs { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 26px; border-bottom: 1px solid var(--rule); margin-bottom: 36px; }
.tab { padding: 10px 0; border: 0; background: none; font: inherit; font-size: 16px; font-weight: 550; color: var(--muted); cursor: pointer; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.panel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: start; }
.panel[hidden] { display: none; }
.panel > figure { grid-column: 1 / span 8; }
.panel > figure img { width: 100%; background: #fff; cursor: zoom-in; }
.panel-text { grid-column: 9 / span 4; }
.panel-text h3 { font-size: 24px; margin-bottom: 12px; }
.panel-text p { color: var(--ink-2); font-size: 16px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 20px 0 0; padding-top: 12px; border-top: 1px solid var(--ink); font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .panel > figure, .panel-text { grid-column: 1 / -1; } .panel-text { margin-top: 24px; } }

/* --------------------------------------------------------------------------
   Videos
   -------------------------------------------------------------------------- */
.videos { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 40px var(--gap); }
.video { grid-column: span 4; }
.video.lead { grid-column: 1 / -1; }
.video.wide { grid-column: span 6; }
.vframe { position: relative; aspect-ratio: 16 / 9; background: var(--paper-3); overflow: hidden; }
.vframe img, .vframe video { width: 100%; height: 100%; object-fit: cover; }
.vframe .vplay {
  position: absolute; left: 16px; bottom: 16px; display: none;
  height: 40px; padding: 0 16px; border: 0; background: var(--paper); color: var(--ink);
  font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer;
}
.has-video .vplay { display: block; }
.playing .vplay { display: none; }
.video figcaption { display: grid; grid-template-columns: 40px 1fr auto; gap: 8px; margin-top: 12px; font-size: 15.5px; align-items: baseline; }
.video figcaption .ext { font-weight: 700; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.video figcaption .state { font-size: 13px; color: var(--muted); }
.has-video figcaption .state { display: none; }
.vcap { margin: 8px 0 0 48px; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); max-width: 70ch; }
.vfull { margin: 6px 0 0 48px; font-size: 14px; color: var(--muted); }
.vfull summary { cursor: pointer; font-weight: 550; color: var(--accent-ink); list-style: none; }
.vfull summary::-webkit-details-marker { display: none; }
.vfull summary::after { content: " +"; }
.vfull[open] summary::after { content: " \2212"; }
.vfull p { margin: 8px 0 0; line-height: 1.55; max-width: 72ch; }
@media (max-width: 900px) { .video, .video.wide { grid-column: span 6; } .vcap, .vfull { margin-left: 0; } }
@media (max-width: 560px) { .video, .video.wide { grid-column: 1 / -1; } }

/* --------------------------------------------------------------------------
   Code, data, citation
   -------------------------------------------------------------------------- */
.res-list { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.res-list li { border-bottom: 1px solid var(--rule); }
.res-list a { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); padding: 22px 0; color: var(--ink); text-decoration: none; align-items: baseline; }
.res-list a:hover .res-name { color: var(--accent-ink); }
.res-kind { grid-column: 1 / span 2; font-size: 14px; color: var(--muted); }
.res-name { grid-column: 3 / span 3; font-size: 26px; font-weight: 700; font-stretch: var(--cond); line-height: 1.1; }
.res-desc { grid-column: 6 / span 4; font-size: 15.5px; color: var(--ink-2); }
.res-url { grid-column: 10 / span 3; font-size: 14px; color: var(--accent-ink); text-align: right; word-break: break-all; }
@media (max-width: 900px) {
  .res-list a { grid-template-columns: 1fr; row-gap: 4px; }
  .res-kind, .res-name, .res-desc, .res-url { grid-column: 1 / -1; text-align: left; }
}

.bib { grid-column: 1 / -1; margin-top: clamp(56px, 7vw, 88px); }
.bib-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.bib pre {
  margin: 0;
  padding: 22px 24px;
  background: var(--paper-2);
  border-top: 1px solid var(--ink);
  color: var(--ink-2);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.7;
  overflow-x: auto;
}
.copy { border: 1px solid var(--ink); background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; padding: 6px 14px; cursor: pointer; }
.copy:hover { background: var(--ink); color: var(--paper); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer { border-top: 1px solid var(--ink); padding: 40px 0 64px; font-size: 14.5px; color: var(--muted); }
.footer .ack { grid-column: 1 / span 7; }
.footer .contact { grid-column: 9 / span 4; }
.footer h4 { font-size: 14.5px; color: var(--ink); margin-bottom: 8px; }
.footer .fine { grid-column: 1 / -1; margin-top: 40px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13.5px; }
@media (max-width: 900px) { .footer .ack, .footer .contact { grid-column: 1 / -1; } .footer .contact { margin-top: 24px; } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --------------------------------------------------------------------------
   Motion: starting states (only when the reader allows motion; see head script)
   GSAP (js/motion.js) owns scroll choreography; Motion (js/interact.js) owns springs.
   -------------------------------------------------------------------------- */
.hero-title .line { display: block; overflow: hidden; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.hero-title .line-inner { display: block; }

html.motion .hero-title,
html.motion .hero-byline,
html.motion .hero-lede,
html.motion .hero-side,
html.motion .section-head > *,
html.motion .rung,
html.motion .ladder-axis,
html.motion .mark .tag,
html.motion .span b,
html.motion .video { opacity: 0; }
html.motion .hero-photo { --w: -5; }
html.motion .linklist li,
html.motion .facts,
html.motion .contrib,
html.motion .runbar,
html.motion .reward,
html.motion .res-list li,
html.motion .nl-row,
html.motion .nl-axis,
html.motion .bib { clip-path: inset(0 100% 0 0); }
html.motion .fig a,
html.motion .fig > img { clip-path: inset(100% 0 0 0); }
html.motion .span { transform: scaleX(0); }
.span { transform-origin: 0 50%; }

/* Shared sliding indicators (positioned by Motion springs) */
.tabs, .runbar { position: relative; }   /* .replay-view is already absolutely positioned */
.tab-indicator, .run-indicator, .view-indicator {
  position: absolute; top: 0; left: 0; display: block; pointer-events: none; box-sizing: border-box;
}
.tab-indicator { border-bottom: 2px solid var(--accent); }
.run-indicator { border-bottom: 3px solid var(--accent); }
.view-indicator { background: var(--ink); z-index: 0; }
.tabs.has-indicator .tab[aria-selected="true"] { border-bottom-color: transparent; }
.runbar.has-indicator button[aria-pressed="true"] { border-bottom: 1px solid var(--rule); }
.replay-view.has-indicator button { position: relative; z-index: 1; }
.replay-view.has-indicator button[aria-pressed="true"] { background: transparent; }

/* ---------- figure lightbox: figures open full screen on the page, not in a new tab ---------- */
a[data-zoom] img { cursor: zoom-in; }
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 24px; border: 0;
  background: var(--paper);
  cursor: zoom-out;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox.zoomed { place-items: safe center; overflow: auto; overscroll-behavior: contain; }
.lightbox::backdrop { background: transparent; }
.lightbox img {
  max-width: 100%; max-height: calc(100dvh - 48px); width: auto; height: auto;
  object-fit: contain; background: #fff; cursor: zoom-in;
  user-select: none; -webkit-user-drag: none;
}
.lightbox.zoomed img { max-width: none; max-height: none; cursor: grab; }
.lightbox.dragging img { cursor: grabbing; }
.lb-close {
  position: fixed; top: 16px; right: 16px; width: 44px; height: 44px; z-index: 1;
  display: grid; place-items: center; border: 0; cursor: pointer;
  background: var(--ink); color: var(--paper); font-size: 20px;
}
.lb-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.lb-hint {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0;
  padding: 4px 10px; background: var(--paper); color: var(--muted);
  font-size: 13px; max-width: calc(100vw - 32px); text-align: center; pointer-events: none;
}
html:has(.lightbox[open]) { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .lightbox[open] { animation: lb-fade 0.25s var(--ease); }
  .lightbox[open]:not(.zoomed) img { animation: lb-in 0.4s var(--ease); }
}
@keyframes lb-fade { from { opacity: 0; } }
@keyframes lb-in { from { opacity: 0; transform: scale(0.97); } }
