/* Landing page for the hosted site.
   Shares the product's OLED palette so the demo does not feel like a
   different application. The product itself is the hero image, because the
   fastest way to explain Sahaay is to show a lecture being captioned in
   Hindi. Every motion here is transform, opacity or clip-path, so the
   compositor runs it and the main thread stays free for /live's Whisper. */

:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: rgba(9, 10, 12, 0.86);
  --surface-2: #101215;
  --line: #1d2025;
  --line-hi: #2c3139;
  --text: #ececec;
  --text-dim: #8b919a;
  --accent: #4db8ff;
  --accent-dim: #07161f;
  --accent-glow: rgba(77, 184, 255, 0.28);
  --glitch: #ff3b6b;
  --npu: #00d68f;
  --warn: #ffb020;
  --danger: #ff5c5c;
  --radius: 14px;
  --measure: 68ch;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --nav-h: 60px;
}

.matrix-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}
/* It starts once the page is idle, and fades in rather than popping. */
.matrix-bg { opacity: 0; transition: opacity 0.8s ease; }
.matrix-bg.on { opacity: 1; }

* { box-sizing: border-box; }

/* The hidden attribute only works while no class rule sets display: the
   "Show the app preview" button's inline-flex beat it, so the button sat
   under the open preview on every visit. The product stylesheet learned
   this first (sahaay/ui/style.css); this one had not. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.wrap { width: min(100% - 2.5rem, 1180px); margin-inline: auto; }

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; font-weight: 600; }
h2 { font-size: clamp(1.45rem, 1.1rem + 1.2vw, 2.1rem); }
p { max-width: var(--measure); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px;
    transition: color 0.2s, text-underline-offset 0.25s var(--ease); }
a:hover { color: #8fd2ff; text-underline-offset: 6px; }
a:focus-visible, .btn:focus-visible, .kpi:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
em { color: var(--text); font-style: italic; }
::selection { background: rgba(77, 184, 255, 0.35); color: #fff; }

code {
  font-family: "Cascadia Code", "Consolas", ui-monospace, monospace;
  font-size: 0.87em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1em 0.38em;
}
pre {
  background: #07080a;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  max-width: var(--measure);
  transition: border-color 0.3s;
}
pre:hover { border-color: var(--line-hi); }
pre code { background: none; border: 0; padding: 0; font-size: 0.9rem; line-height: 1.7; }

/* ---------- scroll progress + nav ---------- */

.progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #8fd2ff);
  transform-origin: 0 50%; transform: scaleX(0); box-shadow: 0 0 12px var(--accent-glow); }

/* Fully opaque: text scrolling underneath a translucent bar reads as noise. */
.top { position: sticky; top: 0; z-index: 50; background: #000; border-bottom: 1px solid var(--line);
  transition: border-color 0.3s; }
.top-in { display: flex; align-items: center; justify-content: space-between; height: var(--nav-h); gap: 1rem; }
.top-brand { display: flex; align-items: center; gap: 0.6rem; color: var(--text); text-decoration: none; font-weight: 600; }
.top-brand:hover { color: var(--text); }
.logo-sm { width: 28px !important; height: 28px !important; }
.top-links { display: flex; align-items: center; gap: 0.3rem; }
.top-links a { color: var(--text-dim); text-decoration: none; font-size: 0.9rem; padding: 0.4rem 0.7rem; border-radius: 8px;
  position: relative; transition: color 0.2s, background 0.2s, transform 0.25s var(--ease); }
.top-links a::after { content: ""; position: absolute; left: 0.7rem; right: 0.7rem; bottom: 0.25rem; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.3s var(--ease); }
.top-links a:hover { color: var(--text); background: var(--surface-2); }
.top-links a:hover::after, .top-links a.here::after { transform: scaleX(1); }
.top-links a.here { color: var(--text); }
.top-links .top-cta { color: var(--text); border: 1px solid var(--line-hi); margin-left: 0.3rem; }
.top-links .top-cta::after { display: none; }
@media (max-width: 760px) { .top-links a:not(.top-cta) { display: none; } }

/* ---------- hero ---------- */

.hero {
  padding: clamp(2.5rem, 1rem + 5vw, 5rem) 0 clamp(2rem, 1rem + 3vw, 3.5rem);
  background:
    radial-gradient(60rem 30rem at 15% -10%, rgba(77, 184, 255, 0.07), transparent 70%),
    radial-gradient(45rem 26rem at 95% 0%, rgba(0, 214, 143, 0.04), transparent 70%);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr); gap: clamp(2rem, 1rem + 3vw, 4rem); align-items: center; }
@media (max-width: 980px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }

/* Slide only, no fade: text that starts transparent does not count as
   painted, so a fade here held back the first paint. */
.hero-copy > * { animation: hero-in 0.8s var(--ease) both; }
@keyframes hero-in { from { transform: translateY(14px); } to { transform: none; } }
.hero-copy > :nth-child(2) { animation-delay: 0.08s; }
.hero-copy > :nth-child(3) { animation-delay: 0.16s; }
.hero-copy > :nth-child(4) { animation-delay: 0.24s; }

@keyframes enter {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.brand { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.6rem; }
.logo { width: 60px; height: 60px; flex: none; display: block;
        transition: transform 0.45s var(--ease), filter 0.45s var(--ease); }
.brand:hover .logo, .top-brand:hover .logo { transform: rotate(-6deg) scale(1.06); filter: drop-shadow(0 0 16px var(--accent-glow)); }
.brand h1 { font-size: clamp(2.2rem, 1.6rem + 2vw, 3rem); letter-spacing: -0.02em; position: relative; }
.tag { margin: 0.25rem 0 0; color: var(--text-dim); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; }

.lede { font-size: clamp(1.2rem, 1rem + 0.8vw, 1.6rem); line-height: 1.42; max-width: 30ch; margin: 0 0 1.8rem; }
.lede em { color: var(--accent); font-style: normal; }

.cta { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-bottom: 1.6rem; }

.btn {
  --tx: 0px; --ty: 0px;
  display: inline-block;
  position: relative;
  overflow: hidden;
  padding: 0.68rem 1.2rem;
  border-radius: 10px;
  border: 1px solid var(--line-hi);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transform: translate(var(--tx), var(--ty));
  transition: border-color 0.2s, background 0.2s, color 0.2s,
              box-shadow 0.3s var(--ease), transform 0.35s var(--ease);
}
/* A sheen that sweeps across on hover. */
.btn::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.14) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform 0.6s var(--ease); pointer-events: none; }
.btn:hover::before { transform: translateX(120%); }
.btn:hover { border-color: var(--accent); color: var(--text); box-shadow: 0 10px 28px -12px var(--accent-glow); text-decoration: none; }
.btn:active { transform: translate(var(--tx), var(--ty)) scale(0.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #03111a; font-weight: 600; }
.btn-primary:hover { color: #03111a; box-shadow: 0 12px 32px -8px rgba(77, 184, 255, 0.6); }

/* Click feedback: a ripple from wherever the button was pressed. */
.btn .rip { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: rgba(255,255,255,.45); pointer-events: none; animation: rip 0.6s var(--ease) forwards; }
@keyframes rip { from { transform: scale(0); opacity: .8; } to { transform: scale(22); opacity: 0; } }

.note { color: var(--text-dim); font-size: 0.86rem; max-width: 56ch; margin: 0; }
.note strong { color: var(--text); font-weight: 500; }

/* The product screenshot: framed like a window, tilting toward the cursor. */
.shot { margin: 0; position: relative; perspective: 1400px; }
/* perspective makes the figure the containing block for position:fixed,
   which would centre the zoomed window on the figure, not the screen. */
.shot.zoomed { perspective: none; }
.shot-frame { animation: shot-in 1.1s var(--ease) 0.15s both; }
@keyframes shot-in {
  0% { opacity: 0; clip-path: inset(0 0 100% 0 round 16px); }
  60% { opacity: 1; clip-path: inset(0 0 0 0 round 16px); }
  100% { opacity: 1; clip-path: none; }
}
.shot-frame {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%;
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--line-hi);
  background: #050607;
  overflow: hidden;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease), border-color 0.4s;
  box-shadow: 0 40px 90px -40px rgba(77, 184, 255, 0.35), 0 0 0 1px rgba(255,255,255,0.02);
}
.shot-frame::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(28rem circle at var(--mx) var(--my), rgba(77,184,255,0.12), transparent 60%); }
.shot:hover .shot-frame { border-color: rgba(77,184,255,0.45); box-shadow: 0 50px 110px -40px rgba(77, 184, 255, 0.5); }
.shot:hover .shot-frame::after { opacity: 1; }
.shot-bar { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-bottom: 1px solid var(--line);
  user-select: none;
  background: #0a0b0d; font-size: 0.72rem; color: var(--text-dim); }
.shot-title { flex: 1; margin-right: 66px; text-align: center; letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* macOS traffic lights. Real buttons: close, minimise (window shade) and
   zoom. The glyphs appear when the pointer is over the group, as on a Mac. */
/* Each light is a 24px button - the WCAG 2.5.8 minimum target - with the
   12px dot drawn inside it. A pseudo-element hit area does not count: the
   audit, and a thumb, measure the button itself. */
.lights { display: flex; margin-left: -6px; }
.light {
  --dot: #ff5f57; --rim: #e0443e;
  width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center; position: relative; border-radius: 50%;
  transition: transform 0.15s var(--ease), filter 0.15s;
}
.light::before { content: ""; grid-area: 1 / 1; width: 12px; height: 12px; border-radius: 50%;
  background: var(--dot); box-shadow: inset 0 0 0 0.5px var(--rim); }
.light svg { grid-area: 1 / 1; position: relative; width: 8px; height: 8px; fill: none; stroke: rgba(0, 0, 0, 0.62); stroke-width: 1.4;
  stroke-linecap: round; opacity: 0; transition: opacity 0.12s; }
.light-zoom svg path { fill: rgba(0, 0, 0, 0.62); stroke: none; }
.light-zoom .shrink, .shot.zoomed .light-zoom .grow { display: none; }
.shot.zoomed .light-zoom .shrink { display: inline; }
.light-close { --dot: #ff5f57; --rim: #e0443e; }
.light-min   { --dot: #febc2e; --rim: #d99e22; }
.light-zoom  { --dot: #28c840; --rim: #1aab29; }
.lights:hover .light svg, .lights:focus-within .light svg { opacity: 1; }
.light:hover { filter: brightness(1.08); }
.light:active { transform: scale(0.88); filter: brightness(0.85); }
.light:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }

/* Minimise: roll the window up to its title bar. */
.shot-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.45s var(--ease); }
.shot-body > * { min-height: 0; overflow: hidden; }
.shot.minimised .shot-body { grid-template-rows: 0fr; }
.shot.minimised .chip { opacity: 0 !important; pointer-events: none; }

/* Close: the window drops away and a pill brings it back. */
.shot.closed .shot-frame, .shot.closed .chip, .shot.closed figcaption { display: none; }
.shot-reopen {
  display: inline-flex; align-items: center; gap: 0.5rem; margin: 2rem auto; padding: 0.7rem 1.1rem;
  border-radius: 999px; border: 1px solid var(--line-hi); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 0.9rem; cursor: pointer; animation: enter 0.5s var(--ease) both;
  transition: border-color 0.2s, transform 0.25s var(--ease);
}
.shot-reopen:hover { border-color: var(--accent); transform: translateY(-2px); }
.shot.closed { display: grid; place-items: center; min-height: 12rem; }

/* Zoom: the window grows to fill most of the screen over a dimmed page. */
.shot-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, 0.78);
  opacity: 0; transition: opacity 0.35s var(--ease); cursor: zoom-out; }
.shot-backdrop.on { opacity: 1; }
.shot.zoomed .shot-frame {
  position: fixed; z-index: 71; left: 50%; top: 50%;
  width: min(94vw, calc(88vh * 1.6), 1500px);
  transform: translate(-50%, -50%) !important;
  animation: none; box-shadow: 0 40px 120px -20px #000;
}
.shot.zoomed .chip { opacity: 0 !important; }
.shot.zoomed .shot-frame::after { display: none; }
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption { margin-top: 0.8rem; font-size: 0.8rem; color: var(--text-dim); text-align: center; }

.chip { position: absolute; z-index: 2; display: flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.8rem;
  border-radius: 999px; background: rgba(0,0,0,0.88); border: 1px solid var(--line-hi); font-size: 0.8rem; color: var(--text-dim);
  white-space: nowrap; box-shadow: 0 12px 30px -12px #000; animation: chip-in 0.7s var(--ease) both, float 6s ease-in-out infinite;
  transition: border-color 0.3s, color 0.3s; }
.chip b { color: var(--accent); font-weight: 600; }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip-a { top: 18%; left: -1.4rem; animation-delay: 0.7s, 1.4s; }
.chip-b { top: 52%; right: -1.2rem; animation-delay: 0.85s, 0s; }
.chip-c { bottom: 12%; left: 8%; animation-delay: 1s, 2.6s; }
@keyframes chip-in { from { opacity: 0; transform: translateY(10px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes float { 50% { translate: 0 -6px; } }
@media (max-width: 620px) { .chip { display: none; } }

/* ---------- key numbers ---------- */

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; margin-top: 0.5rem; margin-bottom: clamp(3rem, 2rem + 4vw, 5rem); }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi {
  --mx: 50%; --my: 50%;
  position: relative; overflow: hidden; display: block; padding: 1.1rem 1.15rem 1.2rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none;
  transition: border-color 0.3s, transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.kpi::before { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.35s; pointer-events: none;
  background: radial-gradient(16rem circle at var(--mx) var(--my), rgba(77,184,255,0.13), transparent 60%); }
.kpi:hover { border-color: rgba(77,184,255,0.45); transform: translateY(-4px); box-shadow: 0 16px 36px -20px var(--accent-glow); color: var(--text); }
.kpi:hover::before { opacity: 1; }
.kpi b { display: block; font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.2rem); font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; color: var(--accent); }
.kpi:first-child b { color: var(--danger); }
.kpi:nth-child(3) b { color: var(--npu); }
.kpi span { display: block; margin-top: 0.3rem; font-size: 0.82rem; line-height: 1.45; color: var(--text-dim); }

/* ---------- sections: numbered index on the left, content on the right ---------- */

main { padding-bottom: clamp(2rem, 1rem + 4vw, 4rem); }

.sec {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 250px) minmax(0, 1fr);
  gap: clamp(1rem, 0.5rem + 3vw, 3.5rem);
  padding: clamp(2rem, 1rem + 3vw, 3.5rem) 0;
  border-top: 1px solid var(--line);
}
@media (max-width: 860px) { .sec { grid-template-columns: minmax(0, 1fr); gap: 1rem; } }

.sec-head { align-self: start; position: sticky; top: calc(var(--nav-h) + 24px); }
@media (max-width: 860px) { .sec-head { position: static; } }
.num { display: block; font: 600 0.78rem/1 "Cascadia Code", Consolas, monospace; letter-spacing: 0.2em; color: var(--accent); margin-bottom: 0.7rem; }
.sec-head h2 { position: relative; }

.sec-body > :first-child { margin-top: 0; }
.card {
  --mx: 50%; --my: 50%;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(1.4rem, 1rem + 2vw, 2.2rem);
  transition: border-color 0.35s;
}
.card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: 0; transition: opacity 0.4s; pointer-events: none;
  background: radial-gradient(32rem circle at var(--mx) var(--my), rgba(77,184,255,0.07), transparent 60%); }
.card:hover { border-color: var(--line-hi); }
.card:hover::before { opacity: 1; }

/* ---------- the glitch-in: sections arrive as they are scrolled to ---------- */
/* Only applied once site.js has marked a section as below the fold, so with
   no JavaScript every section is simply visible. */

.sec.pre .sec-body, .sec.pre .num { opacity: 0; transform: translateY(26px); }
.sec.pre h2 { opacity: 0; }
.sec.in .sec-body { opacity: 1; transform: none; transition: opacity 0.7s var(--ease) 0.18s, transform 0.8s var(--ease) 0.18s; }
.sec.in .num { opacity: 1; transform: none; transition: opacity 0.4s, transform 0.5s var(--ease); }
.sec.in h2 { opacity: 1; animation: glitch-main 0.65s steps(1, end) both; }
.sec.in h2::before, .sec.in h2::after,
.brand h1::before, .brand h1::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0;
}
.sec.in h2::before, .brand h1::before { color: var(--glitch); animation: glitch-a 0.65s steps(1, end) both; }
.sec.in h2::after, .brand h1::after { color: var(--accent); animation: glitch-b 0.65s steps(1, end) both; }
.brand h1 { animation: glitch-main 0.7s steps(1, end) 0.35s both; }
.brand h1::before { animation-delay: 0.35s; }
.brand h1::after { animation-delay: 0.35s; }

/* A scan line sweeps the section once as it lands. */
.sec::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(77,184,255,.7), rgba(255,59,107,.5), transparent); }
.sec.in::after { animation: scan 0.9s var(--ease) both; }

@keyframes glitch-main {
  0%   { clip-path: inset(40% 0 42% 0); transform: translate(-6px, 0) skewX(-8deg); }
  12%  { clip-path: inset(8% 0 70% 0); transform: translate(5px, 0); }
  24%  { clip-path: inset(62% 0 6% 0); transform: translate(-3px, 0) skewX(6deg); }
  36%  { clip-path: inset(0 0 0 0); transform: translate(2px, 0); }
  48%  { clip-path: inset(24% 0 50% 0); transform: translate(-2px, 0); }
  60%, 100% { clip-path: inset(0 0 0 0); transform: none; }
}
@keyframes glitch-a {
  0%   { opacity: .9; clip-path: inset(10% 0 60% 0); transform: translate(-7px, -1px); }
  20%  { opacity: .9; clip-path: inset(55% 0 20% 0); transform: translate(5px, 1px); }
  40%  { opacity: .8; clip-path: inset(30% 0 45% 0); transform: translate(-4px, 0); }
  60%  { opacity: .5; clip-path: inset(70% 0 5% 0); transform: translate(3px, 0); }
  80%, 100% { opacity: 0; transform: none; }
}
@keyframes glitch-b {
  0%   { opacity: .9; clip-path: inset(60% 0 12% 0); transform: translate(7px, 1px); }
  20%  { opacity: .9; clip-path: inset(15% 0 62% 0); transform: translate(-5px, 0); }
  40%  { opacity: .8; clip-path: inset(45% 0 30% 0); transform: translate(4px, -1px); }
  60%  { opacity: .5; clip-path: inset(5% 0 78% 0); transform: translate(-2px, 0); }
  80%, 100% { opacity: 0; transform: none; }
}
@keyframes scan {
  0% { opacity: 0; transform: translateY(0); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(260px); }
}

.claim {
  font-size: clamp(1.1rem, 1rem + 0.7vw, 1.35rem);
  line-height: 1.45;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 0 0 1.2rem;
}
.claim strong { color: var(--accent); }

.src { font-size: 0.9rem; margin-bottom: 0; }
.src a { display: inline-block; transition: transform 0.3s var(--ease), color 0.2s; }
.src a:hover { transform: translateX(4px); }

.caveat {
  background: rgba(255, 176, 32, 0.06);
  border: 1px solid rgba(255, 176, 32, 0.26);
  border-radius: 10px;
  padding: 0.85rem 1.05rem;
  font-size: 0.93rem;
  color: var(--text-dim);
  transition: border-color 0.3s, background 0.3s;
}
.caveat:hover { border-color: rgba(255, 176, 32, 0.5); background: rgba(255, 176, 32, 0.09); }
.caveat strong { color: var(--warn); }

/* ---------- tables ---------- */

table { width: 100%; border-collapse: collapse; margin: 1.1rem 0 1.3rem; font-size: 0.93rem; font-variant-numeric: tabular-nums; }
caption { caption-side: top; text-align: left; color: var(--text-dim); font-size: 0.85rem; padding-bottom: 0.6rem; }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line); transition: background 0.25s, color 0.25s; }
th { color: var(--text-dim); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
td:not(:first-child), th:not(:first-child) { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(77, 184, 255, 0.06); color: #fff; }

tr.good td { background: rgba(0, 214, 143, 0.06); }
tr.bad td { background: rgba(255, 92, 92, 0.06); }
tr.bad strong { color: var(--danger); }
tr.good strong { color: var(--npu); }
.good-cell strong { color: var(--npu); }

@media (max-width: 40rem) {
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { white-space: nowrap; }
}

/* ---------- pipeline ---------- */

.pipeline { display: grid; grid-template-columns: 1fr; gap: 0.5rem; margin: 1.4rem 0; }
.stage {
  --mx: 50%; --my: 50%;
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.8rem;
  align-items: baseline;
  transition: border-color 0.3s, transform 0.35s var(--ease);
}
.stage::before { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.35s; pointer-events: none;
  background: radial-gradient(18rem circle at var(--mx) var(--my), rgba(77,184,255,0.10), transparent 60%); }
.stage:hover { border-color: var(--line-hi); transform: translateX(6px); }
.stage:hover::before { opacity: 1; }
.stage strong { font-weight: 600; }
.stage > span:last-child { grid-column: 2; color: var(--text-dim); font-size: 0.89rem; line-height: 1.5; }

.where { grid-row: span 2; align-self: start; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em;
  padding: 0.22rem 0.42rem; border-radius: 5px; border: 1px solid; }
.where.npu { color: var(--npu); border-color: rgba(0, 214, 143, 0.4); background: rgba(0, 214, 143, 0.08); }
.where.cpu { color: var(--text-dim); border-color: var(--line); background: var(--surface-2); }
.where.target { color: var(--warn); border-color: rgba(255, 176, 32, 0.4); background: rgba(255, 176, 32, 0.08); }

/* The legend reuses the badges, so it cannot drift from the diagram. */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.3rem; font-size: 0.83rem; color: var(--text-dim); max-width: none; margin-top: 1rem; }
.legend .where { grid-row: auto; }
.arrow { color: var(--line-hi); text-align: center; font-size: 1.1rem; line-height: 1; }

/* ---------- stats ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 0.7rem; margin: 1.3rem 0; }
.stat {
  --mx: 50%; --my: 50%;
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  transition: border-color 0.3s, transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.stat::before { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.35s; pointer-events: none;
  background: radial-gradient(14rem circle at var(--mx) var(--my), rgba(0,214,143,0.12), transparent 60%); }
.stat:hover { border-color: rgba(0, 214, 143, 0.4); transform: translateY(-4px); box-shadow: 0 14px 30px -18px rgba(0, 214, 143, 0.5); }
.stat:hover::before { opacity: 1; }
.stat b { display: block; font-size: 1.5rem; font-weight: 600; color: var(--npu); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat span { display: block; color: var(--text-dim); font-size: 0.83rem; line-height: 1.45; margin-top: 0.25rem; }

/* ---------- gaps ---------- */

.gaps { max-width: var(--measure); padding-left: 1.1rem; margin: 0; }
.gaps li { margin-bottom: 0.8rem; color: var(--text-dim); transition: color 0.25s, transform 0.3s var(--ease); }
.gaps li:hover { color: var(--text); transform: translateX(4px); }
.gaps li strong { color: var(--text); font-weight: 500; }
.gaps li:last-child { margin-bottom: 0; }

/* ---------- footer ---------- */

footer { border-top: 1px solid var(--line); padding: 2rem 0 3rem; color: var(--text-dim); font-size: 0.9rem; }
footer p { max-width: none; }
footer a { transition: color 0.2s, text-underline-offset 0.25s var(--ease); }
.small { font-size: 0.82rem; margin-bottom: 0; }

.credit { display: flex; align-items: center; gap: 0.6rem; color: var(--text); font-size: 1rem; letter-spacing: 0.01em; margin: 0 0 1rem; }
.credit .logo { width: 24px; height: 24px; }
.credit a { color: var(--text); font-weight: 600; text-decoration: none;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 0 1px no-repeat;
  transition: background-size 0.35s var(--ease), color 0.2s; }
.credit a:hover { color: var(--accent); background-size: 100% 1px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
  .sec.pre .sec-body, .sec.pre .num, .sec.pre h2 { opacity: 1; transform: none; }
}

/* ---------- the two-minute film ----------
   preload="none": the page costs nothing until someone presses play, and
   then only the part they watch (the file is served with range requests). */
.film { margin-bottom: clamp(3rem, 2rem + 4vw, 5rem); }
.film-head { display: grid; grid-template-columns: minmax(180px, 250px) minmax(0, 1fr); gap: clamp(1rem, 0.5rem + 2vw, 3rem); align-items: end; margin-bottom: 1.1rem; }
@media (max-width: 860px) { .film-head { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; } }
.film-head p { margin: 0; color: var(--text-dim); }
.film-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000;
  border: 1px solid var(--line-hi); box-shadow: 0 40px 90px -40px rgba(77, 184, 255, 0.35);
  transition: border-color 0.4s, box-shadow 0.5s var(--ease); }
.film-frame:hover { border-color: rgba(77, 184, 255, 0.45); box-shadow: 0 50px 110px -40px rgba(77, 184, 255, 0.5); }
.film-frame video { display: block; width: 100%; height: 100%; background: #000; }
.film-note { margin: 0.8rem 0 0; font-size: 0.85rem; color: var(--text-dim); max-width: none; }
