:root {
  --bg: #0b1422;
  --surface: #111f33;
  --surface-2: #162940;
  --surface-3: #1b3049;
  --text: #ecf0e8;
  --muted: #a7b3b1;
  --faint: #748589;
  --line: rgba(204, 181, 130, 0.18);
  --gold: #d4a94e;
  --gold-soft: #efd79e;
  --green: #75a58b;
  --red: #b85f4b;
  --paper: #e9dcc0;
  --nav-w: 270px;
  --top-h: 72px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  --sans: Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}

html[data-theme="light"] {
  --bg: #f1eadb;
  --surface: #fbf7ed;
  --surface-2: #e8deca;
  --surface-3: #ded1b9;
  --text: #18283c;
  --muted: #53616a;
  --faint: #788078;
  --line: rgba(48, 43, 32, 0.16);
  --gold: #9a6d18;
  --gold-soft: #6e4d10;
  --green: #426c58;
  --red: #914638;
  --paper: #eee2c8;
  --shadow: 0 24px 70px rgba(62, 48, 26, 0.15);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top-h) + 24px); }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 80% 5%, rgba(65, 110, 89, 0.13), transparent 28rem),
    radial-gradient(circle at 30% 20%, rgba(184, 95, 75, 0.08), transparent 24rem),
    var(--bg);
  font-family: var(--sans);
  line-height: 1.75;
  transition: background-color .25s ease, color .25s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
  z-index: 100;
}

button, input { font: inherit; }
a { color: inherit; }
img { max-width: 100%; display: block; }
code { font-family: "SFMono-Regular", Consolas, monospace; }

.skip-link { position: fixed; top: -100px; left: 20px; z-index: 1000; padding: 10px 16px; background: var(--gold); color: #101722; border-radius: 8px; }
.skip-link:focus { top: 12px; }

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--top-h);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(18px);
}

.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; line-height: 1.1; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--gold); color: var(--gold-soft); border-radius: 50%; font-family: var(--serif); font-size: 12px; letter-spacing: -1px; }
.brand strong { display: block; font-family: var(--serif); font-size: 17px; letter-spacing: .08em; }
.brand small { display: block; margin-top: 5px; color: var(--faint); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; }
.top-actions { display: flex; gap: 8px; }
.icon-button { display: flex; gap: 7px; align-items: center; border: 1px solid var(--line); color: var(--muted); background: var(--surface); border-radius: 999px; padding: 8px 13px; cursor: pointer; transition: .2s ease; }
.icon-button:hover { color: var(--text); border-color: var(--gold); transform: translateY(-1px); }
.menu-toggle { display: none; }

.reading-progress { position: fixed; top: var(--top-h); left: 0; right: 0; height: 2px; z-index: 55; }
.reading-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--gold), var(--red)); }

.sidebar { position: fixed; top: var(--top-h); bottom: 0; left: 0; width: var(--nav-w); z-index: 40; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 93%, transparent); }
.sidebar-inner { height: 100%; overflow-y: auto; padding: 38px 26px; }
.eyebrow { margin: 0 0 12px; color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.toc { display: grid; gap: 4px; margin-top: 24px; }
.toc a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-left: 1px solid transparent; color: var(--muted); text-decoration: none; font-size: 13px; transition: .2s ease; }
.toc a span { color: var(--faint); width: 22px; font-family: Georgia, serif; font-size: 10px; }
.toc a:hover, .toc a.active { color: var(--text); border-left-color: var(--gold); background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 10%, transparent), transparent); }
.toc a.active span { color: var(--gold); }
.sidebar-note { margin-top: 36px; padding: 18px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); }
.sidebar-note span { color: var(--green); font-size: 10px; letter-spacing: .14em; }
.sidebar-note p { margin: 8px 0 0; font-family: var(--serif); font-size: 14px; line-height: 1.65; }

main { margin-left: var(--nav-w); overflow: hidden; }
.hero { min-height: 940px; position: relative; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .7fr); align-items: center; gap: 7vw; padding: 130px clamp(36px, 7vw, 110px) 90px; border-bottom: 1px solid var(--line); }
.hero-grid { position: absolute; inset: 0; opacity: .08; background-image: linear-gradient(var(--gold) 1px, transparent 1px), linear-gradient(90deg, var(--gold) 1px, transparent 1px); background-size: 52px 52px; mask-image: linear-gradient(to bottom, black, transparent 82%); }
.hero-copy, .hero-visual { position: relative; }
.hero h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(64px, 7vw, 116px); line-height: .98; letter-spacing: -.05em; }
.hero h1 strong { color: var(--gold-soft); font-weight: 500; }
.hero-lead { max-width: 680px; margin: 32px 0 0; color: var(--muted); font-family: var(--serif); font-size: clamp(18px, 1.5vw, 23px); line-height: 1.8; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 38px; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; gap: 16px; padding: 12px 20px; border-radius: 2px; text-decoration: none; font-size: 13px; font-weight: 700; letter-spacing: .05em; transition: .2s ease; }
.primary-button { background: var(--gold); color: #111927; }
.secondary-button { border: 1px solid var(--line); color: var(--text); background: var(--surface); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.hero-stats { display: flex; gap: clamp(26px, 4vw, 58px); margin: 56px 0 0; padding-top: 24px; border-top: 1px solid var(--line); }
.hero-stats div { display: grid; gap: 3px; }
.hero-stats dt { color: var(--gold-soft); font-family: Georgia, serif; font-size: 20px; }
.hero-stats dd { margin: 0; color: var(--faint); font-size: 11px; letter-spacing: .12em; }
.hero-visual { max-width: 430px; justify-self: center; transform: rotate(1.2deg); }

.image-frame { margin: 0; padding: 10px; border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); background: #0b1018; box-shadow: var(--shadow); }
.image-frame img { width: 100%; background: var(--paper); }
.image-frame figcaption { display: flex; justify-content: space-between; gap: 15px; padding: 12px 6px 4px; color: #aab5b5; font-size: 10px; letter-spacing: .08em; }
.image-frame figcaption span { color: var(--gold); }
html[data-theme="light"] .image-frame { background: #1a2735; }

.doc-section { max-width: 1180px; margin: 0 auto; padding: 112px clamp(32px, 6vw, 90px); border-bottom: 1px solid var(--line); }
.section-heading { display: grid; grid-template-columns: 64px 1fr; gap: 22px; align-items: start; margin-bottom: 46px; }
.section-index { color: var(--gold); font-family: Georgia, serif; font-size: 18px; padding-top: 7px; }
.section-heading h2 { margin: 0; max-width: 850px; font-family: var(--serif); font-weight: 500; font-size: clamp(35px, 4vw, 56px); line-height: 1.25; letter-spacing: -.03em; }
.prose { color: var(--muted); font-family: var(--serif); font-size: 17px; line-height: 1.95; }
.prose h3 { color: var(--text); margin: 0 0 16px; font-size: 26px; font-weight: 500; }
.prose p { margin: 0 0 20px; }
.prose strong { color: var(--gold-soft); font-weight: 600; }
.lead-prose { max-width: 880px; font-size: clamp(20px, 2vw, 27px); line-height: 1.85; }

.concept-flow { display: flex; align-items: stretch; gap: 14px; margin-top: 48px; }
.concept-flow div { flex: 1; min-height: 140px; padding: 24px; border: 1px solid var(--line); background: var(--surface); }
.concept-flow span { display: block; color: var(--gold); font: 11px Georgia, serif; }
.concept-flow strong { display: block; margin-top: 17px; font-family: var(--serif); font-size: 24px; }
.concept-flow small { display: block; margin-top: 6px; color: var(--faint); font-size: 11px; }
.concept-flow i { align-self: center; color: var(--gold); font-style: normal; }

.note-card { margin-top: 34px; padding: 28px; border: 1px solid var(--line); background: var(--surface); }
.note-card > span { color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.note-card h3 { margin: 10px 0; font-family: var(--serif); font-weight: 500; }
.note-card p { color: var(--muted); margin: 8px 0 0; }
.accent-card { border-color: color-mix(in srgb, var(--gold) 35%, transparent); }
.quote-card blockquote { margin: 14px 0 0; font-family: var(--serif); font-size: clamp(21px, 2vw, 30px); line-height: 1.7; }

.split-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .65fr); gap: clamp(40px, 7vw, 90px); align-items: center; }
.split-layout.reverse { grid-template-columns: minmax(280px, .65fr) minmax(0, 1.2fr); }
.compact-frame { max-width: 390px; justify-self: center; }
.formula-block { display: grid; gap: 8px; margin: 25px 0; padding: 24px 28px; border-left: 2px solid var(--gold); background: var(--surface); color: var(--text); font: 21px Georgia, serif; }
.definition-list { display: grid; gap: 12px; }
.definition-list div { padding: 16px 18px; border: 1px solid var(--line); background: var(--surface); }
.definition-list b { color: var(--gold-soft); font-family: var(--sans); font-size: 13px; letter-spacing: .05em; }
.definition-list p { margin: 6px 0 0; font-size: 15px; }
.formula-hero { margin: 58px 0 0; padding: 32px; border: 1px solid var(--line); background: linear-gradient(135deg, var(--surface), var(--surface-2)); text-align: center; }
.formula-hero small { color: var(--gold); font-size: 10px; letter-spacing: .18em; }
.formula-hero div { margin-top: 16px; font: clamp(20px, 3vw, 38px) Georgia, serif; overflow-wrap: anywhere; }
.formula-hero p { margin: 12px 0 0; color: var(--muted); font-family: var(--serif); }

.three-up, .four-up { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
.four-up { grid-template-columns: repeat(4, 1fr); }
.mini-card { padding: 24px; border: 1px solid var(--line); background: var(--surface); }
.mini-card span { color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .1em; }
.mini-card h3 { margin: 14px 0 8px; font-family: var(--serif); font-size: 20px; font-weight: 500; }
.mini-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }

.code-example { position: relative; margin: 44px 0 70px; padding: 34px 180px 34px 34px; border: 1px solid var(--line); background: #08111d; color: #e5ecdf; overflow: hidden; }
.code-line { display: flex; gap: 20px; align-items: center; }
.code-line span { width: 30px; color: #627385; font: 12px monospace; }
.code-line code { color: #d9e5d7; font-size: 15px; }
.code-gap { height: 130px; display: grid; place-items: center; color: #526476; font: 11px monospace; letter-spacing: .12em; }
.code-example svg { position: absolute; width: 150px; height: 220px; top: 18px; right: 22px; fill: var(--green); stroke: var(--green); stroke-width: 2; }
.code-example svg path { fill: none; }
.check-list { padding: 0; list-style: none; }
.check-list li { margin-bottom: 10px; padding-left: 20px; position: relative; }
.check-list li::before { content: "×"; position: absolute; left: 0; color: var(--gold); }
.check-list b { color: var(--text); }

.data-table-wrap, .evolution-table-wrap { overflow-x: auto; border: 1px solid var(--line); margin-bottom: 58px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 660px; background: var(--surface); }
.data-table th, .data-table td { padding: 17px 20px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
.data-table th { color: var(--gold); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; background: var(--surface-2); }
.data-table td { color: var(--muted); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td:first-child { color: var(--text); font-family: var(--serif); font-size: 17px; }
.data-table strong { color: var(--gold-soft); }
.equation-note { margin: 28px 0; padding: 22px; border: 1px solid var(--line); background: var(--surface); }
.equation-note code { color: var(--gold-soft); font-size: clamp(17px, 2vw, 23px); }
.equation-note p { margin: 10px 0 0; font-size: 14px; }
.inline-callout { padding: 14px 18px; border-left: 2px solid var(--red); background: var(--surface); color: var(--text); }

.timeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 40px 0; background: var(--line); border: 1px solid var(--line); }
.timeline article { padding: 28px 22px; background: var(--surface); }
.timeline span { color: var(--gold); font: 12px Georgia, serif; }
.timeline h3 { margin: 18px 0 8px; font-family: var(--serif); font-weight: 500; font-size: 19px; }
.timeline p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.two-column-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-column-notes .note-card { margin: 0; }
.token-demo { margin: 42px 0; padding: 32px; text-align: center; border: 1px solid var(--line); background: var(--surface); }
.token-demo p { margin: 0 0 12px; color: var(--muted); }
.token-demo > strong { display: block; font: clamp(20px, 3vw, 34px) Georgia, serif; color: var(--gold-soft); }
.token-demo div { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 24px 0 12px; }
.token-demo div span { padding: 6px 11px; border: 1px solid var(--line); background: var(--surface-2); font-family: monospace; font-size: 13px; }
.token-demo small { color: var(--faint); font-size: 10px; }

.vision-pipeline { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 40px 0 56px; padding: 30px; border: 1px solid var(--line); background: var(--surface); overflow-x: auto; }
.vision-pipeline > i { color: var(--gold); font-style: normal; }
.pixel-grid { width: 106px; min-width: 106px; height: 106px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--line); }
.pixel-grid span { background: linear-gradient(135deg, var(--surface-3), color-mix(in srgb, var(--green) 55%, var(--surface))); }
.pixel-grid span:nth-child(2n) { background: linear-gradient(135deg, color-mix(in srgb, var(--red) 55%, var(--surface)), var(--surface-2)); }
.pixel-grid span:nth-child(5) { background: var(--gold); }
.pipeline-step { min-width: 125px; text-align: center; }
.pipeline-step b { display: block; color: var(--text); font-family: var(--serif); font-size: 15px; }
.pipeline-step small { display: block; color: var(--faint); font-size: 10px; margin-top: 5px; }

.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 60px; }
.memory-grid article { position: relative; padding: 28px 22px; min-height: 240px; border: 1px solid var(--line); background: var(--surface); }
.memory-grid article::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--green); opacity: calc(.35 + var(--i, 0) * .15); }
.memory-grid span { color: var(--gold); font: 13px Georgia, serif; }
.memory-grid h3 { min-height: 56px; margin: 20px 0 10px; font-family: var(--serif); font-size: 19px; font-weight: 500; }
.memory-grid p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.memory-grid small { position: absolute; bottom: 18px; color: var(--green); font-size: 10px; letter-spacing: .08em; }
.large-quote { color: var(--text); font-size: clamp(26px, 3vw, 42px); line-height: 1.55; }
.large-quote em { color: var(--red); font-style: normal; font-size: .65em; letter-spacing: .2em; }

.evolution-table td:nth-child(3) { background: color-mix(in srgb, var(--gold) 7%, transparent); }
.recipe-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin: 45px 0; font-family: Georgia, var(--serif); }
.recipe-line span { padding: 12px 18px; border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); color: var(--gold-soft); background: var(--surface); }
.recipe-line i { color: var(--faint); font-style: normal; }
.block-diagram { display: flex; align-items: stretch; gap: 7px; margin-bottom: 26px; overflow-x: auto; }
.block-input, .block-stage, .block-residual { display: grid; place-items: center; min-width: 118px; padding: 18px 14px; border: 1px solid var(--line); background: var(--surface); text-align: center; }
.block-stage.accent { border-color: color-mix(in srgb, var(--green) 55%, transparent); background: color-mix(in srgb, var(--green) 10%, var(--surface)); }
.block-stage.warm { border-color: color-mix(in srgb, var(--red) 55%, transparent); background: color-mix(in srgb, var(--red) 9%, var(--surface)); }
.block-residual { min-width: 72px; border-radius: 50%; }
.block-diagram b { font-family: var(--serif); font-weight: 500; }
.block-diagram small { display: block; margin-top: 4px; color: var(--faint); font-size: 9px; }

.normalization-section { max-width: 1280px; }
.cost-contrast { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 48px 0 14px; }
.cost-panel { padding: 26px; border: 1px solid var(--line); background: linear-gradient(145deg, var(--surface), var(--surface-2)); }
.cost-label { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
.cost-label span { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.cost-label b { color: var(--gold-soft); font: 24px Georgia, serif; }
.cost-track { display: flex; width: 100%; height: 38px; margin-top: 20px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.cost-track i { display: block; height: 100%; font-style: normal; }
.cost-gemm { width: calc(100% - 5px); background: color-mix(in srgb, var(--green) 65%, var(--surface-3)); }
.cost-norm { background: var(--red); }
.cost-norm.tiny { width: 5px; }
.cost-gemm.runtime { width: 75%; }
.cost-norm.runtime { width: 25%; }
.cost-panel > p { display: flex; justify-content: space-between; gap: 12px; margin: 10px 0 0; color: var(--faint); font-size: 12px; }
.cost-panel > p span:last-child { text-align: right; color: color-mix(in srgb, var(--red) 72%, var(--text)); }
.figure-note { margin: 0 0 54px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.figure-note strong { color: var(--text); }

.normalization-types { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 38px 0 64px; }
.normalization-types article { padding: 30px; border: 1px solid var(--line); background: var(--surface); }
.normalization-types article > span { color: var(--gold); font: 13px Georgia, serif; letter-spacing: .06em; }
.normalization-types h3 { margin: 13px 0 20px; font-family: var(--serif); font-size: 24px; font-weight: 500; }
.normalization-types p { margin: 22px 0 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
.math-line { margin-top: 8px; padding: 11px 14px; overflow-x: auto; border-left: 2px solid var(--green); background: var(--surface-2); color: var(--gold-soft); font: 16px Georgia, serif; white-space: nowrap; }

.worked-example { margin: 0 0 18px; padding: clamp(26px, 4vw, 44px); border: 1px solid color-mix(in srgb, var(--gold) 38%, transparent); background: linear-gradient(145deg, color-mix(in srgb, var(--gold) 7%, var(--surface)), var(--surface)); }
.example-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.example-heading span, .memory-story header span, .optimization-list header span { color: var(--green); font-size: 12px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.example-heading h3, .memory-story header h3, .optimization-list header h3 { margin: 0; font-family: var(--serif); font-size: clamp(23px, 3vw, 34px); font-weight: 500; }
.example-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.example-grid article { padding: 24px; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 45%, transparent); }
.example-grid article > b { color: var(--gold-soft); font-family: Georgia, serif; font-size: 17px; }
.example-grid ol { margin: 18px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.9; }
.example-grid strong { color: var(--text); }
.example-grid code { color: var(--gold-soft); font-size: 12px; overflow-wrap: anywhere; }
.worked-example > p { margin: 26px 0 0; color: var(--muted); font-family: var(--serif); font-size: 17px; line-height: 1.9; }
.worked-example > p strong { color: var(--gold-soft); }

.memory-story { margin: 18px 0 0; padding: clamp(26px, 4vw, 44px); border: 1px solid var(--line); background: var(--surface); }
.memory-story header, .optimization-list header { display: grid; gap: 9px; margin-bottom: 28px; }
.memory-math { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); }
.memory-math > div { min-width: 0; padding: 22px 18px; border-right: 1px solid var(--line); }
.memory-math > div:last-child { border-right: 0; }
.memory-math small { display: block; color: var(--faint); font-size: 11px; letter-spacing: .06em; }
.memory-math strong { display: block; margin-top: 10px; color: var(--gold-soft); font: clamp(19px, 2.2vw, 28px) Georgia, serif; }
.memory-math p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.comparison-table-wrap { margin-top: 22px; overflow-x: auto; border: 1px solid var(--line); }
.comparison-table { width: 100%; min-width: 650px; border-collapse: collapse; }
.comparison-table th, .comparison-table td { padding: 15px 18px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; line-height: 1.55; }
.comparison-table th { color: var(--gold); background: var(--surface-2); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.comparison-table td { color: var(--muted); }
.comparison-table td:first-child { color: var(--text); font-weight: 700; }
.comparison-table tr:last-child td { border-bottom: 0; }
.timing-example { margin: 24px 0 0; padding: 20px 22px; border-left: 2px solid var(--gold); background: var(--surface-2); color: var(--muted); font-size: 14px; line-height: 1.85; }
.timing-example strong { color: var(--gold-soft); }

.bottleneck-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 58px 0 18px; }
.bottleneck-grid article { min-height: 190px; padding: 27px; border: 1px solid var(--line); background: var(--surface); }
.bottleneck-grid span { color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.bottleneck-grid h3 { margin: 17px 0 9px; font-family: var(--serif); font-size: 21px; font-weight: 500; }
.bottleneck-grid p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }

.hbm-answer { display: grid; grid-template-columns: .72fr 1.28fr; gap: clamp(28px, 5vw, 70px); margin: 18px 0; padding: clamp(30px, 5vw, 52px); border: 1px solid color-mix(in srgb, var(--green) 42%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--green) 12%, var(--surface)), var(--surface)); }
.hbm-answer h3 { margin: 15px 0 0; font-family: var(--serif); font-size: clamp(27px, 3.5vw, 43px); font-weight: 500; line-height: 1.3; }
.hbm-answer .prose { font-size: 16px; }

.optimization-list { margin-top: 58px; }
.optimization-list ol { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0; padding: 1px; list-style: none; background: var(--line); }
.optimization-list li { position: relative; min-height: 155px; padding: 27px 27px 25px 62px; background: var(--surface); counter-increment: optimization; }
.optimization-list ol { counter-reset: optimization; }
.optimization-list li::before { content: "0" counter(optimization); position: absolute; top: 27px; left: 25px; color: var(--gold); font: 13px Georgia, serif; }
.optimization-list b { color: var(--text); font-family: var(--serif); font-size: 19px; font-weight: 500; }
.optimization-list p { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.optimization-list code { color: var(--gold-soft); font-size: 12px; }

.movement-section { max-width: 1320px; }
.memory-ladder { display: grid; grid-template-columns: 26px minmax(150px, 1.2fr) 24px minmax(140px, 1fr) 24px minmax(160px, 1.05fr) 24px minmax(170px, 1.15fr) 26px; align-items: stretch; gap: 8px; margin: 52px 0 14px; }
.ladder-stage { position: relative; display: grid; align-content: center; min-height: 164px; padding: 22px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.ladder-stage::after { content: ""; position: absolute; inset: auto 0 0; height: 4px; background: var(--green); opacity: .45; }
.ladder-stage small { color: var(--faint); font-size: 9px; font-weight: 700; letter-spacing: .14em; }
.ladder-stage strong { display: block; margin: 12px 0 6px; color: var(--gold-soft); font: clamp(18px, 2vw, 25px) Georgia, serif; }
.ladder-stage span { color: var(--muted); font-size: 12px; line-height: 1.55; }
.hbm-stage { background: linear-gradient(145deg, color-mix(in srgb, var(--red) 13%, var(--surface)), var(--surface)); }
.hbm-stage::after { background: var(--red); opacity: .78; }
.compute-stage { background: linear-gradient(145deg, color-mix(in srgb, var(--green) 16%, var(--surface)), var(--surface)); }
.compute-stage::after { opacity: .9; }
.ladder-arrow { align-self: center; color: var(--gold); font-style: normal; text-align: center; }
.ladder-axis { display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 9px; letter-spacing: .08em; writing-mode: vertical-rl; }
.ladder-axis i { color: var(--gold); font-size: 18px; font-style: normal; }

.movement-methods { display: grid; gap: 12px; margin: 56px 0 18px; }
.movement-methods > article { display: grid; grid-template-columns: 44px minmax(0, 1.35fr) minmax(260px, .9fr); gap: clamp(18px, 3vw, 38px); align-items: center; min-height: 250px; padding: clamp(24px, 4vw, 38px); border: 1px solid var(--line); background: var(--surface); }
.method-number { align-self: start; color: var(--gold); font: 14px Georgia, serif; }
.method-copy > span { color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: .14em; }
.method-copy h3 { margin: 11px 0 12px; font-family: var(--serif); font-size: clamp(21px, 2.3vw, 29px); font-weight: 500; line-height: 1.4; }
.method-copy p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
.method-copy small { display: block; margin-top: 14px; padding-left: 12px; border-left: 1px solid var(--red); color: var(--faint); font-size: 12px; line-height: 1.7; }

.precision-meter { display: grid; gap: 9px; align-content: center; }
.precision-meter b { display: flex; width: var(--w); min-width: 95px; justify-content: space-between; gap: 12px; padding: 9px 11px; color: var(--text); background: color-mix(in srgb, var(--gold) 22%, var(--surface-3)); font-size: 11px; font-weight: 500; white-space: nowrap; }
.precision-meter b:nth-child(2) { background: color-mix(in srgb, var(--green) 28%, var(--surface-3)); }
.precision-meter b:nth-child(3) { background: color-mix(in srgb, var(--red) 32%, var(--surface-3)); }
.precision-meter em { color: var(--gold-soft); font-style: normal; }

.fusion-sketch { display: grid; gap: 10px; }
.fusion-sketch > div { padding: 15px 17px; border: 1px solid var(--line); background: var(--surface-2); }
.fusion-sketch > div > span { color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.fusion-sketch p { margin: 9px 0 4px; color: var(--muted); font: 12px monospace; line-height: 1.7; }
.fusion-sketch p b { color: var(--red); }
.fusion-sketch small { color: var(--faint); font-size: 10px; }
.fusion-sketch .fused { border-color: color-mix(in srgb, var(--green) 45%, transparent); background: color-mix(in srgb, var(--green) 11%, var(--surface)); }
.fusion-sketch .fused p b, .fusion-sketch .fused > span { color: var(--green); }

.recompute-line { padding: 20px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font: 12px monospace; line-height: 2.7; }
.recompute-line > span:first-child, .recompute-line br + span { display: inline-block; width: 42px; color: var(--faint); font: 10px var(--sans); font-weight: 700; letter-spacing: .1em; }
.recompute-line b { padding: 6px 8px; border: 1px solid var(--gold); color: var(--gold-soft); }
.recompute-line i { color: var(--green); font-style: normal; }
.recompute-line .discard { display: inline; margin-left: 5px; color: var(--red); font: 10px var(--sans); }

.coalescing-demo { display: grid; gap: 15px; }
.coalescing-demo > div > span { color: var(--text); font-size: 11px; font-weight: 700; }
.coalescing-demo small { color: var(--faint); font-size: 10px; }
.cells { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; margin: 7px 0 5px; padding: 5px; border: 1px solid var(--line); background: var(--bg); }
.cells i { height: 24px; background: color-mix(in srgb, var(--green) 58%, var(--surface)); }
.cells.bad i { background: var(--surface-3); }
.cells.bad i:nth-child(1), .cells.bad i:nth-child(3), .cells.bad i:nth-child(6), .cells.bad i:nth-child(8) { background: color-mix(in srgb, var(--red) 64%, var(--surface)); }

.tile-sketch { display: flex; align-items: center; justify-content: center; gap: 11px; min-width: 0; }
.tile-sketch > b { color: var(--gold); font-weight: 400; }
.tile-matrix { flex: 0 0 86px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 5px; border: 1px solid var(--line); background: var(--bg); }
.tile-matrix i { aspect-ratio: 1; background: var(--surface-3); }
.tile-matrix i:nth-child(2), .tile-matrix i:nth-child(5), .tile-matrix i:nth-child(8) { background: color-mix(in srgb, var(--gold) 55%, var(--surface)); }
.tile-chip, .tile-output { display: grid; place-items: center; min-height: 82px; padding: 12px; border: 1px solid color-mix(in srgb, var(--green) 46%, transparent); background: color-mix(in srgb, var(--green) 10%, var(--surface)); text-align: center; }
.tile-chip span { color: var(--green); font-size: 9px; letter-spacing: .1em; }
.tile-chip strong { color: var(--gold-soft); font: 15px Georgia, serif; }
.tile-output { border-color: var(--line); color: var(--muted); font-size: 11px; }

.traffic-case { margin: 56px 0 22px; padding: clamp(26px, 4vw, 44px); border: 1px solid color-mix(in srgb, var(--gold) 38%, transparent); background: linear-gradient(145deg, color-mix(in srgb, var(--gold) 7%, var(--surface)), var(--surface)); }
.traffic-case header { display: grid; gap: 8px; }
.traffic-case header span { color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.traffic-case header h3 { margin: 0; font-family: var(--serif); font-size: clamp(23px, 3vw, 34px); font-weight: 500; }
.traffic-compare { display: grid; grid-template-columns: 1fr 64px 1fr; align-items: stretch; gap: 14px; margin-top: 28px; }
.traffic-compare article { padding: 23px; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 48%, transparent); }
.traffic-compare article > span { color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .11em; }
.traffic-compare article > strong { display: block; margin: 10px 0 3px; color: var(--red); font: clamp(26px, 3vw, 38px) Georgia, serif; }
.traffic-compare article > p { margin: 0; color: var(--muted); font-size: 12px; }
.traffic-compare .traffic-winner { border-color: color-mix(in srgb, var(--green) 48%, transparent); }
.traffic-compare .traffic-winner > strong { color: var(--green); }
.traffic-vs { display: grid; place-items: center; color: var(--gold); font: 18px Georgia, serif; }
.traffic-bar { display: flex; gap: 4px; height: 14px; margin-top: 19px; }
.traffic-bar i { flex: 1; background: var(--red); opacity: .76; }
.traffic-winner .traffic-bar { width: 33.333%; }
.traffic-winner .traffic-bar i { background: var(--green); opacity: 1; }
.traffic-case > p { margin: 24px 0 0; color: var(--muted); font-size: 14px; line-height: 1.85; }
.traffic-case > p strong { color: var(--gold-soft); }
.movement-table-wrap { margin: 0 0 22px; }
.movement-table td:nth-child(2) { color: var(--gold-soft); }

.vocab-section, .recap-section { max-width: 1280px; }
.vocab-section code { overflow-wrap: anywhere; }
.vocab-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 28px; padding: clamp(24px, 4vw, 42px); margin: 40px 0; border: 1px solid var(--line); background: linear-gradient(125deg, var(--surface-2), var(--surface)); }
.vocab-banner > div { flex: 1; min-width: 150px; }
.vocab-banner small, .vocab-banner span { display: block; color: var(--muted); font-size: .875rem; }
.vocab-banner strong { display: block; color: var(--gold-soft); font: clamp(36px, 5vw, 64px) Georgia, serif; line-height: 1.5; }
.vocab-banner > b { color: var(--green); font-size: 28px; }
.vocab-banner > p { flex-basis: 100%; margin: 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--text); }
.vocab-banner em { color: var(--muted); font-size: .875rem; font-style: normal; }
.vocab-equation { margin: 24px 0 32px; padding: 24px; border-left: 2px solid var(--gold); background: var(--surface); }
.vocab-equation > span { display: block; color: var(--muted); font-size: .875rem; }
.vocab-equation > code { display: block; margin: 16px 0; color: var(--gold-soft); font-size: clamp(16px, 2vw, 24px); }
.vocab-equation p { margin: 0; color: var(--muted); font-size: 1rem; }
.recap-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.recap-cards article { padding: 24px; border: 1px solid var(--line); background: var(--surface); }
.recap-cards span { color: var(--green); font-size: .875rem; }
.recap-cards h3 { margin: 15px 0; font-family: var(--serif); font-size: 23px; font-weight: 500; line-height: 1.45; }
.recap-cards p, .vocab-timing article p { margin: 12px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.8; }
.section-citation { margin: 22px 0 40px; color: var(--muted); font-size: .875rem; line-height: 1.9; }
.section-citation a, .vocab-section .prose a, .recap-verdicts a, .vocab-section .note-card a { text-decoration-color: var(--green); text-underline-offset: 4px; }
.vocab-timing .math-line { white-space: normal; line-height: 1.7; }
.recap-verdicts { display: grid; gap: 16px; margin: 38px 0; }
.recap-verdicts > article { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 20px; padding: clamp(24px, 4vw, 38px); border: 1px solid var(--line); background: var(--surface); }
.recap-verdicts > article > span { color: var(--gold); font: 24px Georgia, serif; }
.recap-verdicts h3 { margin: 0 0 20px; font-family: var(--serif); font-size: clamp(24px, 3vw, 32px); font-weight: 500; }
.recap-verdicts p { color: var(--muted); font-size: 1rem; line-height: 1.9; }
.recap-verdicts p:last-child { margin-bottom: 0; }
.recap-verdicts .math-line { white-space: normal; line-height: 1.7; }
@media (max-width: 1100px) { .recap-cards { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
  .vocab-banner { gap: 14px; }
  .vocab-banner > div { min-width: 100px; }
  .vocab-banner strong { font-size: 34px; }
  .vocab-banner > b { font-size: 20px; }
  .recap-verdicts > article { grid-template-columns: 1fr; gap: 12px; }
}

.limits-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.limits-grid article { grid-column: span 2; padding: 26px; border: 1px solid var(--line); background: var(--surface); }
.limits-grid article:nth-child(4), .limits-grid article:nth-child(5) { grid-column: span 3; }
.limits-grid b { color: var(--red); font: 16px Georgia, serif; }
.limits-grid h3 { margin: 14px 0 8px; font-family: var(--serif); font-weight: 500; }
.limits-grid p { margin: 0; color: var(--muted); font-size: 13px; }
.closing-statement { margin: 70px 0 0; text-align: center; color: var(--muted); font-family: var(--serif); font-size: clamp(20px, 2.5vw, 32px); }
.closing-statement strong { color: var(--gold-soft); font-weight: 500; }

.gallery-section { max-width: 1480px; }
.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 40px; }
.gallery-card { position: relative; border: 1px solid var(--line); padding: 0; color: var(--text); background: var(--surface); text-align: left; cursor: zoom-in; overflow: hidden; transition: .25s ease; }
.gallery-card:hover { transform: translateY(-5px); border-color: var(--gold); box-shadow: var(--shadow); }
.gallery-card img { width: 100%; aspect-ratio: 9/16; object-fit: cover; object-position: top; transition: transform .35s ease; }
.gallery-card:hover img { transform: scale(1.025); }
.gallery-card span { position: absolute; left: 10px; top: 10px; padding: 3px 7px; background: rgba(10, 19, 31, .85); color: var(--gold-soft); font: 10px Georgia, serif; }
.gallery-card b { display: block; padding: 13px 12px 15px; font-family: var(--serif); font-size: 14px; font-weight: 500; }

.source-list { display: grid; border-top: 1px solid var(--line); }
.source-list a { display: grid; grid-template-columns: 80px 1fr 30px; align-items: center; gap: 18px; padding: 21px 8px; border-bottom: 1px solid var(--line); text-decoration: none; transition: .2s ease; }
.source-list a:hover { padding-left: 18px; background: var(--surface); }
.source-list span { color: var(--green); font-size: 9px; letter-spacing: .14em; }
.source-list strong { font-family: var(--serif); font-size: 16px; font-weight: 500; }
.source-list i { color: var(--gold); font-style: normal; }

.site-footer { min-height: 420px; display: grid; place-items: center; align-content: center; gap: 18px; padding: 80px 30px; text-align: center; background: var(--surface); }
.site-footer p { color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: .22em; }
.site-footer blockquote { max-width: 800px; margin: 0; font-family: var(--serif); font-size: clamp(28px, 4vw, 52px); line-height: 1.5; }
.site-footer a { color: var(--muted); font-size: 12px; text-decoration: none; }

dialog { color: var(--text); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(2, 7, 13, .84); backdrop-filter: blur(8px); }
.search-dialog { width: min(680px, calc(100vw - 30px)); margin-top: 12vh; padding: 0; border-radius: 10px; }
.search-shell { padding: 0; }
.search-input-wrap { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.search-input-wrap > span { color: var(--gold); font-size: 22px; }
.search-input-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 16px; }
.search-input-wrap button { border: 1px solid var(--line); color: var(--muted); background: var(--surface-2); border-radius: 5px; padding: 3px 7px; font-size: 10px; }
.search-results { max-height: 55vh; overflow-y: auto; padding: 12px; }
.search-results > p { margin: 12px; color: var(--muted); font-size: 13px; }
.search-result { display: block; padding: 13px 15px; border-radius: 6px; text-decoration: none; }
.search-result:hover { background: var(--surface-2); }
.search-result b { display: block; font-family: var(--serif); font-weight: 500; }
.search-result small { color: var(--faint); }
.image-dialog { width: min(920px, 96vw); height: 94vh; max-width: none; max-height: none; padding: 0; background: #070b11; overflow: hidden; }
.modal-content { height: 100%; overflow: auto; display: grid; justify-items: center; padding: 28px; }
.modal-content img { width: min(650px, 88vw); height: auto; }
.modal-content p { color: #d7c18a; font-family: var(--serif); }
.modal-close { position: fixed; top: calc(3vh + 12px); right: calc(2vw + 12px); z-index: 3; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.22); color: white; background: rgba(0,0,0,.65); border-radius: 50%; font-size: 24px; cursor: pointer; }

.searchable.search-hidden { display: none; }

@media (max-width: 1100px) {
  :root { --nav-w: 232px; }
  .hero { grid-template-columns: 1fr .62fr; gap: 40px; }
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
  .four-up { grid-template-columns: repeat(2, 1fr); }
  .memory-grid { grid-template-columns: repeat(2, 1fr); }
  .memory-math { grid-template-columns: repeat(2, 1fr); }
  .memory-math > div:nth-child(2) { border-right: 0; }
  .memory-math > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 820px) {
  :root { --top-h: 64px; }
  .topbar { padding: 0 16px; }
  .button-label { display: none; }
  .icon-button { width: 38px; height: 38px; justify-content: center; padding: 0; }
  .menu-toggle { display: flex; }
  .sidebar { width: min(82vw, 300px); transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  main { margin-left: 0; }
  .hero { min-height: auto; grid-template-columns: 1fr; padding: 110px 24px 70px; }
  .hero h1 { font-size: clamp(57px, 16vw, 88px); }
  .hero-visual { max-width: 430px; margin-top: 24px; transform: none; }
  .doc-section { padding: 84px 24px; }
  .section-heading { grid-template-columns: 40px 1fr; gap: 10px; }
  .split-layout, .split-layout.reverse { grid-template-columns: 1fr; }
  .split-layout.reverse .compact-frame { order: 2; }
  .compact-frame { max-width: 480px; }
  .concept-flow { display: grid; grid-template-columns: 1fr 20px 1fr; }
  .concept-flow i:nth-of-type(2) { display: none; }
  .concept-flow div { min-height: 120px; }
  .three-up { grid-template-columns: 1fr; }
  .cost-contrast, .normalization-types, .example-grid, .bottleneck-grid, .optimization-list ol, .hbm-answer { grid-template-columns: 1fr; }
  .hbm-answer { gap: 22px; }
  .memory-ladder { grid-template-columns: 1fr; gap: 6px; }
  .memory-ladder .ladder-stage { min-height: 116px; }
  .memory-ladder .ladder-arrow { display: block; transform: rotate(90deg); }
  .ladder-axis { display: none; }
  .movement-methods > article { grid-template-columns: 36px 1fr; }
  .movement-methods > article > :last-child { grid-column: 2; }
  .timeline { grid-template-columns: repeat(2, 1fr); }
  .vision-pipeline { justify-content: flex-start; }
  .limits-grid { grid-template-columns: 1fr 1fr; }
  .limits-grid article, .limits-grid article:nth-child(4), .limits-grid article:nth-child(5) { grid-column: span 1; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .brand small { display: none; }
  .hero-lead { font-size: 17px; }
  .hero-stats { gap: 18px; justify-content: space-between; }
  .hero-stats dt { font-size: 16px; }
  .concept-flow { grid-template-columns: 1fr; }
  .concept-flow i { display: none; }
  .section-heading { grid-template-columns: 1fr; }
  .section-index { font-size: 12px; }
  .two-column-notes, .timeline, .memory-grid, .four-up, .limits-grid { grid-template-columns: 1fr; }
  .memory-math { grid-template-columns: 1fr; }
  .memory-math > div, .memory-math > div:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .memory-math > div:last-child { border-bottom: 0; }
  .example-heading { display: grid; align-items: start; }
  .cost-label { align-items: flex-start; }
  .cost-label b { font-size: 20px; }
  .movement-methods > article { grid-template-columns: 1fr; }
  .movement-methods > article > :last-child { grid-column: 1; }
  .method-number { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .traffic-compare { grid-template-columns: 1fr; }
  .traffic-vs { min-height: 34px; }
  .tile-sketch { justify-content: flex-start; overflow-x: auto; }
  .memory-grid article { min-height: 200px; }
  .gallery-grid { gap: 8px; }
  .gallery-card b { font-size: 12px; padding: 10px; }
  .source-list a { grid-template-columns: 60px 1fr 20px; gap: 8px; }
  .source-list strong { font-size: 14px; }
  .code-example { padding-right: 24px; }
  .code-example svg { opacity: .25; right: -10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
