/* ChromaDCNN project site. Tokens first; dark mode is selected, not flipped. */
:root {
  color-scheme: light;
  --page: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #efede6;
  --surface-3: #e6e3da;
  --ink: #16181d;
  --ink-2: #4a4f59;
  --muted: #7b808a;
  --grid: #e6e3da;
  --axis: #cbc7bb;
  --ring: rgba(22, 24, 29, 0.10);
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-soft: #dbe8fb;
  --SNA: #2a78d6; --GUR: #eb6834; --TAR: #1baf7a; --BCO: #eda100;
  --rep-2d: #2a78d6; --rep-pca: #1baf7a; --rep-sum: #eb6834; --rep-max: #898781;
  --bad: #e34948;
  --good: #006300;
  --seq-0: #f3f2ee; --seq-1: #cde2fb; --seq-2: #86b6ef; --seq-3: #3987e5; --seq-4: #1c5cab; --seq-5: #0d366b;
  --hero-glow: radial-gradient(1100px 520px at 75% -10%, rgba(42, 120, 214, 0.16), transparent 60%),
               radial-gradient(800px 420px at 0% 15%, rgba(237, 161, 0, 0.12), transparent 60%);
  --shadow: 0 1px 2px rgba(20, 20, 30, 0.05), 0 8px 26px rgba(20, 20, 30, 0.06);
  --display: Fraunces, Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0e1015; --surface: #161922; --surface-2: #1d212c; --surface-3: #262b38;
    --ink: #eceef3; --ink-2: #b4bac6; --muted: #848b99; --grid: #262b38; --axis: #343a49;
    --ring: rgba(255, 255, 255, 0.10); --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #1d2a4d;
    --SNA: #3987e5; --GUR: #d95926; --TAR: #199e70; --BCO: #c98500;
    --rep-2d: #3987e5; --rep-pca: #199e70; --rep-sum: #d95926; --rep-max: #898781;
    --bad: #e66767; --good: #0ca30c;
    --seq-0: #1d212c; --seq-1: #193661; --seq-2: #1c4d8f; --seq-3: #2a78d6; --seq-4: #6da7ec; --seq-5: #cde2fb;
    --hero-glow: radial-gradient(1100px 520px at 75% -10%, rgba(57, 135, 229, 0.22), transparent 60%),
                 radial-gradient(800px 420px at 0% 15%, rgba(201, 133, 0, 0.14), transparent 60%);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0e1015; --surface: #161922; --surface-2: #1d212c; --surface-3: #262b38;
  --ink: #eceef3; --ink-2: #b4bac6; --muted: #848b99; --grid: #262b38; --axis: #343a49;
  --ring: rgba(255, 255, 255, 0.10); --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #1d2a4d;
  --SNA: #3987e5; --GUR: #d95926; --TAR: #199e70; --BCO: #c98500;
  --rep-2d: #3987e5; --rep-pca: #199e70; --rep-sum: #d95926; --rep-max: #898781;
  --bad: #e66767; --good: #0ca30c;
  --seq-0: #1d212c; --seq-1: #193661; --seq-2: #1c4d8f; --seq-3: #2a78d6; --seq-4: #6da7ec; --seq-5: #cde2fb;
  --hero-glow: radial-gradient(1100px 520px at 75% -10%, rgba(57, 135, 229, 0.22), transparent 60%),
               radial-gradient(800px 420px at 0% 15%, rgba(201, 133, 0, 0.14), transparent 60%);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--page); color: var(--ink); font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.12; margin: 0; }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); max-width: 24ch; }
h3 { font-size: 1.15rem; }
h4 { margin: 0 0 4px; font-size: 1rem; }
p { margin: 0 0 1rem; color: var(--ink-2); }
strong { color: var(--ink); }
code, pre, .mono { font-family: var(--mono); font-size: 0.88em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ── Navigation ─────────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  background: color-mix(in srgb, var(--page) 80%, transparent); border-bottom: 1px solid var(--ring);
}
.nav-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 10px 20px; }
.brand { font-family: var(--display); font-weight: 600; font-size: 1.1rem; color: var(--ink); white-space: nowrap; display: flex; align-items: center; gap: 9px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 24px; height: 24px; }
.nav-links { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--ink-2); font-size: 14px; padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.nav-links a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-links a.active { color: var(--ink); background: var(--surface-2); }
.icon-btn {
  border: 1px solid var(--ring); background: var(--surface); color: var(--ink); border-radius: 10px;
  height: 34px; min-width: 34px; padding: 0 10px; cursor: pointer; font: inherit; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background 0.15s;
}
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--accent); transition: width 0.1s linear; }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero { position: relative; padding: 64px 0 36px; background: var(--hero-glow); overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1fr 1.1fr; gap: 36px; align-items: center; }
.eyebrow { font: 600 12px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-ink); }
.hero h1 { font-size: clamp(2.5rem, 5.6vw, 4.3rem); line-height: 1.02; letter-spacing: -0.025em; margin: 14px 0 18px; max-width: 14ch; font-weight: 600; }
.hero h1 .grad { background: linear-gradient(92deg, var(--SNA), var(--TAR) 50%, var(--GUR)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--ink-2); max-width: 56ch; margin: 0; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 0.95rem;
  border: 1px solid var(--ring); color: var(--ink); background: var(--surface); box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn.primary { background: var(--ink); color: var(--page); border-color: transparent; }
.btn svg { width: 16px; height: 16px; }

.hero-figure {
  background: var(--surface); border: 1px solid var(--ring); border-radius: 20px; box-shadow: var(--shadow);
  padding: 16px 16px 12px; position: relative; min-width: 0;
}
.fig-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.state-label { font: 600 13px/1.3 var(--sans); color: var(--ink-2); display: inline-flex; align-items: center; gap: 8px; }
.state-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--SNA); transition: background 0.4s; flex: none; }
.reader { display: grid; grid-template-columns: 1fr 120px; grid-template-rows: 70px 1fr; gap: 6px; height: 330px; }
.reader .tic { grid-column: 1; grid-row: 1; }
.reader .heat { grid-column: 1; grid-row: 2; position: relative; border-radius: 10px; overflow: hidden; background: var(--seq-0); }
.reader .spec { grid-column: 2; grid-row: 2; }
.reader .corner { grid-column: 2; grid-row: 1; font: 12px/1.35 var(--sans); color: var(--muted); display: flex; flex-direction: column; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.reader .corner span:first-child { color: var(--ink); font-weight: 600; }
.reader canvas { width: 100%; height: 100%; display: block; }
.reader svg { width: 100%; height: 100%; display: block; overflow: visible; }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); opacity: 0.9; pointer-events: none; transform: translateX(-1px); }
.playhead::after { content: ""; position: absolute; left: -3px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.fig-caption { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 28px; }
.stat { background: var(--surface); border: 1px solid var(--ring); border-radius: 16px; padding: 16px 18px; min-width: 0; }
.stat .v { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; color: var(--ink); }
.stat .v small { font-size: 0.5em; color: var(--muted); font-weight: 600; margin-left: 2px; }
.stat .k { color: var(--ink-2); font-size: 14px; margin-top: 4px; line-height: 1.4; }

/* ── Sections ───────────────────────────────────────────────────────────── */
section.chapter { max-width: 1180px; margin: 0 auto; padding: 88px 20px 24px; }
.chapter-head { display: grid; gap: 10px; margin-bottom: 28px; }
.kicker { font: 600 12px/1 var(--mono); color: var(--muted); letter-spacing: 0.08em; }
.chapter .intro { color: var(--ink-2); max-width: 68ch; margin: 6px 0 0; font-size: 1.08rem; }
.prose { max-width: 68ch; color: var(--ink-2); }

.card {
  background: var(--surface); border: 1px solid var(--ring); border-radius: 18px; box-shadow: var(--shadow);
  padding: 20px; position: relative; min-width: 0;
}
.card h3 { margin: 0 0 4px; }
.card .sub { color: var(--ink-2); font-size: 14px; margin: 0 0 12px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head > * { margin: 0; }
.caption { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-2.wide { grid-template-columns: 1.4fr 1fr; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stack { display: grid; gap: 18px; }
.grid-2 > *, .grid-3 > *, .stack > * { min-width: 0; }

.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.controls .group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  border: 1px solid var(--ring); background: var(--surface); color: var(--ink-2); border-radius: 999px;
  padding: 6px 12px 6px 10px; font: 500 13px/1.2 var(--sans); cursor: pointer; transition: all 0.18s; display: inline-flex; align-items: center; gap: 7px;
}
.chip:hover { color: var(--ink); background: var(--surface-2); }
.chip .sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.chip[aria-pressed="false"] { opacity: 0.45; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; max-width: 100%; }
.seg button {
  border: 0; background: transparent; color: var(--ink-2); font: 600 13px/1 var(--sans); padding: 8px 12px;
  border-radius: 9px; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.seg .sw { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
label.inline { font-size: 14px; color: var(--ink-2); display: inline-flex; gap: 8px; align-items: center; }
.slider { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: 13px; color: var(--ink-2); }
.slider b { color: var(--ink); font-variant-numeric: tabular-nums; min-width: 4.5ch; text-align: right; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--grid); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--grid); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--surface);
  border: 2px solid var(--accent); margin-top: -8px; box-shadow: var(--shadow); cursor: grab;
}
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); cursor: grab; }
.small-btn {
  border: 1px solid var(--ring); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 7px 12px;
  font: 600 13px/1 var(--sans); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background 0.15s;
}
.small-btn:hover { background: var(--surface-2); }
.small-btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.small-btn.primary:hover { background: var(--accent-ink); }

/* ── Charts ─────────────────────────────────────────────────────────────── */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.axis text { fill: var(--muted); font: 12px var(--sans); font-variant-numeric: tabular-nums; }
.axis path, .axis line { stroke: var(--axis); }
.gridline line { stroke: var(--grid); }
.gridline path { display: none; }
.axis-title { fill: var(--muted); font: 12px var(--sans); }
.direct-label { font: 600 12px var(--sans); fill: var(--ink-2); }
.row-label { font: 500 12.5px var(--sans); fill: var(--ink); }
.row-sub { font: 11px var(--sans); fill: var(--muted); }
.crosshair { stroke: var(--muted); stroke-width: 1; pointer-events: none; }
.ref-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.legend i.dot { width: 9px; height: 9px; border-radius: 50%; }
.legend i.area { height: 10px; border-radius: 3px; opacity: 0.4; }
.heatwrap { position: relative; border-radius: 12px; overflow: hidden; background: var(--seq-0); }
.heatwrap canvas { width: 100%; height: 100%; display: block; }
.heat-axes { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: 1fr 24px; gap: 4px; }
.heat-axes .ylab, .heat-axes .xlab { font: 12px var(--sans); color: var(--muted); display: flex; }
.heat-axes .ylab { writing-mode: vertical-rl; transform: rotate(180deg); justify-content: center; align-items: center; }
.heat-axes .xlab { grid-column: 2; justify-content: space-between; padding: 0 2px; font-variant-numeric: tabular-nums; }
.ramp { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--seq-0), var(--seq-1), var(--seq-2), var(--seq-3), var(--seq-4), var(--seq-5)); }
.ramp-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.ramp-row .ramp { flex: 1; max-width: 180px; }

.tooltip {
  position: fixed; pointer-events: none; z-index: 100; background: var(--surface); color: var(--ink);
  border: 1px solid var(--ring); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 10px; font-size: 13px;
  opacity: 0; transform: translateY(4px); transition: opacity 0.12s, transform 0.12s; min-width: 120px; max-width: 280px;
}
.tooltip.on { opacity: 1; transform: none; }
.tooltip .tt-head { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tooltip .row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.tooltip .row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.tooltip .row .key { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tooltip .row .key i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.kpi { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.kpi .v { font-size: clamp(16px, 1.6vw, 20px); font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.kpi .k { font-size: 12px; color: var(--ink-2); }
.callout {
  border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 12px 12px 0;
  padding: 14px 16px; color: var(--ink-2); margin: 18px 0 0;
}
.callout p:last-child { margin: 0; }
.big-num { font-size: 56px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; color: var(--ink); }
.big-num.drop { color: var(--bad); }

/* ── Steps / pipeline ──────────────────────────────────────────────────── */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; counter-reset: step; }
.step { background: var(--surface); border: 1px solid var(--ring); border-radius: 16px; padding: 18px; position: relative; box-shadow: var(--shadow); }
.step::before {
  counter-increment: step; content: "0" counter(step); position: absolute; top: 16px; right: 16px;
  font: 600 12px var(--mono); color: var(--muted);
}
.step h4 { margin: 0 0 6px; font-size: 1rem; }
.step p { margin: 0; color: var(--ink-2); font-size: 14px; }
.step svg { width: 44px; height: 44px; margin-bottom: 8px; display: block; }

.pipeline { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 6px 0 10px; scrollbar-width: thin; }
.pipe-stage {
  flex: 1 0 128px; min-width: 128px; border: 1px solid var(--ring); background: var(--surface-2); border-radius: 12px;
  padding: 10px 10px 8px; cursor: pointer; text-align: left; font: inherit; color: var(--ink); position: relative;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.pipe-stage:hover { transform: translateY(-2px); }
.pipe-stage[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.pipe-stage .nm { font-weight: 600; font-size: 13px; display: block; }
.pipe-stage .sh { font: 11.5px var(--mono); color: var(--muted); display: block; margin-top: 4px; }
.pipe-stage .bar { height: 4px; border-radius: 2px; background: var(--accent); margin-top: 8px; opacity: 0.85; }
.pipe-arrow { flex: none; width: 22px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.stage-detail { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; background: var(--surface-2); border-radius: 12px; padding: 14px 16px; margin-top: 8px; min-height: 96px; }
.stage-detail h4 { margin: 0 0 4px; }
.stage-detail p { margin: 0; font-size: 14px; }
.stage-detail .params { text-align: right; font-variant-numeric: tabular-nums; }
.stage-detail .params b { font-size: 22px; display: block; color: var(--ink); }
.stage-detail .params span { font-size: 12px; color: var(--muted); }

.rf-row-label { font: 11.5px var(--sans); fill: var(--muted); }
.rf-cell { fill: var(--surface-3); }
.rf-cell.on { fill: var(--accent); }
.rf-cell.out { fill: var(--GUR); }
.rf-span { stroke: var(--ink); stroke-width: 1.2; fill: none; }
.rf-span-text { font: 600 12px var(--sans); fill: var(--ink); }

details.paperfig { margin-top: 12px; }
details.paperfig summary { cursor: pointer; font-size: 14px; color: var(--accent-ink); font-weight: 600; }
details.paperfig figure { margin: 10px 0 0; background: #fff; border-radius: 12px; padding: 10px; }
details.paperfig img { width: 100%; height: auto; display: block; }

/* ── Table ──────────────────────────────────────────────────────────────── */
.tablewrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; }
table.data th:nth-child(-n+3), table.data td:nth-child(-n+3) { text-align: left; }
table.data th { color: var(--ink-2); font-weight: 600; cursor: pointer; user-select: none; font-size: 12.5px; }
table.data th:hover { color: var(--ink); }
table.data tr.best td { background: var(--accent-soft); }
table.data td .bar { display: inline-block; height: 6px; border-radius: 0 3px 3px 0; vertical-align: middle; margin-right: 8px; opacity: 0.85; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.tag i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ── Limits, code, footer ───────────────────────────────────────────────── */
.limits { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.limit { background: var(--surface); border: 1px solid var(--ring); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); }
.limit h4 { margin: 0 0 4px; font-size: 1rem; display: flex; gap: 8px; align-items: center; }
.limit p { margin: 0; color: var(--ink-2); font-size: 14px; }
pre.code {
  background: var(--surface-2); border: 1px solid var(--ring); border-radius: 14px; padding: 16px 18px; overflow-x: auto;
  font-size: 13px; line-height: 1.7; color: var(--ink); margin: 0;
}
pre.code .c { color: var(--muted); }
.copy { position: absolute; top: 12px; right: 12px; }
.relative { position: relative; }
footer { border-top: 1px solid var(--ring); margin-top: 80px; padding: 30px 20px 50px; color: var(--muted); font-size: 14px; }
footer .inner { max-width: 1180px; margin: 0 auto; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ── Motion ─────────────────────────────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@keyframes pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.loading { color: var(--muted); font-size: 14px; text-align: center; padding: 40px 0; animation: pulse 1.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .loading { animation: none; }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; }
  .grid-2, .grid-2.wide, .grid-3 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .limits { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 600px) {
  .wrap, section.chapter, .nav-inner, footer { padding-left: 16px; padding-right: 16px; }
  .nav-links { display: none; }
  .hero { padding-top: 40px; }
  .stat .v { font-size: 28px; }
  .card { padding: 14px; }
  .reader { grid-template-columns: 1fr 70px; height: 290px; }
  .stage-detail { grid-template-columns: 1fr; }
  .stage-detail .params { text-align: left; }
  .big-num { font-size: 44px; }
  section.chapter { padding-top: 64px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { min-width: 0; }
  .kpi .v { white-space: normal; }
}
