/* ==========================================================================
   Ocula — Project Page Design System
   Quiet porcelain surfaces · one Ocula blue · SF Pro typography
   Concentric radii · soft layered shadows · Apple-standard motion
   ========================================================================== */

:root {
  color-scheme: light;

  /* Surfaces */
  --page: #ffffff;
  --page-alt: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --surface-3: #ebebef;

  /* Ink */
  --ink: #1d1d1f;
  --ink-2: #424245;
  --ink-3: #6e6e73;
  --ink-4: #86868b;

  /* Hairlines */
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.14);
  /* Apple's content-width section rule (rgba(0,0,0,.16) on white) */
  --rule: rgba(0, 0, 0, 0.16);

  /* Ocula blue (paper figures + logo) */
  --blue: #2c6ee2;
  --blue-deep: #2357b8;
  --blue-50: #f1f7fe;
  --blue-soft: rgba(44, 110, 226, 0.085);
  --blue-line: rgba(44, 110, 226, 0.26);

  /* Semantic deltas (paper table colors) */
  --pos: #2d765e;
  --pos-soft: rgba(45, 118, 94, 0.1);
  --neg: #a74a35;
  --neg-soft: rgba(167, 74, 53, 0.1);
  --teacher: #e0528c;

  /* Segmented controls — Liquid Glass capsule + lens */
  --seg-tint: rgba(232, 233, 238, 0.8);
  --seg-rim: rgba(0, 0, 0, 0.065);
  --glide: cubic-bezier(0.3, 1.08, 0.36, 1);
  --glide-lead: cubic-bezier(0.32, 1.22, 0.44, 1);
  --glide-lead-end: cubic-bezier(0.3, 1, 0.4, 1);
  --glide-trail: cubic-bezier(0.38, 0.85, 0.32, 1.03);
  --pop: cubic-bezier(0.34, 1.5, 0.6, 1);

  /* Liquid glass (navbar island) */
  --glass-edge: rgba(255, 255, 255, 0.8);
  --glass-tint: rgba(255, 255, 255, 0.72);
  --glass-rim: rgba(0, 0, 0, 0.085);

  /* Concentric radii */
  --r-2xl: 28px;
  --r-xl: 22px;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;
  --r-xs: 7px;

  /* Layered shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 16px -8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.03), 0 14px 36px -14px rgba(0, 0, 0, 0.11);
  --shadow-lg: 0 2px 6px -2px rgba(0, 0, 0, 0.05), 0 28px 60px -24px rgba(0, 0, 0, 0.17);
  --thumb: 20px;

  /* Type */
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-text: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --font-math: "STIX Two Text", "STIX Two Math", "Cambria Math", "Times New Roman", serif;

  /* Motion */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-1: 160ms;
  --dur-2: 240ms;
  --dur-3: 480ms;

  --max-w: 1100px;
  --card-pad: 28px;
  --card-gap: 24px;
  --tile: #f5f5f7;
  --bar-h: 64px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background-color: var(--page);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.6;
  font-kerning: normal;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
}

::selection {
  background: rgba(44, 110, 226, 0.18);
  color: var(--ink);
}

img,
canvas,
svg,
video {
  display: block;
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
  color: inherit;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

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

main,
.site-footer {
  position: relative;
  z-index: 2;
}

.scroll-progress {
  position: fixed;
  z-index: 120;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, rgba(44, 110, 226, 0.55), var(--blue));
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
  will-change: transform;
}

.container {
  width: min(var(--max-w), calc(100% - 48px));
  margin-inline: auto;
}

/* ==========================================================================
   Typography utilities & publication-grade math
   ========================================================================== */
.mono-inline {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.mono-meta {
  font-family: var(--font-text);
  font-size: 12px;
  letter-spacing: -0.003em;
  font-variant-numeric: tabular-nums;
}

.mono-meta {
  color: var(--ink-3);
}

.mono-badge {
  display: inline-flex;
  align-items: center;
  height: auto;
  padding: 0;
  border-radius: 0;
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: none;
  color: var(--blue-deep);
}

.stat-note {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--pos);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pg-meta #pg-coord-pill {
  color: var(--ink-2);
  font-weight: 500;
}

.badge-mint {
  background: var(--pos-soft);
  color: var(--pos);
}

.math-var {
  font-family: var(--font-math);
  font-style: italic;
  font-size: 1.08em;
  line-height: 1;
  color: var(--ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.math-var sub,
.math-var sup {
  position: relative;
  font-size: 0.72em;
  line-height: 0;
  vertical-align: baseline;
}

.math-var sub {
  bottom: -0.24em;
  margin-left: 0.04em;
}

.math-var sup {
  top: -0.45em;
}

.math-var .math-rm {
  font-style: normal;
}

/* Script capitals (𝒱, 𝒲) live in the Mathematical Alphanumeric block: macOS/iOS have
   STIX Two Math, Windows has Cambria Math, everything else gets the Noto Sans Math webfont
   (only fetched when neither system font exists). */
.math-var .math-script {
  font-family: "STIX Two Math", "Cambria Math", "Noto Sans Math", var(--font-math);
  font-style: normal;
  font-size: 1.04em;
}

.math-display {
  margin-top: 20px;
  padding: 18px 22px;
  border-radius: var(--r-md);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  overflow-x: auto;
}

.math-eq {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

/* MathML takes its layout constants (fractions, big operators) from the first available
   font, so only real math fonts come first; a text font there would win on Windows/Linux. */
.math-eq math {
  font-family: "STIX Two Math", "Cambria Math", "Latin Modern Math", "Noto Sans Math", math, serif;
  font-size: 1.16rem;
  line-height: 1.5;
  color: var(--ink);
}

.math-ref {
  flex-shrink: 0;
  font-family: var(--font-math);
  font-size: 0.94rem;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

/* ==========================================================================
   Controls — sliders, chips, segmented tracks with a sliding thumb
   ========================================================================== */
/* Range fields — a custom rail (fill + on-track stops) under a transparent native input,
   so preset stops sit inside the track and never collide with the thumb */
.range-field {
  --fillp: 0.5;
  position: relative;
  height: 22px;
}

.range-rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 999px;
  background: linear-gradient(to right,
    var(--blue) 0 calc(var(--thumb) / 2 + var(--fillp) * (100% - var(--thumb))),
    rgba(118, 118, 128, 0.18) 0 100%);
  pointer-events: none;
}

.range-stop {
  position: absolute;
  top: 50%;
  left: calc(var(--thumb) / 2 + var(--p, 0) * (100% - var(--thumb)));
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: rgba(118, 118, 128, 0.42);
  transition: background-color var(--dur-2) var(--ease);
}

.range-stop.is-on {
  background: rgba(255, 255, 255, 0.9);
}

input[type="range"] {
  position: relative;
  z-index: 1;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

input[type="range"]:focus-visible {
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--thumb);
  height: var(--thumb);
  border-radius: 50%;
  background: #ffffff;
  border: 0;
  box-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.18), 0 2px 7px rgba(0, 0, 0, 0.13), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  transition: transform var(--dur-2) var(--ease-spring), box-shadow var(--dur-2) var(--ease);
}

input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.06);
}

input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.1);
  box-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.18), 0 3px 10px rgba(44, 110, 226, 0.26), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.18), 0 2px 7px rgba(0, 0, 0, 0.13), 0 0 0 4px rgba(44, 110, 226, 0.24);
}

input[type="range"]::-moz-range-track {
  background: transparent;
  border: 0;
}

input[type="range"]::-moz-range-thumb {
  width: var(--thumb);
  height: var(--thumb);
  border-radius: 50%;
  background: #ffffff;
  border: 0;
  box-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.18), 0 2px 7px rgba(0, 0, 0, 0.13), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}

/* Labels that sit exactly under their stop (first/last hug the track ends) */
.range-labels {
  position: relative;
  margin-top: 7px;
}

.range-labels > * {
  position: absolute;
  top: 0;
  left: calc(var(--thumb) / 2 + var(--p, 0) * (100% - var(--thumb)));
  transform: translateX(-50%);
}

.range-labels > .is-start {
  transform: translateX(calc(var(--thumb) / -2));
}

.range-labels > .is-end {
  transform: translateX(calc(-100% + var(--thumb) / 2));
}

/* Segmented tracks — Liquid Glass capsules for every mutually exclusive chooser.
   A frosted, cool-tinted well with a specular top edge; the selection is a glass lens
   that stretches toward its target (leading edge first) and settles with a soft overshoot. */
.scene-selector,
.diagram-steps-nav,
.method-tab-list,
.console-pills-row,
.benchmark-tabs,
.segmented-control,
.budget-pills {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  border-radius: 20px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0) 68%, rgba(255, 255, 255, 0.34)),
    var(--seg-tint);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  backdrop-filter: blur(16px) saturate(1.6);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.9),
    inset 0 -1px 1.5px rgba(0, 0, 0, 0.045),
    inset 0 0 0 0.5px var(--seg-rim);
}

.pill-btn,
.loop-pill,
.method-tab,
.console-pill,
.bench-tab,
.seg-btn,
.b-pill {
  position: relative;
  z-index: 1;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  margin: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 16px;
  border-radius: 17px;
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.005em;
  color: #5b5b60;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 320ms var(--ease), background-color var(--dur-2) var(--ease);
}

.pill-btn:hover,
.loop-pill:hover,
.method-tab:hover,
.console-pill:hover,
.bench-tab:hover,
.seg-btn:hover,
.b-pill:hover {
  color: var(--ink);
}

/* Glass lens (also the no-JS fallback look of the active item) */
.seg-thumb,
.pill-btn.active,
.loop-pill.active,
.method-tab.active,
.console-pill.active,
.bench-tab.active,
.seg-btn.active,
.b-pill.active {
  background: linear-gradient(160deg, #ffffff 0%, rgba(255, 255, 255, 0.86) 52%, rgba(255, 255, 255, 0.95) 100%);
  box-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 -1px 1px rgba(44, 110, 226, 0.07),
    0 0 0 0.5px rgba(0, 0, 0, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 4px 12px -5px rgba(0, 0, 0, 0.16);
}

.pill-btn.active,
.loop-pill.active,
.method-tab.active,
.console-pill.active,
.bench-tab.active,
.seg-btn.active,
.b-pill.active {
  color: var(--ink);
}

/* Once JS attaches the sliding lens, the lens carries the raised surface */
.has-thumb > .active {
  background: transparent;
  box-shadow: none;
}

.seg-thumb {
  position: absolute;
  z-index: 0;
  left: var(--l, 0px);
  right: var(--r, 100%);
  top: var(--t, 0px);
  height: var(--h, 0px);
  border-radius: 17px;
  -webkit-backdrop-filter: blur(10px) saturate(1.8);
  backdrop-filter: blur(10px) saturate(1.8);
  pointer-events: none;
  opacity: 0;
  transition-property: left, right, top, height, transform, box-shadow, opacity;
  transition-duration: 0.44s, 0.44s, 0.44s, 0.44s, 0.42s, 0.3s, 0.2s;
  transition-timing-function: var(--glide), var(--glide), var(--glide), var(--glide), var(--pop), var(--ease), var(--ease);
}

/* Leading edge leaves first and overshoots a hair, trailing edge follows: the lens
   stretches ~1.2–1.5× mid-flight, then settles (no overshoot at the track's ends) */
.seg-thumb[data-dir="fwd"] {
  transition-duration: 0.5s, 0.46s, 0.44s, 0.44s, 0.42s, 0.3s, 0.2s;
  transition-timing-function: var(--glide-trail), var(--glide-lead), var(--glide), var(--glide), var(--pop), var(--ease), var(--ease);
}

.seg-thumb[data-dir="back"] {
  transition-duration: 0.46s, 0.5s, 0.44s, 0.44s, 0.42s, 0.3s, 0.2s;
  transition-timing-function: var(--glide-lead), var(--glide-trail), var(--glide), var(--glide), var(--pop), var(--ease), var(--ease);
}

.seg-thumb[data-dir="fwd"][data-end] {
  transition-timing-function: var(--glide-trail), var(--glide-lead-end), var(--glide), var(--glide), var(--pop), var(--ease), var(--ease);
}

.seg-thumb[data-dir="back"][data-end] {
  transition-timing-function: var(--glide-lead-end), var(--glide-trail), var(--glide), var(--glide), var(--pop), var(--ease), var(--ease);
}

/* Specular rim: bright where light enters (top-left), a faint cool refraction at the far edge */
.seg-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0) 42%, rgba(255, 255, 255, 0) 62%, rgba(142, 184, 249, 0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* Press: the lens lifts slightly, like glass under a fingertip */
.has-thumb.is-pressing > .seg-thumb {
  transform: scale(1.035);
  box-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 -1px 1px rgba(44, 110, 226, 0.08),
    0 0 0 0.5px rgba(0, 0, 0, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.06),
    0 10px 22px -8px rgba(0, 0, 0, 0.22);
}

.seg-thumb.no-anim {
  transition: none;
}

.small-seg .seg-btn {
  height: 28px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 14px;
}

.small-seg {
  border-radius: 17px;
}

.small-seg .seg-thumb {
  border-radius: 14px;
}

.step-num,
.tab-num {
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* α presets: two-line labels under their on-track stops */
.alpha-presets {
  height: 30px;
}

.mini-chip {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  font-family: var(--font-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: var(--ink-4);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur-2) var(--ease);
}

.mini-chip.is-start {
  align-items: flex-start;
  padding-left: 0;
}

.mini-chip.is-end {
  align-items: flex-end;
  padding-right: 0;
}

.mini-chip b {
  font-size: 12px;
  font-weight: 600;
  color: inherit;
}

.mini-chip span {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-4);
  transition: color var(--dur-2) var(--ease);
}

.mini-chip:hover {
  color: var(--ink-2);
}

.mini-chip.active {
  color: var(--blue-deep);
}

.mini-chip.active span {
  color: var(--blue);
}

/* ==========================================================================
   Navbar — editorial masthead that folds into a floating liquid-glass island
   ========================================================================== */
.site-bar {
  --fold: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: 24px;
  pointer-events: none;
}

.bar-inner {
  --span: min(var(--max-w), calc(100vw - 48px));
  --travel: clamp(0px, calc(var(--span) - 650px), 420px);
  width: calc(var(--span) - var(--travel) * var(--fold));
  height: calc(56px - 8px * var(--fold));
  padding-inline: calc(16px * var(--fold));
  transform: translateY(calc(11px * var(--fold)));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: relative;
  isolation: isolate;
  pointer-events: auto;
  will-change: width, transform;
}

.bar-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 999px;
  background:
    linear-gradient(150deg, var(--glass-edge), rgba(255, 255, 255, 0) 34%, rgba(255, 255, 255, 0) 74%, rgba(255, 255, 255, 0.4)),
    var(--glass-tint);
  -webkit-backdrop-filter: blur(20px) saturate(1.7);
  backdrop-filter: blur(20px) saturate(1.7);
  border: 1px solid var(--glass-rim);
  box-shadow:
    inset 0 1px 1px var(--glass-edge),
    inset 0 -1px 1px rgba(0, 0, 0, 0.035),
    0 10px 30px -12px rgba(0, 0, 0, 0.2);
  opacity: min(1, calc(var(--fold) * 2.4));
  pointer-events: none;
}

.site-bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line);
  opacity: max(0, calc(1 - var(--fold) * 2.8));
  pointer-events: none;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.nav-brand .ocula-mark {
  transition: transform var(--dur-3) var(--ease-spring);
}

.nav-brand:hover .ocula-mark {
  transform: scale(1.08);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  position: relative;
  isolation: isolate;
}

.nav-links[data-marker]::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset-block: 4px;
  left: var(--mark-left, 0%);
  right: var(--mark-right, 100%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow:
    inset 0 1px var(--glass-edge),
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.09),
    0 1px 3px rgba(0, 0, 0, 0.07);
  pointer-events: none;
  transition: left 0.34s cubic-bezier(0.22, 0.75, 0.22, 1), right 0.3s cubic-bezier(0.22, 0.75, 0.22, 1);
}

.nav-links[data-direction="back"]::before {
  transition-duration: 0.3s, 0.34s;
}

.nav-links[data-direction="align"]::before {
  transition: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: color var(--dur-1) var(--ease);
}

.nav-link:hover,
.nav-link[aria-current] {
  color: var(--ink);
}

/* Phone section menu: a capsule naming the current section, opening a glass sheet */
.nav-menu-btn {
  display: none;
  align-items: center;
  gap: 6px;
  height: 34px;
  max-width: 58%;
  padding: 0 12px 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.045);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.008em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-spring);
}

.nav-menu-btn:active {
  transform: scale(0.96);
}

.nav-menu-btn[aria-expanded="true"] {
  background: rgba(0, 0, 0, 0.08);
}

.nav-menu-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-menu-chev {
  flex-shrink: 0;
  color: var(--ink-3);
  transition: transform var(--dur-3) var(--ease-spring);
}

.nav-menu-btn[aria-expanded="true"] .nav-menu-chev {
  transform: rotate(180deg);
}

.nav-sheet {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 2;
  display: grid;
  min-width: 212px;
  padding: 6px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(20px) saturate(1.7);
  backdrop-filter: blur(20px) saturate(1.7);
  border: 1px solid var(--glass-rim);
  box-shadow: inset 0 1px 1px var(--glass-edge), 0 22px 48px -18px rgba(0, 0, 0, 0.28);
  transform-origin: 85% 0;
  animation: sheetIn 0.32s var(--ease-spring);
}

.nav-sheet-link {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 11px 14px;
  border-radius: 14px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  -webkit-tap-highlight-color: transparent;
}

.nav-sheet-link .kicker-num {
  width: 26px;
  flex-shrink: 0;
  font-size: 13px;
}

.nav-sheet-link:active,
.nav-sheet-link[aria-current] {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.045);
}

@keyframes sheetIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
  }
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section {
  position: relative;
  padding: 0 0 128px;
  background: transparent;
  scroll-margin-top: 72px;
}

.section-tinted {
  background: transparent;
}

.section:not(.hero-section) > .container::before {
  content: "";
  display: block;
  height: 1px;
  margin-bottom: 32px;
  background: var(--rule);
}

.section-header {
  max-width: 760px;
  margin-bottom: 52px;
}

.section-kicker {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.kicker-num {
  font-family: var(--font-text);
  font-size: inherit;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}

.section-title {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.6vw, 3rem);
  font-weight: 600;
  line-height: 1.083;
  letter-spacing: -0.003em;
  color: var(--ink);
  text-wrap: balance;
}

.title-muted {
  color: var(--ink-4);
}

.section-lead {
  margin: 0;
  max-width: 700px;
  font-size: 1.0625rem;
  line-height: 1.53;
  color: var(--ink-3);
  text-wrap: pretty;
  letter-spacing: -0.022em;
}

.section-lead em {
  color: var(--ink);
}

.section-lead strong {
  color: var(--ink);
  font-weight: 600;
}

/* ==========================================================================
   Hero — masthead
   ========================================================================== */
.hero-section {
  padding: 52px 0 128px;
  background: transparent;
}

.hero-container {
  text-align: center;
}

.hero-title {
  margin: 0 auto 26px;
  max-width: 1080px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.005em;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-title-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.24em;
}

.hero-title-brand {
  font-weight: 600;
  color: var(--ink-3);
}

.hero-title-focus {
  display: inline-block;
  font-weight: 600;
  letter-spacing: -0.008em;
  color: var(--ink);
  text-wrap: balance;
}

/* balance: phones get "Makes Better / Visual Encoders", not a lone last word */
.hero-title-accent {
  display: block;
  text-wrap: balance;
  margin-top: 0.1em;
  font-size: 0.86em;
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.003em;
  color: var(--ink-4);
}

.hero-eye-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.24em;
  height: 0.78em;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 999px;
  outline: none;
  filter: drop-shadow(0 2px 6px rgba(35, 87, 184, 0.14));
  transition: transform var(--dur-3) var(--ease-spring), filter var(--dur-2) var(--ease);
}

.hero-eye-badge:hover {
  transform: scale(1.07);
  filter: drop-shadow(0 6px 14px rgba(44, 110, 226, 0.26));
}

.hero-eye-badge:active {
  transform: scale(0.96);
}

.hero-eye-badge:focus-visible {
  box-shadow: 0 0 0 3px rgba(44, 110, 226, 0.26);
}

.hero-eye-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Authors */
.hero-authors {
  margin: 0 auto 26px;
  max-width: 980px;
}

.author-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 6px 22px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.author-name {
  white-space: nowrap;
}

.author-name sup,
.affiliation-list sup,
.author-notes sup {
  font-family: var(--font-text);
  font-weight: 600;
  line-height: 0;
  vertical-align: super;
  font-variant-numeric: tabular-nums;
}

.author-name sup {
  margin-left: 1.5px;
  font-size: 0.64em;
  letter-spacing: 0.03em;
  color: var(--blue-deep);
}

.affiliation-list {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 4px 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-3);
}

.affiliation-list sup {
  margin-right: 2px;
  font-size: 0.74em;
  color: var(--ink-2);
}

.author-notes {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 4px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-4);
}

.author-notes sup {
  margin-right: 2px;
  font-size: 0.82em;
  color: var(--blue-deep);
}

.aff-sep {
  opacity: 0.45;
}

.corresp-icon {
  display: inline-block;
  width: 1.05em;
  height: 0.85em;
  vertical-align: -0.06em;
  margin-left: 1px;
}

/* Resource links */
.hero-resource-links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 34px;
  margin: 0 auto 40px;
}

.res-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-decoration: none;
  transition: color var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-spring);
  position: relative;
  isolation: isolate;
}

.res-link svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--ink-3);
  transition: color var(--dur-2) var(--ease);
}

.res-link:hover {
  color: var(--blue);
}

.res-link:hover svg {
  color: var(--blue);
}

.res-link:active {
  transform: scale(0.97);
}

/* Not released yet: readable, but clearly not a link */
.res-link.is-soon {
  color: var(--ink-3);
  cursor: default;
}

.res-link.is-soon:hover,
.res-link.is-soon:hover svg {
  color: var(--ink-3);
}

.res-link.is-soon:active {
  transform: none;
}

.soon-tag {
  margin-left: -1px;
  padding: 2px 7px 2px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.res-sep {
  width: 1px;
  height: 16px;
  border-radius: 1px;
  background: rgba(0, 0, 0, 0.09);
  flex-shrink: 0;
  display: none;
}

/* ==========================================================================
   Living Figure 1 — Human Eyes vs. Ocula
   ========================================================================== */
.teaser-duo {
  display: grid;
  grid-template-columns: 31% 1fr;
  gap: 16px;
  text-align: left;
  align-items: stretch;
}

.teaser-card {
  display: flex;
  flex-direction: column;
  padding: 14px 14px 16px;
  border-radius: var(--r-2xl);
  background: var(--tile);
}

.teaser-card-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 4px 11px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.teaser-head-icon {
  flex-shrink: 0;
}

.teaser-human-frame,
.teaser-pano-frame {
  position: relative;
  border-radius: 13px;
  overflow: hidden;
  background: var(--surface-3);
  line-height: 0;
}

.teaser-human-frame::after,
.teaser-pano-frame::after,
.pg-canvas-wrap::after,
.console-canvas-box::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  pointer-events: none;
}

.teaser-human-frame {
  flex: 1;
}

/* Teaser canvases fade in once their imagery has decoded (no grey flash) */
.teaser-duo canvas {
  opacity: 0;
  transition: opacity 700ms var(--ease);
}

.teaser-duo.is-ready canvas {
  opacity: 1;
}

.teaser-human-frame canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.teaser-pano-frame canvas {
  width: 100%;
  height: auto;
}

.teaser-timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px 0 8px;
  align-items: end;
}

.teaser-track-solid {
  position: absolute;
  left: 12.5%;
  width: 50%;
  bottom: 13px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #adcaf9 0%, var(--blue) 100%);
  pointer-events: none;
}

.teaser-track-dashed {
  position: absolute;
  left: 62.5%;
  width: 34.6%;
  bottom: 13px;
  height: 0;
  border-top: 2px dashed rgba(44, 110, 226, 0.6);
  pointer-events: none;
}

.teaser-track-arrow {
  position: absolute;
  right: 2.6%;
  bottom: 10px;
  width: 7px;
  height: 7px;
  border-top: 2px solid rgba(44, 110, 226, 0.7);
  border-right: 2px solid rgba(44, 110, 226, 0.7);
  border-radius: 1px;
  transform: rotate(45deg);
  pointer-events: none;
}

.teaser-node {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.teaser-node-label {
  font-family: var(--font-text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink-3);
  white-space: nowrap;
  transition: color var(--dur-2) var(--ease);
}

.teaser-node-label i {
  font-family: var(--font-math);
  font-size: 1.12em;
  font-weight: 500;
  font-style: italic;
}

.teaser-node-label small {
  margin-left: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-4);
}

.teaser-node:hover .teaser-node-label,
.teaser-node.active .teaser-node-label {
  color: var(--blue-deep);
}

.teaser-node-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #adcaf9;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 0 rgba(44, 110, 226, 0);
  transition: transform var(--dur-3) var(--ease-spring), background-color var(--dur-2) var(--ease), box-shadow var(--dur-3) var(--ease);
}

.teaser-node.active .teaser-node-dot {
  background: var(--blue);
  transform: scale(1.25);
  box-shadow: 0 0 0 4px rgba(44, 110, 226, 0.15);
}

.teaser-node.is-future .teaser-node-dot {
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: inset 0 0 0 2px rgba(44, 110, 226, 0.6);
}

.teaser-node.is-future.active .teaser-node-dot {
  background: #ffffff;
  box-shadow: inset 0 0 0 2.5px var(--blue), 0 0 0 4px rgba(44, 110, 226, 0.15);
}

.teaser-thumbs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 2px;
}

.teaser-thumb {
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid rgba(0, 0, 0, 0.07);
  background: var(--surface-3);
  cursor: pointer;
  line-height: 0;
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-3) var(--ease), transform var(--dur-3) var(--ease-spring);
}

.teaser-thumb canvas {
  width: 100%;
  height: auto;
}

.teaser-thumb:hover {
  border-color: rgba(44, 110, 226, 0.4);
  transform: translateY(-1px);
}

.teaser-thumb.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(44, 110, 226, 0.14), 0 8px 18px -10px rgba(35, 87, 184, 0.45);
  transform: translateY(-2px);
}

.teaser-thumb.is-future {
  border-style: dashed;
  border-color: rgba(44, 110, 226, 0.5);
}

.teaser-thumb.is-future.active {
  border-color: var(--blue);
}

/* ==========================================================================
   Shared card shells
   ========================================================================== */
/* Apple-style flat tiles: fill contrast only (white on the grey bands, soft grey on the white bands) */
.playground-shell,
.method-diagram-card,
.method-tabs-card,
.console-shell,
.chart-card {
  background: var(--tile);
  border-radius: var(--r-2xl);
}

/* Card grammar shared by sections 02–05: a left-aligned switcher on top, content,
   then one muted caption with a bold lead-in. Same sizes and gaps in every card. */
.pg-caption,
.diagram-caption-bar p,
.console-caption-box p,
.budget-takeaway {
  max-width: 880px;
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.47;
  color: var(--ink-3);
  text-wrap: pretty;
  letter-spacing: -0.022em;
}

.diagram-caption-bar p,
.console-caption-box p {
  margin: 0;
}

.pg-caption strong,
.diagram-caption-bar strong,
.console-caption-box strong,
.budget-takeaway strong {
  font-weight: 600;
  color: var(--ink);
}

/* ==========================================================================
   01 · Overview — key numbers
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  padding: 2px 28px;
  border-radius: 0;
  background: none;
  border-left: 1px solid var(--line-2);
}

/* Reveal uses `transform` (staggered); hover lift uses the independent `translate` */
.kpi-grid .kpi-card.rv.in {
  transition:
    opacity 0.9s var(--ease-out) calc(var(--stagger, 0) * 70ms),
    transform 1s var(--ease-out) calc(var(--stagger, 0) * 70ms),
    translate var(--dur-3) var(--ease-spring),
    box-shadow var(--dur-3) var(--ease);
}

.kpi-grid .kpi-card:first-child {
  border-left: 0;
  padding-left: 0;
}

.kpi-label {
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.003em;
  color: var(--ink-3);
}

.kpi-value {
  margin-bottom: 12px;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 3.3vw, 3rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.012em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.kpi-unit {
  margin-left: 0.04em;
  font-size: 0.52em;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink-4);
}

.accent-blue {
  color: var(--blue-deep);
}

.accent-blue .kpi-unit {
  color: rgba(35, 87, 184, 0.55);
}

.accent-mint {
  color: var(--ink);
}

.kpi-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-3);
  text-wrap: pretty;
  letter-spacing: -0.005em;
}

/* ==========================================================================
   02 · Gaze lens — interactive resampling
   ========================================================================== */
.playground-shell {
  padding: var(--card-pad);
}

.playground-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px 28px;
  flex-wrap: wrap;
  margin-bottom: var(--card-gap);
}

.playground-sliders {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.slider-group {
  width: 300px;
  max-width: 100%;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

.slider-label-row .mono-badge {
  font-family: var(--font-text);
  font-size: 15px;
  color: var(--ink);
}

.slider-label-row .math-var {
  margin-left: 2px;
  font-size: 1.15em;
  font-weight: 500;
}



.playground-stage {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
}

.pg-source-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pg-encoder-stack {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.pg-subcard {
  min-width: 0;
}

.pg-panel-header,
.console-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 26px;
  margin-bottom: 10px;
  padding-inline: 2px;
  flex-wrap: wrap;
}

.pg-panel-title,
.pane-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.008em;
  color: var(--ink);
}

.pg-telemetry-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pg-tele-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.pg-tele-chip.is-accent {
  background: var(--blue-soft);
  border-color: transparent;
  color: var(--blue-deep);
  font-weight: 600;
}

.dot-blue,
.dot-gray {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-blue {
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(44, 110, 226, 0.14);
}

.dot-gray {
  background: #aeaeb2;
  box-shadow: 0 0 0 3px rgba(118, 118, 128, 0.12);
}

.pg-canvas-wrap {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface-3);
  line-height: 0;
}

.pg-small-wrap {
  border-radius: var(--r-md);
}

/* Ocula's crop wears the accent rim in both comparisons (Gaze Lens and Demos) */
.pg-small-wrap.is-ocula::after {
  box-shadow: inset 0 0 0 2px rgba(44, 110, 226, 0.92);
}

.pg-canvas-wrap canvas {
  width: 100%;
  height: auto;
}

.pg-small-wrap canvas {
  image-rendering: pixelated;
}

#pg-source-canvas {
  cursor: crosshair;
  touch-action: none;
}

.pg-caption {
  margin-top: auto;
  padding-top: 18px;
}

.roi-overlay-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  gap: 6px;
  pointer-events: none;
}

.roi-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
  background: rgba(0, 0, 0, 0.48);
  color: #ffffff;
  letter-spacing: -0.003em;
}

.roi-chip-ocula,
.roi-chip-uniform {
  background: rgba(0, 0, 0, 0.56);
  color: #ffffff;
}

.roi-chip-density {
  background: rgba(44, 110, 226, 0.92);
  color: #ffffff;
}

.roi-chip-base {
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

/* ==========================================================================
   03 · Method — closed loop diagram + technical tabs
   ========================================================================== */
.method-diagram-card {
  overflow: hidden;
  margin-bottom: 20px;
  padding: var(--card-pad);
}

.diagram-toolbar {
  display: flex;
  margin-bottom: var(--card-gap);
}

.svg-diagram-stage {
  padding: 4px 0 0;
}

#pipeline-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.svg-math {
  font-family: "STIX Two Math", "Cambria Math", "Noto Sans Math", "STIX Two Text", serif;
  font-size: 23px;
}

.svg-script {
  font-family: "STIX Two Math", "Cambria Math", "Noto Sans Math", serif;
  font-size: 1.12em;
  font-weight: 400;
}

.svg-mono-xs {
  font-family: var(--font-text);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.svg-block-lbl {
  font-family: var(--font-text);
  font-size: 10.5px;
  font-weight: 500;
  fill: rgba(255, 255, 255, 0.82);
}

.svg-block-num {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
  fill: #ffffff;
}

.pipe-edge {
  fill: none;
  stroke: #d2d2d7;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 420ms var(--ease), stroke-width 420ms var(--ease);
}

.pipe-edge.active-blue {
  stroke: var(--blue);
  stroke-width: 2;
}

.pipe-edge.active-mint {
  stroke: var(--pos);
  stroke-width: 2;
}

.pipe-node {
  cursor: pointer;
  transition: opacity 560ms var(--ease);
}

.pipe-node.dimmed {
  opacity: 0.62;
}

.pipe-node.focused {
  opacity: 1;
}

/* Spotlight: a soft blue halo ring around the act's active nodes */
.pipe-ring {
  fill: rgba(44, 110, 226, 0.045);
  stroke: rgba(44, 110, 226, 0.5);
  stroke-width: 1.3;
  opacity: 0;
  transition: opacity 560ms var(--ease);
}

.pipe-ring.soft {
  stroke: none;
  fill: rgba(44, 110, 226, 0.07);
}

.pipe-ring.mint {
  fill: rgba(45, 118, 94, 0.05);
  stroke: rgba(45, 118, 94, 0.5);
}

.pipe-node.focused .pipe-ring {
  opacity: 1;
}

.pipe-w-ring {
  transform-origin: 229px 140px;
  opacity: 0.3;
  animation: pipeSpin 16s linear infinite;
  transition: opacity 560ms var(--ease);
}

.pipe-node.focused .pipe-w-ring {
  opacity: 0.85;
}

@keyframes pipeSpin {
  to {
    transform: rotate(360deg);
  }
}

.pipe-cap {
  font-family: var(--font-text);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.006em;
  fill: var(--ink);
  text-anchor: middle;
}

.pipe-sub {
  font-family: var(--font-text);
  font-size: 11px;
  font-weight: 500;
  fill: var(--ink-3);
  text-anchor: middle;
}

.pipe-math {
  font-family: var(--font-math);
  font-size: 14px;
  font-style: italic;
  font-weight: 500;
  fill: var(--ink-2);
  text-anchor: middle;
}

.pipe-math-l {
  font-family: var(--font-math);
  font-size: 15px;
  font-style: italic;
  font-weight: 500;
  fill: var(--ink-2);
}

.pipe-sub-i {
  font-size: 0.74em;
}

.pipe-ell {
  font-family: var(--font-text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  fill: #b7cdf0;
}

.pipe-in {
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 600;
  fill: var(--ink-2);
}

.pipe-llm {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.012em;
  fill: var(--ink);
}

.pipe-pred-title {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.006em;
  fill: #1f4d3f;
}

.pipe-pred-sub {
  font-family: var(--font-text);
  font-size: 10.8px;
  font-weight: 500;
  fill: #3d7f69;
}

.pipe-block-ring {
  fill: none;
  stroke: rgba(44, 110, 226, 0.55);
  stroke-width: 1.4;
  opacity: 0;
  transition: opacity 360ms var(--ease);
}

.pipe-block.lit .pipe-block-ring {
  opacity: 1;
}

.pipe-block > rect:nth-child(2) {
  transition: opacity 360ms var(--ease);
}

.pipe-block.lit > rect:nth-child(2) {
  opacity: 0.84;
}

.pipe-q rect {
  fill: #f5f5f7;
  stroke: #e3e3e8;
  transition: fill 420ms var(--ease), stroke 420ms var(--ease);
}

.svg-q {
  font-family: var(--font-math);
  font-size: 12.5px;
  font-style: italic;
  fill: var(--ink-4);
  transition: fill 420ms var(--ease);
}

.pipe-q.on rect {
  fill: rgba(44, 110, 226, 0.1);
  stroke: rgba(44, 110, 226, 0.45);
}

.pipe-q.on .svg-q {
  fill: var(--blue-deep);
}

/* Streaming loop: frame-pair deck, progress, 𝒱_T rows, predictor memory */
.deck-veil {
  fill: rgba(243, 247, 254, 0.42);
}

.deck-rim {
  fill: none;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

/* pairs not yet observed are dashed, as in the paper figure */
.deck-rim.is-unseen {
  stroke: #81aaf2;
  stroke-width: 1.2;
  stroke-dasharray: 4 3;
}

.pipe-dot {
  fill: #d2d2d7;
  transform-box: fill-box;
  transform-origin: center;
  transition: fill 360ms var(--ease), transform 360ms var(--ease);
}

.pipe-dot.is-done {
  fill: rgba(44, 110, 226, 0.38);
}

.pipe-dot.is-current {
  fill: var(--blue);
  transform: scale(1.3);
}

.pipe-vt-slot {
  fill: #f2f3f6;
}

.pipe-mem-well {
  fill: #ffffff;
  stroke: #a9d2c3;
  stroke-width: 1;
}

.pipe-gaze-pulse,
.pipe-ripple {
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.4;
  opacity: 0;
  pointer-events: none;
}

#pipe-w .pipe-w-core,
#pipe-merger {
  transition: fill 300ms var(--ease), stroke 300ms var(--ease);
}

#pipe-w.lit .pipe-w-core,
#pipe-merger.lit {
  fill: #eef4fe;
}

#pipe-merger.lit {
  stroke: rgba(44, 110, 226, 0.55);
}

/* 𝒲 holds the predicted gaze until the next pair passes through it */
#pipe-w.armed .pipe-w-ring {
  opacity: 1;
  stroke-width: 1.6;
}

#pipe-gnext .pipe-math-l {
  transition: fill 360ms var(--ease);
}

#pipe-gnext.on .pipe-math-l {
  fill: var(--blue-deep);
}

#pipeline-svg.is-seeking {
  animation: pipeSeek 420ms var(--ease-out);
}

@keyframes pipeSeek {
  from {
    opacity: 0.35;
  }
}

/* Light pulses travelling along active wires */
.pipe-comet,
.pipe-comet-glow {
  fill: none;
  stroke-linecap: round;
  pointer-events: none;
  opacity: 0;
}

.pipe-comet {
  stroke-width: 2.6;
}

.pipe-comet-glow {
  stroke-width: 7;
  filter: url(#pipe-blur);
}

.diagram-caption-bar {
  margin-top: var(--card-gap);
}

.diagram-caption-bar p {
  min-height: 2.94em;
}

.diagram-caption-bar.swap p {
  animation: softSwap 520ms var(--ease-out) both;
}

.method-tabs-card {
  padding: var(--card-pad);
}

.method-tab-list {
  display: flex;
  width: fit-content;
  margin: 0 0 var(--card-gap);
}

.method-panel {
  display: none;
}

.method-panel.active {
  display: block;
  animation: softSwap 560ms var(--ease-out) both;
}

.method-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.method-panel h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.004em;
  color: var(--ink);
  text-wrap: balance;
}

.method-panel p {
  margin: 0;
  font-size: 17px;
  line-height: 1.53;
  color: var(--ink-2);
  text-wrap: pretty;
  letter-spacing: -0.022em;
}

.method-panel p strong {
  color: var(--ink);
  font-weight: 600;
}

.method-spec-list {
  padding: 4px 18px;
  border-radius: var(--r-lg);
  background: var(--surface);
}

.spec-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-3);
}

.spec-row:last-child {
  border-bottom: 0;
}

.mono-val {
  font-weight: 500;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   04 · Autonomous gaze demos
   ========================================================================== */
.console-shell {
  padding: var(--card-pad);
}

.console-pills-row {
  margin-bottom: var(--card-gap);
}

.pill-bench {
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-4);
  transition: color var(--dur-2) var(--ease);
}

.console-pill.active .pill-bench {
  color: var(--blue);
}

.console-dual-stage {
  display: grid;
  /* widths chosen so two stacked square crops exactly match the 4:3 frame's height */
  grid-template-columns: minmax(0, 2.72fr) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
}

.console-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.console-canvas-box {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface-3);
  line-height: 0;
}

.console-canvas-box canvas {
  width: 100%;
  height: auto;
}

.console-canvas-box.zoom-box {
  flex: 1 1 auto;
  min-height: 180px;
  border-radius: 0;
  overflow: visible;
  background: transparent;
}

/* the crops draw their own rims; no frame hairline around the column */
.console-canvas-box.zoom-box::after {
  content: none;
}

.zoom-box #traj-encoder-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.console-controls-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 36px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding: 0 2px;
}

.console-scrubber {
  flex: 1 1 420px;
  min-width: 0;
}

.scrubber-ticks {
  height: 18px;
}

.tick-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  padding: 0 2px;
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  color: var(--ink-4);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur-2) var(--ease);
}

.tick-btn i {
  font-family: var(--font-math);
  font-size: 1.14em;
  font-style: italic;
  font-weight: 500;
}

.tick-btn:hover {
  color: var(--ink-2);
}

.tick-btn.active {
  color: var(--blue-deep);
  font-weight: 600;
}

.tick-btn .tk-sp {
  white-space: pre;
}

.console-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  min-height: 22px;
  font-size: 13px;
  color: var(--ink-2);
}

.leg-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.leg-ocula {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--blue) 0 2.2px, #ffffff 2.8px);
  border: 2.4px solid var(--blue);
  box-shadow: 0 0 0 1.5px #ffffff, 0 1px 3px rgba(0, 0, 0, 0.2);
}

.leg-arc {
  width: 18px;
  height: 3px;
  border-radius: 3px;
  background: #4180e7;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9);
}

.leg-teacher {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teacher);
  box-shadow: 0 0 0 2px #ffffff, 0 1px 3px rgba(224, 82, 140, 0.4);
}

.console-caption-box {
  display: block;
  margin-top: var(--card-gap);
}

.console-caption-box.swap > * {
  animation: softSwap 480ms var(--ease-out) both;
}

.behavior-tag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.003em;
  white-space: nowrap;
}

.demo-video-stage {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #000000;
  line-height: 0;
}

.demo-video-stage video {
  width: 100%;
  height: auto;
}

/* ==========================================================================
   05 · Results — charts
   ========================================================================== */
.chart-card {
  padding: var(--card-pad);
  margin-bottom: 20px;
}

.compact-card {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

/* The compute chart sits centred in whatever height the paired card gives it */
#efficiency-chart-card .svg-chart-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 8px 0 18px;
}

.chart-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 18px;
  flex-wrap: wrap;
  margin-bottom: var(--card-gap);
}

.chart-title {
  margin: 0 0 5px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.004em;
  color: var(--ink);
}

.chart-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--ink-3);
}

.chart-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.benchmark-tabs {
  margin-bottom: var(--card-gap);
}

.svg-chart-wrap {
  width: 100%;
  overflow-x: auto;
}

.svg-chart-wrap svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* Chart typography — inherits the page's SF stack instead of hardcoded fonts */
.ch-t {
  font-family: var(--font-text);
  letter-spacing: -0.005em;
}

.ch-n {
  font-family: var(--font-text);
  font-variant-numeric: tabular-nums;
}

/* label masks take the tile colour so the reference line breaks cleanly behind values */
.ch-mask {
  fill: var(--tile);
}

.ch-mask-ours {
  fill: #e9edf5;
}

.ch-m {
  font-family: var(--font-text);
  font-variant-numeric: tabular-nums;
}

.chart-footnote {
  margin: 18px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-4);
  text-wrap: pretty;
}

.frontier-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 20px;
}

.efficiency-mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: auto;
  padding-top: var(--card-gap);
}

.ems-box {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
}

.ems-k {
  min-width: 0;
  font-size: 12px;
  line-height: 1.3;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ems-v {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}

.ems-v.muted {
  color: var(--ink-4);
}

.budget-slider-controls {
  margin-bottom: var(--card-gap);
}

.budget-pills {
  display: flex;
  flex-wrap: nowrap;
  border-radius: 14px;
}

.b-pill {
  flex: 1 1 0;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  height: 46px;
  padding: 0 6px;
  border-radius: 11px;
  font-family: var(--font-text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.003em;
}

.budget-pills .seg-thumb {
  border-radius: 11px;
}

.b-tok {
  font-size: 11px;
  color: var(--ink-4);
  transition: color var(--dur-2) var(--ease);
}

.b-pill.active .b-tok {
  color: var(--blue);
}

.budget-takeaway {
  margin-top: var(--card-gap);
}

/* ==========================================================================
   Citation
   ========================================================================== */
.cite-section {
  padding: 0 0 112px;
}

.cite-card {
  max-width: none;
  margin: 0 auto;
  padding: var(--card-pad);
  border-radius: var(--r-2xl);
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.6fr);
  gap: 32px;
  align-items: center;
}

.cite-block {
  max-width: var(--max-w);
}

.cite-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.cite-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: 0.007em;
  color: var(--ink);
}

.cite-intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-left: 4px;
}

.cite-note {
  margin: 10px 0 20px;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--ink-3);
  text-wrap: pretty;
}

.cite-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.cite-kicker {
  margin-bottom: 8px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--blue);
}

.cite-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-wrap: balance;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: auto;
  padding: 4px 2px;
  border-radius: 999px;
  background: none;
  color: var(--blue);
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
  border: 0;
  appearance: none;
  -webkit-appearance: none;
}

.copy-btn:hover {
  color: var(--blue-deep);
}

.copy-btn:active {
  transform: scale(0.97);
}

.copy-btn.is-copied {
  color: var(--pos);
}

.bibtex-code {
  margin: 0;
  padding: 24px 28px;
  border-radius: var(--r-lg);
  background: var(--tile);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
  white-space: pre;
  overflow-x: auto;
  tab-size: 2;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  padding: 28px 0 34px;
  background: var(--tile);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.footer-tagline {
  margin: 5px 0 0;
  font-size: 13px;
  color: var(--ink-3);
}

.footer-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 24px;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: auto;
  padding: 2px 0;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease);
}

.footer-link svg {
  transition: transform var(--dur-3) var(--ease-spring);
}

.footer-link:hover {
  color: var(--ink);
}

.footer-top:hover svg {
  transform: translateY(-2px);
}

/* ==========================================================================
   Motion — magnetic reveals, stage focus, swaps
   ========================================================================== */
/* Content is only hidden for a reveal when scripts run (`.js` is set in <head>, and
   dropped again if main.js never arrives), so the page always reads without JS. */
.js .rv {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition: none;
}

.js .rv[data-rv-from="top"] {
  transform: translate3d(0, -22px, 0);
}

.js .rv.in {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.8s var(--ease-out),
    transform 0.9s var(--ease-out);
}

/* Headings come into focus: a short blur-in, staggered kicker → title → lead */
.js .section-header .rv {
  filter: blur(8px);
}

.js .section-header .rv.in {
  filter: blur(0);
  transition:
    opacity 0.9s var(--ease-out),
    transform 1s var(--ease-out),
    filter 0.8s var(--ease-out);
  transition-delay: calc(var(--stagger, 0) * 80ms);
}

.js .section-header .rv:nth-child(2).in {
  transition-delay: 70ms;
}

.js .section-header .rv:nth-child(3).in {
  transition-delay: 140ms;
}

.js .rv-stagger.in {
  transition-delay: calc(var(--stagger, 0) * 70ms);
}

/* The masthead animates in from CSS on first paint instead of waiting for main.js
   (and the teaser images it preloads), so the title is never held back by the network. */
.js .rv-hero {
  animation: heroIn 0.9s var(--ease-out) both;
  animation-delay: calc(60ms + var(--stagger, 0) * 80ms);
}

.js .hero-title.rv-hero,
.js .hero-authors.rv-hero {
  animation-name: heroInFocus;
  animation-duration: 1s;
}

@keyframes heroIn {
  from {
    opacity: 0;
    transform: translate3d(0, 22px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes heroInFocus {
  from {
    opacity: 0;
    transform: translate3d(0, 22px, 0);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

.scroll-scale {
  transform-origin: 50% 40%;
}

.js .scroll-scale {
  transform: scale(0.955) translateY(22px);
  opacity: 0.72;
}

/* ==========================================================================
   Film — plays muted as it scrolls in and grows toward the viewport.
   JS drives --film-s (scale) from scroll; the radius and the control
   cluster are counter-scaled so they keep their true size.
   ========================================================================== */
.film-section {
  position: relative;
  padding: 0 0 128px;
  scroll-margin-top: var(--bar-h);
}

.film-stage {
  /* at rest: as wide as the page grid; fully grown: as wide as fits the viewport */
  --film-w: max(
    min(var(--max-w), calc(100% - 48px)),
    min(calc(100% - 48px), 1480px, calc((100vh - var(--bar-h) - 80px) * 16 / 9))
  );
  width: var(--film-w);
  aspect-ratio: 16 / 9;
  margin-inline: auto;
}

@supports (height: 100svh) {
  .film-stage {
    --film-w: max(
      min(var(--max-w), calc(100% - 48px)),
      min(calc(100% - 48px), 1480px, calc((100svh - var(--bar-h) - 80px) * 16 / 9))
    );
  }
}

.film-shell {
  --film-r: var(--r-2xl);
  --film-s: 1;
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--film-r) / var(--film-s));
  overflow: hidden;
  isolation: isolate;
  background: #fdfdfd;
  transform: scale(var(--film-s));
  transform-origin: 50% 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 30px 80px -40px rgba(16, 24, 40, 0.3);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.film-shell.is-scrolling {
  will-change: transform;
}

/* hairline that keeps the frame legible when the film itself is white */
.film-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07);
  pointer-events: none;
}

.film-video,
.film-poster {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.film-video {
  background: #fdfdfd;
}

/* the poster is the exact frame autoplay starts on, so the hand-off is invisible */
.film-poster {
  z-index: 1;
  transition: opacity 0.4s var(--ease);
}

.film-shell.is-live .film-poster {
  opacity: 0;
}

.film-shell.is-idle {
  cursor: none;
}

/* Controls: Apple-style round glass buttons, progress drawn as a ring */
.film-ctrl {
  position: absolute;
  right: 22px;
  bottom: 22px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  transform-origin: 100% 100%;
  scale: calc(1 / var(--film-s));
  translate: 0 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s var(--ease), translate 0.7s var(--ease-spring);
}

.film-shell.is-live .film-ctrl,
.film-shell[data-state="paused"] .film-ctrl,
.film-shell[data-state="ended"] .film-ctrl,
.film-shell:focus-within .film-ctrl {
  opacity: 1;
  translate: 0 0;
  pointer-events: auto;
}

.film-shell.is-live.is-idle:not(:focus-within) .film-ctrl {
  opacity: 0;
  translate: 0 6px;
  pointer-events: none;
  transition-duration: 0.8s, 0.8s;
}

.film-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #1d1d1f;
  background: rgba(232, 232, 237, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease), transform 0.35s var(--ease-spring);
}

.film-btn:hover {
  background: rgba(242, 242, 246, 0.92);
  transform: scale(1.06);
}

.film-btn:active {
  transform: scale(0.94);
}

.film-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.film-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.film-btn svg .w {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.film-toggle {
  width: 48px;
  height: 48px;
}

.film-btn .film-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  transform: rotate(-90deg);
  pointer-events: none;
}

.film-ring-arc {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 141.372;
  stroke-dashoffset: 141.372;
  opacity: 0.9;
}

.film-toggle .i-play,
.film-toggle .i-replay,
.film-btn .i-muted,
.film-shell:not([data-state="playing"]) .film-toggle .i-pause,
.film-shell.is-muted .film-btn .i-sound {
  display: none;
}

.film-shell[data-state="idle"] .film-toggle .i-play,
.film-shell[data-state="paused"] .film-toggle .i-play,
.film-shell[data-state="ended"] .film-toggle .i-replay,
.film-shell.is-muted .film-btn .i-muted {
  display: block;
}

.film-video:fullscreen {
  object-fit: contain;
  background: #fdfdfd;
}

@keyframes softSwap {
  from {
    opacity: 0;
    transform: translate3d(0, 6px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
/* Mid widths: keep the demo picker on one line by dropping the benchmark tags
   (phones scroll the row instead and keep them) */
@media (min-width: 761px) and (max-width: 1180px) {
  .console-pill .pill-bench {
    display: none;
  }
}

/* the phone menu never outlives a rotation to a wider screen */
@media (min-width: 761px) {
  .nav-sheet {
    display: none !important;
  }
}

/* the BibTeX title line needs ~640 px: stack the citation card below desktop width */
@media (max-width: 1180px) {
  .cite-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
}

@media (max-width: 980px) {
  .teaser-duo {
    grid-template-columns: 1fr;
  }

  .teaser-human-frame canvas {
    max-height: 460px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 36px;
  }

  .kpi-grid .kpi-card:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }


  .playground-stage,
  .console-dual-stage,
  .frontier-grid,
  .method-panel-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .pg-encoder-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  /* single column: the two crops sit side by side */
  .console-canvas-box.zoom-box {
    flex: none;
    min-height: 0;
    aspect-ratio: 2 / 1.02;
  }

  .method-panel-grid {
    gap: 24px;
  }
}

@media (max-width: 760px) {
  .film-section {
    padding-bottom: 80px;
  }

  .film-shell {
    --film-r: var(--r-xl);
  }

  .film-ctrl {
    right: 12px;
    bottom: 12px;
    gap: 8px;
  }

  .film-btn {
    width: 34px;
    height: 34px;
  }

  .film-toggle {
    width: 40px;
    height: 40px;
  }

  .film-btn svg {
    width: 17px;
    height: 17px;
  }

  .nav-links {
    display: none;
  }

  .nav-menu-btn {
    display: inline-flex;
  }

  .section {
    padding: 0 0 80px;
  }

  .section:not(.hero-section) > .container::before {
    margin-bottom: 24px;
  }

  .hero-section {
    padding: 36px 0 80px;
  }

  .section-header {
    margin-bottom: 36px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    row-gap: 0;
  }

  .kpi-grid .kpi-card {
    border-left: 0;
    padding: 22px 0;
  }

  .kpi-grid .kpi-card + .kpi-card {
    border-top: 1px solid var(--line);
  }

  :root {
    --card-pad: 18px;
    --card-gap: 18px;
  }

  .playground-shell,
  .console-shell,
  .chart-card,
  .method-diagram-card,
  .method-tabs-card,
  .cite-card {
    padding: 18px 16px 20px;
    border-radius: 22px;
  }

  .pg-caption,
  .diagram-caption-bar p,
  .console-caption-box p,
  .budget-takeaway {
    font-size: 15px;
    letter-spacing: -0.012em;
  }

  .pg-encoder-stack {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Segmented tracks become one swipeable row on phones */
  .scene-selector,
  .diagram-steps-nav,
  .method-tab-list,
  .console-pills-row,
  .benchmark-tabs,
  .segmented-control,
  .budget-pills {
    display: flex;
    flex-wrap: nowrap;
    width: auto;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .scene-selector::-webkit-scrollbar,
  .diagram-steps-nav::-webkit-scrollbar,
  .method-tab-list::-webkit-scrollbar,
  .console-pills-row::-webkit-scrollbar,
  .benchmark-tabs::-webkit-scrollbar,
  .segmented-control::-webkit-scrollbar,
  .budget-pills::-webkit-scrollbar {
    display: none;
  }

  .pill-btn,
  .loop-pill,
  .method-tab,
  .console-pill,
  .bench-tab,
  .seg-btn {
    flex: 0 0 auto;
  }

  .b-pill {
    flex: 0 0 auto;
    padding: 0 12px;
  }

  .chart-card-header > *,
  .chart-controls-right,
  .playground-controls > * {
    min-width: 0;
    max-width: 100%;
  }

  /* Wide figures keep a legible size and scroll sideways */
  .svg-diagram-stage {
    overflow-x: auto;
  }

  #pipeline-svg {
    min-width: 760px;
  }

  /* the accuracy and compute charts redraw at the card's width; the 8-benchmark bars scroll */
  #budget-svg-container svg {
    min-width: 460px;
  }

  .bibtex-code {
    font-size: 11.5px;
  }

  .teaser-node-label small {
    display: none;
  }

  .hero-resource-links {
    gap: 6px 24px;
  }

  /* latency tiles: label above value so "141 ms" never breaks */
  .ems-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .res-sep {
    display: none;
  }

  .res-link {
    font-size: 14px;
  }

  .tick-btn:not(:first-child) .tk-t,
  .tick-btn .tk-sp {
    display: none;
  }

  .console-caption-box {
    flex-direction: column;
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .rv,
  .scroll-scale {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
    animation: none !important;
  }

  .seg-thumb,
  .nav-links[data-marker]::before {
    transition: none !important;
  }

  .nav-sheet,
  .pipe-w-ring,
  #pipeline-svg.is-seeking,
  .pipe-edge.active-blue,
  .pipe-edge.active-mint,
  .method-panel.active,
  .diagram-caption-bar.swap p,
  .console-caption-box.swap > * {
    animation: none !important;
  }
}
