/* ==========================================================================
   RoboWits project page — design system
   Chart colours come from the validated categorical palette (slots 1/2/3);
   UI chrome stays neutral so colour on this page always means something.
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  color-scheme: light;

  --bg:        #faf9f6;
  --bg-sunk:   #f2f0e9;
  --surface:   #ffffff;
  --surface-2: #f6f4ee;
  --line:      #e5e2d8;
  --line-2:    #d3cfc2;

  --ink:    #15181e;
  --ink-2:  #4b525b;
  --ink-3:  #7d858f;
  --ink-on-accent: #ffffff;

  --sage:   #aeb296;
  --sage-wash: rgba(174, 178, 150, .16);

  /* data colours — categorical slots 1, 2, 3 */
  --seed:   #2a78d6;
  --mut:    #eb6834;
  --third:  #1baf7a;
  --seed-wash: rgba(42, 120, 214, .13);
  --mut-wash:  rgba(235, 104, 52, .13);

  --shadow-sm: 0 1px 2px rgba(21, 24, 30, .05), 0 2px 8px rgba(21, 24, 30, .04);
  --shadow-md: 0 2px 4px rgba(21, 24, 30, .05), 0 12px 32px rgba(21, 24, 30, .08);
  --shadow-lg: 0 4px 8px rgba(21, 24, 30, .06), 0 28px 64px rgba(21, 24, 30, .14);

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 22px;

  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* One content width for the whole page; .wrap-wide is kept as an alias so
     every section lines up on the same left and right edges. */
  --wrap: 1200px;
  --nav-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark;
    --bg:        #15181e;
    --bg-sunk:   #101319;
    --surface:   #1b1f27;
    --surface-2: #222733;
    --line:      #2b313b;
    --line-2:    #3b434f;
    --ink:    #eef1f5;
    --ink-2:  #a8b1bd;
    --ink-3:  #79838f;
    --ink-on-accent: #15181e;
    --sage:   #9ea387;
    --sage-wash: rgba(158, 163, 135, .14);
    --seed:   #3987e5;
    --mut:    #d95926;
    --third:  #199e70;
    --seed-wash: rgba(57, 135, 229, .18);
    --mut-wash:  rgba(217, 89, 38, .18);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 2px 4px rgba(0,0,0,.35), 0 12px 32px rgba(0,0,0,.4);
    --shadow-lg: 0 4px 8px rgba(0,0,0,.4), 0 28px 64px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"] { color-scheme: dark;
  --bg:        #15181e;
  --bg-sunk:   #101319;
  --surface:   #1b1f27;
  --surface-2: #222733;
  --line:      #2b313b;
  --line-2:    #3b434f;
  --ink:    #eef1f5;
  --ink-2:  #a8b1bd;
  --ink-3:  #79838f;
  --ink-on-accent: #15181e;
  --sage:   #9ea387;
  --sage-wash: rgba(158, 163, 135, .14);
  --seed:   #3987e5;
  --mut:    #d95926;
  --third:  #199e70;
  --seed-wash: rgba(57, 135, 229, .18);
  --mut-wash:  rgba(217, 89, 38, .18);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 2px 4px rgba(0,0,0,.35), 0 12px 32px rgba(0,0,0,.4);
  --shadow-lg: 0 4px 8px rgba(0,0,0,.4), 0 28px 64px rgba(0,0,0,.55);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 18px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: -.02em; margin: 0; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--seed); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--sage-wash); }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 22px; }
.wrap-wide { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 22px; }
.section { padding-block: clamp(56px, 8vw, 104px); }
.section--sunk { background: var(--bg-sunk); border-block: 1px solid var(--line); }
.prose { max-width: 70ch; }
.center { text-align: center; margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* section heading ---------------------------------------------------------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--line-2); flex: none; }
.center .eyebrow { justify-content: center; }
.h2 { font-size: clamp(27px, 3.6vw, 40px); }
.lede { font-size: clamp(16px, 1.5vw, 18px); color: var(--ink-2); max-width: 68ch; margin-top: 14px; }
.center .lede { margin-inline: auto; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  height: var(--nav-h);
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background .25s ease;
}
.nav.is-stuck { border-bottom-color: var(--line); }
.nav__inner { height: var(--nav-h); display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 600; font-size: 16.5px; letter-spacing: -.01em; text-decoration: none; }
.brand img { width: 25px; height: 25px; object-fit: contain; }
:root[data-theme="dark"] .brand img, :root[data-theme="dark"] .footer__logo { filter: invert(1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand img,
  :root:not([data-theme="light"]) .footer__logo { filter: invert(1); }
}
.nav__links { display: flex; gap: 2px; margin-left: auto; }
.nav__links a {
  font-size: 13.5px; color: var(--ink-2); text-decoration: none;
  padding: 7px 11px; border-radius: 99px; transition: color .18s, background .18s;
}
.nav__links a:hover { color: var(--ink); background: var(--surface-2); }
.nav__links a[aria-current="true"] { color: var(--ink); background: var(--surface-2); }
.nav__tools { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav__links + .nav__tools { margin-left: 10px; }
.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--line); border-radius: 99px;
  background: var(--surface); color: var(--ink-2); cursor: pointer;
  transition: color .18s, border-color .18s, transform .18s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 16px; height: 16px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
}
@media (max-width: 940px) { .nav__links { display: none; } }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(42px, 7vw, 78px) clamp(28px, 4vw, 48px); }
.hero__bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero__bg::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 54px 54px;
  opacity: .5;
  mask-image: radial-gradient(ellipse 70% 62% at 50% 24%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 70% 62% at 50% 24%, #000 0%, transparent 78%);
}
.hero__bg::after {
  content: ""; position: absolute; left: 50%; top: -230px; translate: -50% 0;
  width: 860px; height: 560px; border-radius: 50%;
  background: radial-gradient(circle, var(--sage-wash), transparent 68%);
  filter: blur(14px);
}
.hero__inner { position: relative; z-index: 1; text-align: center; }

.hero h1 {
  font-size: clamp(32px, 4.3vw, 54px);
  letter-spacing: -.03em; line-height: 1.08;
  text-wrap: balance; max-width: 19em; margin-inline: auto;
}

.authors { margin: 26px auto 0; max-width: 1020px; font-size: 15.5px; line-height: 2; }
.authors a { text-decoration: none; border-bottom: 1px solid var(--line-2); padding-bottom: 1px; transition: border-color .18s; }
.authors a:hover { border-bottom-color: var(--ink); }
.authors sup { font-size: 10.5px; color: var(--ink-3); margin-left: 1px; }
.authors .eq { color: var(--ink-3); }
.affils { margin: 10px auto 0; max-width: 940px; font-size: 13.5px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: center; }
.affils sup { color: var(--ink-3); margin-right: 3px; }
.note-eq { margin-top: 8px; font-size: 12.5px; color: var(--ink-3); }

.cta { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 32px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 99px;
  font-size: 14.5px; font-weight: 500; text-decoration: none; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn--primary { background: var(--ink); color: var(--ink-on-accent); border-color: var(--ink); }
.btn--primary:hover { background: var(--ink); }

/* hero media frame */
.frame {
  position: relative; margin-top: clamp(34px, 5vw, 56px);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); padding: 10px; box-shadow: var(--shadow-lg);
}
.frame > img, .frame > video { width: 100%; height: auto; border-radius: calc(var(--radius-lg) - 10px); }
.frame__cap {
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 12px 8px 4px; font-size: 12.5px; color: var(--ink-3);
}

/* ---------- stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--bg); padding: 22px 20px; }
.stat__v { font-family: var(--font-body); font-weight: 600; font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat__l { margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.stat__n { margin-top: 2px; font-size: 12px; color: var(--ink-3); }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- generic cards ---------- */
.cards { display: grid; gap: 16px; }
.cards--3 { grid-template-columns: repeat(3, 1fr); }
.cards--4 { grid-template-columns: repeat(4, 1fr); }
.cards--2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 980px) { .cards--3, .cards--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .cards--2, .cards--3, .cards--4 { grid-template-columns: 1fr; } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.card h3 { font-size: 17.5px; margin-bottom: 8px; }
.card p { font-size: 14.5px; color: var(--ink-2); margin: 0; }
.card__num {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em;
  color: var(--ink-3); display: block; margin-bottom: 12px;
}

/* ---------- chips / tags ---------- */
/* Labels read as labels: no border, no raised surface, nothing that
   advertises a click. Only button.chip gets a control's affordances. */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; padding: 4px 0; border-radius: 0;
  border: 0; background: none; color: var(--ink-3);
  white-space: nowrap;
}
.lb__chips span.chip + span.chip::before { content: "·"; margin-right: 9px; color: var(--line-2); }
.lb__chips { gap: 7px 10px; align-items: center; }
button.chip {
  cursor: pointer; font-family: inherit; color: var(--ink);
  padding: 4px 11px; border-radius: 99px;
  border: 1px solid var(--line-2); background: var(--surface-2);
  transition: border-color .18s, background .18s;
}
button.chip:hover { border-color: var(--ink-3); background: var(--surface); }
.chip__dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; flex: none; }
.chip--seed { color: var(--seed); }
.chip--mut  { color: var(--mut); }
.chip--core { color: var(--ink-2); }

/* toggle group */
.toggles { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; }
.seg button {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-2);
  padding: 6px 14px; border: 0; border-radius: 99px; background: transparent; cursor: pointer;
  transition: color .18s, background .18s, box-shadow .18s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg__label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-right: 2px; }

/* ---------- pipeline ---------- */
.pipe-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-top: 28px; counter-reset: step; }
@media (max-width: 1040px) { .pipe-steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .pipe-steps { grid-template-columns: 1fr; } }
.pipe-step {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 16px;
}
.pipe-step__k {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
  display: block; margin-bottom: 9px;
}
.pipe-step h3 { font-size: 15.5px; margin-bottom: 6px; }
.pipe-step p { font-size: 13.5px; color: var(--ink-2); margin: 0; }

/* ---------- gallery ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 26px 0 22px; }
.filter {
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
  padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2);
  transition: color .18s, border-color .18s, background .18s;
}
.filter:hover { color: var(--ink); border-color: var(--line-2); }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ink-on-accent); }
.filter small { opacity: .62; margin-left: 5px; font-variant-numeric: tabular-nums; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1080px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 780px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 430px)  { .grid { grid-template-columns: 1fr; } }

.tile {
  position: relative; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0; overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .22s cubic-bezier(.2,.7,.3,1), box-shadow .22s, border-color .22s;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.tile__media { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.tile__media img, .tile__media video { width: 100%; height: 100%; object-fit: cover; }
.tile__media video { position: absolute; inset: 0; opacity: 0; transition: opacity .3s ease; }
.tile__media video.is-on { opacity: 1; }
.tile__flags { position: absolute; top: 9px; right: 9px; z-index: 2; display: flex; gap: 5px; }
.tile__flag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .05em;
  padding: 3px 7px; border-radius: 6px; background: rgba(10, 12, 16, .62); color: #fff; backdrop-filter: blur(4px);
}
.tile__play {
  position: absolute; right: 9px; bottom: 9px; z-index: 2;
  width: 29px; height: 29px; border-radius: 99px; display: grid; place-items: center;
  background: rgba(10, 12, 16, .62); color: #fff; backdrop-filter: blur(4px);
  transition: transform .2s, background .2s;
}
.tile:hover .tile__play { transform: scale(1.08); }
/* buffering feedback: the play badge pulses until the first frame is ready */
.tile__media.is-loading .tile__play { animation: tile-wait 1s ease-in-out infinite; }
@keyframes tile-wait { 50% { opacity: .45; } }
.tile__play svg { width: 12px; height: 12px; }
.tile__body { padding: 13px 14px 15px; }
.tile__name { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: -.012em; }
.tile__instr {
  margin-top: 5px; font-size: 12.8px; color: var(--ink-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile__meta { margin-top: 10px; display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-3); }
.tile__bar { flex: 1; height: 3px; border-radius: 99px; background: var(--line); overflow: hidden; }
.tile__bar i { display: block; height: 100%; border-radius: 99px; background: var(--mut); }

/* ---------- mutation showcase ---------- */
.mut-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 20px; }
.triptych { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 860px) { .triptych { grid-template-columns: 1fr; } }
.clip { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.clip video, .clip img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.clip__body { padding: 13px 15px 16px; }
.clip__body h4 { font-size: 14.5px; font-family: var(--font-display); font-weight: 600; margin-bottom: 5px; }
.clip__body p { font-size: 13px; color: var(--ink-2); margin: 8px 0 0; }
.clip--seed { border-color: color-mix(in srgb, var(--seed) 34%, var(--line)); }
.clip--mut  { border-color: color-mix(in srgb, var(--mut) 34%, var(--line)); }
.instr-line {
  display: flex; gap: 10px; align-items: baseline; padding: 14px 16px;
  border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--surface-2);
  font-size: 14px; color: var(--ink-2);
}
.instr-line b { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); flex: none; }

/* ---------- results ---------- */
.result-head { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel__head { padding: 18px 20px 0; }
.panel__head h3 { font-size: 16.5px; }
.panel__head p { font-size: 13px; color: var(--ink-3); margin: 5px 0 0; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: block; }

.chart-wrap { padding: 8px 12px 14px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-text { font-family: var(--font-body); font-size: 11.5px; fill: var(--ink-3); }
.chart .group-text { font-family: var(--font-body); font-size: 13px; font-weight: 500; fill: var(--ink-2); }
.chart .value-text { font-family: var(--font-body); font-size: 11.5px; font-weight: 600; fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart .bar { transition: opacity .15s; }
.chart .bar-hit { fill: transparent; cursor: pointer; }
.chart.is-hovering .bar { opacity: .35; }
.chart .bar.is-active { opacity: 1; }

.tip {
  position: fixed; z-index: 90; pointer-events: none; opacity: 0;
  transform: translate(-50%, -112%); transition: opacity .12s;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: var(--shadow-md); padding: 9px 12px; font-size: 12.5px; min-width: 150px;
}
.tip.is-on { opacity: 1; }
.tip b { display: block; font-size: 13px; margin-bottom: 4px; }
.tip dl { display: grid; grid-template-columns: auto auto; gap: 2px 14px; margin: 0; }
.tip dt { color: var(--ink-3); }
.tip dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

.table-scroll { overflow-x: auto; }
table.rt { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
table.rt th, table.rt td { padding: 9px 12px; text-align: right; white-space: nowrap; }
table.rt thead th { font-weight: 500; color: var(--ink-3); font-size: 12px; border-bottom: 1px solid var(--line); }
table.rt thead tr.pol th { text-align: center; border-bottom: 0; padding-bottom: 2px; font-family: var(--font-display); font-size: 13.5px; color: var(--ink); font-weight: 600; }
table.rt th.task, table.rt td.task { text-align: left; width: 1%; }
table.rt tbody tr { border-bottom: 1px solid var(--line); }
table.rt tbody tr:hover { background: var(--surface-2); }
table.rt tbody tr.is-avg { border-top: 2px solid var(--line-2); border-bottom: 0; font-weight: 600; background: var(--surface-2); }
table.rt td.v { position: relative; font-variant-numeric: tabular-nums; }
table.rt td.v .wash { position: absolute; top: 3px; bottom: 3px; right: 6px; border-radius: 3px; z-index: 0; }
table.rt td.v .num { position: relative; z-index: 1; }
table.rt td.v.is-best .num { font-weight: 700; }
table.rt td.v.is-best .num::after { content: "●"; font-size: 7px; vertical-align: 3px; margin-left: 4px; color: var(--ink-3); }
table.rt td.sep { border-left: 1px solid var(--line); }
table.rt .zero { color: var(--ink-3); }

/* ---------- code ---------- */
.code { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.code__bar { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.code__name { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); margin-right: auto; }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; }
.code code { font-family: var(--font-mono); font-size: 12.8px; line-height: 1.75; color: var(--ink); }
.code .c { color: var(--ink-3); }
.code .k { color: var(--seed); }
.copy {
  font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; color: var(--ink-2);
  border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 5px 10px;
  display: inline-flex; align-items: center; gap: 6px; transition: color .18s, border-color .18s;
}
.copy:hover { color: var(--ink); border-color: var(--line-2); }
.copy svg { width: 13px; height: 13px; }
.copy.is-done { color: var(--third); border-color: color-mix(in srgb, var(--third) 40%, transparent); }

/* ---------- resources ---------- */
.res { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 960px) { .res { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .res { grid-template-columns: 1fr; } }
.res a {
  display: flex; flex-direction: column; gap: 6px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.res a:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.res .res__i { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 6px; }
.res .res__i svg { width: 15px; height: 15px; }
.res strong { font-family: var(--font-display); font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.res span { font-size: 13px; color: var(--ink-2); }
.res svg.out { width: 12px; height: 12px; color: var(--ink-3); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--bg-sunk); padding-block: 44px 38px; padding-bottom: calc(38px + env(safe-area-inset-bottom, 0px)); }
.footer__grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 32px; }
@media (max-width: 760px) { .footer__grid { grid-template-columns: 1fr; } }
.footer h4 { font-family: var(--font-mono); font-weight: 500; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.footer p, .footer li { font-size: 13.5px; color: var(--ink-2); }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.footer__logo { width: 34px; height: 34px; object-fit: contain; margin-bottom: 12px; }
.footer__bottom { margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px 20px; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); }

/* ---------- lightbox ---------- */
/* A closed <dialog> must stay out of the layout. Author styles beat the UA
   rule `dialog:not([open]) { display: none }` whatever the specificity, so
   the `display` below has to be re-hidden explicitly — otherwise the empty
   fixed, full-bleed dialog sits invisibly on top and swallows every click. */
.lb { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
dialog.lb:not([open]) { display: none; }
.lb::backdrop { background: rgba(8, 10, 14, .76); backdrop-filter: blur(5px); }
.lb[open] { animation: lb-in .22s ease; }
@keyframes lb-in { from { opacity: 0; transform: scale(.985); } }
dialog.lb {
  border: 0; padding: 0; background: transparent; max-width: 100%; max-height: 100%; width: min(980px, 100%);
}
dialog.lb:focus, dialog.lb:focus-visible { outline: none; }
.lb__card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: auto; max-height: calc(100vh - 40px); box-shadow: var(--shadow-lg);
  overscroll-behavior: contain; }
.lb__media { position: relative; background: #0b0d11; }
.lb__media video, .lb__media img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #0b0d11; }
.lb__body { padding: 20px 22px 22px; }
.lb__top { display: flex; align-items: flex-start; gap: 14px; }
.lb__top h3 { font-size: 21px; }
.lb__instr { margin: 12px 0 0; font-size: 14.5px; color: var(--ink-2); }
.lb__chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.lb__close { margin-left: auto; }
.lb__nav { display: flex; gap: 8px; align-items: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.lb__nav .count { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.lb table.mini { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 16px; }
.lb table.mini th, .lb table.mini td { padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.lb table.mini th:first-child { text-align: left; color: var(--ink-3); }
.lb table.mini td:first-child { text-align: left; color: var(--ink); font-weight: 500; }
.lb table.mini thead th { font-weight: 500; color: var(--ink-3); font-size: 11.5px; border-bottom: 1px solid var(--line); }
.lb table.mini tbody tr + tr { border-top: 1px solid var(--line); }
.lb__empty { display: grid; place-items: center; aspect-ratio: 16/9; color: var(--ink-3); font-size: 13.5px; gap: 8px; background: var(--surface-2); }

/* zoomable figure */
.zoom { cursor: zoom-in; }

/* ---------- spec mini-tables ---------- */
table.mini-spec { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini-spec td { padding: 7px 0; vertical-align: top; color: var(--ink-2); border-top: 1px solid var(--line); }
table.mini-spec tr:first-child td { border-top: 0; }
table.mini-spec td:first-child { white-space: nowrap; padding-right: 14px; width: 1%; }
table.mini-spec td:nth-child(2) { white-space: nowrap; padding-right: 14px; width: 1%; font-variant-numeric: tabular-nums; color: var(--ink-3); }
table.mini-spec code { font-family: var(--font-mono); font-size: 11.8px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; }
table.mini-spec em { display: block; font-style: normal; font-size: 10.5px; color: var(--ink-3); margin-top: 3px; font-family: var(--font-mono); }

/* ---------- news ---------- */
.news { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.news li {
  display: grid; grid-template-columns: 120px 1fr; gap: 18px;
  padding: 15px 0; border-top: 1px solid var(--line);
}
.news li:last-child { border-bottom: 1px solid var(--line); }
.news time { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); padding-top: 2px; }
.news p { margin: 0; font-size: 14px; color: var(--ink-2); }
@media (max-width: 560px) { .news li { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- tab buttons (mutation + code) ---------- */
.tab {
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
  padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2);
  transition: color .18s, border-color .18s, background .18s;
}
.tab:hover { color: var(--ink); border-color: var(--line-2); }
.tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--ink-on-accent); }


/* ---------- poster session strip (one row, under the title) ---------- */
.event {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 6px 12px; width: fit-content; max-width: 100%;
  margin: 20px auto 0; padding: 7px 8px 7px 14px;
  border: 1px solid var(--line-2); border-radius: 99px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  font-size: 13.5px; color: var(--ink-2); text-align: left;
}
.event__ico { width: 15px; height: 15px; flex: none; color: var(--ink-3); }
.event__txt { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.event__txt strong { color: var(--ink); font-weight: 600; }
.event__when {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
  color: var(--mut);
}
.event__link {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 12.5px; font-weight: 500; color: var(--ink); text-decoration: none;
  padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface-2); transition: border-color .18s, background .18s;
}
.event__link:hover { border-color: var(--line-2); background: var(--surface); }
.event__link svg { width: 11px; height: 11px; color: var(--ink-3); }
.event.is-now .event__when { color: var(--seed); }
.event.is-past { background: var(--surface-2); box-shadow: none; border-color: var(--line); }

@media (max-width: 620px) {
  .event { border-radius: var(--radius); padding: 12px 14px; }
}

/* ---------- pipeline: wide animated figure + stage stepper ---------- */
.frame--wide { margin-top: clamp(26px, 4vw, 40px); }
.frame--wide > video { border-radius: calc(var(--radius-lg) - 10px); background: #fff; }

.stepper { margin-top: 26px; }
.stepper__dots {
  list-style: none; margin: 0 0 18px; padding: 0;
  display: flex; align-items: center; justify-content: center; gap: 0;
}
.stepper__dots li { display: flex; align-items: center; }
.stepper__dots li + li::before {
  content: ""; width: clamp(24px, 6vw, 72px); height: 1px; background: var(--line-2); flex: none;
}
.stepper__dot {
  position: relative; display: grid; place-items: center;
  width: 34px; height: 34px; margin: 0 6px; padding: 0; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 99px;
  background: var(--surface); color: var(--ink-3);
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.stepper__dot:hover { color: var(--ink); border-color: var(--ink-3); }
.stepper__dot[aria-selected="true"] {
  background: var(--ink); border-color: var(--ink); color: var(--ink-on-accent); transform: scale(1.1);
}
.stepper__panel {
  display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center;
  max-width: 760px; margin-inline: auto;
  padding: 22px 26px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
/* Transparent line art lifted from the method figure, so it inverts cleanly
   with the theme instead of sitting on a white plate. */
.stepper__icon { width: 84px; height: 84px; flex: none; display: grid; place-items: center; }
.stepper__icon img { width: 100%; height: 100%; object-fit: contain; }
:root[data-theme="dark"] .stepper__icon img { filter: invert(1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stepper__icon img { filter: invert(1); }
}
.stepper__k { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; color: var(--ink-3); }
.stepper__panel h3 { font-size: 19px; margin: 6px 0 7px; }
.stepper__panel p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.stepper__panel.is-swapping { opacity: 0; }
.stepper__panel { transition: opacity .18s ease; }
@media (max-width: 560px) {
  .stepper__panel { grid-template-columns: 1fr; gap: 14px; padding: 18px; text-align: left; }
  .stepper__icon { width: 64px; height: 64px; }
  .stepper__dot { width: 30px; height: 30px; margin: 0 3px; }
}

/* ---------- inline video player (pipeline figure) ---------- */
.vplayer { position: relative; }
.vplayer video { display: block; width: 100%; height: auto; border-radius: calc(var(--radius-lg) - 10px); background: #fff; cursor: pointer; }
.vbar {
  display: flex; align-items: center; gap: 12px;
  margin-top: 10px; padding: 0 2px;
}
.vbtn {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--line); border-radius: 99px; background: var(--surface);
  color: var(--ink); cursor: pointer; transition: border-color .18s, background .18s;
}
.vbtn:hover { border-color: var(--line-2); background: var(--surface-2); }
.vbtn svg { width: 12px; height: 12px; }
.vbtn .ic-pause { display: none; }
.vplayer.is-playing .vbtn .ic-play { display: none; }
.vplayer.is-playing .vbtn .ic-pause { display: block; }

.vseek-wrap { position: relative; flex: 1; display: flex; align-items: center; min-width: 0; }
/* a hairline where the right-hand panels take over from the left column */
.vseek-mark {
  position: absolute; top: 50%; translate: -50% -50%; width: 2px; height: 11px;
  border-radius: 1px; background: var(--line-2); pointer-events: none;
}
.vseek {
  -webkit-appearance: none; appearance: none; width: 100%; height: 18px;
  background: transparent; cursor: pointer; margin: 0;
}
.vseek::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: var(--line); }
.vseek::-moz-range-track { height: 4px; border-radius: 99px; background: var(--line); }
.vseek::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--ink-3); }
.vseek::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 13px; height: 13px; margin-top: -4.5px;
  border-radius: 99px; background: var(--ink); border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line-2);
}
.vseek::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 99px; background: var(--ink);
  border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2);
}
.vseek:focus-visible { outline: 2px solid var(--seed); outline-offset: 4px; border-radius: 99px; }
.vtime {
  flex: none; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; min-width: 4.5ch; text-align: right;
}

/* progress score riding alongside the success rate in each results cell */
table.rt .ps {
  display: inline-block; font-style: normal; margin-left: 7px;
  font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
table.rt td.v.is-best .ps { font-weight: 400; }
