/* Ansh Agrawal — portfolio design system and components.
   Dark graphite surfaces, one cyan accent, IBM Plex (self-hosted, OFL) with system fallbacks. */

/* ---------- Fonts (local; the page still renders with system fonts if these fail) ---------- */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("../assets/fonts/ibm-plex-sans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("../assets/fonts/ibm-plex-sans-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("../assets/fonts/ibm-plex-sans-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("../assets/fonts/ibm-plex-mono-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("../assets/fonts/ibm-plex-mono-500.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #0a0c0f;
  --bg-raised: #0e1216;
  --surface: #11151a;
  --surface-2: #171c22;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e6eaf0;
  --text-2: #b8c0cc;
  --muted: #9aa4b2;
  --faint: #8a94a3;
  --accent: #3fd0e8;
  --accent-ink: #061418;
  --accent-soft: rgba(63, 208, 232, 0.12);
  --accent-line: rgba(63, 208, 232, 0.35);
  --warn: #e8b04a;
  --warn-soft: rgba(232, 176, 74, 0.1);
  --ok: #5fd39a;

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --fs-xs: 0.75rem;   /* 12 */
  --fs-sm: 0.875rem;  /* 14 */
  --fs-base: 1rem;    /* 16 */
  --fs-md: 1.125rem;  /* 18 */
  --fs-lg: 1.375rem;  /* 22 */
  --fs-xl: 1.75rem;   /* 28 */
  --fs-2xl: clamp(1.75rem, 1.2rem + 1.8vw, 2.25rem);
  --fs-hero: clamp(2.5rem, 1.6rem + 3.6vw, 4rem);

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  --radius: 10px;
  --radius-sm: 6px;
  --container: 1200px;
  --header-h: 60px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-base) / 1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 var(--s-4); }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
code, kbd { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0.05em 0.35em; color: var(--text-2); }
ul, ol { margin: 0 0 var(--s-4); padding-left: 1.25em; }
li { margin-bottom: var(--s-2); }
strong { font-weight: 600; color: var(--text); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-7) 0; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: var(--s-2) var(--s-4);
  border-radius: var(--radius-sm); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--s-3); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--s-4); }
@media (min-width: 768px) { .container { padding: 0 var(--s-6); } }

/* Faint technical grid behind the page */
.grid-bg {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ---------- Header / navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(10, 12, 15, 0.82);
  backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.brand { display: inline-flex; align-items: center; gap: var(--s-3); color: var(--text); text-decoration: none; font-weight: 600; letter-spacing: 0.01em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  border: 1px solid var(--accent-line); background: var(--accent-soft);
  font: 500 0.78rem/1 var(--font-mono); color: var(--accent);
}
.nav-list { display: flex; gap: var(--s-1); list-style: none; margin: 0; padding: 0; }
.nav-list li { margin: 0; }
.nav-list a {
  display: block; padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-size: var(--fs-sm); font-weight: 500;
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.nav-list a:hover { color: var(--text); background: var(--surface-2); }
.nav-list a[aria-current="true"], .nav-list a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav-toggle {
  display: none; align-items: center; justify-content: center; width: 40px; height: 40px;
  background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--text); cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }
@media (max-width: 899px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    position: fixed; inset: var(--header-h) 0 auto 0; background: var(--bg-raised);
    border-bottom: 1px solid var(--line); padding: var(--s-3) var(--s-4) var(--s-5);
    display: none;
  }
  .site-nav.is-open { display: block; }
  .nav-list { flex-direction: column; gap: 2px; }
  .nav-list a { padding: 12px 12px; font-size: var(--fs-base); }
}

/* ---------- Typography helpers ---------- */
.eyebrow {
  display: inline-block; font: 500 var(--fs-xs) / 1.4 var(--font-mono);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent);
}
.muted { color: var(--muted); }
.lede { font-size: var(--fs-md); color: var(--text-2); max-width: 68ch; }
.mono { font-family: var(--font-mono); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text); font: 500 var(--fs-sm) / 1.2 var(--font-sans); text-decoration: none; cursor: pointer;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}
.btn:hover { border-color: var(--accent-line); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: #6fdcef; border-color: #6fdcef; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.btn[aria-disabled="true"] { opacity: 0.6; cursor: default; }
.note-inline { font-size: var(--fs-sm); color: var(--muted); }

/* ---------- Tags / provenance chips ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px;
  font: 500 0.6875rem/1.6 var(--font-mono); letter-spacing: 0.02em; white-space: nowrap;
  border: 1px solid var(--line-strong); color: var(--muted);
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-reeval { color: var(--accent); border-color: var(--accent-line); }
.tag-live { color: var(--ok); border-color: rgba(95, 211, 154, 0.35); }
.tag-notebook { color: var(--muted); }
.tag-caveat { color: var(--warn); border-color: rgba(232, 176, 74, 0.35); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.chips li { margin: 0; font: 400 var(--fs-xs)/1.6 var(--font-mono); color: var(--text-2); padding: 2px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-raised); }

/* ---------- Sections ---------- */
.section { padding: var(--s-8) 0; border-top: 1px solid var(--line); }
@media (min-width: 768px) { .section { padding: var(--s-9) 0; } }
.section-head { max-width: 760px; margin-bottom: var(--s-7); }
.section-head h2 { font-size: var(--fs-2xl); margin-top: var(--s-3); }
.section-head p { margin-top: var(--s-4); color: var(--text-2); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: var(--s-8) 0 var(--s-8); border-bottom: 1px solid var(--line); }
@media (min-width: 768px) { .hero { padding: 120px 0 112px; } }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.55; pointer-events: none; }
.hero-fade { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 15% 40%, var(--bg) 30%, rgba(10, 12, 15, 0.75) 60%, rgba(10, 12, 15, 0.2) 100%); }
.hero-content { position: relative; max-width: 760px; }
.hero h1 { font-size: var(--fs-hero); line-height: 1.06; letter-spacing: -0.025em; margin: var(--s-4) 0 var(--s-5); }
.hero h1 .accent { color: var(--accent); }
.hero .lede { margin-bottom: var(--s-6); }
.hero-meta { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin-top: var(--s-7); padding: 0; list-style: none; font: 400 var(--fs-sm)/1.4 var(--font-mono); color: var(--muted); }
.hero-meta li { margin: 0; }
.hero-meta strong { color: var(--text); font-weight: 500; }
.hero-caption { position: absolute; right: var(--s-4); bottom: var(--s-3); font: 400 0.6875rem/1.4 var(--font-mono); color: var(--faint); max-width: 46ch; text-align: right; }
@media (max-width: 767px) { .hero-caption { display: none; } }

/* ---------- About ---------- */
.about-grid { display: grid; gap: var(--s-6); }
@media (min-width: 900px) { .about-grid { grid-template-columns: 1.4fr 1fr; gap: var(--s-8); } }
.about-text { font-size: var(--fs-md); color: var(--text-2); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-5); }
.panel h3 { font-size: var(--fs-base); margin-bottom: var(--s-3); }
.facts { margin: 0; display: grid; gap: var(--s-3); }
.facts div { display: grid; grid-template-columns: 110px 1fr; gap: var(--s-3); }
.facts dt { font: 400 var(--fs-xs)/1.6 var(--font-mono); color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; padding-top: 2px; }
.facts dd { margin: 0; color: var(--text-2); font-size: var(--fs-sm); }
.callout { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--bg-raised); border-radius: var(--radius-sm); padding: var(--s-4) var(--s-5); color: var(--text-2); font-size: var(--fs-sm); }
.callout-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout strong { display: block; margin-bottom: 4px; }

/* ---------- Project cards ---------- */
.projects { display: grid; gap: var(--s-6); }
.project {
  display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: border-color 0.2s var(--ease);
}
.project:hover, .project:focus-within { border-color: var(--line-strong); }
@media (min-width: 960px) {
  .project { grid-template-columns: 1fr 1fr; }
  .project:nth-child(even) .project-visual { order: 2; border-right: 0; border-left: 1px solid var(--line); }
}
.project-visual { background: var(--bg-raised); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
@media (min-width: 960px) { .project-visual { border-bottom: 0; border-right: 1px solid var(--line); } }
.project-visual img { width: 100%; height: auto; aspect-ratio: 8 / 5; object-fit: cover; }
.project-body { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
@media (min-width: 768px) { .project-body { padding: var(--s-6); } }
.project-kicker { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.project-index { font: 500 var(--fs-xs)/1 var(--font-mono); color: var(--faint); }
.project h3 { font-size: var(--fs-xl); }
.project h3 span { display: block; margin-top: 6px; font-size: var(--fs-md); font-weight: 400; color: var(--text-2); letter-spacing: 0; }
.project p { color: var(--text-2); margin: 0; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-2); margin: 0; }
.metric { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s-3); }
.metric dt { font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; }
.metric dd { margin: 4px 0 6px; font: 500 var(--fs-lg)/1.2 var(--font-mono); color: var(--text); }
.metric dd.src { margin: 0; font: inherit; }
.metric .tag, td .tag { white-space: normal; }
.project-links { margin-top: auto; padding-top: var(--s-2); }

/* ---------- Demo videos ---------- */
.demos { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.demo { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.video-frame { position: relative; aspect-ratio: 8 / 5; background: #000; }
.video-frame video, .video-frame img { width: 100%; height: 100%; object-fit: cover; }
.video-play {
  position: absolute; inset: 0; display: grid; place-items: center; width: 100%; padding: 0; border: 0; cursor: pointer;
  background: linear-gradient(180deg, rgba(10, 12, 15, 0) 40%, rgba(10, 12, 15, 0.65));
}
.video-play img { position: absolute; inset: 0; }
.video-play .play-icon {
  position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(10, 12, 15, 0.75); border: 1px solid var(--accent-line); color: var(--accent);
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease);
}
.video-play:hover .play-icon, .video-play:focus-visible .play-icon { transform: scale(1.06); background: var(--accent-soft); }
.video-play .play-icon svg { width: 24px; height: 24px; margin-left: 3px; }
.video-play .duration { position: absolute; right: 10px; bottom: 10px; font: 500 var(--fs-xs)/1 var(--font-mono); color: var(--text); background: rgba(10, 12, 15, 0.8); padding: 5px 7px; border-radius: 4px; }
.demo-body { padding: var(--s-4) var(--s-5) var(--s-5); display: grid; gap: var(--s-2); }
.demo-body h3 { font-size: var(--fs-base); }
.demo-body p { font-size: var(--fs-sm); color: var(--text-2); }
.demo-body .tag { justify-self: start; }

/* ---------- Principles ---------- */
.principles { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.principle { padding: var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.principle .num { font: 500 var(--fs-xs)/1 var(--font-mono); color: var(--accent); }
.principle h3 { font-size: var(--fs-base); margin: var(--s-3) 0 var(--s-2); }
.principle p { font-size: var(--fs-sm); color: var(--text-2); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5); margin-top: var(--s-5); font-size: var(--fs-sm); color: var(--muted); align-items: center; }

/* ---------- Skills ---------- */
.skills { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.skill { padding: var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: var(--s-3); align-content: start; }
.skill h3 { font-size: var(--fs-base); }
.skill .used-in { font-size: var(--fs-xs); color: var(--muted); font-family: var(--font-mono); }
.skill .used-in a { color: var(--text-2); }

/* ---------- Timeline (experience) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line-strong); }
.timeline > li { position: relative; margin: 0 0 var(--s-6); padding-left: var(--s-6); }
.timeline > li:last-child { margin-bottom: 0; }
.timeline > li::before { content: ""; position: absolute; left: -5px; top: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.timeline .when { font: 400 var(--fs-xs)/1.6 var(--font-mono); color: var(--muted); letter-spacing: 0.04em; }
.timeline h3 { font-size: var(--fs-md); margin: 2px 0 2px; }
.timeline .org { color: var(--text-2); font-size: var(--fs-sm); margin-bottom: var(--s-2); }
.timeline p { color: var(--text-2); font-size: var(--fs-sm); max-width: 72ch; }

/* ---------- Credentials ---------- */
.creds { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.cred { padding: var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: var(--s-2); align-content: start; }
.cred .kind { font: 500 var(--fs-xs)/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.cred h3 { font-size: var(--fs-base); }
.cred .issuer { color: var(--text-2); font-size: var(--fs-sm); }
.cred p { color: var(--muted); font-size: var(--fs-sm); }
.cred-highlight { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 60%); }

/* ---------- Contact ---------- */
.contact-list { display: grid; gap: var(--s-3); list-style: none; padding: 0; margin: 0; max-width: 640px; }
.contact-list li { margin: 0; }
.contact-list a {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-4) var(--s-5);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none;
  transition: border-color 0.15s var(--ease);
}
.contact-list a:hover { border-color: var(--accent-line); }
.contact-list .label { font: 500 var(--fs-xs)/1.4 var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.contact-list .value { font-size: var(--fs-base); word-break: break-word; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: var(--s-6) 0; color: var(--faint); font-size: var(--fs-sm); }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3); }
.site-footer a { color: var(--muted); }

/* ---------- Case-study pages ---------- */
.cs-hero { padding: var(--s-7) 0 var(--s-7); border-bottom: 1px solid var(--line); }
@media (min-width: 768px) { .cs-hero { padding: var(--s-8) 0; } }
.breadcrumb { font: 400 var(--fs-sm)/1.4 var(--font-mono); color: var(--muted); margin-bottom: var(--s-5); }
.breadcrumb a { color: var(--muted); }
.cs-hero h1 { font-size: var(--fs-hero); letter-spacing: -0.025em; margin: var(--s-3) 0 var(--s-3); }
.cs-hero .subtitle { font-size: var(--fs-lg); color: var(--text-2); margin-bottom: var(--s-5); max-width: 60ch; }
.cs-hero .btn-row { margin-top: var(--s-5); }
.cs-layout { display: grid; gap: var(--s-7); padding: var(--s-7) 0 var(--s-8); }
@media (min-width: 1024px) { .cs-layout { grid-template-columns: 220px minmax(0, 1fr); gap: var(--s-8); } }
.toc { display: none; }
@media (min-width: 1024px) {
  .toc { display: block; position: sticky; top: calc(var(--header-h) + 24px); align-self: start; }
  .toc ol { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line); }
  .toc li { margin: 0; }
  .toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 1px solid transparent; color: var(--muted); text-decoration: none; font-size: var(--fs-sm); }
  .toc a:hover { color: var(--text); }
  .toc a[aria-current="true"] { color: var(--accent); border-left-color: var(--accent); }
}
.cs-content { max-width: 780px; min-width: 0; }
.cs-section { padding-bottom: var(--s-7); margin-bottom: var(--s-7); border-bottom: 1px solid var(--line); }
.cs-section:last-child { border-bottom: 0; }
.cs-section h2 { font-size: var(--fs-xl); margin-bottom: var(--s-4); display: flex; gap: var(--s-3); align-items: baseline; }
.cs-section h2 .n { font: 500 var(--fs-sm)/1 var(--font-mono); color: var(--accent); }
.cs-section h3 { font-size: var(--fs-md); margin: var(--s-5) 0 var(--s-3); }
.cs-section p, .cs-section li { color: var(--text-2); }
.cs-figure { margin: var(--s-5) 0; background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.video-caption { margin: 0; padding: var(--s-3) var(--s-4); font-size: var(--fs-sm); color: var(--muted); border-top: 1px solid var(--line); }
.cs-figure figcaption { padding: var(--s-3) var(--s-4); font-size: var(--fs-sm); color: var(--muted); border-top: 1px solid var(--line); }

/* Pipeline / architecture flow */
.flow { list-style: none; margin: var(--s-5) 0; padding: 0; display: grid; gap: var(--s-2); counter-reset: step; }
.flow li {
  position: relative; margin: 0; padding: var(--s-3) var(--s-4) var(--s-3) 52px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text-2); font-size: var(--fs-sm);
}
.flow li::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  position: absolute; left: 16px; top: 13px; font: 500 var(--fs-xs)/1.4 var(--font-mono); color: var(--accent);
}
.flow li + li::after { content: ""; position: absolute; left: 26px; top: -9px; width: 1px; height: 8px; background: var(--line-strong); }
.flow strong { color: var(--text); }

/* Tables */
.table-wrap { overflow-x: auto; margin: var(--s-4) 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
caption { text-align: left; padding: var(--s-3) var(--s-4); color: var(--muted); caption-side: bottom; border-top: 1px solid var(--line); font-size: var(--fs-xs); }
th, td { padding: 10px var(--s-4); text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font: 500 var(--fs-xs)/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--bg-raised); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.num, th.num { font-family: var(--font-mono); text-align: right; white-space: nowrap; color: var(--text); }
tbody th { font-weight: 500; color: var(--text); }

.cs-next { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin-top: var(--s-5); }
.cs-next a { display: block; padding: var(--s-4) var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.cs-next a:hover { border-color: var(--accent-line); }
.cs-next .dir { font: 400 var(--fs-xs)/1.4 var(--font-mono); color: var(--muted); display: block; margin-bottom: 4px; }

/* ---------- 404 ---------- */
.notfound { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: var(--s-8) 0; }
.notfound h1 { font-size: var(--fs-hero); margin: var(--s-3) 0; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
