:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f0efec;
  --border: #e2e1dc;
  --text: #121211;
  --text-2: #52514e;
  --text-3: #7c7b76;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --grid: #e8e7e3;
  --good: #1f8a4c;
  --warn: #b86e00;
  --bad: #c9372c;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --radius: 12px;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --surface-2: #232321; --border: #2e2e2b;
    --text: #f4f4f2; --text-2: #c3c2b7; --text-3: #8f8e87; --accent: #3987e5; --grid: #2a2a28;
    --good: #3fb56f; --warn: #e0a030; --bad: #ec6a5e;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --surface-2: #232321; --border: #2e2e2b;
  --text: #f4f4f2; --text-2: #c3c2b7; --text-3: #8f8e87; --accent: #3987e5; --grid: #2a2a28;
  --good: #3fb56f; --warn: #e0a030; --bad: #ec6a5e;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); }
img, video, svg { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); font-weight: 700; }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); font-weight: 650; margin-top: 0; }
h3 { font-size: 1.08rem; font-weight: 620; }
p { margin: 0 0 1em; }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; color: var(--text-3); }

/* ---------- layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
main { padding: 28px 0 64px; }
section { margin: 0 0 48px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card > h3:first-child { margin-top: 0; }
.card.flush { padding: 0; overflow: hidden; }
.lead { font-size: 1.12rem; color: var(--text-2); max-width: 760px; }
.eyebrow { font-size: .78rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: .5em; }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.nav .wrap { display: flex; align-items: center; gap: 16px; height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; }
.nav-links { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { color: var(--text-2); padding: 7px 11px; border-radius: 8px; font-size: .92rem; white-space: nowrap; }
.nav-links a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav-links a.active { color: var(--text); background: var(--surface-2); font-weight: 600; }
.nav-links a.cta { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; flex: none; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .menu-btn { display: grid; margin-left: auto; }
  .nav-links { display: none; position: absolute; top: 58px; left: 0; right: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 16px 14px; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 11px 12px; }
}
footer { border-top: 1px solid var(--border); padding: 28px 0 40px; color: var(--text-3); font-size: .88rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }

/* ---------- components ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .95rem; padding: 10px 16px; border-radius: 10px; cursor: pointer; }
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .k { font-size: .84rem; color: var(--text-2); }
.tag { display: inline-block; font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.tag.learned { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--text); }
.tag.rule { background: color-mix(in srgb, #eb6834 14%, transparent); border-color: color-mix(in srgb, #eb6834 40%, transparent); color: var(--text); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; flex: none; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { font: inherit; font-size: .9rem; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); padding: 7px 13px; border-radius: 999px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.note { border-left: 3px solid var(--accent); background: var(--surface-2); padding: 12px 14px; border-radius: 0 10px 10px 0; color: var(--text-2); font-size: .93rem; }
.note.warn { border-left-color: var(--warn); }
.findings { margin: 0; padding-left: 1.2em; }
.findings li { margin-bottom: .55em; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 620; color: var(--text-2); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }

/* ---------- media ---------- */
.player { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
.player video { width: 100%; height: 100%; display: block; }
figure { margin: 0; }
figure img { display: block; width: 100%; border-radius: 10px; border: 1px solid var(--border); }
figcaption { font-size: .85rem; color: var(--text-2); margin-top: 6px; }
.gallery { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.shot { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; text-align: left; padding: 0; font: inherit; color: inherit; }
.shot img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.shot .body { padding: 10px 12px 12px; }
.shot:hover { border-color: var(--accent); }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-2); font-size: 11px; font-family: var(--font); }
.chart .axis line, .chart .axis path { stroke: var(--border); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .cursor { stroke: var(--text); stroke-width: 1.5; pointer-events: none; }
.chart .hair { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart .row-label { fill: var(--text); font-size: 12px; font-weight: 550; }
.chart .sub-label { fill: var(--text-3); font-size: 10.5px; }
.chart .seg { cursor: pointer; }
.chart .seg:hover { filter: brightness(1.15); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .84rem; color: var(--text-2); margin: 8px 0 4px; }
.legend span { display: inline-flex; align-items: center; }
.tip { position: absolute; pointer-events: none; z-index: 30; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: 0 4px 18px rgba(0,0,0,.18); border-radius: 8px; padding: 7px 10px; font-size: .8rem; line-height: 1.4; white-space: nowrap; opacity: 0; transition: opacity .08s; }
.tip b { font-weight: 650; }

/* ---------- demo ---------- */
.drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 34px 18px; text-align: center; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.drop input { display: none; }
.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress > div { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.hidden { display: none !important; }
.error { color: var(--bad); font-weight: 550; }

/* ---------- team ---------- */
.person { display: flex; flex-direction: column; gap: 10px; }
.person img { width: 116px; height: 116px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface-2); }
.person .role { color: var(--accent); font-weight: 600; font-size: .92rem; }
.person ul { margin: 0; padding-left: 1.1em; color: var(--text-2); font-size: .93rem; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a { font-size: .86rem; font-weight: 600; border: 1px solid var(--border); padding: 5px 10px; border-radius: 8px; color: var(--text); }
.links a:hover { background: var(--surface-2); text-decoration: none; }

/* ---------- hero / diagram ---------- */
.hero { padding: 30px 0 10px; }
.hero h1 span { color: var(--accent); }
.diagram svg { width: 100%; height: auto; }
.diagram text { font-family: var(--font); }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
