/* ==========================================================================
   StepBridge — project page
   Palette derives from the paper: bridgeblue #285FA6 / bridgewarm #B86B4B
   ========================================================================== */

:root {
  /* ---- scale knob ----------------------------------------------------------
     Everything below is laid out at 1.0 by default. When a large display makes
     the page feel oversized, one value changes it -- either here, or for a
     single visit with ?zoom=0.67 in the URL (see the inline script in
     index.html). Accepts anything from 0.4 to 1.5.

     `zoom` is used rather than `transform: scale()` because zoom scales the
     layout box too: a transform would shrink the picture but leave the scroll
     extent at full size, producing a band of empty space and a wrong scrollbar.
     Two places compensate for a non-1 value:
       · both 3D canvases divide their device-pixel ratio by it, otherwise the
         figures are drawn too small and look soft;
       · the lightbox heights divide their vh by it.                              */
  --ui-zoom: 1;

  --paper: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f4f1eb;
  --ink: #101828;
  --ink-2: #3b4559;
  --muted: #6d7688;
  --line: #e7e2d9;
  --line-strong: #d7d0c3;
  --blue: #285fa6;
  --blue-soft: #e9f0f9;
  --warm: #b86b4b;
  --warm-soft: #f9ede6;
  --violet: #6a63a8;
  --grad: linear-gradient(100deg, #285fa6 0%, #6a63a8 50%, #b86b4b 100%);
  --grad-solid: linear-gradient(100deg, #285fa6 0%, #6a63a8 50%, #b86b4b 100%);
  --grad-soft: linear-gradient(100deg, rgba(40, 95, 166, 0.12), rgba(184, 107, 75, 0.12));
  --glow-blue: rgba(40, 95, 166, 0.16);
  --glow-warm: rgba(184, 107, 75, 0.14);
  --best-bg: #fde8ef;
  --best-fg: #9d174d;
  --second-bg: #e6eefb;
  --second-fg: #1e3a8a;
  --third-bg: #e3f5e6;
  --third-fg: #166534;
  --header-bg: rgba(250, 248, 244, 0.82);
  --radius: 20px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 2px 10px -2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 18px 40px -20px rgba(16, 24, 40, 0.28), 0 2px 8px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 40px 80px -40px rgba(16, 24, 40, 0.4), 0 4px 16px rgba(16, 24, 40, 0.06);
  --maxw: 1180px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Instrument Serif", "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Consolas, monospace;
}

[data-theme="dark"] {
  --paper: #0a0f1c;
  --surface: #111827;
  --surface-2: #0e1524;
  --ink: #edf0f6;
  --ink-2: #c3cbda;
  --muted: #8e99ae;
  --line: #222c40;
  --line-strong: #33415c;
  --blue: #8db8ec;
  --blue-soft: #14243a;
  --warm: #e4a586;
  --warm-soft: #2b1d17;
  --violet: #aea8e6;
  --grad: linear-gradient(100deg, #8db8ec 0%, #aea8e6 50%, #e4a586 100%);
  --grad-solid: linear-gradient(100deg, #285fa6 0%, #6a63a8 50%, #b86b4b 100%);
  --grad-soft: linear-gradient(100deg, rgba(141, 184, 236, 0.14), rgba(228, 165, 134, 0.14));
  --glow-blue: rgba(74, 130, 200, 0.24);
  --glow-warm: rgba(200, 120, 85, 0.18);
  --best-bg: rgba(244, 63, 94, 0.18);
  --best-fg: #fda4b7;
  --second-bg: rgba(96, 165, 250, 0.16);
  --second-fg: #a9c8fb;
  --third-bg: rgba(52, 211, 153, 0.14);
  --third-fg: #9ae6bd;
  --header-bg: rgba(10, 15, 28, 0.78);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 18px 40px -20px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 40px 90px -40px rgba(0, 0, 0, 0.85);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
  -webkit-text-size-adjust: 100%;
  zoom: var(--ui-zoom);
}

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

body.no-scroll {
  overflow: hidden;
}

img,
video {
  display: block;
  max-width: 100%;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.18s ease;
}

a:hover {
  color: var(--warm);
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

::selection {
  background: rgba(184, 107, 75, 0.24);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 16px;
  color: var(--paper);
}

/* ---------- layout helpers ---------- */

.wrap {
  width: min(100% - 48px, var(--maxw));
  margin-inline: auto;
}

.wrap--narrow {
  width: min(100% - 48px, 840px);
  margin-inline: auto;
}

section {
  position: relative;
  padding: clamp(64px, 8vw, 112px) 0;
}

section + section {
  border-top: 1px solid var(--line);
}

.section-head {
  max-width: 780px;
  margin-bottom: clamp(36px, 4vw, 56px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--grad);
}

.eyebrow__num {
  font-variant-numeric: tabular-nums;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.2vw, 3.1rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.08;
}

.section-lede {
  margin-top: 16px;
  color: var(--ink-2);
  font-size: 1.03rem;
  line-height: 1.7;
}

.lede-center {
  text-align: center;
  margin-inline: auto;
}

.lede-center .eyebrow {
  justify-content: center;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.86rem;
}

.mono {
  font-family: var(--font-mono);
}

.arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

a:hover .arrow {
  transform: translateX(3px);
}

/* ---------- header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  background: transparent;
  transition: background 0.25s ease, border-color 0.25s ease, backdrop-filter 0.25s ease;
}

.site-header.is-scrolled {
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: var(--line);
}

/* brand left, section pill dead centre, actions right */
.nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.02rem;
}

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

.brand__mark {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: var(--grad-solid);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px -4px rgba(40, 95, 166, 0.6);
}

.brand__mark svg {
  width: 21px;
  height: 21px;
  display: block;
}

.brand__sub {
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 2px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-self: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.nav__links a {
  position: relative;
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav__links a:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav__links a.is-active {
  background: var(--ink);
  color: var(--paper);
}

.nav__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  justify-self: end;
}

a.icon-btn {
  text-decoration: none;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.icon-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* The GitHub mark is a filled silhouette rather than a 1.8 px stroke, so at the
   same box it reads heavier than the stroked theme icon next to it. A slightly
   smaller box evens out the optical weight. */
.icon-btn .icon-github {
  width: 17px;
  height: 17px;
}

.icon-btn--github:hover {
  color: var(--ink);
}

[data-theme="light"] .icon-sun,
[data-theme="dark"] .icon-moon {
  display: none;
}

.nav__toggle {
  display: none;
}

.nav__drawer {
  display: none;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding-top: 140px;
  contain: layout paint style;
  /* the comparison section below opens with a hairline rule; without this the
     rule lands immediately under the CTA buttons and looks like part of them */
  padding-bottom: clamp(46px, 5.6vw, 78px);
  overflow: hidden;
  border-top: 0;
}

.hero__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 60% at 18% -8%, var(--glow-blue) 0%, transparent 62%),
    radial-gradient(55% 55% at 84% 2%, var(--glow-warm) 0%, transparent 60%),
    radial-gradient(40% 40% at 50% 40%, rgba(106, 99, 168, 0.08) 0%, transparent 70%);
}

.hero__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(72% 62% at 50% 22%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(72% 62% at 50% 22%, #000 0%, transparent 78%);
  opacity: 0.5;
}

.hero__bridge {
  position: absolute;
  left: 50%;
  bottom: 4%;
  width: min(1500px, 130vw);
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0.5;
  color: var(--muted);
  mask-image: linear-gradient(to bottom, #000, transparent 95%);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 95%);
}

.hero__inner {
  position: relative;
  z-index: 2;
  text-align: center;
}

.venue-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  padding: 7px 16px 7px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  box-shadow: var(--shadow-sm);
  font-size: 0.82rem;
  color: var(--ink-2);
}

.venue-pill b {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--grad-solid);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.venue-pill .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--warm);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.3rem, 4.75vw, 4.15rem);
  line-height: 1.04;
  letter-spacing: -0.021em;
  max-width: 1200px;
  margin: 0 auto;
  text-wrap: balance;
}

.hero h1 .accent {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: italic;
}

.hero__sub {
  max-width: 1040px;
  margin: 26px auto 0;
  color: var(--ink-2);
  font-size: clamp(1rem, 1.32vw, 1.1rem);
  line-height: 1.72;
  text-wrap: pretty;
}

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

/* method names: quiet inline links, underlined just enough to look clickable */
.hero__sub .ms {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--warm) 55%, transparent);
  padding-bottom: 0.5px;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.hero__sub .ms:hover,
.hero__sub .ms:focus-visible {
  color: var(--warm);
  border-bottom-color: var(--warm);
  background: color-mix(in srgb, var(--warm) 10%, transparent);
}

.hero__sub .ms:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--warm) 60%, transparent);
  outline-offset: 2px;
  border-radius: 2px;
}

.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
  margin-top: 30px;
  font-size: 0.98rem;
  color: var(--ink-2);
}

.authors span {
  position: relative;
}

.authors span + span::before {
  content: "";
  position: absolute;
  left: -11px;
  top: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}

.affil {
  margin-top: 10px;
  font-size: 0.79rem;
  line-height: 1.5;
  letter-spacing: 0.005em;
  color: var(--muted);
}

/* one row: affiliations + contribution note, wrapping only when it must */
.affil--single {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0 2px;
  max-width: 1020px;
  margin-inline: auto;
}

.affil--single .affil__item {
  white-space: nowrap;
}

.affil--single .affil__sep {
  margin: 0 10px;
}

.affil__note b {
  margin-right: 2px;
  font-weight: 700;
  color: var(--warm);
}

.affil--single .affil__note {
  color: var(--muted);
}

.affil em {
  font-style: normal;
  color: var(--warm);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: var(--ink);
}

.btn svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.btn--primary {
  background: var(--ink);
  color: var(--paper);
}

.btn--primary:hover {
  color: var(--paper);
}

.btn--grad {
  background: var(--grad-solid);
  color: #fff;
}

.btn--grad:hover {
  color: #fff;
}

.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  box-shadow: none;
}

.btn--ghost:hover {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.btn__soon {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

.stats {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  width: min(100% - 48px, 1180px);
  margin: 44px auto 0;
  padding-bottom: 8px;
}

.stat {
  position: relative;
  padding: 24px 22px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.stat::after {
  content: "";
  position: absolute;
  inset: auto 22px 0;
  height: 2px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}

.stat:hover::after {
  transform: scaleX(1);
}

.stat__num {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.2vw, 2.7rem);
  line-height: 1;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat__num small {
  font-size: 0.48em;
  letter-spacing: 0;
}

.stat__label {
  margin-top: 12px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

.stat__label b {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
}

/* ---------- abstract ---------- */

.abstract-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
}

.abstract-quote {
  position: relative;
  padding: 4px 0 4px 28px;
  border-left: 2px solid;
  border-image: var(--grad) 1;
}

.abstract-text {
  font-size: clamp(1.05rem, 1.4vw, 1.16rem);
  line-height: 1.8;
  color: var(--ink-2);
  text-align: justify;
  text-justify: inter-word;
  -webkit-hyphens: auto;
  hyphens: auto;
  word-spacing: -0.008em;
  hanging-punctuation: first;
}

.abstract-quote {
  max-width: 70ch;
}

.abstract-text strong {
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 -0.45em 0 var(--blue-soft);
}

.tldr {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
  max-width: 70ch;
  margin-top: 34px;
  padding: 22px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.tldr__tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 7px;
  background: var(--warm);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tldr p {
  color: var(--ink-2);
  font-size: 0.98rem;
  line-height: 1.7;
}

/* ---------- contribution cards ---------- */

.contrib-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 54px;
}

.contrib {
  position: relative;
  padding: 28px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.contrib:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.contrib__num {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--warm);
  letter-spacing: 0.02em;
}

.contrib h3 {
  margin-top: 14px;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.contrib p {
  margin-top: 10px;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--muted);
}

/* ---------- figures ---------- */

.figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.figure__media {
  position: relative;
  padding: 18px;
  background: #fff;
  cursor: zoom-in;
}

[data-theme="dark"] .figure__media {
  background: #f7f5f1;
}

.figure__media img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.figure__media--pad0 {
  padding: 0;
}

.figure__media--pad0 img {
  border-radius: 0;
}

.zoom-hint {
  position: absolute;
  right: 26px;
  bottom: 26px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(16, 24, 40, 0.72);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.figure__media:hover .zoom-hint {
  opacity: 1;
  transform: none;
}

.figure figcaption {
  padding: 16px 20px 18px;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--muted);
}

.figure figcaption b {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- method ---------- */

.method-figure {
  margin-bottom: 44px;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 8px;
}

.step-card {
  position: relative;
  padding: 28px 24px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.step-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--grad);
  opacity: 0.85;
}

.step-card__idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.step-card:nth-child(2) .step-card__idx {
  background: var(--warm-soft);
  color: var(--warm);
}

.step-card:nth-child(3) .step-card__idx {
  background: color-mix(in srgb, var(--violet) 14%, transparent);
  color: var(--violet);
}

.step-card h3 {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.step-card p {
  margin-top: 9px;
  font-size: 0.89rem;
  line-height: 1.65;
  color: var(--muted);
}

.step-card__tag {
  display: inline-block;
  margin-top: 16px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.deep-dive {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}

.panel {
  padding: 26px 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel--dark {
  /* Always dark, in both themes: this is the "equations on a blackboard" card. */
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(40, 95, 166, 0.28), transparent 60%),
    linear-gradient(160deg, #101828, #0a0f1c 70%);
  color: #eef2f8;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.6);
}

.panel--dark h3 {
  color: #f2f6fd;
}

.panel h3 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.panel p {
  margin-top: 10px;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--muted);
}

.panel--dark p {
  color: #aab5c9;
}

.equations {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.eq {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-display);
  font-size: 1.02rem;
  color: #f2f5fa;
  overflow-x: auto;
  white-space: nowrap;
}

.panel--dark .eq i {
  font-family: var(--font-mono);
  font-style: italic;
  color: #cdd7ea;
}

.eq__tag {
  margin-left: auto;
  font-family: var(--font-sans);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7f8ca3;
  white-space: nowrap;
}

.panel--dark .eq sup,
.panel--dark .eq sub {
  font-size: 0.68em;
}

.note-strip {
  display: grid;
  gap: 9px;
  margin-top: 24px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.86rem;
  color: var(--ink-2);
}

.note-strip > span {
  display: flex;
  align-items: baseline;
  gap: 9px;
  line-height: 1.45;
}

.note-strip > span::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--grad-solid);
  transform: translateY(-2px);
}

.note-strip b {
  color: var(--ink);
}

.note-strip .sep {
  display: none;
}

/* ---------- results ---------- */

/* five cards: two rows of three, the last two centred */
.delta-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 44px;
}

.delta-grid > .delta {
  grid-column: span 2;
}

/* the trailing pair sits on the second row, centred across the grid */
.delta-grid > .delta:nth-child(4) {
  grid-column: 2 / span 2;
}

.delta-grid > .delta:nth-child(5) {
  grid-column: 4 / span 2;
}

/* baseline attribution strip under the delta cards */
.baseline-note {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin: -26px 0 40px;
  padding: 12px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  font-size: 0.78rem;
  color: var(--muted);
}

.baseline-note__k {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 4px;
}

.baseline-note .ms {
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--warm) 50%, transparent);
  transition: color 0.16s ease, border-color 0.16s ease;
}

.baseline-note .ms:hover,
.baseline-note .ms:focus-visible {
  color: var(--warm);
  border-bottom-color: var(--warm);
}

.baseline-note__tail {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--muted);
}

@media (max-width: 700px) {
  .baseline-note__tail {
    margin-left: 0;
  }
}

.delta {
  position: relative;
  padding: 22px 20px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.delta__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.delta__name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.01em;
}

.delta__badge {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.delta__values {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 18px;
  font-variant-numeric: tabular-nums;
}

.delta__from {
  font-size: 1.02rem;
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.delta__arrow {
  color: var(--line-strong);
}

.delta__to {
  font-family: var(--font-display);
  font-size: 1.85rem;
  line-height: 1;
  color: var(--ink);
}

.delta__gain {
  margin-left: auto;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--warm);
  letter-spacing: 0.01em;
}

.delta__track {
  position: relative;
  height: 6px;
  margin-top: 18px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.delta__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) 0.15s;
}

.is-in .delta__fill {
  transform: scaleX(1);
}

.delta__note {
  margin-top: 12px;
  font-size: 0.76rem;
  color: var(--muted);
}

/* tables */

.table-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.table-toolbar__title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
}

.chip:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.table-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 11px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: right;
}

table.data thead th:first-child {
  text-align: left;
  padding-left: 20px;
}

table.data thead th.group {
  text-align: center;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}

table.data tbody td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  color: var(--ink-2);
}

table.data tbody td:first-child {
  text-align: left;
  padding-left: 20px;
  color: var(--ink);
  font-weight: 500;
}

table.data tbody tr:last-child td {
  border-bottom: 0;
}

table.data tbody tr:hover td {
  background: color-mix(in srgb, var(--blue) 5%, transparent);
}

table.data tr.is-ours td {
  background: var(--warm-soft);
}

table.data tr.is-ours td:first-child {
  box-shadow: inset 3px 0 0 var(--warm);
  font-weight: 600;
}

table.data tr.is-ours:hover td {
  background: color-mix(in srgb, var(--warm) 16%, var(--surface));
}

table.data tr.is-divider td {
  padding: 0;
  height: 1px;
  background: var(--line-strong);
}

table.data tr.group-start td {
  border-top: 1px solid var(--line-strong);
}

.cell-best,
.cell-second,
.cell-third {
  font-weight: 700;
}

.cell-best { background: var(--best-bg) !important; color: var(--best-fg) !important; }
.cell-second { background: var(--second-bg) !important; color: var(--second-fg) !important; }
.cell-third { background: var(--third-bg) !important; color: var(--third-fg) !important; }

.pm {
  display: inline-block;
  margin-left: 2px;
  font-size: 0.66em;
  font-weight: 400;
  color: var(--muted);
  vertical-align: 1px;
}

.cell-best .pm,
.cell-second .pm,
.cell-third .pm {
  color: inherit;
  opacity: 0.7;
}

.method-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.nfe {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
}

.nfe--2 {
  background: var(--blue-soft);
  color: var(--blue);
}

.table-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  font-size: 0.74rem;
  color: var(--muted);
}

.legend-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-key .key {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.key--best { background: var(--best-bg); }
.key--second { background: var(--second-bg); }
.key--third { background: var(--third-bg); }

.table-legend .note {
  margin-left: auto;
}

.scroll-hint {
  display: none;
  color: var(--warm);
  font-weight: 600;
}

.hide {
  display: none !important;
}

/* efficiency */

.eff-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.eff {
  position: relative;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.eff__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
}

.eff__num {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: 2.3rem;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.eff__num small {
  font-family: var(--font-sans);
  font-size: 0.4em;
  color: var(--muted);
  margin-left: 4px;
}

.eff__bar {
  height: 5px;
  margin-top: 16px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.eff__bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--grad);
}

.eff__meta {
  margin-top: 10px;
  font-size: 0.74rem;
  color: var(--muted);
}

.eff--ours {
  border-color: color-mix(in srgb, var(--warm) 45%, var(--line));
  background: linear-gradient(180deg, var(--warm-soft), var(--surface) 70%);
}

/* ---------- qualitative ---------- */

.fig-stack {
  display: grid;
  gap: 24px;
}

.fig-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.fig-pair .figure--tall .figure__media {
  padding: 24px;
}

/* ---------- ablation ---------- */

.ablation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 24px;
  align-items: start;
}

.ladder {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.ladder h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.ladder__sub {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.ladder__rows {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.ladder__row {
  display: grid;
  grid-template-columns: 132px 1fr 46px;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
}

.ladder__label {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ladder__row.is-full .ladder__label {
  color: var(--ink);
  font-weight: 600;
}

.ladder__track {
  height: 9px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.ladder__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 55%, var(--surface-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.is-in .ladder__fill {
  transform: scaleX(1);
}

.ladder__fill--warm {
  background: var(--grad);
}

.ladder__row--joint .ladder__fill {
  background: repeating-linear-gradient(45deg, var(--line-strong), var(--line-strong) 5px, var(--surface-2) 5px, var(--surface-2) 10px);
}

.ladder__val {
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  text-align: right;
  font-weight: 600;
}

.ladder__row.is-full .ladder__val {
  color: var(--warm);
}

.ladder__insight {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--line-strong);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--ink-2);
}

.ladder__insight b {
  color: var(--warm);
  font-weight: 600;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mini-table th {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: right;
}

.mini-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  color: var(--ink-2);
}

.mini-table th:first-child,
.mini-table td:first-child {
  text-align: left;
  color: var(--ink);
}

.mini-table tbody tr:last-child td {
  border-bottom: 0;
}

.analysis-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 20px;
  align-items: stretch;
  margin-top: 24px;
}

.analysis-grid--ladder {
  grid-template-columns: 1.05fr 0.95fr;
}

.pullquote {
  padding: 30px;
  border-radius: var(--radius);
  /* always dark: --ink flips to near-white in the dark theme, which turned this
     card white and left the light body text unreadable */
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(184, 107, 75, 0.22), transparent 62%),
    linear-gradient(160deg, #14203a, #0a0f1c 72%);
  color: #eef2f8;
  border: 1px solid rgba(255, 255, 255, 0.09);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 22px 44px -30px rgba(0, 0, 0, 0.7);
  align-self: start;
}

.pullquote::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(184, 107, 75, 0.34), transparent 65%);
  pointer-events: none;
}

.pullquote__k {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4vw, 3.2rem);
  line-height: 1;
  background: var(--grad-solid);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.pullquote p {
  position: relative;
  margin-top: 14px;
  font-size: 0.93rem;
  line-height: 1.65;
  color: #c3ccdc;
}

.pullquote p b {
  color: #fff;
}

.pullquote__foot {
  margin-top: 18px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #93a0b8;
}

/* ---------- takeaways ---------- */

.takeaways {
  display: flex;
  flex-direction: column;
}

.takeaways__list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 15px;
}

.takeaways__list li {
  position: relative;
  padding-left: 20px;
  font-size: 0.87rem;
  line-height: 1.62;
  color: var(--muted);
}

.takeaways__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.52em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--grad);
}

.takeaways__list b {
  color: var(--ink);
  font-weight: 600;
}

.takeaways__foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px dashed var(--line-strong);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--muted);
}

/* ---------- citation ---------- */

.citation-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.citation-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.copy-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.copy-btn svg {
  width: 14px;
  height: 14px;
}

.citation-card pre {
  margin: 0;
  padding: 22px 24px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.72;
  color: var(--ink-2);
  background: transparent;
}

.citation-card pre .k {
  color: var(--blue);
}

.citation-card pre .s {
  color: var(--warm);
}

/* ---------- footer ---------- */

.site-footer {
  padding: 56px 0 40px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-brand p {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 0.82rem;
}

.footer-links a {
  color: var(--ink-2);
}

.footer-links a:hover {
  color: var(--warm);
}

.footer-meta {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--muted);
}

/* ---------- lightbox ---------- */

.lightbox {
  width: min(94vw, 1400px);
  max-height: calc(92vh / var(--ui-zoom));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: #0b1020;
  color: #e9eef7;
  box-shadow: 0 60px 120px -40px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

/* Opening a viewer should feel like the tile grew, not like a new page
   appeared. A long expo-out curve with a real scale delta and a touch of blur
   does that; a short linear fade reads as a jump cut. */
.lightbox[open] {
  animation: lb-in 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.lightbox[open] .lightbox__media {
  animation: lb-media-in 0.52s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.lightbox[open]::backdrop {
  animation: lb-fade 0.34s ease both;
}

@keyframes lb-in {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.945);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes lb-media-in {
  from {
    opacity: 0;
    transform: scale(0.965);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes lb-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox[open],
  .lightbox[open] .lightbox__media,
  .lightbox[open]::backdrop {
    animation: none;
  }
}

.lightbox::backdrop {
  background: rgba(6, 10, 20, 0.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.lightbox__body {
  display: flex;
  flex-direction: column;
  max-height: calc(92vh / var(--ui-zoom));
}

.lightbox__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lightbox__title {
  font-size: 0.86rem;
  font-weight: 600;
  color: #eef2f8;
}

.lightbox__sub {
  font-size: 0.72rem;
  color: #8e9bb1;
  margin-top: 2px;
}

.lightbox__close {
  margin-left: auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: transparent;
  color: #dfe7f2;
  cursor: pointer;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lightbox__close svg {
  width: 16px;
  height: 16px;
}

.lightbox__media {
  padding: 14px;
  overflow: auto;
  background: #070b14;
}

/* once a player is inside, the panel hands its padding to the player so the
   stage can use the full width */
.lightbox__media:has(.vplay) {
  padding: 0;
  overflow: hidden;
}

/* the figure viewer keeps this; the video player has its own stage rules */
.lightbox__media img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-inline: auto;
}

.lightbox__caption {
  padding: 12px 16px 14px;
  font-size: 0.76rem;
  line-height: 1.55;
  color: #95a2b8;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---------- the morph ghost ---------- */

/* While a dialog grows out of a thumbnail (or shrinks back into it) this layer
   carries the picture. It is the only thing that moves: the dialog is already
   laid out behind it, so its header, controls and caption never warp. */
.zoomghost {
  position: fixed;
  z-index: 100000;
  border-radius: 10px;
  overflow: hidden;
  pointer-events: none;
  background-color: #070b12;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.9);
  will-change: transform;
}

/* the dialog's contents stay invisible until the ghost has landed */
dialog.is-morphing .lightbox__body,
dialog.is-morphing .wdlg__inner {
  opacity: 0;
}

dialog.is-morphing {
  /* nothing of the panel itself may show through the morph */
  background: transparent;
  box-shadow: none;
}

dialog.is-morphing::backdrop {
  animation: none;
}

/* ---------- video player ---------- */

.vplay {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  background: #05080f;
  outline: none;
}

.vplay__stage {
  position: relative;
  background: #05080f;
  /* The stage takes the clip's own shape so nothing is letterboxed and nothing
     is cropped. A bare `aspect-ratio` plus `max-height` would clamp the height
     and leave the width at 100 %, which silently changes the ratio -- and the
     crop maths below depends on the ratio being exact. Deriving the width from
     the capped height keeps it true. */
  aspect-ratio: var(--ar, 16 / 9);
  max-height: calc(70vh / var(--ui-zoom));
  width: min(100%, calc(calc(70vh / var(--ui-zoom)) * var(--arn, 1.7778)));
  margin-inline: auto;
}

/* Cropping stage: the poster and the video are scaled and offset identically,
   so a clip whose baked bands were trimmed in the card is trimmed here too.

   The factors arrive as plain numbers from JS. Computing them in CSS is not
   possible: `calc(100% / (1 - 11.5%))` divides a length by a percentage, which
   is invalid, and the declaration is dropped silently. */
.vplay__crop {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.vplay__crop > img,
.vplay__crop > video {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(100% * var(--zx, 1));
  height: calc(100% * var(--zy, 1));
  margin-left: calc(-100% * var(--mx, 0));
  margin-top: calc(-100% * var(--my, 0));
  max-width: none;
  object-fit: fill;
  display: block;
}

.vplay__poster,
.vplay__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.vplay__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: opacity 0.45s ease;
}

/* the video only becomes visible once it can actually paint a frame: that
   cross-fade is what covers the decode delay after a click */
.vplay__video {
  z-index: 2;
  opacity: 0;
  transition: opacity 0.45s ease;
  cursor: pointer;
}

.vplay.is-live .vplay__video {
  opacity: 1;
}

.vplay.is-live .vplay__poster {
  opacity: 0;
}

.vplay__busy {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.vplay.is-busy .vplay__busy {
  opacity: 1;
}

.vplay__ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #e0a97f;
  animation: vplay-spin 0.8s linear infinite;
}

@keyframes vplay-spin {
  to {
    transform: rotate(360deg);
  }
}

/* a large play button when paused; hidden while playing */
.vplay__big {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(10, 15, 24, 0.62);
  color: #fff;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: opacity 0.26s ease, transform 0.26s ease, background 0.2s ease;
}

.vplay__big svg {
  width: 24px;
  height: 24px;
  margin-left: 3px;
}

.vplay__big:hover {
  background: rgba(24, 34, 54, 0.86);
  transform: scale(1.06);
}

.vplay__big.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

/* ---- control bar ---- */

.vplay__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 10px;
  background: linear-gradient(to top, rgba(8, 12, 20, 0.98), rgba(8, 12, 20, 0.9));
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

/* fades away while playing and the pointer is at rest */
.vplay:not(.is-awake) .vplay__bar {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

.vplay:not(.is-awake) .vplay__stage {
  cursor: none;
}

.vplay__btn {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #dbe4f2;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.vplay__btn:hover {
  background: rgba(224, 169, 127, 0.16);
  border-color: rgba(224, 169, 127, 0.5);
  color: #ffe4cd;
}

.vplay__btn svg {
  width: 14px;
  height: 14px;
}

.vplay__time {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: #93a1b8;
  min-width: 76px;
  text-align: center;
}

.vplay__track {
  position: relative;
  flex: 1;
  height: 22px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  outline: none;
}

.vplay__track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.vplay__buffered,
.vplay__played {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 999px;
  transform-origin: left center;
  transform: scaleX(0);
}

.vplay__buffered {
  background: rgba(255, 255, 255, 0.2);
}

.vplay__played {
  background: linear-gradient(90deg, #5c9be8, #a98ff0 55%, #f0ae86);
}

.vplay__knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(224, 169, 127, 0.28);
  transition: transform 0.15s ease;
  pointer-events: none;
}

.vplay__track:hover .vplay__knob,
.vplay__track:focus-visible .vplay__knob {
  transform: scale(1.25);
}

.vplay__track:focus-visible::before {
  box-shadow: 0 0 0 2px rgba(224, 169, 127, 0.6);
}

@media (prefers-reduced-motion: reduce) {
  .vplay__poster,
  .vplay__video,
  .vplay__bar,
  .vplay__big {
    transition: none;
  }

  .vplay__ring {
    animation: none;
  }
}

@media (max-width: 760px) {
  .vplay__time {
    display: none;
  }

  .vplay__big {
    width: 52px;
    height: 52px;
    margin: -26px 0 0 -26px;
  }

  .vplay__bar {
    gap: 8px;
    padding: 8px 10px 9px;
  }
}

/* stage + legend row: the legend is a column beside the picture, never over it */
.vplay__row {
  display: flex;
  align-items: stretch;
  background: #05080f;
}

.vplay__legend {
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 126px;
  padding: 2px 12px 2px 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(to bottom, #0a0f18, #070b13);
  pointer-events: none;
}

.vplay__legend-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.01em;
  line-height: 1.1;
  text-align: right;
  white-space: nowrap;
  color: #aebbd0;
}

/* the StepBridge rows, tinted the way zone 02 marks its own results */
.vplay__legend-row.is-ours {
  color: #e8b08a;
  font-weight: 500;
}

@media (max-width: 760px) {
  .vplay__legend {
    width: 92px;
    padding-inline: 8px;
  }

  .vplay__legend-row {
    font-size: 0.5rem;
  }
}

/* a dialog that shrink-wraps its player, so no dead black shows at the sides */
.lightbox.is-fit {
  width: fit-content;
  max-width: calc(100vw / var(--ui-zoom) - 24px);
}

.lightbox.is-fit .lightbox__media {
  padding: 0;
  overflow: hidden;
}

.lightbox.is-fit .vplay {
  width: 100%;
}

.lightbox.is-fit .vplay__stage {
  margin-inline: 0;
}

/* ---------- frozen background while a modal is open ---------- */

/* Nobody can see the gallery through a modal, so nothing in it should be
   costing a frame. The video pool is released from JS; these rules stop the
   CSS animations. */
body.is-modal .vrow__track,
body.is-modal .vpile::before,
body.is-modal .vpile__item,
body.is-modal .vstack::before,
body.is-modal .vstack::after,
body.is-modal .vstack__card.is-front::after {
  animation-play-state: paused !important;
}

body.is-modal .vpile__sky {
  visibility: hidden;
}

/* The scrim is 90 % opaque, so nothing behind it is legible. Hiding the gallery
   outright lets the compositor skip the whole subtree instead of painting it
   into a layer the reader cannot see. Layout is untouched, so closing the dialog
   does not reflow anything. */
body.is-modal .vgal {
  visibility: hidden;
}

/* Everything outside the dialog stops animating. `animation-play-state` does not
   inherit, so this targets the children too; the emblem, the wordmark shine and
   the abstract's connectors were all still repainting behind a scrim nobody can
   see through, and they are what made playback in region 01 stutter while
   region 02 (whose section sits far from the hero) was already smooth. */
body.is-modal .hero,
body.is-modal .hero *,
body.is-modal .site-head *,
body.is-modal main > section:not(.vgal) *,
body.is-modal .flow__stage * {
  animation-play-state: paused !important;
}

/* ---------- off-screen sections are not laid out or painted ---------- */

/* Painting a section nobody is looking at is pure cost, and this page is long:
   the hero emblem alone animates an SVG continuously. `content-visibility: auto`
   lets the browser skip layout, paint and compositing for a section until it
   approaches the viewport. `contain-intrinsic-size: auto <estimate>` keeps the
   scrollbar stable: the reported size is the estimate until the section has been
   rendered once, after which the browser remembers its real size, so scrolling
   never jumps.

   The gallery is deliberately excluded -- its IntersectionObservers and video
   pool depend on it staying live. */
main > section:not(.vgal):not(#videos),
.hero {
  content-visibility: auto;
  contain-intrinsic-size: auto 900px;
}

/* a section that is skipped must not keep its animations ticking */
body:not(.is-modal) .hero,
body:not(.is-modal) .hero * {
  animation-play-state: running;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 300;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast svg {
  width: 15px;
  height: 15px;
}

/* ---------- method: two compact subsections ---------- */

.method-section {
  padding-top: clamp(56px, 6.5vw, 92px);
}

.method-section .section-head {
  margin-bottom: clamp(26px, 3vw, 38px);
}

.subsec {
  scroll-margin-top: 96px;
}

.subsec + .subsec {
  margin-top: clamp(32px, 3.4vw, 46px);
  padding-top: clamp(26px, 3vw, 36px);
  border-top: 1px solid var(--line);
}

.subsec__head {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: baseline;
  gap: 10px clamp(24px, 3vw, 48px);
  margin-bottom: clamp(20px, 2.4vw, 28px);
}

.subsec__label {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.subsec__num {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--warm);
  transform: translateY(-0.15em);
}

.subsec__title {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.subsec__lede {
  font-size: 0.92rem;
  line-height: 1.68;
  color: var(--muted);
  max-width: 60ch;
}

/* ---------- the two 3D panels read as one stacked figure ---------- */

.duo {
  display: grid;
  gap: 0;
  margin-top: clamp(18px, 2.2vw, 26px);
}

.duo > .stepviz {
  border-radius: 0;
  border-bottom: 0;
  box-shadow: none;
}

.duo > .stepviz:first-child {
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  box-shadow: 0 -18px 40px -34px rgba(0, 0, 0, 0.5);
}

.duo > .stepviz:last-child {
  border-bottom: 1px solid var(--line);
  border-bottom-left-radius: 22px;
  border-bottom-right-radius: 22px;
  box-shadow: 0 30px 60px -46px rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .duo > .stepviz:last-child {
  border-bottom-color: #1b2438;
}

/* the shared caption sits right under the pair */
.duo__note {
  margin-top: 14px;
  max-width: 100%;
  text-align: justify;
  text-justify: inter-word;
  text-align-last: left;
  -webkit-hyphens: auto;
  hyphens: auto;
  word-spacing: -0.005em;
}

/* ---------- step visualization (3D) ---------- */

.steps-section {
  background:
    radial-gradient(70% 60% at 50% 0%, var(--blue-soft) 0%, transparent 70%),
    var(--paper);
}

.stepviz {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #060a14;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

[data-theme="dark"] .stepviz {
  border-color: #1d2740;
  box-shadow: 0 40px 90px -50px rgba(0, 0, 0, 0.95);
}

.stepviz__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 7.6;
  min-height: 300px;
  isolation: isolate;
}

#stepCanvas,
.stepviz__stage > canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: pan-y;
}

#stepCanvas:active,
.stepviz__stage > canvas:active {
  cursor: grabbing;
}

.stepviz__hud {
  position: absolute;
  z-index: 2;
  left: clamp(16px, 2.4vw, 30px);
  top: clamp(14px, 2vw, 26px);
  pointer-events: none;
  color: #eaeff9;
  text-shadow: 0 1px 16px rgba(4, 8, 16, 0.9);
}

.stepviz__kicker {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(234, 239, 249, 0.45);
}

.stepviz__nfe {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 7px;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.2vw, 3.1rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stepviz__nfe em {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: rgba(234, 239, 249, 0.5);
}

.stepviz__nfe.is-ticking {
  animation: sb-tick 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes sb-tick {
  0% { opacity: 0; transform: translateY(8px); filter: blur(3px); }
  60% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: none; }
}

.stepviz__stage-label {
  margin-top: 9px;
  font-size: 0.76rem;
  letter-spacing: 0.01em;
  color: rgba(234, 239, 249, 0.62);
}

.stepviz__metrics {
  position: absolute;
  z-index: 2;
  right: clamp(16px, 2.4vw, 30px);
  top: clamp(14px, 2vw, 26px);
  display: flex;
  gap: clamp(16px, 2.4vw, 30px);
  text-align: right;
  pointer-events: none;
  color: #eaeff9;
  text-shadow: 0 1px 16px rgba(4, 8, 16, 0.9);
}

.stepviz__metric b {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.7vw, 1.5rem);
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stepviz__metric b i {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.5em;
  margin-left: 2px;
  color: rgba(234, 239, 249, 0.5);
}

.stepviz__metric span {
  display: block;
  margin-top: 6px;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(234, 239, 249, 0.4);
}

.stepviz__corner {
  position: absolute;
  z-index: 2;
  bottom: clamp(14px, 2vw, 24px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(234, 239, 249, 0.45);
  pointer-events: none;
  text-shadow: 0 1px 12px rgba(4, 8, 16, 0.8);
}

.stepviz__corner--noise { left: clamp(16px, 2.4vw, 30px); }
.stepviz__corner--clean { right: clamp(16px, 2.4vw, 30px); }

.stepviz__pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6fa8f5;
  box-shadow: 0 0 0 0 rgba(111, 168, 245, 0.5);
  animation: sb-pulse 2.6s ease-out infinite;
}

.stepviz__pulse--warm {
  background: #ffc09b;
  box-shadow: 0 0 0 0 rgba(255, 192, 155, 0.5);
}

@keyframes sb-pulse {
  0% { box-shadow: 0 0 0 0 rgba(140, 180, 255, 0.45); }
  70% { box-shadow: 0 0 0 9px rgba(140, 180, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(140, 180, 255, 0); }
}

.stepviz__anchor {
  position: absolute;
  z-index: 2;
  right: clamp(16px, 2.4vw, 30px);
  bottom: clamp(44px, 5vw, 58px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 7px 12px;
  border: 1px solid rgba(255, 192, 155, 0.3);
  border-radius: 999px;
  background: rgba(120, 62, 36, 0.34);
  color: #ffcbb0;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  pointer-events: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.stepviz.is-2step .stepviz__anchor {
  opacity: 1;
  transform: none;
}

.stepviz__anchor-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffb08a;
  box-shadow: 0 0 10px #ff9d6e;
}

.stepviz__legend {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: clamp(14px, 2vw, 24px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(234, 239, 249, 0.38);
  pointer-events: none;
}

.stepviz__ramp {
  width: 84px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f8fdc, #8f7fdd 55%, #e2a07c);
}

.stepviz__controls {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 10px 20px;
  padding: 13px 18px 14px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.stepflow {
  grid-column: 1 / -1;
  grid-row: 1;
}

.stepviz__tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.stepviz__tab {
  display: grid;
  gap: 3px;
  padding: 7px 15px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

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

.stepviz__tab-n {
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stepviz__tab-l {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.8;
}

.stepviz__tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.stepviz__tab[aria-selected="true"] .stepviz__tab-n {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stepviz__progress {
  grid-column: 1;
  grid-row: 2;
  height: 3px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.stepviz__progress i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: var(--grad-solid);
  transform: scaleX(0);
  transform-origin: left;
}

.stepviz__hint {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  font-size: 0.71rem;
  color: var(--muted);
  white-space: nowrap;
}

.stepviz__note {
  max-width: 1020px;
  margin: 20px auto 0;
  text-align: center;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--muted);
}

/* authors + affiliations */
.authors sup {
  margin-left: 2px;
  font-size: 0.6em;
  font-weight: 600;
  color: var(--warm);
  vertical-align: super;
  line-height: 0;
}

.affil a {
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.affil a:hover {
  color: var(--warm);
  text-decoration-color: currentColor;
}

.affil sup {
  margin-right: 2px;
  font-size: 0.62em;
  font-weight: 700;
  color: var(--warm);
}

.affil__sep {
  margin: 0 9px;
  color: var(--line-strong);
}

/* ---------- step flow selector: 50 >>> 4 >>>> 2 ---------- */

.stepflow {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.stepflow__node {
  display: grid;
  gap: 2px;
  padding: 6px 12px 7px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: center;
  justify-items: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.stepflow__n {
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.stepflow__l {
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.9;
  white-space: nowrap;
}

.stepflow__node[aria-selected="true"] {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.stepflow__node[aria-selected="true"] .stepflow__n {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stepflow__link {
  flex: 1 1 70px;
  min-width: 44px;
  display: grid;
  gap: 6px;
  align-content: center;
}

.stepflow__rail {
  position: relative;
  display: block;
  height: 14px;
}

.stepflow__rail::before {
  content: "";
  position: absolute;
  left: 0;
  right: 9px;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(40, 95, 166, 0.55), rgba(106, 99, 168, 0.6) 50%, rgba(184, 107, 75, 0.65));
}

.stepflow__link--wide .stepflow__rail::before {
  height: 3.5px;
}

.stepflow__rail b {
  position: absolute;
  right: 0;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--warm);
  border-right: 2px solid var(--warm);
  transform: translateY(-50%) rotate(45deg);
}

.stepflow__rail i {
  position: absolute;
  top: 50%;
  left: 0;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-top: 2px solid var(--blue);
  border-right: 2px solid var(--blue);
  transform: rotate(45deg);
  opacity: 0;
  animation: flow-chev 2.2s linear infinite;
}

.stepflow__rail i:nth-child(1) { animation-delay: 0s; }
.stepflow__rail i:nth-child(2) { border-color: var(--violet); animation-delay: 0.22s; }
.stepflow__rail i:nth-child(3) { border-color: var(--warm); animation-delay: 0.44s; }
.stepflow__rail i:nth-child(4) { border-color: var(--warm); animation-delay: 0.66s; }

.stepflow__link--wide .stepflow__rail i {
  border-color: var(--warm);
}

.stepflow__cap {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes flow-chev {
  0% { left: 0; opacity: 0; }
  10% { opacity: 1; }
  85% { opacity: 1; }
  100% { left: calc(100% - 12px); opacity: 0; }
}

/* authors: equal contribution / project leader */

.mark + .mark {
  margin-left: 3.5px;
}

.mark {
  margin-left: 1px;
  font-size: 0.72em;
  font-weight: 700;
  line-height: 0;
  color: var(--warm);
  vertical-align: super;
}

/* ---------- unified distillation architecture ---------- */

.arch {
  margin-top: 0;
}

.arch__intro {
  max-width: 720px;
  margin-bottom: clamp(24px, 3vw, 34px);
}

.arch__title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.1vw, 2.35rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin-top: 6px;
}

.arch__lede {
  margin-top: 14px;
  color: var(--ink-2);
  font-size: 0.97rem;
  line-height: 1.7;
}

.archviz__stage {
  aspect-ratio: 16 / 6.2;
}

.archviz__controls {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px 20px;
}

.archviz__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.72rem;
  color: var(--muted);
}

.archviz__key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.archviz__key b {
  color: var(--ink-2);
  font-weight: 600;
}

.archviz__key .swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.swatch--blue { background: #4f8fdc; }
.swatch--violet { background: #8f7fdd; }
.swatch--warm { background: #e2a07c; }

.note-arrow {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: 2px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: -2px;
}

.note-arrow--up {
  background: var(--blue-soft);
  color: var(--blue);
}

.note-arrow--down {
  background: var(--warm-soft);
  color: var(--warm);
}

.archviz .chips {
  margin-left: 0;
}

/* role cards under the architecture diagram */

.arch-roles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 22px;
}

.arch-role {
  position: relative;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.arch-role b {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  padding-left: 16px;
}

.arch-role p {
  margin-top: 8px;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
}

.arch-role__dot {
  position: absolute;
  left: 18px;
  top: 24px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.arch-role__dot--blue { background: #4f8fdc; }
.arch-role__dot--warm { background: #e2a07c; }
.arch-role__dot--violet { background: #8f7fdd; }

/* speed metrics under the architecture diagram */

.arch-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 26px 0 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}

.arch-metric {
  padding: 18px 20px;
  background: var(--surface);
  display: grid;
  gap: 5px;
}

.arch-metric b {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  font-weight: 400;
  line-height: 1;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}

.arch-metric b i {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.45em;
  margin-left: 2px;
}

.arch-metric span {
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--muted);
}

/* the paper's own overview figure: treated as a light "sheet" inside the dark page */

.figure--paper {
  margin-top: clamp(36px, 4vw, 52px);
  border-color: rgba(255, 255, 255, 0.09);
  background: #f4efe6;
  box-shadow: 0 30px 60px -40px rgba(0, 0, 0, 0.8);
}

[data-theme="light"] .figure--paper {
  border-color: var(--line);
  background: #f4efe6;
  box-shadow: var(--shadow-sm);
}

.figure--paper .figure__media {
  padding: 22px;
  background: #f6f1e8;
}

.figure--paper .figure__media img {
  border-radius: 6px;
  opacity: 0.97;
}

.figure--paper figcaption {
  background: var(--surface);
  color: var(--muted);
}

.figure--paper figcaption b {
  color: var(--ink);
}

.figure--paper .zoom-hint {
  background: rgba(16, 24, 40, 0.8);
}

.figure--paper::before {
  content: "Paper figure · Fig. 2";
  display: block;
  padding: 10px 22px;
  border-bottom: 1px solid rgba(16, 24, 40, 0.08);
  background: #eee7d9;
  color: #6b6357;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- responsive ---------- */

@media (max-width: 1024px) {
  .nav__links { display: none; }
  .nav__toggle { display: grid; }
  .nav { grid-template-columns: 1fr auto; }
  .nav__actions { margin-left: auto; }
  .nav__drawer {
    display: block;
    position: fixed;
    inset: 68px 0 auto 0;
    z-index: 99;
    padding: 12px 24px 22px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .nav__drawer.is-open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .nav__drawer a {
    display: block;
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
    color: var(--ink-2);
    font-size: 0.95rem;
  }
  .nav__drawer a:last-child { border-bottom: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .deep-dive { grid-template-columns: 1fr; }
  .ablation-layout { grid-template-columns: 1fr; }
  .analysis-grid { grid-template-columns: 1fr; }
  .fig-pair { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  /* five cards -> two rows, the odd one keeps the full first column pair */
  .delta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .delta-grid > .delta,
  .delta-grid > .delta:nth-child(4),
  .delta-grid > .delta:nth-child(5) {
    grid-column: auto;
  }
  .delta-grid > .delta:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .contrib-grid,
  .pipeline,
  .delta-grid,
  .eff-grid { grid-template-columns: 1fr; }
  .delta-grid > .delta,
  .delta-grid > .delta:nth-child(4),
  .delta-grid > .delta:nth-child(5),
  .delta-grid > .delta:last-child:nth-child(odd) {
    grid-column: auto;
  }
  .contrib-grid { gap: 14px; }
  .hero { padding-top: 118px; }
  .authors { font-size: 0.9rem; }
  .table-toolbar { align-items: flex-start; }
  .chips { margin-left: 0; }
  .scroll-hint { display: inline; }
  .brand__sub { display: none; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .video-toolbar { gap: 10px; }
  .fig-pair { gap: 16px; }
  .ladder__row { grid-template-columns: 108px 1fr 40px; }
  .footer-grid { flex-direction: column; }

  .stepviz__stage {
    aspect-ratio: 4 / 3;
    min-height: 330px;
  }
  .stepviz__metrics {
    display: none;
  }
  .stepviz__legend {
    display: none;
  }
  .stepviz__corner {
    display: none;
  }
  .stepviz__anchor {
    left: auto;
    right: 12px;
    bottom: 12px;
    max-width: calc(100% - 24px);
    justify-content: flex-end;
    font-size: 0.58rem;
    padding: 6px 10px;
  }
  .stepviz__controls {
    gap: 10px 12px;
  }
  .stepflow {
    grid-column: 1 / -1;
  }
  .stepflow__node {
    padding: 6px 9px 7px;
  }
  .stepflow__cap {
    display: none;
  }
  .stepviz__progress {
    grid-column: 1;
    order: 3;
    flex-basis: 100%;
  }
  .stepviz__hint {
    display: none;
  }
  .arch-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .arch-roles {
    grid-template-columns: 1fr;
  }
  .arch-metric {
    padding: 14px 16px;
  }
  .archviz__controls {
    grid-template-columns: 1fr;
  }
  .archviz__legend {
    gap: 4px 14px;
    font-size: 0.68rem;
  }
  .archviz__stage {
    aspect-ratio: 4 / 2.9;
    min-height: 0;
  }
}

@media (max-width: 700px) {
  .subsec__head {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .subsec__title {
    font-size: 1.35rem;
  }
  .subsec__lede {
    font-size: 0.87rem;
  }
}

@media (max-width: 700px) {
  /* right-aligned justification opens huge word gaps on a narrow column */
  .duo__note {
    text-align: left;
    text-align-last: left;
    -webkit-hyphens: manual;
    hyphens: manual;
    word-spacing: 0;
  }
  /* dots would dangle at the end of a wrapped line; gaps read better */
  .affil--single {
    gap: 2px 16px;
  }
  .affil--single .affil__sep {
    display: none;
  }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap,
  .wrap--narrow { width: min(100% - 32px, var(--maxw)); }
  .stats {
    width: min(100% - 32px, 1180px);
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 34px;
  }
  .stat { padding: 18px 16px 16px; }
  .stat__label { font-size: 0.75rem; }
  .cta-row .btn { flex: 1 1 auto; justify-content: center; }
  .venue-pill { font-size: 0.74rem; }
  .tldr { grid-template-columns: 1fr; gap: 10px; }
  .note-strip .sep { display: none; }
  .authors { gap: 4px 14px; }
  .authors span + span::before { display: none; }
  .lightbox { width: calc(100vw / var(--ui-zoom)); max-height: calc(100vh / var(--ui-zoom)); border-radius: 0; }
  .lightbox__body { max-height: calc(100vh / var(--ui-zoom)); }
  #toTop { display: none; }
  .scroll-hint { display: inline; }
}

@media (max-width: 700px) {
  /* The row labels already describe the ablation; hide the component ticks
     so the scores stay on screen without horizontal scrolling. */
  .ablation-table th:nth-child(n + 2):nth-child(-n + 6),
  .ablation-table td:nth-child(n + 2):nth-child(-n + 6) {
    display: none;
  }
  .ablation-table th,
  .ablation-table td {
    padding-left: 8px;
    padding-right: 8px;
    font-size: 0.78rem;
  }
  .ablation-table thead th:first-child,
  .ablation-table tbody td:first-child {
    padding-left: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .delta__fill { transform: scaleX(1); }
  .ladder__fill { transform: scaleX(1); }
}

/* print */
@media print {
  .site-header, .hero__bg, .hero__grid, .hero__bridge, .cta-row, .toast, .nav__toggle { display: none; }
  body { background: #fff; }
  section { break-inside: avoid; }
}
