/* Fine-Tuned SLM Router: sibling of the portfolio page. Light theme only.
   Identity colour is --sig (blue, --sig-slm). Frontier lane uses ink. */

body::before {
  background:
    radial-gradient(900px 620px at 90% 4%, rgb(29 78 216 / 0.11), transparent 62%),
    radial-gradient(760px 560px at 0% 62%, rgb(255 159 67 / 0.10), transparent 62%),
    radial-gradient(640px 480px at 60% 100%, rgb(29 78 216 / 0.07), transparent 62%);
}
.brand-mark svg { stroke: var(--sig); }
.nav-links a:focus-visible { outline-offset: 1px; }
.nav .btn-ghost .i { width: 14px; height: 14px; }
.hero-title em, .cta-title em { color: var(--sig); }
.pill-img::before {
  background-image: linear-gradient(110deg, #1d4ed8 0%, #60a5fa 28%, #c7d7ff 50%, #3b6ff0 74%, #1d4ed8 100%);
}
.pill-img { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.5), 0 6px 20px -6px rgb(29 78 216 / 0.5); }
.cta::before { background: radial-gradient(ellipse at center, rgb(29 78 216 / 0.13), transparent 65%); }
.chapter-sub { max-width: 26rem; font-size: 15px; }

/* ---------- hero ---------- */
.hero { min-height: 0; display: block; padding: 150px clamp(16px, 5vw, 80px) var(--space-9); max-width: 1480px; margin: 0 auto; }
.hero-title { font-size: clamp(2.2rem, 5.9vw, 5.9rem); margin-bottom: var(--space-8); max-width: none; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 96px); align-items: start; }
.hero-copy { padding-top: var(--space-6); }
.hero-sub { margin-bottom: var(--space-7); }
.router { margin: 0; transform: translateY(var(--space-7)); }
.router-frame {
  position: relative; aspect-ratio: 16 / 10; border-radius: var(--radius-xl); overflow: hidden;
  border: 1px solid var(--border-subtle); box-shadow: var(--shadow-lg);
  background:
    radial-gradient(circle at 42% 50%, rgb(29 78 216 / 0.10), transparent 55%),
    radial-gradient(circle, rgb(29 78 216 / 0.14) 1px, transparent 1.4px) 0 0 / 22px 22px,
    rgb(255 255 255 / 0.88);
}
.router-svg, .router-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.lane { fill: none; stroke-width: 1.5; stroke-dasharray: 3 7; stroke-linecap: round; }
.lane-in { stroke: var(--border-strong); }
.lane-fr { stroke: var(--text-muted); }
.lane-sl { stroke: var(--sig); stroke-width: 2; }
.node-halo { fill: rgb(29 78 216 / 0.08); stroke: rgb(29 78 216 / 0.25); stroke-dasharray: 2 5; }
.node-core { fill: var(--surface-raised); stroke: var(--sig); stroke-width: 2; }
.node-glyph { fill: none; stroke: var(--sig); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rl { position: absolute; font-size: 11px; color: var(--text-muted); letter-spacing: 0.02em; white-space: nowrap; }
.rl-in { left: 4%; top: 41%; }
.rl-router { left: 28%; top: 62%; transform: translateX(-50%); color: var(--accent-text); }
.rl-fr { right: 3%; top: 13%; color: var(--text-secondary); }
.rl-sl { right: 3%; top: 84%; color: var(--sig); font-weight: 500; }
.router-hud { position: absolute; left: 18px; top: 16px; display: flex; gap: var(--space-5); margin: 0; font-size: 11px; }
.router-hud div { display: flex; flex-direction: column; gap: 2px; }
.router-hud dt { color: var(--text-muted); }
.router-hud dd { margin: 0; font-size: 15px; }
.router-hud b { font-weight: 500; }
.c-sl b { color: var(--sig); } .c-fr b { color: var(--text-primary); }
.router figcaption { margin-top: var(--space-3); font-size: 13px; color: var(--text-muted); text-align: right; }

/* ---------- problem ---------- */
.problem-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 6vw, 112px); align-items: end; }
.problem .chapter-title { font-size: clamp(2.2rem, 4.6vw, 4.4rem); line-height: 1.02; max-width: none; }
.problem-body p { margin: 0 0 var(--space-6); font-size: clamp(17px, 1.3vw, 19px); color: var(--text-secondary); max-width: 46ch; }
.stack { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; padding: 0; margin: 0; }
.stack li { font-size: 12px; color: var(--text-secondary); background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-full); padding: 5px 12px; }

/* ---------- simulator ---------- */
.sim {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 0;
  background: var(--surface-raised); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.sim-controls { padding: clamp(24px, 3.4vw, 56px); display: flex; flex-direction: column; gap: var(--space-7); background: linear-gradient(160deg, color-mix(in oklab, var(--sig) 6%, white), var(--surface-raised) 70%); border-right: 1px solid var(--border-subtle); }
.ctl-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); margin-bottom: var(--space-4); }
.ctl label { font-weight: 600; font-size: 15px; }
.ctl output { font-size: clamp(1.4rem, 2.2vw, 2rem); letter-spacing: -0.03em; font-weight: 500; color: var(--sig); }
.ctl input[type=range] { width: 100%; height: 28px; margin: 0; accent-color: var(--sig); cursor: pointer; background: transparent; }
.ctl-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.sim-note { margin: 0; font-size: 13px; color: var(--text-muted); max-width: 46ch; }
.sim-out { padding: clamp(24px, 3.4vw, 56px); display: flex; flex-direction: column; gap: var(--space-6); justify-content: center; }
.bar-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; color: var(--text-secondary); margin-bottom: var(--space-3); }
.bar-head b { font-size: clamp(1.3rem, 2vw, 1.8rem); letter-spacing: -0.03em; font-weight: 500; color: var(--text-primary); }
.track { position: relative; display: flex; height: 22px; border-radius: 99px; background: var(--surface-overlay); overflow: hidden; }
.fill { display: block; height: 100%; flex: none; }
.fill-direct { width: 100%; background: var(--text-primary); border-radius: 99px; }
.fill-gpu { width: 1.7%; background: var(--sig); }
.fill-esc { width: 15%; background: color-mix(in oklab, var(--sig) 38%, white); }
.bar-legend { display: flex; gap: var(--space-5); margin-top: var(--space-3); font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.bar-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bar-legend b { font-weight: 500; color: var(--text-primary); }
.k-gpu { background: var(--sig); } .k-esc { background: color-mix(in oklab, var(--sig) 38%, white); }
.saving { display: flex; justify-content: space-between; align-items: end; gap: var(--space-5); flex-wrap: wrap; padding: var(--space-5) var(--space-6); border-radius: var(--radius-lg); background: color-mix(in oklab, var(--sig) 8%, white); border: 1px solid color-mix(in oklab, var(--sig) 24%, var(--border-subtle)); }
.saving-label { display: block; font-size: 14px; color: var(--text-secondary); margin-bottom: var(--space-1); }
.saving-num { font-size: clamp(2.4rem, 4.4vw, 4.2rem); line-height: 1; letter-spacing: -0.05em; font-weight: 600; color: var(--sig); }
.saving-pct { display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; color: var(--text-secondary); }
.saving-pct b { font-size: clamp(1.6rem, 2.6vw, 2.4rem); letter-spacing: -0.04em; font-weight: 500; color: var(--text-primary); }
.latency { display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; font-size: 13px; color: var(--text-muted); border-top: 1px solid var(--border-subtle); padding-top: var(--space-4); }
.latency s { text-decoration: line-through; margin-right: 4px; }
.latency b { font-weight: 500; color: var(--text-primary); }
.latency .i { color: var(--sig); }

.values { list-style: none; margin: var(--space-8) 0 0; padding: 0; display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: var(--space-5); }
.values li { display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-5); border-top: 1px solid var(--border-strong); }
.values b { font-size: clamp(2.4rem, 4.4vw, 4rem); line-height: 1; letter-spacing: -0.05em; font-weight: 600; color: var(--sig); }
.values span { color: var(--text-secondary); max-width: 30ch; font-size: 15px; }

/* ---------- pipeline ---------- */
.pipe { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 112px); align-items: start; }
.pipe-stick { position: sticky; top: 130px; }
.pipe-stick .chapter-title { margin-bottom: var(--space-7); }
.pipe-svg { width: min(100%, 300px); overflow: visible; }
.rail { stroke: var(--border-strong); stroke-width: 2; }
.rail-fill { stroke: var(--sig); stroke-width: 2; stroke-dasharray: 240; stroke-dashoffset: var(--rail, 240); }
.pn circle { fill: var(--surface-raised); stroke: var(--border-strong); stroke-width: 2; transition: fill var(--motion-base) var(--ease-out), stroke var(--motion-base) var(--ease-out); }
.pn text { font: 500 12px var(--font-mono); fill: var(--text-muted); transition: fill var(--motion-base) var(--ease-out); }
.pn .pt { font: 500 15px var(--font-sans); fill: var(--text-secondary); }
.pn.is-active circle, .pn.is-done circle { stroke: var(--sig); }
.pn.is-active circle { fill: var(--sig); }
.pn.is-active text:not(.pt) { fill: #fff; }
.pn.is-active .pt { fill: var(--text-primary); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-8); }
.step {
  position: relative; padding: var(--space-7); border-radius: var(--radius-xl); min-height: 300px;
  background: var(--surface-raised); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: var(--space-4); justify-content: flex-end; overflow: hidden;
  transition: box-shadow var(--motion-base) var(--ease-out), border-color var(--motion-base) var(--ease-out);
}
.step:nth-child(even) { margin-left: clamp(0px, 4vw, 64px); }
.step.is-active { border-color: color-mix(in oklab, var(--sig) 45%, var(--border-subtle)); box-shadow: var(--shadow-md); }
.step-n { position: absolute; top: var(--space-4); right: var(--space-6); font-size: clamp(6rem, 11vw, 10rem); line-height: 1; letter-spacing: -0.06em; color: color-mix(in oklab, var(--sig) 12%, white); font-weight: 500; pointer-events: none; }
.step h3 { position: relative; margin: 0; font-size: clamp(1.5rem, 2.4vw, 2.2rem); line-height: 1.1; letter-spacing: -0.025em; max-width: 18ch; }
.step p { position: relative; margin: 0; color: var(--text-secondary); max-width: 46ch; }
.split { position: relative; display: flex; height: 36px; border-radius: 99px; overflow: hidden; font: 500 13px/36px var(--font-mono); }
.split-sl { width: 85%; background: var(--sig); color: #fff; padding-left: 16px; }
.split-fr { width: 15%; background: var(--text-primary); color: #fff; text-align: center; }

/* ---------- scrub ---------- */
.chapter-center { padding-block: var(--space-10); }
.scrub { font-size: clamp(1.6rem, 3.2vw, 3rem); }

/* ---------- deliverables bento ---------- */
.dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(250px, auto); grid-auto-flow: dense; gap: var(--space-4); }
.dl-cell {
  --mx: 50%; --my: 50%; --spot: 0;
  position: relative; overflow: hidden; padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3);
  background: radial-gradient(420px circle at var(--mx) var(--my), rgb(29 78 216 / var(--spot)), transparent 60%), var(--surface-raised);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  transition: border-color var(--motion-base) var(--ease-out), box-shadow var(--motion-base) var(--ease-out), transform var(--motion-slow) var(--ease-out);
}
.dl-cell:hover { --spot: 0.09; border-color: color-mix(in oklab, var(--sig) 40%, var(--border-subtle)); box-shadow: var(--shadow-md); }
.dl-cell h3 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -0.015em; max-width: 20ch; }
.dl-cell p { margin: 0; color: var(--text-secondary); font-size: 15px; max-width: 38ch; }
.dl-a { grid-column: span 2; grid-row: span 2; }
.dl-b { grid-column: span 2; }
.code { margin: auto 0 0; padding: var(--space-5); border-radius: var(--radius-md); background: var(--surface-base); border: 1px solid var(--border-subtle); font-size: 13px; line-height: 1.7; overflow-x: auto; color: var(--text-secondary); transition: transform var(--motion-slow) var(--ease-out); }
.code .k { color: var(--sig); } .code .v { color: #9a3412; }
.dl-a:hover .code { transform: translateY(-4px); }
.mini { width: 100%; margin-top: auto; overflow: visible; }
.m-box { fill: var(--surface-base); stroke: var(--border-strong); stroke-width: 1.5; }
.m-on { fill: color-mix(in oklab, var(--sig) 12%, white); stroke: var(--sig); }
.mini text { font: 500 12px var(--font-mono); fill: var(--text-secondary); }
.m-arrow { fill: none; stroke: var(--sig); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pill { margin-top: auto; align-self: flex-start; font-size: 12px; padding: 8px 12px; border-radius: var(--radius-md); background: color-mix(in oklab, var(--sig) 10%, white); color: var(--accent-text); border: 1px solid color-mix(in oklab, var(--sig) 25%, white); }
.gauge { margin-top: auto; position: relative; height: 12px; border-radius: 99px; background: linear-gradient(90deg, var(--text-primary) 0 15%, color-mix(in oklab, var(--sig) 30%, white) 15% 100%); }
.gauge span { position: absolute; inset: 0; border-radius: inherit; }
.gauge i { position: absolute; top: -5px; left: 15%; width: 3px; height: 22px; background: var(--sig); border-radius: 2px; transition: left var(--motion-slow) var(--ease-out); }
.dl-d:hover .gauge i { left: 40%; }

/* ---------- reduced motion + responsive ---------- */
@media (prefers-reduced-motion: reduce) {
  .dl-cell, .code, .gauge i { transition: none !important; }
}
@media (max-width: 1024px) {
  .hero-grid, .problem-grid, .sim, .pipe { grid-template-columns: minmax(0, 1fr); }
  .router { transform: none; }
  .hero-copy { padding-top: 0; }
  .sim-controls { border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .pipe-stick { position: relative; top: 0; }
  .pipe-svg { display: none; }
  .values { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl-a { grid-row: span 1; min-height: 380px; }
  .step:nth-child(even) { margin-left: 0; }
}
@media (max-width: 640px) {
  .hero { padding-top: 156px; }
  .hero-title { font-size: 2.1rem; }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .dl-a, .dl-b { grid-column: span 1; }
  .step { padding: var(--space-5); min-height: 260px; }
  .rl { font-size: 9px; }
  .router-hud { gap: var(--space-4); left: 12px; top: 10px; }
  .router-hud dd { font-size: 13px; }
  .nav-links { display: none; }
  .nav { grid-template-columns: 1fr auto; }
}
