@font-face { font-family: "Inter"; src: url("fonts/inter-var.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-var.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }

/* ---------- tokens: dark is the default look ---------- */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --page: #070b14;
  --surface: #0e1524;
  --surface-2: #121b2e;
  --band: #0a1020;
  --ink: #e9eef7;
  --ink-2: #aeb9cc;
  --muted: #8591a6;
  --grid: #1c2638;
  --axis: #2e3b54;
  --border: rgba(148, 180, 255, 0.13);
  --border-strong: rgba(148, 180, 255, 0.28);
  --accent: #3987e5;
  --accent-ink: #86b6ef;
  --btn: #1c5cab;
  --glow: #22d3ee;
  --glow-2: #6366f1;
  --au: #3987e5;
  --nz: #d95926;
  --rural: #c98500;
  --mixed: #199e70;
  --urban: #9085e9;
  --c-env: #c3c2b7;
  --c-ote: #3987e5;
  --c-ome: #d95926;
  --c-rose: #199e70;
  --tip-bg: #e9eef7;
  --tip-ink: #070b14;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 20px 40px -24px rgba(0,0,0,.7);
  --hero-grid: rgba(120, 160, 255, 0.07);
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --band: #eef1f7;
  --ink: #0b0f19;
  --ink-2: #4a5263;
  --muted: #646d7e;
  --grid: #e3e6ee;
  --axis: #c3c8d4;
  --border: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.22);
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --btn: #1c5cab;
  --glow: #0e7490;
  --glow-2: #4f46e5;
  --au: #2a78d6;
  --nz: #eb6834;
  --rural: #b87a00;
  --mixed: #178f65;
  --urban: #6250d6;
  --c-env: #52514e;
  --c-ote: #2a78d6;
  --c-ome: #eb6834;
  --c-rose: #1baf7a;
  --tip-bg: #0b0f19;
  --tip-ink: #f7f8fb;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 16px 32px -24px rgba(15,23,42,.25);
  --hero-grid: rgba(30, 64, 175, 0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.65 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-feature-settings: "cv11", "ss01"; -webkit-text-size-adjust: 100%; }
a { color: var(--accent-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.prose { max-width: 760px; }
.wrap.prose { max-width: 1120px; }
.wrap.prose > * { max-width: 760px; }
.wrap.prose > .table-wrap, .wrap.prose > details.maths { max-width: 900px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--page) 78%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--ink); text-decoration: none; white-space: nowrap; letter-spacing: -0.01em; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: conic-gradient(from 210deg, var(--glow), var(--glow-2), var(--accent), var(--glow)); box-shadow: 0 0 18px -4px var(--glow); }
.topbar nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; transition: background .2s, color .2s; }
.topbar nav a:hover, .topbar nav a.active { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--ink); }
.theme-toggle { border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); border-radius: 10px; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; flex: none; transition: border-color .2s, color .2s; }
.theme-toggle:hover { border-color: var(--border-strong); color: var(--ink); }
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--glow-2), var(--glow)); }
@supports (animation-timeline: scroll()) {
  .progress { animation: grow linear both; animation-timeline: scroll(root); }
  @keyframes grow { to { transform: scaleX(1); } }
}
@media (max-width: 640px) { .brand { display: none; } .topbar nav { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); padding-right: 24px; } }

/* ---------- sections ---------- */
section { padding: 88px 0; position: relative; }
.band { background: var(--band); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
h1 { font-size: clamp(32px, 5.4vw, 60px); line-height: 1.05; letter-spacing: -0.035em; margin: 18px 0 24px; max-width: 980px; font-weight: 750; }
h2 { font-size: clamp(28px, 3.4vw, 38px); line-height: 1.12; margin: 0 0 20px; letter-spacing: -0.025em; font-weight: 700; }
h3 { font-size: 20px; margin: 36px 0 10px; letter-spacing: -0.01em; font-weight: 650; }
.kicker { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; color: var(--glow); margin: 0 0 6px; letter-spacing: .08em; }
.kicker::after { content: ""; display: inline-block; width: 40px; height: 1px; background: currentColor; vertical-align: middle; margin-left: 10px; opacity: .6; }
p, li { color: var(--ink); }
.prose p, .prose li { max-width: 72ch; }
ul, ol { padding-left: 22px; }
li { margin: 6px 0; }
li::marker { color: var(--muted); }
strong { font-weight: 650; }

/* ---------- hero ---------- */
.hero { padding: 96px 0 88px; overflow: hidden; isolation: isolate; min-height: min(92vh, 900px); display: flex; align-items: center; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -3; background-image: linear-gradient(var(--hero-grid) 1px, transparent 1px), linear-gradient(90deg, var(--hero-grid) 1px, transparent 1px); background-size: 48px 48px; -webkit-mask-image: radial-gradient(ellipse 80% 70% at 60% 30%, #000 30%, transparent 75%); mask-image: radial-gradient(ellipse 80% 70% at 60% 30%, #000 30%, transparent 75%); }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; opacity: .85; }
.hero-glow { position: absolute; z-index: -1; width: 900px; height: 900px; right: -300px; top: -420px; background: radial-gradient(circle, color-mix(in srgb, var(--glow-2) 30%, transparent), transparent 62%); pointer-events: none; }
.hero-inner { position: relative; width: 100%; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 12.5px; letter-spacing: .04em; margin: 0; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: color-mix(in srgb, var(--surface) 60%, transparent); font-family: "JetBrains Mono", ui-monospace, monospace; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--glow); animation: pulse 2.4s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--glow) 60%, transparent); } 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.grad { background: linear-gradient(100deg, var(--glow) 0%, var(--accent) 45%, var(--glow-2) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { font-size: clamp(17px, 1.6vw, 19px); color: var(--ink-2); max-width: 780px; }
.lede strong { color: var(--ink); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 36px 0; }
.tile { position: relative; background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); overflow: hidden; transition: transform .25s, border-color .25s; }
.tile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--glow-2), var(--glow)); opacity: .8; }
.tile:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.tile-v { font-size: 42px; font-weight: 700; line-height: 1.05; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tile-l { color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 12px; background: var(--btn); color: #fff; text-decoration: none; font-weight: 600; box-shadow: 0 8px 24px -10px color-mix(in srgb, var(--accent) 80%, transparent); transition: transform .2s, box-shadow .2s; }
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--border-strong); box-shadow: none; }
.btn-ghost:hover { border-color: var(--ink-2); }

/* ---------- tables ---------- */
.steps li { margin: 10px 0; }
.table-wrap { overflow-x: auto; margin: 16px 0; -webkit-overflow-scrolling: touch; border-radius: 12px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 15px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
caption { text-align: left; font-weight: 650; padding: 0 0 10px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--grid); vertical-align: top; }
thead th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); text-transform: uppercase; letter-spacing: .05em; }
thead th:first-child { border-top-left-radius: 12px; }
thead th:last-child { border-top-right-radius: 12px; }
tbody th { font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
table.num td:not(:first-child), table.num th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }

details.maths { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 4px 22px; margin: 28px 0; box-shadow: var(--shadow); }
details.maths[open] { padding-bottom: 18px; }
details > summary { cursor: pointer; font-weight: 600; padding: 14px 0; }
details > summary::marker { color: var(--glow); }
.eq { font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif; font-size: 19px; overflow-x: auto; white-space: nowrap; padding: 12px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }

/* ---------- charts ---------- */
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px 20px 14px; margin: 28px 0; box-shadow: var(--shadow); position: relative; }
figure { margin: 0; }
figcaption { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.fig-title { font-weight: 650; font-size: 17px; letter-spacing: -0.01em; }
.fig-sub { color: var(--ink-2); font-size: 14px; }
.chart { position: relative; width: 100%; min-height: 260px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: "Inter", system-ui, sans-serif; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); margin: 0 0 8px; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--ink-2); }
.legend svg { width: 22px; height: 10px; flex: none; }
details.tbl { margin-top: 10px; font-size: 14px; }
details.tbl summary { font-weight: 500; color: var(--ink-2); padding: 6px 0; }
details.tbl table { font-size: 13px; }
details.tbl td, details.tbl th { padding: 6px 10px; white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  .bar-grow { transform-box: fill-box; animation: bar-in .7s cubic-bezier(.2,.7,.2,1) both; }
  .bar-grow.up { transform-origin: 50% 100%; }
  .bar-grow.down { transform-origin: 50% 0%; }
  .bar-grow.right { transform-origin: 0% 50%; animation-name: bar-in-x; }
  @keyframes bar-in { from { transform: scaleY(0); } }
  @keyframes bar-in-x { from { transform: scaleX(0); } }
}

/* ---------- dashboard console ---------- */
.console { display: grid; gap: 14px; margin: 28px 0 8px; padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow); }
@media (min-width: 900px) { .console { grid-template-columns: 1.4fr 1fr; } .console .seg:last-child { grid-column: 1 / -1; } }
fieldset.seg { border: 0; margin: 0; padding: 0; min-width: 0; }
.seg legend { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0; margin-bottom: 8px; }
.seg .hint { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.seg-row { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-row label { position: relative; cursor: pointer; }
.seg-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-row span { display: flex; flex-direction: column; justify-content: center; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 550; line-height: 1.25; transition: background .2s, color .2s, border-color .2s, box-shadow .2s; }
.seg-row small { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.seg-row label:hover span { border-color: var(--border-strong); color: var(--ink); }
.seg-row input:checked + span { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 1px var(--accent) inset, 0 6px 20px -12px var(--accent); }
.seg-row input:checked + span small { color: var(--ink-2); }
.seg-row input:focus-visible + span { outline: 2px solid var(--glow); outline-offset: 2px; }
.chips span { min-height: 36px; padding: 6px 12px; border-radius: 999px; }

.dash-grid { display: grid; gap: 18px; }
@media (min-width: 960px) { .dash-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }
.insight { border: 1px solid color-mix(in srgb, var(--glow) 30%, var(--border)); background: linear-gradient(160deg, color-mix(in srgb, var(--glow) 8%, var(--surface)), var(--surface)); border-radius: 14px; padding: 14px 16px; font-size: 14.5px; line-height: 1.55; }
.insight-wide { margin: 14px 0 6px; }
.insight-h { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--glow); }
.spark { width: 14px; height: 14px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 2 4 14h7l-1 8 9-12h-7z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 2 4 14h7l-1 8 9-12h-7z'/%3E%3C/svg%3E") center / contain no-repeat; }
.insight p { margin: 6px 0; color: var(--ink); }
.insight .caveat { color: var(--ink-2); font-size: 13.5px; border-top: 1px dashed var(--border-strong); padding-top: 8px; margin-top: 10px; }
.insight b { font-variant-numeric: tabular-nums; font-weight: 650; }
@media (prefers-reduced-motion: no-preference) {
  .insight .fresh { animation: fadein .45s ease; }
  @keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}

.explorer { margin-top: 48px; }
.net-pick { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; }
.net-pick label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); flex: 1 1 260px; max-width: 420px; }
select { font: inherit; font-size: 15px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; width: 100%; }
.net-card { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 16px 0 0; }
.net-card .kv { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.net-card .k { display: block; font-size: 12px; color: var(--muted); }
.net-card .v { display: block; font-size: 21px; font-weight: 680; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.net-card .note { grid-column: 1 / -1; font-size: 14px; color: var(--ink-2); margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 20px; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1fr; } }

/* ---------- tooltip ---------- */
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--tip-bg); color: var(--tip-ink); font-size: 13px; line-height: 1.45; padding: 9px 11px; border-radius: 10px; max-width: 290px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.tip b { font-weight: 650; }
.tip .row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tip .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.tip .val { font-variant-numeric: tabular-nums; margin-left: 12px; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; }

/* ---------- misc ---------- */
.note { color: var(--ink-2); font-size: 14px; }
.pending { border-left: 3px solid var(--axis); padding: 4px 0 4px 14px; color: var(--ink-2); }
.downloads { list-style: none; padding: 0; display: grid; gap: 10px; }
.downloads li { margin: 0; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.downloads a { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 14px; font-weight: 600; }
.downloads .meta { color: var(--muted); font-size: 13px; margin-left: 6px; }
.refs li { font-size: 15px; color: var(--ink-2); }
.contact { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.contact .btn { padding: 9px 16px; font-size: 15px; cursor: pointer; font: inherit; font-weight: 600; }
.contact-link { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 15px; padding: 9px 4px; }
.about-name { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 0; }
.findings { list-style: none; padding-left: 0; }
.findings li { margin: 0 0 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.verdict { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--axis); color: var(--ink); margin-right: 6px; white-space: nowrap; }
.verdict::before { margin-right: 4px; }
.v-holds::before { content: "\2713"; }
.v-weak::before { content: "~"; }
.v-no::before { content: "\2717"; }
.footer { border-top: 1px solid var(--border); padding: 28px 0 44px; color: var(--muted); font-size: 14px; }
.footer p { color: var(--muted); }

/* ---------- reveal on scroll (only when JS is on and motion is welcome) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
  .js .reveal.in { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pulse-dot { animation: none; }
  .hero-canvas { display: none; }
}

@media print {
  .topbar, .console, .theme-toggle, #explore, .cta, .hero-canvas, .hero-glow { display: none !important; }
  section { padding: 16px 0; }
  .hero { min-height: 0; }
  .band { background: none; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
}
@media (max-width: 720px) { .hero-canvas { opacity: .4; } }
