/* KerneLab site styles. Tokens first; dark values are declared twice
   (OS preference and explicit toggle) so the toggle wins both ways. */
:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --bg-2: #efede6;
  --panel: #ffffff;
  --line: #dcd8cc;
  --ink: #14161b;
  --ink-2: #4a4f5a;
  --ink-3: #6b707c;
  --accent: #8f5a00;
  --accent-fill: #eeb030;
  --on-accent: #17130a;
  --cool: #0b7386;
  --stall: #b4472f;
  --s1: #2f62c9;
  --s2: #a86a00;
  --s3: #a13fa6;
  --shadow: 0 1px 2px rgba(20, 22, 27, .06), 0 8px 24px rgba(20, 22, 27, .06);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --wrap: 1120px;
  --gutter: 20px;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0d12;
    --bg-2: #10131a;
    --panel: #151922;
    --line: #252b38;
    --ink: #eef0f4;
    --ink-2: #b1b8c6;
    --ink-3: #838b9b;
    --accent: #f2b53c;
    --accent-fill: #f2b53c;
    --on-accent: #17130a;
    --cool: #62d6e8;
    --stall: #f0795c;
    --s1: #5b8def;
    --s2: #c98500;
    --s3: #c765c9;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg-2: #10131a;
  --panel: #151922;
  --line: #252b38;
  --ink: #eef0f4;
  --ink-2: #b1b8c6;
  --ink-3: #838b9b;
  --accent: #f2b53c;
  --accent-fill: #f2b53c;
  --on-accent: #17130a;
  --cool: #62d6e8;
  --stall: #f0795c;
  --s1: #5b8def;
  --s2: #c98500;
  --s3: #c765c9;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, canvas { max-width: 100%; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent-fill); color: var(--on-accent); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent-fill); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap { display: flex; align-items: center; gap: 20px; height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; text-decoration: none; font-size: 18px; }
.brand svg { width: 26px; height: 26px; }
.brand b { color: var(--accent); font-weight: 650; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-size: 15px; }
.nav a:hover { color: var(--ink); background: var(--bg-2); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 8px 8px 0 0; }
.icon-btn { appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); width: 36px; height: 36px; border-radius: 9px; display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn svg { width: 17px; height: 17px; }
.menu-btn { display: none; }
@media (max-width: 760px) {
  .menu-btn { display: inline-grid; }
  .nav { position: absolute; left: 0; right: 0; top: 62px; background: var(--bg); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 8px var(--gutter) 14px; display: none; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 8px; font-size: 16px; }
  .nav a[aria-current="page"] { box-shadow: inset 2px 0 0 var(--accent); border-radius: 0; }
  .head-tools { margin-left: auto; display: flex; gap: 8px; }
}
@media (min-width: 761px) { .head-tools { display: flex; gap: 8px; } }

/* ---------- type ---------- */
h1, h2, h3 { line-height: 1.12; letter-spacing: -.022em; margin: 0; font-weight: 680; text-wrap: balance; }
h1 { font-size: clamp(40px, 7vw, 76px); letter-spacing: -.035em; }
h2 { font-size: clamp(28px, 4vw, 42px); }
h3 { font-size: 20px; letter-spacing: -.012em; line-height: 1.25; }
p { margin: 0 0 1em; text-wrap: pretty; }
.lede { font-size: clamp(18px, 2.1vw, 22px); color: var(--ink-2); max-width: 62ch; line-height: 1.5; }
.eyebrow { font: 500 12.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); display: inline-flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; }
.muted { color: var(--ink-2); }
.small { font-size: 14.5px; }
.mono { font-family: var(--mono); font-size: .92em; }
code { font-family: var(--mono); font-size: .88em; background: var(--bg-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }

/* ---------- sections ---------- */
section { padding: clamp(56px, 9vw, 112px) 0; }
section.tight { padding: clamp(40px, 6vw, 72px) 0; }
section.alt { background: var(--bg-2); border-block: 1px solid var(--line); }
.sec-head { max-width: 760px; margin-bottom: clamp(28px, 4vw, 48px); }
.sec-head p { color: var(--ink-2); font-size: 18px; margin-top: 16px; }
.page-hero { padding: clamp(56px, 9vw, 104px) 0 clamp(32px, 5vw, 56px); position: relative; }
.page-hero h1 { font-size: clamp(36px, 6vw, 64px); max-width: 16ch; }
.page-hero .lede { margin-top: 22px; }
.gridlines { position: absolute; inset: 0; pointer-events: none; z-index: -1;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px; opacity: .45;
  mask-image: radial-gradient(ellipse 80% 90% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 90% at 50% 0%, #000 20%, transparent 75%); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 10px; font-weight: 600; font-size: 15.5px; text-decoration: none; border: 1px solid transparent; cursor: pointer; font-family: inherit; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent-fill); color: var(--on-accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent-fill) 88%, #fff); }
.btn.ghost { border-color: var(--line); color: var(--ink); background: var(--panel); }
.btn.ghost:hover { border-color: var(--ink-3); }
.btn .arr { transition: transform .15s ease; }
.btn:hover .arr { transform: translateX(3px); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- cards & grids ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; position: relative; }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--ink-2); margin: 0; font-size: 15.5px; }
.card .num { font: 500 12px/1 var(--mono); color: var(--ink-3); letter-spacing: .1em; display: block; margin-bottom: 16px; }
.card.hover { transition: border-color .2s ease, transform .2s ease; }
.card.hover:hover { border-color: var(--accent); transform: translateY(-2px); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); } }
.tag { display: inline-flex; align-items: center; gap: 6px; font: 500 11.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 6px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); background: var(--bg); }
.tag.live { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.tag.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.note { border-left: 2px solid var(--accent); padding: 4px 0 4px 16px; color: var(--ink-2); font-size: 15px; }
ul.clean { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
ul.clean li { padding-left: 22px; position: relative; color: var(--ink-2); }
ul.clean li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
ul.clean li b { color: var(--ink); font-weight: 600; }

/* ---------- home hero ---------- */
.hero { padding: clamp(48px, 8vw, 96px) 0 clamp(40px, 6vw, 72px); position: relative; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: center; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { margin: 24px 0 30px; }
.stage { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.stage-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); font: 500 12px/1 var(--mono); color: var(--ink-3); letter-spacing: .04em; }
.stage-bar span { white-space: nowrap; }
.stage-bar .dots { display: flex; gap: 5px; }
.stage-bar .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.stage-bar .state { margin-left: auto; color: var(--accent); }
.stage canvas { width: 100%; height: 330px; }
@media (max-width: 620px) { .stage canvas { height: 270px; } }
.stage-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 12px 14px; border-top: 1px solid var(--line); font: 500 12.5px/1.3 var(--mono); color: var(--ink-2); }
.stage-foot b { color: var(--ink); font-variant-numeric: tabular-nums; }
.stage-foot button { margin-left: auto; }
.chip-btn { appearance: none; font: 500 12px/1 var(--mono); letter-spacing: .04em; color: var(--ink); background: var(--bg); border: 1px solid var(--line); padding: 8px 11px; border-radius: 8px; cursor: pointer; }
.chip-btn:hover { border-color: var(--accent); }
.chip-btn[aria-pressed="true"] { background: var(--accent-fill); color: var(--on-accent); border-color: transparent; }

/* ---------- versus ---------- */
.versus { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 760px) { .versus { grid-template-columns: minmax(0, 1fr); } }
.versus .card.win { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.stack { display: grid; gap: 5px; margin: 18px 0; }
.stack i { display: block; height: 22px; border-radius: 5px; background: var(--bg-2); border: 1px solid var(--line); font: 500 11px/20px var(--mono); font-style: normal; color: var(--ink-3); padding: 0 8px; }
.stack.fused { gap: 0; border: 1.5px solid var(--accent); border-radius: 8px; overflow: hidden; }
.stack.fused i { border: 0; border-radius: 0; border-bottom: 1px dashed var(--line); background: color-mix(in srgb, var(--accent) 9%, var(--panel)); height: 27px; line-height: 27px; }
.stack.fused i:last-child { border-bottom: 0; }

/* ---------- loop (tabs) ---------- */
.loop { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; position: relative; }
@media (max-width: 760px) { .loop { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.loop button { appearance: none; text-align: left; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; cursor: pointer; position: relative; overflow: hidden; }
.loop button .n { font: 500 12px/1 var(--mono); color: var(--ink-3); letter-spacing: .1em; }
.loop button strong { display: block; font-size: 19px; margin: 12px 0 4px; letter-spacing: -.01em; }
.loop button span.d { color: var(--ink-2); font-size: 14.5px; line-height: 1.4; display: block; }
.loop button::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
.loop button[aria-selected="true"] { border-color: var(--accent); }
.loop.auto button[aria-selected="true"]::after { animation: fill var(--dur, 4s) linear forwards; }
.loop:not(.auto) button[aria-selected="true"]::after { transform: scaleX(1); }
@keyframes fill { to { transform: scaleX(1); } }
.loop-detail { margin-top: 14px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.loop-detail > div { padding: 22px; border-right: 1px solid var(--line); }
.loop-detail > div:last-child { border-right: 0; }
.loop-detail h4 { margin: 0 0 10px; font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.loop-detail p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
@media (max-width: 760px) { .loop-detail { grid-template-columns: minmax(0, 1fr); } .loop-detail > div { border-right: 0; border-bottom: 1px solid var(--line); } .loop-detail > div:last-child { border-bottom: 0; } }
.feedback { display: flex; align-items: center; gap: 10px; margin-top: 12px; font: 500 12px/1.4 var(--mono); color: var(--ink-3); }
.feedback::before { content: "\21BA"; color: var(--accent); font-size: 16px; }

/* ---------- cost model ---------- */
.model { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
@media (max-width: 860px) { .model { grid-template-columns: minmax(0, 1fr); } }
.model .controls { padding: 22px; border-right: 1px solid var(--line); display: grid; gap: 16px; align-content: start; background: var(--bg-2); }
@media (max-width: 860px) { .model .controls { border-right: 0; border-bottom: 1px solid var(--line); } }
.ctl label { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 6px; }
.ctl output { font-family: var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { width: 100%; accent-color: var(--accent-fill); margin: 0; }
.model .out { padding: 22px; min-width: 0; }
.hero-num { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.hero-num strong { font-size: clamp(40px, 6vw, 60px); letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-num span { color: var(--ink-2); font-size: 15px; max-width: 34ch; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 16px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
.bar-row { margin-bottom: 16px; }
.bar-row .lbl { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.bar-row .lbl b { font-weight: 600; }
.bar-row .lbl span { font-family: var(--mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bar { display: flex; gap: 2px; height: 30px; }
.bar > i { display: block; height: 100%; min-width: 0; border-radius: 4px; transition: flex-basis .25s ease; cursor: default; }
.bar > i:hover { filter: brightness(1.12); }
.c1 { background: var(--s1); } .c2 { background: var(--s2); } .c3 { background: var(--s3); }
.readout { min-height: 22px; font: 500 12.5px/1.5 var(--mono); color: var(--ink-2); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { font: 500 11.5px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
details.tbl { margin-top: 12px; }
details.tbl summary { cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.table-scroll { overflow-x: auto; }

/* ---------- toy search ---------- */
.lab { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.lab-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.lab-head .t { font: 500 12px/1 var(--mono); letter-spacing: .06em; color: var(--ink-3); margin-right: auto; }
.lab canvas { width: 100%; height: 320px; cursor: crosshair; }
.lab-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.lab-stats div { padding: 14px 16px; border-right: 1px solid var(--line); }
.lab-stats div:last-child { border-right: 0; }
.lab-stats span { display: block; font: 500 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.lab-stats b { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
@media (max-width: 620px) { .lab-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lab-stats div:nth-child(2) { border-right: 0; } .lab-stats div:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }
.caption { font-size: 13.5px; color: var(--ink-3); margin-top: 12px; }

/* ---------- case studies ---------- */
.case { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.case-head { padding: 24px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); }
.case-head h3 { font-size: 24px; margin-top: 10px; }
.case dl { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.case dl > div { padding: 18px 24px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.case dl > div:nth-child(3n) { border-right: 0; }
.case dt { font: 500 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.case dd { margin: 0; font-size: 15.5px; }
.case dd.pending { color: var(--ink-3); font-family: var(--mono); font-size: 13.5px; }
.case-foot { padding: 18px 24px; color: var(--ink-2); font-size: 15px; }
@media (max-width: 760px) { .case dl { grid-template-columns: minmax(0, 1fr); } .case dl > div { border-right: 0; } }
ol.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
ol.steps li { counter-increment: s; padding: 18px 22px 18px 64px; position: relative; border-bottom: 1px solid var(--line); }
ol.steps li:last-child { border-bottom: 0; }
ol.steps li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 22px; top: 20px; font: 500 12px/1.4 var(--mono); color: var(--accent); letter-spacing: .08em; }
ol.steps b { display: block; margin-bottom: 2px; }
ol.steps span { color: var(--ink-2); font-size: 15.5px; }

/* ---------- faq ---------- */
.faq details { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq details:first-child { border-top: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; font-size: 18px; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--accent); }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { color: var(--ink-2); margin: 12px 0 0; max-width: 72ch; }

/* ---------- form ---------- */
.form { display: grid; gap: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--ink-3); }
.field input, .field select, .field textarea { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 620px) { .two { grid-template-columns: minmax(0, 1fr); } }
pre.preview { margin: 0; white-space: pre-wrap; word-break: break-word; font: 13px/1.55 var(--mono); background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; color: var(--ink-2); max-height: 260px; overflow: auto; }

/* ---------- cta + footer ---------- */
.cta { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: clamp(28px, 5vw, 56px); display: grid; grid-template-columns: minmax(0, 1.4fr) auto; gap: 24px; align-items: center; position: relative; overflow: hidden; }
.cta::before { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 240px at 90% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%); pointer-events: none; }
.cta > * { position: relative; }
.cta p { color: var(--ink-2); margin: 12px 0 0; max-width: 56ch; }
@media (max-width: 760px) { .cta { grid-template-columns: minmax(0, 1fr); } }
.site-foot { border-top: 1px solid var(--line); padding: 40px 0 56px; color: var(--ink-2); font-size: 14.5px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 20px 40px; justify-content: space-between; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-foot a { text-decoration: none; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0ms); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .tag.live::before, .loop.auto button[aria-selected="true"]::after { animation: none; }
  .loop.auto button[aria-selected="true"]::after { transform: scaleX(1); }
}

/* ---------- convergence schematic (home hero) ---------- */
.cv { padding: 18px 16px 8px; display: grid; gap: 11px; }
.cv-head, .cv-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) 84px; gap: 12px; align-items: center; }
.cv-head { font: 500 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.cv-name { font: 500 12.5px/1.2 var(--mono); color: var(--ink-2); white-space: nowrap; }
.cv-name b { color: var(--ink-3); font-weight: 500; margin-right: 6px; }
.cv-track { height: 16px; border-radius: 4px; background: var(--bg-2); border: 1px solid var(--line); position: relative; overflow: hidden; }
.cv-track i { position: absolute; inset: 0 auto 0 0; width: 100%; background: var(--cool); opacity: .8; border-radius: 3px; transition: width .7s cubic-bezier(.2, .7, .2, 1), background .3s ease; }
.cv-row.active .cv-name { color: var(--ink); }
.cv-row.active .cv-track { border-color: var(--ink-3); }
.cv-row.reject .cv-track i { background: var(--stall); }
.cv-row.gap .cv-track i { background: var(--accent); }
.cv-flag { font: 500 10.5px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); text-align: right; white-space: nowrap; }
.cv-row.done .cv-flag { color: var(--cool); }
.cv-row.reject .cv-flag { color: var(--stall); }
.cv-row.gap .cv-flag { color: var(--accent); }
.cv-log { margin: 6px 16px 14px; padding: 10px 12px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); font: 500 12px/1.6 var(--mono); color: var(--ink-2); height: 86px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.cv-log div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-log div:last-child { color: var(--ink); }
.cv-log .ok { color: var(--cool); } .cv-log .no { color: var(--stall); } .cv-log .gp { color: var(--accent); }
@media (max-width: 520px) { .cv-head, .cv-row { grid-template-columns: 92px minmax(0, 1fr) 62px; gap: 8px; } .cv-name b { display: none; } }

/* ---------- misc additions ---------- */
.principles { counter-reset: p; display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.principles > div { counter-increment: p; display: grid; grid-template-columns: 56px minmax(0, 1fr); padding: 20px 22px 20px 0; border-bottom: 1px solid var(--line); }
.principles > div:last-child { border-bottom: 0; }
.principles > div::before { content: counter(p); font: 600 22px/1.2 var(--mono); color: var(--accent); text-align: center; }
.principles h3 { margin-bottom: 4px; font-size: 18px; }
.principles p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
pre.rule { margin: 0; padding: 20px 22px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); font: 500 14px/1.7 var(--mono); color: var(--ink); overflow-x: auto; }
pre.rule .k { color: var(--accent); } pre.rule .c { color: var(--ink-3); }
.layers { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.layers > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); align-items: baseline; }
.layers > div:last-child { border-bottom: 0; }
.layers b { font: 600 13.5px/1.3 var(--mono); }
.layers b span { color: var(--accent); margin-right: 8px; }
.layers p { margin: 0; color: var(--ink-2); font-size: 15px; }
@media (max-width: 620px) { .layers > div { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
.route { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font: 500 12.5px/1 var(--mono); color: var(--ink-2); margin: 14px 0 0; }
.route span { padding: 7px 10px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.route i { font-style: normal; color: var(--accent); }
.outcome { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.outcome > div { padding: 20px 24px; }
.outcome > div:first-child { border-right: 1px solid var(--line); }
.outcome h4 { margin: 0 0 12px; font: 500 11.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
@media (max-width: 760px) { .outcome { grid-template-columns: minmax(0, 1fr); } .outcome > div:first-child { border-right: 0; border-bottom: 1px solid var(--line); } }
ul.refs { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
ul.refs li { padding: 14px 20px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; }
ul.refs li:last-child { border-bottom: 0; }
ul.refs a { font-weight: 600; text-decoration: none; }
ul.refs a:hover { text-decoration: underline; }
ul.refs span { color: var(--ink-2); font-size: 14.5px; grid-column: 1 / -1; }
ul.refs em { font: 500 11.5px/1.6 var(--mono); font-style: normal; color: var(--ink-3); letter-spacing: .06em; }
h3.sub { font: 500 12.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 36px 0 14px; }

[hidden] { display: none !important; }
