/*
 * ANTIBODY — Gram Stain design system
 * See DESIGN.md for the contract behind every token.
 */

/* ---------- Tokens ---------- */
:root {
  --bg: oklch(0.965 0.006 245);
  --surface: oklch(0.995 0.002 250);
  --sunken: oklch(0.94 0.008 250);
  --ink: oklch(0.21 0.03 270);
  --ink-2: oklch(0.38 0.025 268);
  --ink-3: oklch(0.49 0.02 265);
  --rule: oklch(0.88 0.01 255);
  --rule-strong: oklch(0.74 0.015 258);

  --accent: oklch(0.54 0.2 15);        /* Safranin — interaction only */
  --accent-hover: oklch(0.47 0.19 15);
  --on-accent: oklch(0.99 0.005 15);

  --violet: oklch(0.44 0.17 312);      /* Crystal violet — caught */
  --violet-lite: oklch(0.62 0.16 312);
  --violet-soft: oklch(0.93 0.035 312);
  --amber: oklch(0.76 0.15 70);        /* Iodine amber — escaped */
  --amber-ink: oklch(0.5 0.12 58);
  --amber-soft: oklch(0.95 0.055 85);
  --green: oklch(0.5 0.13 150);
  --green-soft: oklch(0.94 0.045 150);
  --red: oklch(0.55 0.2 28);

  /* Darkfield: code specimens, constant in both themes */
  --dark: oklch(0.19 0.022 272);
  --dark-2: oklch(0.27 0.022 272);
  --code-fg: oklch(0.92 0.01 255);
  --code-dim: oklch(0.66 0.02 265);

  --f-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;

  --r-xs: 2px;
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --shadow-float: 0 1px 0 oklch(1 0 0 / 0.06) inset, 0 18px 48px -12px oklch(0.15 0.03 270 / 0.35);

  --sec-pad: clamp(72px, 8vw, 120px);

  /* Aliases consumed by script.js inline styles */
  --ink-primary: var(--ink);
  --ink-secondary: var(--ink-2);
  --ink-muted: var(--ink-3);
  --font-mono: var(--f-mono);
  --proof-green: var(--green);
  --escape-amber: var(--amber-ink);
  --alert-red: var(--red);
  --stain-violet: var(--violet);
  --bg-surface: var(--sunken);
  --border-surgical: var(--rule);
  --radius-sm: var(--r-sm);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: oklch(0.165 0.014 270);
  --surface: oklch(0.205 0.016 270);
  --sunken: oklch(0.14 0.012 270);
  --ink: oklch(0.95 0.008 250);
  --ink-2: oklch(0.8 0.012 255);
  --ink-3: oklch(0.66 0.015 260);
  --rule: oklch(0.29 0.015 268);
  --rule-strong: oklch(0.42 0.018 265);

  --accent: oklch(0.66 0.19 15);
  --accent-hover: oklch(0.72 0.17 15);
  --on-accent: oklch(0.16 0.02 15);

  --violet: oklch(0.7 0.15 312);
  --violet-lite: oklch(0.78 0.12 312);
  --violet-soft: oklch(0.3 0.08 312);
  --amber: oklch(0.8 0.14 75);
  --amber-ink: oklch(0.82 0.13 75);
  --amber-soft: oklch(0.3 0.06 70);
  --green: oklch(0.76 0.14 150);
  --green-soft: oklch(0.28 0.05 150);
  --red: oklch(0.7 0.17 28);

  --dark: oklch(0.12 0.012 270);
  --dark-2: oklch(0.24 0.016 270);

  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  font-kerning: auto;
  font-variant-ligatures: common-ligatures contextual;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 300ms var(--ease-out), color 300ms var(--ease-out);
}
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img, svg { display: block; }
code { font-family: var(--f-mono); font-size: 0.9em; }
:where(p, li, dd) code { background: var(--sunken); padding: 1px 5px; border-radius: var(--r-sm); }
.font-mono { font-family: var(--f-mono); }

::selection { background: var(--accent); color: var(--on-accent); }
* { scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 6px; }

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

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r-md);
  font-weight: 600; text-decoration: none; transition: top 200ms var(--ease-out);
}
.skip-link:focus { top: 12px; }

.wrap { max-width: 1240px; margin: 0 auto; padding-inline: clamp(16px, 4vw, 40px); }
.ico { width: 16px; height: 16px; flex: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 20px;
  border: 1px solid transparent; border-radius: 999px;
  font-family: var(--f-body); font-size: 15px; font-weight: 600; line-height: 1.2;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 200ms var(--ease-out),
              color 200ms var(--ease-out), border-color 200ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn .ico { transition: transform 200ms var(--ease-out); }
.btn:hover .ico use[href="#i-arrow"], .btn:hover .ico:last-child { transform: translateX(2px); }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn-ghost:hover { border-color: var(--ink); background: var(--sunken); }
.btn-ink { background: var(--ink); color: var(--bg); }
.btn-ink:hover { background: var(--accent); color: var(--on-accent); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 17px 28px; font-size: 17px; }
.btn-block { flex: 1; }
.magnetic { will-change: transform; }

.ctl {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; min-width: 36px; padding: 0 10px;
  background: transparent; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 999px;
  font-family: var(--f-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  cursor: pointer; transition: border-color 200ms var(--ease-out), background-color 200ms var(--ease-out);
}
.ctl:hover { border-color: var(--ink); }
.theme-icon { display: inline-flex; }
.ico-moon { display: none; }
[data-theme="dark"] .ico-moon { display: block; }
[data-theme="dark"] .ico-sun { display: none; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklch, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.nav-row { display: flex; align-items: center; gap: 16px; height: 64px; }
.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--f-display); font-weight: 800; font-size: 22px; letter-spacing: -0.03em;
  text-decoration: none; color: var(--ink);
  font-variation-settings: "opsz" 48;
}
.wordmark-mark { width: 22px; height: 22px; color: var(--accent); }
.wordmark-mark circle:last-child { fill: var(--violet); }
.nav-event {
  font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3);
  padding-left: 16px; border-left: 1px solid var(--rule); white-space: nowrap;
}
.nav-links { display: flex; gap: 0; margin-left: auto; }
.nav-links a {
  font-size: 13px; font-weight: 500; color: var(--ink-2); text-decoration: none;
  padding: 6px 8px; border-radius: 999px; white-space: nowrap;
  transition: color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.nav-links a:hover { color: var(--ink); background: var(--sunken); }
.nav-controls { display: flex; align-items: center; gap: 8px; margin-left: 12px; }

.nav-menu { position: relative; display: none; }
.nav-menu summary { list-style: none; }
.nav-menu summary::-webkit-details-marker { display: none; }
.burger { width: 14px; height: 1.5px; background: currentColor; box-shadow: 0 -4.5px 0 currentColor, 0 4.5px 0 currentColor; }
.nav-menu-panel {
  position: absolute; right: 0; top: calc(100% + 10px);
  display: grid; min-width: 230px; padding: 6px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg);
  box-shadow: var(--shadow-float);
}
.nav-menu-panel a { padding: 10px 12px; border-radius: var(--r-md); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-menu-panel a:hover { background: var(--sunken); }

@media (max-width: 1520px) {
  .nav-event { display: none; }
}
@media (max-width: 1400px) {
  .nav-links { display: none; }
  .nav-controls { margin-left: auto; }
  .nav-menu { display: block; }
}
@media (max-width: 560px) {
  .nav-event { display: none; }
  .nav-controls .btn-sm span { display: none; }
  .nav-controls .btn-sm { padding: 0; width: 36px; height: 36px; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(40px, 7vw, 88px) 0 clamp(56px, 7vw, 96px); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(32px, 5vw, 72px); align-items: center;
}
.dateline {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-2);
  margin-bottom: clamp(24px, 3vw, 36px);
}
.dateline::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.dateline-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }

.hero-title {
  font-family: var(--f-display); font-weight: 800;
  font-size: clamp(2.3rem, 1.2rem + 3.7vw, 4.4rem);
  line-height: 1; letter-spacing: -0.022em;
  text-wrap: balance;
}
.hero-title > span { display: block; }
.h1-b { font-weight: 500; color: var(--ink-2); margin-top: 0.12em; }
.h1-b em {
  font-style: normal; font-weight: 800; color: var(--ink);
  background: linear-gradient(transparent 86%, var(--accent) 86% 94%, transparent 94%);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.hero-sub { margin-top: 28px; font-size: clamp(1rem, 0.94rem + 0.3vw, 1.15rem); line-height: 1.6; color: var(--ink-2); max-width: 58ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

.js .hero-title > span { clip-path: inset(0 0 100% 0); transform: translateY(0.25em); animation: rise 900ms var(--ease-out) forwards; }
.js .hero-title .h1-b { animation-delay: 140ms; }
.js .hero-sub, .js .hero-actions { opacity: 0; animation: fade 700ms var(--ease-out) 380ms forwards; }
.js .slide { opacity: 0; animation: fade 900ms var(--ease-out) 200ms forwards; }
@keyframes rise { to { clip-path: inset(0 0 -10% 0); transform: none; } }
@keyframes fade { to { opacity: 1; } }

/* Signature: the slide under the lens */
.slide { position: relative; }
.slide-frame {
  position: relative;
  height: clamp(400px, 44vw, 560px);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--dark);
  isolation: isolate;
  touch-action: pan-y;
  --x: 50%; --y: 50%; --r: 110px;
}
.slide-layer { position: absolute; inset: 0; padding: 26px 26px; overflow: hidden; }
.slide-code {
  margin: 0; font-family: var(--f-mono); font-size: 12.5px; line-height: 1.72;
  white-space: pre; color: oklch(0.58 0.02 265);
}
.slide-code i { font-style: normal; display: inline-block; width: 3.2ch; margin-right: 1.6ch; text-align: right; opacity: 0.55; }
.slide-code .f { color: oklch(0.8 0.015 260); font-weight: 500; }

.slide-stain {
  background:
    radial-gradient(circle at var(--x) var(--y), oklch(0.99 0.01 350) 0, oklch(0.95 0.03 350) calc(var(--r) * 0.9), oklch(0.9 0.05 350) var(--r));
  clip-path: circle(var(--r) at var(--x) var(--y));
}
.slide-stain .slide-code { color: oklch(0.55 0.15 8); }
.slide-stain .slide-code i { color: oklch(0.55 0.08 8); }
.slide-stain .f { color: oklch(0.3 0.04 280); font-weight: 700; }
.slide-stain .f::after {
  content: attr(data-tag);
  margin-left: 1.4ch; padding: 1px 7px; border-radius: 3px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em;
}
.slide-stain .f[data-state="twin"]::after { background: oklch(0.42 0.17 312); color: #fff; }
.slide-stain .f[data-state="suspected"]::after { background: oklch(0.8 0.15 75); color: oklch(0.3 0.06 60); }
.slide-stain .f[data-state="rejected"]::after { border: 1px solid currentColor; color: oklch(0.55 0.15 8); }
.slide-stain .f[data-state="origin"]::after { background: oklch(0.45 0.12 150); color: #fff; }
.slide-stain .t {
  padding: 2px 6px 2px 0; margin-left: -2px; border-radius: 3px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.slide-stain .t[data-state="twin"] { background: oklch(0.42 0.17 312); color: #fff; font-weight: 700; }
.slide-stain .t[data-state="twin"] i { color: oklch(0.85 0.06 312); opacity: 1; }
.slide-stain .t[data-state="suspected"] { background: oklch(0.84 0.14 78); color: oklch(0.28 0.05 60); font-weight: 700; }
.slide-stain .t[data-state="origin"] { color: oklch(0.4 0.12 150); text-decoration: underline 2px; text-underline-offset: 3px; }
.slide-stain .t[data-state="rejected"] { color: oklch(0.55 0.15 8); }

.lens {
  position: absolute; left: 0; top: 0; z-index: 3;
  width: calc(var(--r) * 2); height: calc(var(--r) * 2);
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 0 6px oklch(0.19 0.02 272 / 0.55), var(--shadow-float);
  transform: translate3d(calc(var(--x) - var(--r)), calc(var(--y) - var(--r)), 0);
  pointer-events: none;
  background:
    linear-gradient(var(--accent), var(--accent)) center 10px / 1px 10px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center calc(100% - 10px) / 1px 10px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 10px center / 10px 1px no-repeat,
    linear-gradient(var(--accent), var(--accent)) calc(100% - 10px) center / 10px 1px no-repeat;
}
.lens-mag {
  position: absolute; left: 50%; bottom: -26px; transform: translateX(-50%);
  font-family: var(--f-mono); font-size: 10px; font-weight: 700; color: var(--accent);
  background: var(--dark); padding: 1px 6px; border-radius: 3px;
}
.slide-cap {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  margin-top: 14px; font-family: var(--f-mono); font-size: 12px; color: var(--ink-3);
}
.slide-cap-readout { color: var(--accent); font-weight: 700; white-space: nowrap; }

/* Spec strip */
.spec-strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(56px, 7vw, 88px);
  border-top: 1px solid var(--ink);
}
.spec { padding: 18px 20px 0 0; }
.spec + .spec { padding-left: 20px; border-left: 1px solid var(--rule); }
.spec dt { font-weight: 600; font-size: 15.5px; line-height: 1.3; }
.spec dd { margin-top: 6px; font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); }

/* ---------- Sections ---------- */
.sec { padding-block: var(--sec-pad); }
.sec-lab, .sec-proof { background: var(--surface); border-block: 1px solid var(--rule); }
.sec-sandbox { background: var(--sunken); }

.sec-head {
  position: relative;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px;
  padding-top: 22px; margin-bottom: clamp(40px, 5vw, 64px);
}
.sec-head::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--ink);
  transform-origin: left center;
}
.sec-label {
  grid-column: 1 / 4; grid-row: 1 / 3;
  display: flex; align-items: baseline; gap: 10px;
  font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-2); line-height: 1.5;
  padding-top: 10px;
}
.sec-label::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--violet); transform: translateY(-1px);
}
.sec-head h2, .gitops h2 {
  font-family: var(--f-display); font-weight: 700;
  font-size: clamp(2rem, 1.25rem + 2.7vw, 3.6rem);
  line-height: 1.04; letter-spacing: -0.018em;
  text-wrap: balance;
}
.sec-head h2 { grid-column: 4 / 13; max-width: 20ch; }
.sec-lede { grid-column: 4 / 12; margin-top: 20px; font-size: 17.5px; color: var(--ink-2); max-width: 62ch; }

.js .sec-head::before { transform: scaleX(0); transition: transform 1100ms var(--ease-in-out); }
.js .sec-head h2 { clip-path: inset(0 0 100% 0); transform: translateY(0.3em); transition: clip-path 900ms var(--ease-out) 150ms, transform 900ms var(--ease-out) 150ms; }
.js .sec-head.is-in::before { transform: scaleX(1); }
.js .sec-head.is-in h2 { clip-path: inset(0 0 -10% 0); transform: none; }

/* ---------- Lab ---------- */
.lab { border: 1px solid var(--rule-strong); border-radius: var(--r-lg); background: var(--bg); overflow: hidden; }
.lab-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 18px; border-bottom: 1px solid var(--rule); background: var(--surface);
}
.specimen { display: flex; align-items: center; gap: 10px; min-width: 0; }
.specimen-label { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.specimen-select {
  appearance: none; -webkit-appearance: none;
  min-width: 0; max-width: 100%;
  padding: 9px 36px 9px 12px;
  font: 500 14px var(--f-body); color: var(--ink);
  background: var(--sunken) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23777' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--rule); border-radius: var(--r-md); cursor: pointer;
  text-overflow: ellipsis;
}
.specimen-select:hover { border-color: var(--rule-strong); }

.stepper {
  display: flex; gap: 2px; padding: 3px;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--sunken);
  overflow-x: auto; max-width: 100%;
}
.phase-step {
  padding: 7px 14px; border: 0; border-radius: 999px; background: transparent;
  font-family: var(--f-mono); font-size: 12px; font-weight: 500; color: var(--ink-3);
  white-space: nowrap; cursor: pointer;
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}
.phase-step:hover { color: var(--ink); }
.phase-step.completed { color: var(--violet); }
.phase-step.completed::before { content: "✓ "; }
.phase-step.active { background: var(--ink); color: var(--bg); }

.lab-grid { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); }
.lab-plate { display: flex; flex-direction: column; gap: 22px; padding: 24px; border-right: 1px solid var(--rule); }

.score-label { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); }
.score-num { display: flex; align-items: flex-start; margin-top: 4px; }
.score-val {
  font-family: var(--f-display); font-weight: 800; font-size: clamp(88px, 9vw, 120px);
  line-height: 0.88; letter-spacing: -0.03em; font-variant-numeric: lining-nums tabular-nums;
  font-variation-settings: "opsz" 144;
}
.score-pct { font-family: var(--f-display); font-weight: 500; font-size: 36px; line-height: 1; color: var(--ink-3); margin: 6px 0 0 4px; }
.score-ratio { margin-top: 10px; font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-2); }

.rounds { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--rule-strong); border-radius: var(--r-md); overflow: hidden; }
.round-btn {
  padding: 9px 6px; border: 0; background: var(--surface); cursor: pointer;
  font-family: var(--f-mono); font-size: 11.5px; line-height: 1.3; color: var(--ink-2);
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}
.round-btn + .round-btn { border-left: 1px solid var(--rule-strong); }
.round-btn:hover { background: var(--sunken); color: var(--ink); }
.round-btn.active { background: var(--ink); color: var(--bg); }

.plate {
  padding: 14px 16px 16px;
  background: var(--surface);
  border: 1.5px solid var(--rule-strong); border-radius: 3px 16px 16px 16px;
}
.plate-head { display: flex; justify-content: space-between; gap: 8px; font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); }
.plate-body { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.plate-row { font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); padding-bottom: 18px; }
.well-grid { flex: 1; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.well-unit {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 0; border: 0; background: none; cursor: pointer;
}
.well-circle {
  width: 100%; max-width: 42px; aspect-ratio: 1; border-radius: 50%;
  background: var(--sunken);
  border: 1.5px solid var(--rule-strong);
  box-shadow: inset 0 2px 5px oklch(0.2 0.03 270 / 0.18);
  transition: background-color 400ms var(--ease-out), border-color 400ms var(--ease-out), transform 160ms var(--ease-out);
}
.well-unit[data-state="detected"] .well-circle {
  background: radial-gradient(circle at 35% 32%, var(--violet-lite), var(--violet) 70%);
  border-color: var(--violet);
}
.well-unit[data-state="escaped"] .well-circle {
  background: radial-gradient(circle at 35% 32%, oklch(0.9 0.12 90), var(--amber) 70%);
  border-color: var(--amber);
}
.well-unit:hover .well-circle { transform: scale(1.07); }
.well-unit.active-well .well-circle { outline: 2px solid var(--accent); outline-offset: 3px; }
.well-unit.pop .well-circle { animation: pop 280ms var(--ease-out); }
@keyframes pop { 0% { transform: scale(0.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.well-tag { font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); }
.plate-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--rule); font-family: var(--f-mono); font-size: 11px; color: var(--ink-2); }
.legend { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 10px; height: 10px; border-radius: 50%; }
.swatch-caught { background: var(--violet); }
.swatch-escaped { background: var(--amber); }

.sim-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.sim-controls .btn { flex: 1 1 auto; padding: 12px 16px; font-size: 14px; }
.ico-pause { display: none; }
#sim-play-btn.is-playing .ico-pause { display: block; }
#sim-play-btn.is-playing .ico-play { display: none; }

.lab-inspector { min-width: 0; display: flex; flex-direction: column; background: var(--surface); }
.tabs { display: flex; gap: 0; padding: 0 8px; border-bottom: 1px solid var(--rule); overflow-x: auto; }
.tab-btn {
  padding: 15px 9px 13px; border: 0; border-bottom: 2px solid transparent; background: none;
  font-size: 13px; font-weight: 500; color: var(--ink-3); white-space: nowrap; cursor: pointer;
  transition: color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--ink); border-bottom-color: var(--accent); }
.inspector-body { padding: 24px; min-height: 540px; font-size: 14px; }

/* Script-generated inspector content */
.diagnosis-banner { padding: 18px 20px; background: var(--sunken); border-radius: var(--r-md); }
.diag-title { font-family: var(--f-display); font-weight: 600; font-size: 21px; line-height: 1.2; letter-spacing: -0.01em; }
.diag-desc { margin-top: 6px; color: var(--ink-2); }
.twins-stack { display: grid; gap: 8px; }
.twin-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--bg);
}
.twin-card-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.twin-badge {
  display: inline-block; padding: 3px 7px; border-radius: var(--r-sm);
  font-family: var(--f-mono); font-size: 11px; font-weight: 700;
  background: var(--ink); color: var(--bg);
}
.twin-file { font-family: var(--f-mono); font-size: 12.5px; font-weight: 500; overflow-wrap: anywhere; }
.twin-reason { font-size: 13px; color: var(--ink-2); }
.twin-status-pill, .twin-badge.status-fixed, .twin-badge.status-suspected {
  display: inline-block; padding: 4px 9px; border-radius: 999px;
  font-family: var(--f-mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap;
}
.status-fixed { background: var(--violet-soft); color: var(--violet); }
.status-suspected { background: var(--amber-soft); color: var(--amber-ink); }
.status-rejected { background: var(--sunken); color: var(--ink-3); text-decoration: line-through; }

/* ---------- Code specimens (darkfield) ---------- */
.code-window { margin-top: 16px; background: var(--dark); border: 1px solid var(--dark-2); border-radius: var(--r-md); overflow: hidden; }
.code-window-header { display: flex; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--dark-2); }
.window-dots { display: none; }
.window-filename { font-family: var(--f-mono); font-size: 11.5px; color: var(--code-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-pre {
  margin: 0; padding: 16px; overflow-x: auto;
  font-family: var(--f-mono); font-size: 12.5px; line-height: 1.7; color: var(--code-fg);
  white-space: pre; tab-size: 4;
}
.code-pre code { font-size: inherit; }
.hl-keyword { color: oklch(0.76 0.14 355); }
.hl-func { color: oklch(0.8 0.09 245); }
.hl-string { color: oklch(0.85 0.12 85); }
.hl-comment { color: oklch(0.6 0.02 265); font-style: italic; }
.line-del, .line-add { display: inline-block; min-width: calc(100% + 32px); margin: 0 -16px; padding: 0 16px; }
.line-del { background: oklch(0.6 0.2 25 / 0.16); color: oklch(0.82 0.1 25); }
.line-add { background: oklch(0.7 0.16 150 / 0.14); color: oklch(0.86 0.12 150); }
.c-warn { color: oklch(0.84 0.14 80); }
.c-dim { color: oklch(0.65 0.02 265); }
.c-pass { color: oklch(0.8 0.17 150); }
.c-fail { color: oklch(0.72 0.17 25); }
.c-path { color: oklch(0.78 0.1 245); }
.c-cmd { color: #fff; font-weight: 700; }

/* ---------- Repo map ---------- */
.map { border: 1px solid var(--rule-strong); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.map-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--rule); }
.map-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.map-status-pill {
  display: inline-flex; align-items: center; gap: 9px; padding: 6px 12px; border-radius: 999px;
  font-family: var(--f-mono); font-size: 12px; font-weight: 500;
  transition: background-color 400ms var(--ease-out), color 400ms var(--ease-out);
}
.status-quarantine { background: var(--amber-soft); color: var(--amber-ink); }
.status-immune { background: var(--violet-soft); color: var(--violet); }
.status-active-pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

.map-scroll { overflow-x: auto; }
.repo-canvas-stage {
  position: relative; min-width: 780px; aspect-ratio: 1040 / 480;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 52px 48px;
  background-position: -1px -1px;
}
.repo-svg-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.repo-svg-edge {
  stroke: var(--rule-strong); stroke-width: 1.5; stroke-dasharray: 3 6; fill: none;
  vector-effect: non-scaling-stroke;
  transition: stroke 500ms var(--ease-out);
}
.repo-svg-edge.infected { stroke: var(--amber); animation: flow 1.4s linear infinite; }
.repo-svg-edge.immunized { stroke: var(--violet); stroke-dasharray: none; stroke-width: 2; }
@keyframes flow { to { stroke-dashoffset: -18; } }

.repo-node {
  position: absolute;
  left: calc(var(--nx) / 1040 * 100%); top: calc(var(--ny) / 480 * 100%);
  transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 7px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: 999px;
  text-align: left; cursor: pointer;
  transition: border-color 300ms var(--ease-out), background-color 300ms var(--ease-out), transform 160ms var(--ease-out);
}
.repo-node:hover { border-color: var(--ink); }
.repo-node:active { transform: translate(-50%, -50%) scale(0.97); }
.node-cell {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: var(--sunken); border: 1.5px solid var(--rule-strong);
  transition: background-color 400ms var(--ease-out), border-color 400ms var(--ease-out);
}
.repo-node.origin .node-cell { background: var(--red); border-color: var(--red); box-shadow: inset 0 0 0 4px var(--surface); }
.repo-node.infected .node-cell { background: var(--amber); border-color: var(--amber); }
.repo-node.suspect .node-cell { border: 1.5px dashed var(--amber-ink); }
.repo-node.immunized .node-cell { background: var(--violet); border-color: var(--violet); }
.repo-node.infected { border-color: color-mix(in oklch, var(--amber) 70%, var(--rule-strong)); }
.repo-node.immunized { border-color: color-mix(in oklch, var(--violet) 60%, var(--rule-strong)); }
.repo-node.shield .node-cell { box-shadow: 0 0 0 3px var(--surface), 0 0 0 4.5px var(--violet); }
.node-text-wrap { display: grid; line-height: 1.3; }
.node-filename { font-family: var(--f-mono); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.node-role-tag { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.node-badge-shield {
  position: absolute; top: -9px; right: -8px;
  min-width: 22px; height: 22px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--violet); color: #fff;
  font-family: var(--f-mono); font-size: 10.5px; font-weight: 700;
  border: 2px solid var(--surface);
}
.map-drawer { display: grid; gap: 4px; padding: 16px 20px; border-top: 1px solid var(--rule); background: var(--sunken); font-size: 13.5px; color: var(--ink-2); }
.map-drawer b { color: var(--ink); font-weight: 600; }
.map-hint, #node-detail-hint { color: var(--ink-3); }

/* ---------- Problem ---------- */
.tax-list { border-top: 1px solid var(--ink); }
.tax {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 4vw, 64px);
  padding: clamp(28px, 3.5vw, 44px) 0; border-bottom: 1px solid var(--rule);
}
.tax-metric {
  font-family: var(--f-display); font-weight: 600;
  font-size: clamp(1.5rem, 1rem + 1.6vw, 2.35rem); line-height: 1.08; letter-spacing: -0.022em;
  font-variation-settings: "opsz" 96; text-wrap: balance;
}
.tax-body h3 { font-size: 19px; font-weight: 600; line-height: 1.3; }
.tax-body p { margin-top: 10px; color: var(--ink-2); max-width: 60ch; }

/* ---------- Microscope ---------- */
.lens-switch {
  display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; margin-bottom: 24px;
  border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--surface);
}
.lens-mode-btn {
  padding: 9px 16px; border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}
.lens-mode-btn:hover { color: var(--ink); }
.lens-mode-btn.active { background: var(--ink); color: var(--bg); }
.scope-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.scope-panel { min-width: 0; padding: 20px; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--surface); }
.scope-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); }
.scope-engine { font-size: 11px; color: var(--violet); font-weight: 700; }
.scope-panel .code-window { margin-top: 14px; }
.scope-note { margin-top: 16px; font-size: 14px; color: var(--ink-2); line-height: 1.65; }
.scope-note b { color: var(--ink); }
.ast-tree-diagram {
  margin-top: 14px; padding: 18px; min-height: 190px; overflow-x: auto;
  background: var(--dark); color: var(--code-fg); border-radius: var(--r-md);
  font-family: var(--f-mono); font-size: 12.5px; line-height: 1.85; white-space: pre;
}
.ast-aware { color: oklch(0.82 0.16 150); background: oklch(0.7 0.16 150 / 0.15); padding: 2px 6px; border-radius: 4px; }
.ast-naive { color: oklch(0.75 0.16 25); background: oklch(0.6 0.2 25 / 0.18); padding: 2px 6px; border-radius: 4px; font-weight: 700; }
.ast-callout { display: block; margin-top: 10px; color: oklch(0.84 0.14 80); font-size: 12px; }
.scope-why { margin-top: 16px; padding: 14px 16px; background: var(--sunken); border-radius: var(--r-md); font-size: 13.5px; color: var(--ink-2); }
.scope-why b { color: var(--ink); }
.scope-why code { background: var(--surface); padding: 1px 5px; border-radius: var(--r-sm); }

/* ---------- Phases ---------- */
.loop { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ink); counter-reset: none; }
.loop-step { position: relative; padding: 30px 24px 8px 0; }
.loop-step + .loop-step { padding-left: 24px; border-left: 1px solid var(--rule); }
.loop-step::before {
  content: ""; position: absolute; top: -6px; left: 0;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--ink);
}
.loop-step + .loop-step::before { left: -6px; }
.loop-step:last-child::before { background: var(--violet); border-color: var(--violet); }
.phase-num { font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.04em; }
.loop-step h3 {
  margin-top: 10px; font-family: var(--f-display); font-weight: 700;
  font-size: clamp(1.6rem, 1.2rem + 1vw, 2.1rem); line-height: 1.05; letter-spacing: -0.02em;
}
.phase-who { margin: 10px 0 14px; font-family: var(--f-mono); font-size: 12px; color: var(--violet); line-height: 1.5; }
.loop-step p:not(.phase-who) { font-size: 15px; color: var(--ink-2); }
.loop-out { display: inline-block; margin-top: 18px; padding: 5px 9px; background: var(--sunken); border-radius: var(--r-sm); font-size: 11.5px; color: var(--ink); }

/* ---------- Adversarial self-play (darkfield band) ---------- */
.sec-adv {
  --bg: oklch(0.17 0.02 272);
  --surface: oklch(0.215 0.022 272);
  --sunken: oklch(0.14 0.018 272);
  --ink: oklch(0.96 0.008 250);
  --ink-2: oklch(0.8 0.014 258);
  --ink-3: oklch(0.66 0.016 262);
  --rule: oklch(0.3 0.02 270);
  --rule-strong: oklch(0.42 0.02 268);
  --violet: oklch(0.7 0.16 312);
  --violet-lite: oklch(0.8 0.12 312);
  --amber: oklch(0.8 0.14 75);
  --dark: oklch(0.12 0.014 272);
  --dark-2: oklch(0.26 0.018 272);
  --team-red: oklch(0.68 0.19 25);
  --team-blue: oklch(0.72 0.12 245);
  background: var(--bg); color: var(--ink);
}
[data-theme="dark"] .sec-adv { --bg: oklch(0.12 0.014 272); --surface: oklch(0.17 0.016 272); border-block: 1px solid oklch(0.26 0.015 270); }
.sec-adv .sec-head::before { background: var(--ink-3); }

.adv-intro {
  max-width: 62ch; margin: 0 0 clamp(36px, 4vw, 56px) auto;
  font-family: var(--f-display); font-weight: 500; font-size: clamp(1.25rem, 1rem + 0.8vw, 1.7rem);
  line-height: 1.35; letter-spacing: -0.01em; color: var(--ink-2); text-wrap: pretty;
}

.duel { display: grid; grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr); align-items: stretch; }
.team {
  position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0;
  padding: clamp(22px, 3vw, 34px);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg);
}
.team-red { --team: var(--team-red); }
.team-blue { --team: var(--team-blue); }
.team::before {
  content: ""; position: absolute; left: 22px; right: 22px; top: -1px; height: 2px; background: var(--team); border-radius: 2px;
}
.team-head { display: flex; align-items: center; gap: 10px; }
.team-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--team); }
.team-role { font-family: var(--f-mono); font-size: 12px; color: var(--team); font-weight: 700; }
.team h3 { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.8rem, 1.3rem + 1.4vw, 2.5rem); line-height: 1.02; letter-spacing: -0.02em; }
.team p { color: var(--ink-2); font-size: 15.5px; }
.team .code-window { margin-top: 4px; }
.mutations { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.mutations li code {
  display: inline-block; padding: 6px 10px; border-radius: var(--r-sm);
  background: var(--sunken); border: 1px dashed color-mix(in oklch, var(--team-red) 55%, transparent);
  color: oklch(0.84 0.08 25); font-size: 12px;
}
.team .blind {
  margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--rule);
  font-family: var(--f-mono); font-size: 12px; color: var(--ink-3);
}
.blind code { background: none; padding: 0; color: var(--ink); text-decoration: line-through; text-decoration-color: var(--team); text-decoration-thickness: 1.5px; }

.duel-wall { position: relative; display: grid; place-items: center; color: var(--ink-3); }
.duel-wall::before { content: ""; position: absolute; top: 12%; bottom: 12%; left: 50%; border-left: 1px dashed var(--rule-strong); }
.duel-wall svg { position: relative; width: 30px; height: 30px; padding: 5px; background: var(--bg); border-radius: 50%; }

.arena {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 4vw, 64px); align-items: center;
  margin-top: clamp(48px, 6vw, 80px); padding-top: clamp(32px, 4vw, 48px); border-top: 1px solid var(--rule);
}
.arena-copy h3 { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.6rem, 1.2rem + 1.1vw, 2.2rem); line-height: 1.08; letter-spacing: -0.018em; max-width: 16ch; }
.arena-steps { counter-reset: step; margin-top: 22px; display: grid; gap: 16px; }
.arena-steps li { counter-increment: step; position: relative; padding-left: 40px; color: var(--ink-2); font-size: 15.5px; }
.arena-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  width: 26px; height: 26px; display: grid; place-items: center;
  border: 1px solid var(--rule-strong); border-radius: 50%;
  font-family: var(--f-mono); font-size: 11.5px; font-weight: 700; color: var(--ink);
}

.arena-track { padding: clamp(18px, 2.5vw, 28px); background: var(--dark); border: 1px solid var(--dark-2); border-radius: var(--r-lg); }
.arena-track-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3); }
.round-row {
  display: grid; grid-template-columns: 84px minmax(0, 1fr) 64px; align-items: center; gap: 16px;
  padding: 16px 0; border-bottom: 1px dashed var(--dark-2);
}
.round-name { font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); }
.mini-wells { display: grid; grid-template-columns: repeat(6, minmax(0, 34px)); gap: clamp(6px, 1.2vw, 12px); }
.mini-wells i {
  aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, oklch(0.9 0.12 90), var(--amber) 70%);
  box-shadow: inset 0 0 0 1.5px oklch(1 0 0 / 0.08);
  transition: background-color 500ms var(--ease-out), transform 500ms var(--ease-out), opacity 500ms var(--ease-out);
}
.mini-wells i.c { background: radial-gradient(circle at 35% 32%, var(--violet-lite), oklch(0.46 0.17 312) 72%); }
.round-score { justify-self: end; font-family: var(--f-display); font-weight: 700; font-size: 26px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.round-score-win { color: var(--violet-lite); }
.arena-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-family: var(--f-mono); font-size: 11px; color: var(--ink-2); }

.js .arena-track .round-row { opacity: 0.25; transition: opacity 600ms var(--ease-out) calc(var(--d) * 450ms); }
.js .arena-track .mini-wells i { transform: scale(0.8); transition-delay: calc(var(--d) * 450ms + 150ms); }
.js .arena-track.is-in .round-row { opacity: 1; }
.js .arena-track.is-in .mini-wells i { transform: none; }

.adv-result {
  margin: clamp(48px, 6vw, 80px) 0 0; padding-top: 28px; border-top: 1px solid var(--ink-3);
}
.adv-result p {
  max-width: 30ch;
  font-family: var(--f-display); font-weight: 700; font-size: clamp(1.7rem, 1.1rem + 2.2vw, 3rem);
  line-height: 1.08; letter-spacing: -0.022em; text-wrap: balance;
}

@media (max-width: 960px) {
  .duel { grid-template-columns: 1fr; }
  .duel-wall { height: 56px; }
  .duel-wall::before { top: 0; bottom: 0; }
  .arena { grid-template-columns: 1fr; }
  .adv-intro { margin-left: 0; }
}
@media (max-width: 640px) {
  .round-row { grid-template-columns: 1fr auto; gap: 10px 12px; }
  .mini-wells { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- Proof ---------- */
.versus { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 20px; align-items: stretch; }
.verdict { min-width: 0; padding: clamp(20px, 2.6vw, 32px); border-radius: var(--r-lg); background: var(--bg); }
.verdict-guess { border: 1.5px dashed var(--rule-strong); }
.verdict-proof { border: 1.5px solid var(--ink); }
.verdict-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.verdict-who { font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); }
.verdict-tag { padding: 3px 9px; border-radius: 999px; font-family: var(--f-mono); font-size: 11px; font-weight: 700; }
.verdict-guess .verdict-tag { background: var(--amber-soft); color: var(--amber-ink); }
.verdict-proof .verdict-tag { background: var(--violet-soft); color: var(--violet); }
.verdict h3 { margin: 22px 0 10px; font-family: var(--f-display); font-weight: 700; font-size: clamp(1.6rem, 1.2rem + 1.1vw, 2.2rem); line-height: 1.05; letter-spacing: -0.02em; }
.verdict-guess h3 { color: var(--ink-2); }
.verdict > p { color: var(--ink-2); font-size: 15px; }
.verdict .code-window { margin-top: 22px; }
.verdict .code-pre { white-space: pre-wrap; }
.versus-mark { align-self: center; font-family: var(--f-display); font-weight: 500; font-size: 22px; color: var(--ink-3); }

/* ---------- Bob ---------- */
.bob-layout { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.sec-head-rail { display: block; position: sticky; top: 100px; margin-bottom: 0; }
.sec-head-rail .sec-label { padding-top: 0; margin-bottom: 18px; }
.sec-head-rail h2 { font-size: clamp(2rem, 1.3rem + 2vw, 3rem); max-width: 14ch; }
.sec-head-rail .sec-lede { font-size: 16px; }
.powers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.power { padding: 28px 28px 32px 0; border-bottom: 1px solid var(--rule); }
.power:nth-child(even) { padding-left: 28px; padding-right: 0; border-left: 1px solid var(--rule); }
.power h3 { font-family: var(--f-display); font-weight: 600; font-size: 23px; line-height: 1.15; letter-spacing: -0.015em; }
.power h3::before {
  content: ""; display: block; width: 18px; height: 18px; margin-bottom: 18px; border-radius: 50%;
  border: 1.5px solid var(--violet); background: radial-gradient(circle, var(--violet) 0 3px, transparent 3.5px);
}
.power p { margin-top: 10px; font-size: 15px; color: var(--ink-2); }

/* ---------- GitOps ---------- */
.sec-gitops { border-top: 1px solid var(--rule); }
.gitops { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.gitops .sec-label { padding: 0; margin-bottom: 18px; }
.gitops h2 { font-size: clamp(1.9rem, 1.3rem + 2vw, 3rem); }
.gitops .sec-lede { font-size: 16.5px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.checks li { padding: 7px 13px; border: 1px solid var(--rule-strong); border-radius: 999px; font-family: var(--f-mono); font-size: 12px; font-weight: 500; }
.checks li::before { content: "✓ "; color: var(--violet); font-weight: 700; }
.tree-view { min-width: 0; padding: clamp(20px, 3vw, 32px); background: var(--dark); border-radius: var(--r-lg); overflow-x: auto; }
.tree-view pre { margin: 0; font-family: var(--f-mono); font-size: 13px; line-height: 1.85; color: var(--code-fg); }
.tree-folder { color: oklch(0.8 0.09 245); font-weight: 700; }
.tree-file { color: oklch(0.8 0.12 312); font-weight: 700; }
.tree-comment { color: oklch(0.58 0.02 265); }

/* ---------- Sandbox ---------- */
.sandbox-chips-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.terminal-chip {
  padding: 8px 12px; border: 1px solid var(--rule-strong); border-radius: var(--r-sm); background: var(--surface); cursor: pointer;
  color: var(--ink-2);
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.terminal-chip code { font-size: 12.5px; }
.terminal-chip:hover { border-color: var(--ink); color: var(--ink); }
.terminal-chip:active { transform: scale(0.97); }
.terminal-chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.interactive-terminal { background: var(--dark); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--dark-2); }
.terminal-header-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--dark-2); font-family: var(--f-mono); font-size: 12px; color: var(--code-dim); }
.terminal-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.terminal-online { color: oklch(0.8 0.17 150); font-size: 11px; font-weight: 700; white-space: nowrap; }
.terminal-body { padding: 22px 24px; min-height: 320px; overflow-x: auto; font-family: var(--f-mono); font-size: 13.5px; line-height: 1.8; color: var(--code-fg); }
.terminal-cursor { display: inline-block; width: 8px; height: 1.1em; margin-left: 3px; vertical-align: text-bottom; background: var(--code-fg); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Quickstart ---------- */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 36px); }
.step { min-width: 0; padding-top: 20px; border-top: 1px solid var(--ink); }
.step-badge { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); }
.step h3 { margin: 8px 0 18px; font-family: var(--f-display); font-weight: 600; font-size: 23px; line-height: 1.15; letter-spacing: -0.015em; }
.command-clip { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 14px; background: var(--dark); border-radius: var(--r-md); }
.command-clip code { background: none; padding: 0; color: var(--code-fg); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: none;
  border: 1px solid var(--dark-2); border-radius: 6px; background: transparent; color: var(--code-dim); cursor: pointer;
  transition: color 160ms var(--ease-out), border-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.copy-btn:hover { color: #fff; border-color: var(--code-dim); }
.copy-btn:active { transform: scale(0.92); }
.step p { margin-top: 14px; font-size: 14.5px; color: var(--ink-2); }

/* ---------- Team ---------- */
.members { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 36px); }
.member { display: flex; flex-direction: column; min-width: 0; padding-top: 24px; border-top: 1px solid var(--ink); }
.member-cell {
  display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, var(--violet-lite), var(--violet) 72%);
  color: #fff; font-family: var(--f-mono); font-size: 15px; font-weight: 700; letter-spacing: 0.04em;
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--rule-strong);
}
.member h3 { font-family: var(--f-display); font-weight: 700; font-size: clamp(1.4rem, 1.1rem + 0.8vw, 1.8rem); line-height: 1.1; letter-spacing: -0.018em; }
.member-link {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; margin-top: 18px; padding: 8px 14px;
  border: 1px solid var(--rule-strong); border-radius: 999px; text-decoration: none; font-size: 13.5px; font-weight: 600;
  transition: border-color 200ms var(--ease-out), color 200ms var(--ease-out), transform 160ms var(--ease-out);
}
.member-link:hover { border-color: var(--accent); color: var(--accent); }
.member-link:active { transform: scale(0.97); }
.map-scroll-hint { display: none; padding: 10px 18px 0; font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3); }
@media (max-width: 820px) { .map-scroll-hint { display: block; } }
@media (max-width: 860px) { .members { grid-template-columns: 1fr; } }

/* ---------- CTA ---------- */
.cta { background: oklch(0.2 0.03 272); color: oklch(0.96 0.008 250); overflow: hidden; }
[data-theme="dark"] .cta { background: oklch(0.11 0.012 270); border-top: 1px solid var(--rule); }
.cta-inner { position: relative; padding-block: clamp(96px, 12vw, 168px); text-align: center; }
.cta-cell {
  position: absolute; width: min(560px, 90vw); height: auto; left: 50%; top: 50%;
  transform: translate(-50%, -50%); color: oklch(0.66 0.19 15); opacity: 0.22; pointer-events: none;
}
.cta h2 {
  position: relative; margin: 0 auto; max-width: 14ch;
  font-family: var(--f-display); font-weight: 800; font-size: clamp(2.6rem, 1.4rem + 4.6vw, 5.6rem);
  line-height: 1; letter-spacing: -0.025em; text-wrap: balance;
}
.cta p { position: relative; margin: 24px auto 36px; max-width: 52ch; font-size: 17.5px; color: oklch(0.8 0.015 255); }
.cta .btn { position: relative; }
.cta .btn-accent { background: oklch(0.62 0.2 15); color: #fff; }
.cta .btn-accent:hover { background: oklch(0.68 0.19 15); }

/* ---------- Footer ---------- */
.foot { padding: 36px 0 44px; border-top: 1px solid var(--rule); }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 24px; }
.foot-brand { font-family: var(--f-display); font-weight: 800; font-size: 22px; letter-spacing: -0.03em; }
.foot p { margin-top: 4px; font-size: 14px; color: var(--ink-3); }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 14px; color: var(--ink-2); }
.foot-links a { text-decoration: none; }
.foot-links a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .lab-grid { grid-template-columns: 1fr; }
  .lab-plate { border-right: 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); column-gap: 28px; align-items: start; }
  .lab-plate .score { grid-row: span 2; }
  .sim-controls { grid-column: 1 / -1; margin-top: 0; }
  .inspector-body { min-height: 0; }
  .loop { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loop-step:nth-child(3) { padding-left: 0; border-left: 0; }
  .loop-step:nth-child(3)::before { left: 0; }
  .loop-step:nth-child(n+3) { margin-top: 28px; border-top: 1px solid var(--rule); }
}

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .slide-frame { height: 420px; }
  .spec-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec:nth-child(3) { padding-left: 0; border-left: 0; }
  .spec:nth-child(n+3) { margin-top: 18px; }
  .sec-head { display: block; }
  .sec-label { margin-bottom: 14px; padding-top: 0; }
  .sec-head h2 { max-width: 22ch; }
  .scope-grid, .gitops, .bob-layout { grid-template-columns: 1fr; }
  .sec-head-rail { position: static; }
  .versus { grid-template-columns: 1fr; }
  .versus-mark { justify-self: center; }
  .tax { grid-template-columns: 1fr; gap: 14px; }
  .steps { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .slide-frame { height: 380px; }
  .slide-layer { padding: 18px 14px; }
  .slide-code { font-size: 10.5px; }
  .slide-cap { flex-direction: column; gap: 4px; }
  .lab-bar { padding: 12px; }
  .specimen { flex-direction: column; align-items: stretch; gap: 6px; width: 100%; }
  .specimen-select { width: 100%; }
  .stepper { width: 100%; }
  .lab-plate { display: flex; padding: 18px; }
  .inspector-body { padding: 16px; }
  .twin-card { flex-direction: column; align-items: flex-start; }
  .loop { grid-template-columns: 1fr; border-top: 0; border-left: 1px solid var(--ink); }
  .loop-step, .loop-step + .loop-step, .loop-step:nth-child(3) { padding: 0 0 32px 24px; border-left: 0; margin-top: 0; border-top: 0; }
  .loop-step::before, .loop-step + .loop-step::before, .loop-step:nth-child(3)::before { left: -6px; top: 3px; }
  .powers { grid-template-columns: 1fr; }
  .power, .power:nth-child(even) { padding: 24px 0; border-left: 0; }
  .terminal-body { padding: 16px; font-size: 12px; }
  .hero-actions .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  .terminal-cursor { animation: none; }
}
