/* =====================================================================
   Nijiati Abulizi — design system
   Three facets, one identity:
     data      Data Scientist          teal
     build     Business Builder        amber
     research  Researcher & Teacher    blue
   Every page sets <body data-facet="…">, which retints --color-accent so
   the page-level styles (written against --color-accent) follow along.
   ===================================================================== */

/* Self-hosted fonts (SIL OFL, see static/fonts/LICENSE-*.txt). The
   "Fallback" faces are metric-matched local fonts, so text keeps its layout
   while the web fonts load and nothing shifts when they swap in. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/inter-latin-wght-normal.260c81a4759b.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/instrument-serif-latin-400-italic.bc891bdd08ad.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/instrument-serif-latin-400-normal.9b8dd1ecf641.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/jetbrains-mono-latin-400-normal.caf0dfde4e44.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/jetbrains-mono-latin-500-normal.a21e038a03f7.woff2") format("woff2"); }
@font-face { font-family: "Inter Fallback"; src: local("Arial"), local("Helvetica"); size-adjust: 107.12%; ascent-override: 90.44%; descent-override: 22.52%; line-gap-override: 0%; }
@font-face { font-family: "Instrument Serif Fallback"; font-style: italic; src: local("Times New Roman Italic"), local("Times-Italic"), local("Georgia Italic"); size-adjust: 92%; ascent-override: 98%; descent-override: 24%; line-gap-override: 0%; }

:root {
  /* Facet hues */
  --data: #0f766e;
  --data-2: #14b8a6;
  --build: #b45309;
  --build-2: #f59e0b;
  --research: #1d4ed8;
  --research-2: #60a5fa;

  /* Surfaces */
  --color-bg: #f7f6f2;
  --color-bg-soft: #efede7;
  --color-card: #ffffff;
  --color-border: #e4e1d9;
  --color-text: #14161b;
  --color-muted: #5d6270;
  --color-on-accent: #ffffff;
  --ink: #0b0d12;

  /* Accent (retinted per facet below) */
  --color-accent: var(--data);
  --color-accent-dark: var(--data-2);
  --title-accent: var(--data);

  --signature: linear-gradient(90deg, var(--data-2), var(--build-2) 50%, var(--research-2));

  --font-sans: "Inter", "Inter Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Instrument Serif", "Instrument Serif Fallback", "Iowan Old Style", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --max-width: 1180px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 27, 0.04), 0 1px 1px rgba(20, 22, 27, 0.03);
  --shadow-md: 0 12px 32px -14px rgba(20, 22, 27, 0.18);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --data: #2dd4bf;
  --data-2: #5eead4;
  --build: #fbbf24;
  --build-2: #fcd34d;
  --research: #60a5fa;
  --research-2: #93c5fd;

  --color-bg: #0a0b0f;
  --color-bg-soft: #13151b;
  --color-card: #111319;
  --color-border: #23262f;
  --color-text: #ececf1;
  --color-muted: #9a9fae;
  --color-on-accent: #0a0b0f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 18px 40px -18px rgba(0, 0, 0, 0.7);
}

body[data-facet="data"]     { --color-accent: var(--data);     --color-accent-dark: var(--data-2);     --title-accent: var(--data); }
body[data-facet="build"]    { --color-accent: var(--build);    --color-accent-dark: var(--build-2);    --title-accent: var(--build); }
body[data-facet="research"] { --color-accent: var(--research); --color-accent-dark: var(--research-2); --title-accent: var(--research); }

/* ----- Base ----- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}
body { transition: background-color 0.25s ease, color 0.25s ease; overflow-x: hidden; }

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
/* Links inside running text are underlined, not told apart by colour alone. */
p a:not([class]) { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.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; }
img { max-width: 100%; height: auto; }
::selection { background: color-mix(in srgb, var(--color-accent) 25%, transparent); }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; border-radius: 4px; }

.serif { font-family: var(--font-serif); font-weight: 400; font-style: italic; letter-spacing: -0.01em; }
.mono { font-family: var(--font-mono); }
.skip-link {
  position: absolute; left: -999px; top: 0.5rem; z-index: 200;
  background: var(--color-card); color: var(--color-text);
  padding: 0.5rem 0.9rem; border-radius: 8px; border: 1px solid var(--color-border);
}
.skip-link:focus { left: 0.75rem; }

/* ----- Navigation ----- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 0.8rem clamp(1rem, 3vw, 2rem);
  background: color-mix(in srgb, var(--color-bg) 90%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.site-nav.is-scrolled { border-bottom-color: var(--color-border); }
.site-nav::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: var(--signature);
  opacity: 0;
  transition: opacity 0.3s;
}
.site-nav.is-scrolled::after { opacity: 0.55; }

.site-nav .logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.site-nav .logo:hover { text-decoration: none; }
.logo-mark {
  position: relative;
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1;
  overflow: hidden;
  transition: transform 0.3s var(--ease);
}
[data-theme="dark"] .logo-mark { background: #f2f2f5; color: var(--ink); }
.logo-mark::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--signature);
}
.site-nav .logo:hover .logo-mark { transform: rotate(-6deg) scale(1.05); }

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
  padding: 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-card) 70%, transparent);
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  color: var(--color-muted);
  font-size: 0.88rem;
  font-weight: 550;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover { color: var(--color-text); background: var(--color-bg-soft); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--color-text); background: var(--color-bg-soft); }
.nav-links .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--dot, var(--color-muted));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, transparent) 18%, transparent);
}
.nav-links .f-data { --dot: var(--data); }
.nav-links .f-build { --dot: var(--build); }
.nav-links .f-research { --dot: var(--research); }

.nav-actions { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.nav-cta {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 0.85rem;
  font-weight: 600;
  transition: transform 0.15s, opacity 0.15s;
}
.nav-cta:hover { text-decoration: none; transform: translateY(-1px); opacity: 0.9; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--color-text);
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.icon-btn:hover { background: var(--color-bg-soft); }
.icon-btn svg { width: 17px; height: 17px; }

.theme-toggle .icon-moon, .theme-toggle .icon-sun { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

.menu-toggle { display: none; }

@media (max-width: 980px) {
  .nav-cta { display: none; }
}
@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .site-nav nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    padding: 0.75rem 1rem 1.25rem;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    display: none;
  }
  .site-nav.nav-open nav { display: block; }
  .nav-links {
    flex-direction: column;
    align-items: stretch;
    border: none;
    background: transparent;
    padding: 0;
    gap: 0.2rem;
  }
  .nav-links a { font-size: 1.05rem; padding: 0.75rem 0.9rem; border-radius: 12px; color: var(--color-text); }
}

/* ----- Main ----- */
.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem clamp(1rem, 3vw, 2rem);
}

/* ----- Shared building blocks ----- */
.eyebrow-label {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-muted);
}
.eyebrow-label .bar { width: 22px; height: 1px; background: currentColor; opacity: 0.6; }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e;
  animation: live-pulse 2.4s cubic-bezier(0.66, 0, 0, 1) infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.page-hero { padding: clamp(1.5rem, 5vw, 4rem) 0 clamp(1.5rem, 4vw, 3rem); max-width: 860px; }
.page-hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  font-weight: 700;
  margin: 1rem 0 1.1rem;
}
.page-hero h1 .serif { color: var(--color-accent); font-size: 1.08em; }
.page-hero .lede { font-size: clamp(1.05rem, 1.6vw, 1.22rem); color: var(--color-muted); max-width: 60ch; margin: 0; line-height: 1.6; }

.section-title {
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 0.6rem 0 0.75rem;
}
.section-title .serif { color: var(--color-accent); font-size: 1.08em; }

.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  background: var(--color-card);
  white-space: nowrap;
}

/* Scroll reveal: blur-to-focus rise (progressive: visible without JS).
   Uses the individual translate/scale properties so an element's own
   hover `transform` still composes with it. Stagger siblings with --i. */
.js [data-reveal] {
  opacity: 0;
  translate: 0 28px;
  scale: 0.985;
  filter: blur(8px);
  transition:
    opacity 0.9s var(--ease) calc(var(--i, 0) * 110ms),
    translate 1s var(--ease) calc(var(--i, 0) * 110ms),
    scale 1s var(--ease) calc(var(--i, 0) * 110ms),
    filter 0.9s var(--ease) calc(var(--i, 0) * 110ms);
}
.js [data-reveal].is-in { opacity: 1; translate: 0 0; scale: 1; filter: none; }

/* Scroll-linked motion. The engine in base.html writes --p (0 → 1) on every
   [data-scroll] element each frame:
     enter   0 when its top meets the bottom of the viewport, 1 at 40% up
     through 0 entering at the bottom, 1 leaving at the top
     leave   0 while its top is at the top of the viewport, 1 once scrolled past
     pin     progress through a tall container whose child is position: sticky
   Defaults are the finished state, so nothing is stuck without JS. */
[data-scroll] { --p: 1; }
[data-scroll="leave"] { --p: 0; }
[data-scroll="through"] { --p: 0.5; }

/* Count-up numbers keep their width steady while animating */
.count-up { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; translate: none; scale: none; filter: none; transition: none; }
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.68rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-text);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
  font-size: 0.92rem;
  line-height: 1.2;
}
.btn:hover { background: var(--color-bg-soft); border-color: color-mix(in srgb, var(--color-text) 25%, transparent); text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--color-accent); color: var(--color-on-accent); border-color: var(--color-accent); }
.btn-primary:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-on-accent);
  box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--color-accent) 70%, transparent);
}
.btn-ink { background: var(--color-text); color: var(--color-bg); border-color: var(--color-text); }
.btn-ink:hover { background: var(--color-text); color: var(--color-bg); opacity: 0.9; }

/* ----- Footer ----- */
.site-footer {
  position: relative;
  margin-top: 5rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.9rem;
}
.site-footer::before {
  content: "";
  position: absolute; left: 0; right: 0; top: -1px; height: 1px;
  background: var(--signature);
  opacity: 0.6;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3.5rem clamp(1rem, 3vw, 2rem) 2rem;
}
.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr));
  gap: 2.5rem;
  padding-bottom: 2.5rem;
}
.footer-statement {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 650;
  color: var(--color-text);
  margin: 0 0 1.25rem;
}
.footer-statement .serif { color: var(--color-text); }
.footer-col h2 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin: 0 0 0.9rem;
  color: var(--color-muted);
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; }
.footer-col a { display: inline-block; padding: 0.3rem 0; color: var(--color-text); font-weight: 500; }
.footer-col a:hover { color: var(--color-accent); }
.footer-bottom {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.82rem;
}
.footer-bottom .facets { display: inline-flex; gap: 1rem; flex-wrap: wrap; }
.footer-bottom .facets span { display: inline-flex; align-items: center; gap: 0.4rem; }
.footer-bottom .facets i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
@media (max-width: 760px) {
  .footer-top { grid-template-columns: 1fr 1fr; }
  .footer-top > :first-child { grid-column: 1 / -1; }
}

/* Mobile */
@media (max-width: 700px) {
  .site-main { padding: 1.5rem 1rem; }
}

/* ===================== Data visualisation (static/js/dsviz.js) ===================== */
:root { --viz-grid: color-mix(in srgb, var(--color-text) 9%, transparent); }
.viz { --tone: var(--color-accent); position: relative; font-size: 0.88rem; }
.viz [data-tone="data"] { --tone: var(--data); }
.viz [data-tone="research"] { --tone: var(--research); }
.viz [data-tone="build"] { --tone: var(--build); }
.viz [data-tone="muted"] { --tone: color-mix(in srgb, var(--color-text) 38%, transparent); }
.viz [data-tone="soft"] { --tone: color-mix(in srgb, var(--color-accent) 28%, var(--color-bg-soft)); }
.viz-readout { margin: 0.9rem 0 0; min-height: 2.9em; padding: 0.7rem 0.9rem; border-radius: 12px; background: var(--color-bg-soft); border: 1px solid var(--color-border); font-size: 0.84rem; line-height: 1.5; color: var(--color-text); }
.viz-readout b { color: var(--color-accent); font-weight: 650; }
.viz-note { margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--color-muted); }
.viz-note:empty { display: none; }
.viz-seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; margin: 0 0 1rem; border-radius: 999px; background: var(--color-bg-soft); border: 1px solid var(--color-border); }
.viz-seg button { font: inherit; font-size: 0.8rem; font-weight: 600; padding: 0.4rem 0.85rem; border: 0; border-radius: 999px; background: transparent; color: var(--color-muted); cursor: pointer; transition: background 0.2s, color 0.2s; }
.viz-seg button[aria-pressed="true"] { background: var(--color-card); color: var(--color-text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--color-border); }
.viz-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; list-style: none; margin: 0 0 0.8rem; padding: 0; font-size: 0.78rem; color: var(--color-muted); }
.viz-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.viz-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--tone); }

/* Forest plot */
.vf-group { margin: 0.9rem 0 0.2rem; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-muted); }
.vf-group:first-child { margin-top: 0; }
.vf-row, .vf-axis { display: grid; grid-template-columns: minmax(150px, 0.95fr) minmax(0, 2fr) 7.2rem; gap: 0.9rem; align-items: center; }
.vf-row { padding: 0.5rem 0.4rem; margin: 0 -0.4rem; border-top: 1px solid var(--color-border); border-radius: 8px; outline-offset: 2px; transition: background 0.2s; cursor: default; }
.vf-row:hover, .vf-row.is-active { background: color-mix(in srgb, var(--tone) 7%, transparent); }
.vf-row[hidden] { display: none; }
.vf-name b { display: block; font-weight: 600; line-height: 1.3; }
.vf-name span { display: block; color: var(--color-muted); font-size: 0.76rem; }
.vf-flag { display: inline-block; margin-top: 0.2rem; font-style: normal; font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.1rem 0.4rem; border-radius: 4px; border: 1px dashed var(--color-muted); color: var(--color-muted); }
.vf-track { position: relative; height: 22px; background: var(--grid, none); }
.vf-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--viz-grid); }
.vf-ref { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 1.5px dashed color-mix(in srgb, var(--color-text) 40%, transparent); }
.vf-ci { position: absolute; top: 50%; height: 3px; transform: translateY(-50%); border-radius: 2px; background: color-mix(in srgb, var(--tone) 55%, transparent); transition: left 0.9s var(--ease), width 0.9s var(--ease); }
.vf-ci::before, .vf-ci::after { content: ""; position: absolute; top: -4px; width: 2px; height: 11px; border-radius: 1px; background: var(--tone); }
.vf-ci::before { left: 0; } .vf-ci::after { right: 0; }
.vf-dot { position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%; translate: -50% -50%; background: var(--tone); box-shadow: 0 0 0 3px var(--color-card), 0 0 0 5px color-mix(in srgb, var(--tone) 20%, transparent); transition: left 0.9s var(--ease); }
.is-flagged .vf-dot { background: var(--color-card); border: 2.5px solid var(--tone); }
.is-flagged .vf-ci { background: repeating-linear-gradient(90deg, var(--tone) 0 4px, transparent 4px 7px); }
.vf-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vf-val small { display: block; font-weight: 500; font-size: 0.72rem; color: var(--color-muted); }
.vf-axis { margin-top: 0.3rem; font-family: var(--font-mono); font-size: 0.66rem; color: var(--color-muted); }
.vf-ticks { position: relative; height: 1.2em; }
.vf-ticks span { position: absolute; translate: -50% 0; white-space: nowrap; }
.vf-axis-label { text-align: right; }

/* Funnel */
.vfn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.vfn-step { display: grid; grid-template-columns: minmax(150px, 0.95fr) minmax(0, 2fr) 7.2rem; gap: 0.9rem; align-items: center; padding: 0.45rem 0.4rem; margin: 0 -0.4rem; border-radius: 8px; transition: background 0.2s; }
.vfn-step:hover, .vfn-step.is-active { background: color-mix(in srgb, var(--color-accent) 7%, transparent); }
.vfn-head b { display: block; font-weight: 600; line-height: 1.3; }
.vfn-head span { font-size: 0.76rem; color: var(--color-muted); }
.vfn-ratio { font-family: var(--font-mono); font-size: 0.7rem; color: var(--color-accent); }
.vfn-bar { height: 26px; border-radius: 7px; background: var(--color-bg-soft); overflow: hidden; }
.vfn-bar i { display: block; height: 100%; width: 0; border-radius: 7px; background: linear-gradient(90deg, var(--color-accent), color-mix(in srgb, var(--color-accent) 55%, var(--research))); transition: width 1.2s var(--ease); }
.vfn-n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.vfn-n small { font-weight: 500; color: var(--color-muted); font-size: 0.72rem; }

/* Bars */
.vb-body { display: grid; gap: 0.2rem; }
.vb-row { display: grid; grid-template-columns: minmax(150px, 0.95fr) minmax(0, 2fr) 7.2rem; gap: 0.9rem; align-items: center; padding: 0.45rem 0.4rem; margin: 0 -0.4rem; border-radius: 8px; transition: background 0.2s; }
.vb-row:hover, .vb-row.is-active { background: color-mix(in srgb, var(--color-accent) 7%, transparent); }
.vb-name b { display: block; font-weight: 600; }
.vb-name span { display: block; font-size: 0.76rem; color: var(--color-muted); }
.vb-track { display: flex; height: 22px; border-radius: 6px; background: var(--color-bg-soft); overflow: hidden; }
.vb-track i { display: block; width: 0; height: 100%; background: var(--tone); transition: width 1.1s var(--ease); }
.vb-track i + i { box-shadow: inset 1px 0 0 var(--color-card); }
.vb-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Tabs used by chart panels */
.viz-tabs [role="tablist"] { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; margin: 0 0 1.25rem; padding-bottom: 1px; border-bottom: 1px solid var(--color-border); }
.viz-tabs [role="tab"] { flex: none; font: inherit; font-size: 0.86rem; font-weight: 600; padding: 0.7rem 0.95rem; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--color-muted); cursor: pointer; transition: color 0.2s, border-color 0.2s; }
.viz-tabs [role="tab"]:hover { color: var(--color-text); }
.viz-tabs [role="tab"][aria-selected="true"] { color: var(--color-text); border-bottom-color: var(--color-accent); }
.viz-tabs [role="tabpanel"] { animation: viz-in 0.45s var(--ease); }
.viz-tabs [role="tabpanel"] > p:first-child { margin-top: 0; }
@keyframes viz-in { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }

@media (max-width: 640px) {
  .viz-tabs [role="tablist"] { flex-wrap: wrap; overflow: visible; }
  .viz-tabs [role="tab"] { padding: 0.6rem 0.7rem; }
  .vf-row, .vf-axis, .vfn-step, .vb-row { grid-template-columns: minmax(0, 1fr) 5.6rem; gap: 0.35rem 0.6rem; }
  .vf-name, .vfn-head, .vb-name { grid-column: 1 / -1; }
  .vf-axis > :first-child, .vf-axis-label { display: none; }
  .vf-axis { grid-template-columns: minmax(0, 1fr) 5.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .vf-ci, .vf-dot, .vfn-bar i, .vb-track i { transition: none; }
  .viz-tabs [role="tabpanel"] { animation: none; }
}

/* ===================== Pointer glow + reading progress ===================== */
/* A soft light that follows the pointer across cards (fine pointers only;
   the class is added by base.html). Only background-image is set, so each
   card keeps its own background colour. */
.glow { background-image: radial-gradient(520px circle at var(--mx, -999px) var(--my, -999px), color-mix(in srgb, var(--tone, var(--color-accent)) 10%, transparent), transparent 55%) !important; }
.scroll-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 200; height: 2px; background: var(--signature); transform-origin: 0 50%; transform: scaleX(var(--sp, 0)); pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .scroll-progress { display: none; } }
@media print { .scroll-progress { display: none; } }
