/* Shared styles for every page under /docs/.
   Tokens, header and footer match the marketing pages (index/pricing/team), which inline
   the same rules. Keep them in sync when the site theme changes. */
:root {
  /* dark (primary) */
  --ground: #080d0b;
  --surface: #0e1613;
  --surface-2: #14201b;
  --line: rgba(120,190,155,0.14);
  --line-strong: rgba(120,190,155,0.28);
  --text: #e9f2ec;
  --muted: #8fa69a;
  --accent: #4fe39b;      /* cool / verdant */
  --accent-ink: #04140d;
  --heat: #ff8a4c;        /* thermal counter-accent */
  --shadow: 0 24px 60px -24px rgba(0,0,0,0.7);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Segoe UI Mono", "Roboto Mono", Menlo, monospace;

  --maxw: 1180px;
  --pad: clamp(20px, 5vw, 64px);
}
@media (prefers-color-scheme: light) {
  :root {
    --ground: #f3f6f3;
    --surface: #ffffff;
    --surface-2: #eaf0ea;
    --line: rgba(18,60,44,0.12);
    --line-strong: rgba(18,60,44,0.22);
    --text: #0c1512;
    --muted: #4c6157;
    --accent: #0f9d61;
    --accent-ink: #ffffff;
    --heat: #d9541f;
    --shadow: 0 24px 50px -28px rgba(20,50,38,0.4);
  }
}
:root[data-theme="dark"] {
  --ground:#080d0b; --surface:#0e1613; --surface-2:#14201b;
  --line:rgba(120,190,155,0.14); --line-strong:rgba(120,190,155,0.28);
  --text:#e9f2ec; --muted:#8fa69a; --accent:#4fe39b; --accent-ink:#04140d;
  --heat:#ff8a4c; --shadow:0 24px 60px -24px rgba(0,0,0,0.7);
}
:root[data-theme="light"] {
  --ground:#f3f6f3; --surface:#ffffff; --surface-2:#eaf0ea;
  --line:rgba(18,60,44,0.12); --line-strong:rgba(18,60,44,0.22);
  --text:#0c1512; --muted:#4c6157; --accent:#0f9d61; --accent-ink:#ffffff;
  --heat:#d9541f; --shadow:0 24px 50px -28px rgba(20,50,38,0.4);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: ""; width: 26px; height: 1px; background: var(--accent); opacity: .7;
}
h1, h2, h3 { text-wrap: balance; letter-spacing: -0.03em; line-height: 1.04; margin: 0; }
p { margin: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-sans); font-size: 0.95rem; font-weight: 600;
  padding: 13px 22px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -12px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn .arrow { transition: transform .18s ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* Smooth in-page navigation; offset for the 66px sticky header. */
html { scroll-behavior: smooth; scroll-padding-top: 82px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- NAV ---------- */
header.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--ground) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
/* Signature: thin telemetry hairline under the bar (accent -> heat sweep). */
header.nav::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent 2%, var(--accent) 30%, var(--heat) 70%, transparent 98%);
  opacity: .5; pointer-events: none;
}
.nav-inner { display: flex; align-items: center; gap: 22px; height: 66px; flex-wrap: nowrap; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 650; letter-spacing: -0.02em; font-size: 1.05rem; white-space: nowrap; }
.brand .brand-logo { flex: none; display: block; object-fit: contain; }
.brand .abbr { color: var(--muted); font-weight: 500; }
/* Dark mode: the tree's navy trunk vanishes on the dark bar — give the mark a
   small light chip (matches the partner logo-chip treatment). */
:root[data-theme="dark"] .brand-logo { background: #fff; border-radius: 8px; padding: 2px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo { background: #fff; border-radius: 8px; padding: 2px; }
}

.nav-links { display: flex; gap: 18px; margin-left: 8px; flex: none; }
.nav-links a {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); transition: color .15s; white-space: nowrap; position: relative; padding: 4px 0;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .22s ease;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); }
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { transform: scaleX(1); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.btn-nav {
  padding: 8px 13px; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.12em;
  text-transform: uppercase; border-radius: 8px;
  border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--text);
}
.btn-nav:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 14px -6px var(--accent); }
@media (max-width: 1150px) { .btn-nav { display: none; } }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 9px; border: 1px solid var(--line); background: transparent;
  color: var(--muted); cursor: pointer; transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn .moon { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: none; }
:root[data-theme="dark"] .icon-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .sun { display: none; }
  :root:not([data-theme="light"]) .icon-btn .moon { display: block; }
}

/* ---------- DOCS LAYOUT (sidebar + content) ---------- */
.docs-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: clamp(32px, 4vw, 56px); padding-block: 44px 110px; }
.docs-side { position: sticky; top: 90px; align-self: start; max-height: calc(100vh - 110px); overflow: auto; }
.docs-side summary { display: none; }
.docs-side .side-label { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.docs-side ul { list-style: none; margin: 0; padding: 0; }
.docs-side li { margin: 0; }
.docs-side a { display: block; padding: 6px 12px; border-left: 2px solid var(--line); color: var(--muted); font-size: 0.93rem; transition: color .15s, border-color .15s; }
.docs-side a:hover { color: var(--text); border-color: var(--line-strong); }
.docs-side a[aria-current="page"] { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.docs-side .group > a { color: var(--text); font-weight: 600; margin-top: 10px; }
.docs-side .group > a[aria-current="page"] { color: var(--accent); }
.docs-side ul ul a { padding-left: 26px; font-size: 0.9rem; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 22px; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .5; }
.crumbs [aria-current="page"] { color: var(--text); }

.doc h1 { font-size: clamp(2.1rem, 4.2vw, 3.2rem); font-weight: 680; }
.doc .lead { color: var(--muted); font-size: 1.08rem; margin-top: 18px; max-width: 64ch; }
.doc-section { margin-top: clamp(48px, 7vh, 72px); padding-top: clamp(32px, 5vh, 44px); border-top: 1px solid var(--line); }
.doc-section h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 660; }
.doc-section > p { color: var(--muted); margin-top: 12px; max-width: 64ch; }
.doc-section h2 + .doc-cards, .doc-section h2 + .bench-grid, .doc-section h2 + .def-grid, .doc-section h2 + .principles { margin-top: 26px; }
.doc-section > p + .doc-cards, .doc-section > p + .bench-grid, .doc-section > p + .def-grid { margin-top: 26px; }

/* link cards (docs home, validation overview) */
.doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.doc-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 22px 20px; display: flex; flex-direction: column; transition: transform .2s ease, border-color .2s ease; }
.doc-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.doc-card .ctag { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.doc-card h3 { font-size: 1.14rem; font-weight: 640; letter-spacing: -0.02em; }
.doc-card p { color: var(--muted); font-size: 0.93rem; margin-top: 8px; }
.doc-card .go { margin-top: auto; padding-top: 16px; color: var(--accent); font-weight: 600; font-size: 0.9rem; }

/* approach list (validation overview) */
.principles { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.principles > div { display: grid; grid-template-columns: 220px 1fr; gap: 8px 28px; padding: 18px 22px; border-top: 1px solid var(--line); background: var(--surface); }
.principles > div:first-child { border-top: none; }
.principles h3 { font-size: 1rem; font-weight: 640; letter-spacing: -0.01em; line-height: 1.4; text-wrap: wrap; hyphens: none; }
.principles p { color: var(--muted); font-size: 0.94rem; }
@media (max-width: 720px) { .principles > div { grid-template-columns: 1fr; } }

/* ---------- STATS ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 34px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 16px; }
.stat .n { font-size: clamp(1.8rem, 3vw, 2.5rem); font-weight: 680; letter-spacing: -0.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 0.86rem; margin-top: 6px; }

/* ---------- BENCHMARK CARDS ---------- */
.bench-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.bench { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px 22px; display: flex; flex-direction: column; }
.bench.wide { grid-column: 1 / -1; }
.bench .btag { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.bench .btag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.bench .btag.heat { color: var(--heat); }
.bench .btag.heat .dot { background: var(--heat); box-shadow: 0 0 8px var(--heat); }
.bench h3 { font-size: 1.18rem; font-weight: 640; letter-spacing: -0.02em; }
.bench p { color: var(--muted); font-size: 0.94rem; margin-top: 8px; max-width: 70ch; }
.bench .metrics-label { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-top: 20px; }
.metrics { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin-top: 22px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.bench .metrics-label + .metrics { margin-top: 8px; }
.metrics > div { min-width: 0; padding: 12px 16px; border-right: 1px solid var(--line); background: var(--surface-2); }
.metrics > div:last-child { border-right: none; }
.metrics b { display: block; font-size: 1.4rem; font-weight: 680; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.metrics span { display: block; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.bench .note { font-size: 0.86rem; border-left: 2px solid var(--line-strong); padding-left: 12px; margin-top: 14px; }
/* result figures (matplotlib PNGs on white): framed so they read in dark mode too */
.figs { display: grid; gap: 22px; margin-top: 24px; }
.fig { margin: 0; }
.fig a { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; cursor: zoom-in; transition: border-color .15s; }
.fig a:hover { border-color: var(--accent); }
.fig img { display: block; width: 100%; height: auto; }
.fig.square { max-width: 440px; }
/* map + scatter side by side; column ratio keeps the two images about the same height */
.figs.pair { grid-template-columns: 1.42fr 1fr; align-items: start; }
.figs.pair .fig.square { max-width: none; }
.figs.pair.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .figs.pair, .figs.pair.even { grid-template-columns: 1fr; } }
.fig figcaption { color: var(--muted); font-size: 0.86rem; margin-top: 10px; max-width: 90ch; }
.fig figcaption b { color: var(--text); font-weight: 640; }
dialog.lightbox { padding: 0; border: none; background: transparent; max-width: 96vw; max-height: 94vh; }
dialog.lightbox::backdrop { background: rgba(4, 8, 6, 0.86); }
dialog.lightbox img { display: block; max-width: 96vw; max-height: 86vh; width: auto; height: auto; background: #fff; border-radius: 10px; padding: 10px; cursor: zoom-out; }
dialog.lightbox p { color: #dbe7e0; font-size: 0.85rem; margin: 10px 4px 0; max-width: 110ch; }
.bench .src { margin-top: auto; padding-top: 18px; font-size: 0.82rem; color: var(--muted); }
.bench .src::before { content: "Data · "; font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; }

/* ---------- METRIC DEFINITIONS ---------- */
.def-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.def { border: 1px solid var(--line); border-radius: 16px; padding: 22px; background: var(--surface); }
.def .num { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.16em; color: var(--accent); text-transform: uppercase; }
.def h3 { font-size: 1.08rem; font-weight: 640; margin-top: 10px; letter-spacing: -0.02em; }
.def p { color: var(--muted); font-size: 0.93rem; margin-top: 6px; }

/* ---------- CTA (instrument card) ---------- */
.cta-card { position: relative; background: #070c0a; color: #e9f2ec; border: 1px solid rgba(120,190,155,0.2); border-radius: 18px; padding: clamp(24px, 3.5vw, 40px); box-shadow: var(--shadow); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 22px 36px; }
.cta-card h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); font-weight: 660; max-width: 22ch; }
.cta-card p { color: #b9cabf; margin-top: 10px; max-width: 48ch; }
.cta-card::after { content: ""; position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; border-top: 1px solid rgba(127,240,182,0.5); border-right: 1px solid rgba(127,240,182,0.5); border-radius: 0 6px 0 0; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; }
.cta-card .btn-primary { background: #4fe39b; color: #04140d; }
.cta-card .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.4); }
.cta-card .btn-ghost:hover { border-color: #7ff0b6; color: #7ff0b6; }

/* ---------- FOOTER ---------- */
footer { background: var(--ground); border-top: 1px solid var(--line); padding-block: 60px 34px; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 34px; }
.foot-col h4 { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; font-weight: 600; }
.foot-col a { display: block; color: var(--muted); font-size: 0.92rem; padding: 5px 0; transition: color .15s; }
.foot-col a:hover { color: var(--text); }
.foot-about p { color: var(--muted); font-size: 0.92rem; margin-top: 14px; max-width: 34ch; }
.foot-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.82rem; }

/* reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .bench-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .nav-links { display: none; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  /* Sidebar collapses into a "Docs menu" disclosure above the content. */
  .docs-shell { grid-template-columns: 1fr; gap: 26px; padding-top: 26px; }
  .docs-side { position: static; max-height: none; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  .docs-side summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 12px 16px; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text); list-style: none; }
  .docs-side summary::-webkit-details-marker { display: none; }
  .docs-side summary::after { content: "+"; color: var(--accent); font-size: 1rem; }
  .docs-side details[open] summary::after { content: "−"; }
  .docs-side .side-body { padding: 0 16px 14px; }
  .docs-side .side-label { display: none; }
}
@media (max-width: 560px) {
  .foot-grid { grid-template-columns: 1fr; }
  .metrics > div { padding: 10px 12px; }
  .metrics b { font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .doc-card:hover { transform: none; }
}
