:root {
  color-scheme: light;
  --page: #f1f2ee;
  --surface: #fcfcfb;
  --surface-2: #f5f5f2;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --line: #e1e0d9;
  --axis: #c3c2b7;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --accent: #24389a;
  --accent-ink: #1f2f80;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --shadow: 0 1px 2px rgba(11, 11, 11, .04), 0 8px 24px -12px rgba(11, 11, 11, .12);
  --ring: rgba(11, 11, 11, .08);
  --radius: 16px;
  --space-xs: clamp(.5rem, .45rem + .25vw, .75rem);
  --space-s: clamp(.75rem, .6rem + .75vw, 1.25rem);
  --space-m: clamp(1.25rem, 1rem + 1.25vw, 2rem);
  --space-l: clamp(2.5rem, 1.8rem + 3vw, 5rem);
  --maxw: 76rem;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --focus: #1f3a93;
  --card: #fcfcfb;
  --glow: rgba(65, 105, 225, .08);
  --glow-edge: rgba(65, 105, 225, .35);
  --royal: #1f3a93;
  --royal-2: #4b2a8c;
  --gold: #9c7a2e;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #000000; --surface: #0a0b16; --surface-2: #11132b; --card: rgba(8, 9, 22, .76); --ink: #ffffff; --ink-2: #c3c6da; --muted: #8a8ca3;
    --line: rgba(255, 255, 255, .08); --axis: rgba(255, 255, 255, .16); --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --accent: #8d9be8; --accent-ink: #b3bdf0; --ring: rgba(110, 125, 220, .13);
    --shadow: 0 0 0 1px rgba(255, 255, 255, .02) inset, 0 1px 0 rgba(255, 255, 255, .05) inset, 0 24px 48px -28px rgba(0, 0, 0, .95); --focus: #c9a96e;
    --glow: rgba(40, 56, 170, .20); --glow-edge: rgba(118, 132, 220, .50); --royal: #2a3aa8; --royal-2: #4b2a8c; --gold: #c9a96e;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #000000; --surface: #0a0b16; --surface-2: #11132b; --card: rgba(8, 9, 22, .76); --ink: #ffffff; --ink-2: #c3c6da; --muted: #8a8ca3;
  --line: rgba(255, 255, 255, .08); --axis: rgba(255, 255, 255, .16); --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --accent: #8d9be8; --accent-ink: #b3bdf0; --ring: rgba(110, 125, 220, .13);
  --shadow: 0 0 0 1px rgba(255, 255, 255, .02) inset, 0 1px 0 rgba(255, 255, 255, .05) inset, 0 24px 48px -28px rgba(0, 0, 0, .95); --focus: #c9a96e;
  --glow: rgba(40, 56, 170, .20); --glow-edge: rgba(118, 132, 220, .50); --royal: #2a3aa8; --royal-2: #4b2a8c; --gold: #c9a96e;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); isolation: isolate; color: var(--ink); font: 400 1rem/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, svg { max-inline-size: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: .5rem; background: var(--surface); padding: .5rem 1rem; z-index: 100; border-radius: 8px; }
.skip:focus { left: .5rem; }
.muted { color: var(--ink-2); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-inline-size: var(--maxw); margin: 0 auto; padding: .6rem clamp(1rem, 3vw, 2rem); display: flex; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand-mark { inline-size: 2.1rem; block-size: 2.1rem; flex-shrink: 0; border-radius: 9px; box-shadow: 0 6px 16px -8px rgba(8, 11, 44, .9); transition: box-shadow .4s var(--ease); }
.brand-mark svg { display: block; inline-size: 100%; block-size: 100%; }
.brand:hover .brand-mark { box-shadow: 0 6px 18px -6px rgba(201, 169, 110, .45); }
.brand-text { display: flex; flex-direction: column; gap: .2rem; line-height: 1; }
.brand-text strong { font-size: 1rem; font-weight: 700; letter-spacing: -.015em; }
.brand-text span { color: var(--muted); font-size: .64rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.nav { display: flex; gap: .15rem; margin-inline: auto; overflow-x: auto; scrollbar-width: none; min-inline-size: 0; }
.nav::-webkit-scrollbar { display: none; }
@media (max-width: 64rem) { .nav { mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 1.5rem; } }
.nav a { color: var(--ink-2); text-decoration: none; font-size: .875rem; font-weight: 500; padding: .45rem .7rem; border-radius: 999px; white-space: nowrap; transition: background .2s, color .2s; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: color-mix(in srgb, var(--s1) 14%, transparent); color: var(--accent-ink); }
.topbar-tools { display: flex; gap: .35rem; flex-shrink: 0; }
.icon-btn { inline-size: 2.5rem; block-size: 2.5rem; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.icon-btn svg { inline-size: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-btn svg .fill { fill: currentColor; stroke: none; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .i-sun { display: none; }
  :root:where(:not([data-theme="light"])) .i-moon { display: block; }
}
@media (max-width: 56rem) { .brand-text span { display: none; } }
@media (max-width: 40rem) { .brand-text { display: none; } }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; color: #fff; background: radial-gradient(120% 140% at 85% 0%, #2f4bb8 0%, transparent 55%),
  linear-gradient(150deg, #0b1242 0%, #141f63 45%, #1f3a93 100%); padding: clamp(3rem, 2rem + 5vw, 6.5rem) clamp(1rem, 3vw, 2rem) clamp(6rem, 5rem + 5vw, 9rem); }
.hero-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(80% 90% at 70% 20%, #000 20%, transparent 75%); pointer-events: none; }
.hero-inner { position: relative; z-index: 1; max-inline-size: var(--maxw); margin: 0 auto; }
.eyebrow { font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.hero .eyebrow { color: #d9c28f; letter-spacing: .14em; }
.hero h1 { font-size: clamp(2.2rem, 1.3rem + 4.2vw, 4.4rem); font-weight: 800; margin: .6rem 0 1rem; max-inline-size: 16ch; letter-spacing: -.035em; }
.lede { font-size: clamp(1.05rem, .95rem + .45vw, 1.3rem); max-inline-size: 58ch; color: #dde1f4; }
.lede strong { color: #fff; }
.chips { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.chips li { font-size: .82rem; padding: .3rem .75rem; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); color: #e6eefb; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.btn { display: inline-flex; align-items: center; min-block-size: 2.9rem; padding: 0 1.3rem; border-radius: 12px; font-weight: 600; font-size: .95rem; text-decoration: none; transition: transform .15s, background .2s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: #fff; color: #141f63; }
.btn-glass { background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .28); }
.btn-glass:hover { background: rgba(255, 255, 255, .18); }

/* ---------- KPI cards ---------- */
.kpis { max-inline-size: var(--maxw); margin: clamp(-4.5rem, -3rem - 3vw, -3rem) auto 0; padding: 0 clamp(1rem, 3vw, 2rem); position: relative; z-index: 2; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: var(--space-s); }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--ring); padding: 1.1rem 1.2rem 1rem; display: grid; gap: .25rem; }
.kpi-label { font-size: .85rem; color: var(--ink-2); font-weight: 500; }
.kpi-value { font-size: clamp(1.8rem, 1.5rem + 1.2vw, 2.4rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.kpi-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.delta { white-space: nowrap; display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; }
.delta svg { inline-size: .8rem; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.delta.up-good { color: #006300; background: color-mix(in srgb, var(--good) 14%, transparent); }
.delta.up-bad { color: #a82b2b; background: color-mix(in srgb, var(--critical) 14%, transparent); }
:root[data-theme="dark"] .delta.up-good { color: #0ca30c; }
:root[data-theme="dark"] .delta.up-bad { color: #ef8d8d; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .delta.up-good { color: #0ca30c; }
  :root:where(:not([data-theme="light"])) .delta.up-bad { color: #ef8d8d; }
}
.spark { inline-size: 96px; block-size: 32px; flex-shrink: 0; }
.kpi-note { font-size: .8rem; color: var(--ink-2); margin-top: .6rem; }

/* ---------- insight cards ---------- */
.insights { max-inline-size: var(--maxw); margin: var(--space-l) auto 0; padding: 0 clamp(1rem, 3vw, 2rem); display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: var(--space-s); }
.insight { background: var(--card); border-radius: var(--radius); border: 1px solid var(--ring); padding: 1.5rem; display: flex; flex-direction: column; gap: .5rem; box-shadow: var(--shadow); }
.insight-icon { inline-size: 2.6rem; block-size: 2.6rem; border-radius: 12px; display: grid; place-items: center; margin-bottom: .4rem; }
.insight-icon svg { inline-size: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.insight-icon.heat { background: color-mix(in srgb, var(--s2) 15%, transparent); color: var(--s2); }
.insight-icon.battery { background: color-mix(in srgb, var(--s1) 15%, transparent); color: var(--s1); }
.insight-icon.rider { background: color-mix(in srgb, var(--s3) 15%, transparent); color: var(--s3); }
.insight-num { font-size: clamp(2.2rem, 1.8rem + 1.5vw, 3rem); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.insight h3 { font-size: 1.05rem; font-weight: 600; }
.insight p:not(.insight-num) { color: var(--ink-2); font-size: .95rem; }
.more { margin-top: auto; padding-top: .5rem; font-weight: 600; font-size: .9rem; text-decoration: none; }
.more:hover { text-decoration: underline; }

/* ---------- sections ---------- */
.section { max-inline-size: var(--maxw); margin: 0 auto; padding: var(--space-l) clamp(1rem, 3vw, 2rem) 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-s); }
.section-head { display: flex; gap: clamp(1rem, 2vw, 1.75rem); align-items: flex-start; margin-bottom: .5rem; }
.section-num { font-size: .85rem; font-weight: 700; color: var(--accent-ink); background: color-mix(in srgb, var(--s1) 12%, transparent); border-radius: 10px;
  padding: .45rem .6rem; font-variant-numeric: tabular-nums; flex-shrink: 0; margin-top: .15rem; }
.section-head h2 { font-size: clamp(1.6rem, 1.2rem + 1.7vw, 2.5rem); font-weight: 700; margin: .35rem 0 .6rem; }
.section-lede { color: var(--ink-2); max-inline-size: 68ch; font-size: 1.05rem; }
.subhead { font-size: 1.2rem; margin-top: var(--space-s); }
@media (max-width: 40rem) { .section-head { flex-direction: column; gap: .75rem; } }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr)); gap: var(--space-s); }

.card { margin: 0; background: var(--card); border-radius: var(--radius); border: 1px solid var(--ring); box-shadow: var(--shadow); padding: 1.1rem 1.2rem 1rem;
  display: flex; flex-direction: column; gap: .5rem; min-inline-size: 0; position: relative; }
.card.flat { box-shadow: none; }
.card figcaption h3 { font-size: 1.02rem; font-weight: 600; }
.card figcaption p { color: var(--ink-2); font-size: .88rem; margin-top: .2rem; }
.chart { inline-size: 100%; block-size: 320px; }
.card.wide .chart { block-size: 360px; }
.card-actions { display: flex; gap: .4rem; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .2rem; }
.ghost { font: 500 .8rem var(--font); color: var(--ink-2); background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: .35rem .7rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: .35rem; min-block-size: 2rem; }
.ghost:hover { background: var(--surface-2); color: var(--ink); }
.ghost[aria-pressed="true"] { background: color-mix(in srgb, var(--s1) 12%, transparent); color: var(--accent-ink); border-color: transparent; }
.ghost svg { inline-size: .9rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (pointer: coarse) { .ghost { min-block-size: 2.75rem; } }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; inline-size: 100%; font-size: .85rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 600; color: var(--ink-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; background: var(--surface); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--surface-2); }
th button { all: unset; cursor: pointer; display: inline-flex; gap: .25rem; align-items: center; }
th button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
th[aria-sort="ascending"] button::after { content: "▲"; font-size: .6rem; }
th[aria-sort="descending"] button::after { content: "▼"; font-size: .6rem; }
.table-view { max-block-size: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.swatch { display: inline-block; inline-size: .7rem; block-size: .7rem; border-radius: 50%; margin-right: .4rem; vertical-align: -1px; }
.bar-cell { display: flex; align-items: center; gap: .5rem; min-inline-size: 7rem; }
.bar-cell i { display: block; block-size: 6px; border-radius: 3px; background: var(--s2); }
.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.hl-row td { background: color-mix(in srgb, var(--s2) 9%, transparent); }

/* ---------- filters & controls ---------- */
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; background: var(--card); border: 1px solid var(--ring); border-radius: 12px; padding: .6rem .8rem;
  position: sticky; top: 4.1rem; z-index: 10; box-shadow: var(--shadow); }
.filter-label { font-size: .8rem; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.chip-toggles { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip-toggles button { font: 500 .85rem var(--font); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: .35rem .8rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: .4rem; min-block-size: 2.2rem; }
.chip-toggles button[aria-pressed="true"] { background: color-mix(in srgb, var(--s1) 12%, transparent); border-color: color-mix(in srgb, var(--s1) 40%, transparent); color: var(--accent-ink); }
.chip-toggles button[aria-pressed="true"]::before { content: ""; inline-size: .45rem; block-size: .45rem; border-radius: 50%; background: var(--s1); }
.chip-toggles .all { font-weight: 600; }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; align-self: flex-start; gap: 2px; }
.segmented button { font: 500 .85rem var(--font); border: 0; background: transparent; color: var(--ink-2); padding: .35rem .9rem; border-radius: 8px; cursor: pointer; min-block-size: 2rem; }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.select-wrap select { font: 500 .9rem var(--font); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .45rem 2rem .45rem .8rem; min-block-size: 2.4rem;
  appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; max-inline-size: 100%; }
@media (pointer: coarse) { .chip-toggles button, .segmented button { min-block-size: 2.75rem; } }

/* ---------- map ---------- */
.map-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; }
.map-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.map-wrap { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.map { inline-size: 100%; block-size: clamp(420px, 55vh + 120px, 640px); }
.map-legend { position: absolute; left: 12px; bottom: 12px; z-index: 2; max-inline-size: calc(100% - 24px); display: grid; gap: .45rem; padding: .7rem .85rem; border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--ring); box-shadow: var(--shadow);
  font-size: .78rem; color: var(--ink-2); pointer-events: none; }
.map-legend .lg-title { font-weight: 600; color: var(--ink); font-size: .8rem; }
.map-legend .lg-row { display: flex; flex-wrap: wrap; gap: .35rem .9rem; align-items: center; }
.map-legend .lg-item { display: inline-flex; align-items: center; gap: .4rem; }
.map-legend .dot { display: inline-block; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--ring); }
.map-legend .ramp { block-size: 8px; inline-size: 170px; border-radius: 4px; }
.map-legend .ends { display: flex; justify-content: space-between; inline-size: 170px; font-size: .72rem; }
.map-fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 2rem; color: var(--ink-2); background: var(--surface-2); }
.map-fallback[hidden] { display: none; }
.maplibregl-map { font-family: var(--font); }
.maplibregl-popup-content { background: var(--surface); color: var(--ink); border-radius: 12px; padding: .75rem .9rem; box-shadow: 0 12px 32px -10px rgba(0, 0, 0, .4); border: 1px solid var(--ring); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--surface); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }
.map-pop { display: grid; gap: .3rem; min-inline-size: 13rem; font-size: .8rem; }
.map-pop .pop-head { display: flex; align-items: center; gap: .45rem; font-weight: 700; font-size: .9rem; }
.map-pop .pop-sub { color: var(--ink-2); }
.map-pop .pop-grid { display: grid; grid-template-columns: auto auto; gap: .15rem 1rem; margin-top: .2rem; }
.map-pop .pop-grid span:nth-child(odd) { color: var(--ink-2); }
.map-pop .pop-grid span:nth-child(even) { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.maplibregl-ctrl-group { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow); border: 1px solid var(--ring); }
.maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--surface) 85%, transparent) !important; color: var(--ink-2); }
.maplibregl-ctrl-attrib a { color: var(--ink-2); }
:root[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon,
:root[data-theme="dark"] .maplibregl-ctrl-attrib-button { filter: invert(1); }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .maplibregl-ctrl-group button .maplibregl-ctrl-icon,
  :root:where(:not([data-theme="light"])) .maplibregl-ctrl-attrib-button { filter: invert(1); }
}
.cooperative-gesture-screen { font-family: var(--font); }
.station-link { all: unset; cursor: pointer; font-weight: 600; color: var(--accent); }
.station-link:hover { text-decoration: underline; }
.station-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* ---------- callouts, waves, stats ---------- */
.callout { display: flex; gap: 1rem; background: color-mix(in srgb, var(--s4) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--s4) 35%, transparent); border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.callout-icon { inline-size: 2.4rem; block-size: 2.4rem; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--s4) 22%, transparent); color: #8a5d00; }
:root[data-theme="dark"] .callout-icon { color: var(--s4); }
.callout-icon svg { inline-size: 1.3rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.callout h3 { font-size: 1.02rem; margin-bottom: .3rem; }
.callout p { color: var(--ink-2); font-size: .95rem; max-inline-size: 80ch; }
.wave-grid, .stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: var(--space-s); }
.mini { background: var(--card); border: 1px solid var(--ring); border-radius: 14px; padding: 1rem 1.1rem; display: grid; gap: .3rem; }
.mini .k { font-size: .78rem; color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.mini .v { font-size: 1.6rem; font-weight: 700; letter-spacing: -.03em; }
.mini .d { font-size: .85rem; color: var(--ink-2); }
.meter { block-size: 6px; border-radius: 3px; background: color-mix(in srgb, var(--s1) 18%, transparent); overflow: hidden; }
.meter i { display: block; block-size: 100%; background: var(--s1); border-radius: 3px; }

/* ---------- retention tiers ---------- */
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: var(--space-s); }
.tier { border-radius: 14px; padding: 1rem 1.2rem; border: 1px solid var(--ring); background: var(--card); display: grid; gap: .4rem; border-top: 4px solid var(--muted); }
.tier-primary { border-top-color: var(--s2); }
.tier-secondary { border-top-color: var(--s1); }
.tier-tag { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.tier p { font-size: .95rem; }

/* ---------- verdicts & plan ---------- */
.verdicts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: var(--space-s); }
.verdict { background: var(--card); border: 1px solid var(--ring); border-radius: var(--radius); padding: 1.2rem; display: flex; flex-direction: column; gap: .6rem; box-shadow: var(--shadow); }
.verdict-tag { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; align-self: flex-start; }
.verdict-tag svg { inline-size: .9rem; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.verdict-tag.no { color: #a82b2b; background: color-mix(in srgb, var(--critical) 13%, transparent); }
.verdict-tag.partial { color: #8a5d00; background: color-mix(in srgb, var(--warning) 20%, transparent); }
:root[data-theme="dark"] .verdict-tag.no { color: #ef8d8d; }
:root[data-theme="dark"] .verdict-tag.partial { color: var(--warning); }
.verdict h3 { font-size: 1.1rem; }
.verdict .ev { color: var(--ink-2); font-size: .9rem; }
.verdict .instead { font-size: .9rem; border-top: 1px solid var(--line); padding-top: .6rem; margin-top: auto; }
.verdict .instead strong { color: var(--accent-ink); }
.plan { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; counter-reset: step; }
.plan li { counter-increment: step; display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; background: var(--card); border: 1px solid var(--ring); border-radius: 14px; padding: 1rem 1.2rem; }
.plan li::before { content: counter(step); grid-row: span 2; inline-size: 2.2rem; block-size: 2.2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(180deg, #1f3a93, #141f63); color: #fff; }
.plan h4 { margin: 0; font-size: 1rem; }
.plan p { color: var(--ink-2); font-size: .9rem; }
.plan .tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }

/* ---------- anomalies ---------- */
.anomalies { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: var(--space-s); }
.anomaly { background: var(--card); border: 1px solid var(--ring); border-radius: 14px; padding: 1rem 1.2rem; display: grid; gap: .35rem; border-left: 4px solid var(--serious); }
.anomaly h3 { font-size: .98rem; }
.anomaly p { font-size: .88rem; color: var(--ink-2); }
.anomaly .act { color: var(--ink); font-weight: 500; }

/* ---------- footer ---------- */
.footer { margin-top: var(--space-l); border-top: 1px solid var(--line); background: var(--card); }
.footer-inner { max-inline-size: var(--maxw); margin: 0 auto; padding: var(--space-m) clamp(1rem, 3vw, 2rem); display: flex; flex-wrap: wrap; gap: var(--space-m); justify-content: space-between; }
.footer-inner > div { max-inline-size: 52ch; display: grid; gap: .4rem; font-size: .88rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: flex-start; }
.footer-links a { font-weight: 500; font-size: .9rem; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* ---------- motion ---------- */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover { transform: none; }
}
@media print { .topbar, .card-actions, .filter-row { display: none; } .card { break-inside: avoid; box-shadow: none; } }

/* ---------- small-screen overrides (kept last so they win the cascade) ---------- */
@media (max-width: 48rem) {
  .filter-row { flex-wrap: nowrap; }
  .chip-toggles { min-inline-size: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 88%, transparent); padding-right: 1.5rem; }
  .chip-toggles::-webkit-scrollbar { display: none; }
  .chip-toggles button { flex-shrink: 0; }
}
@media (max-width: 40rem) {
  .map-legend { font-size: .7rem; padding: .5rem .6rem; left: 8px; bottom: 8px; }
  .map-legend .ramp, .map-legend .ends { inline-size: 120px; }
}


/* ---------- OLED theme: interactive royal background ---------- */
.bg-fx { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.bg-fx canvas { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; display: block; }
.progress { position: fixed; inset: 0 0 auto 0; block-size: 2px; z-index: 70; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--royal), var(--royal-2) 62%, var(--gold)); pointer-events: none; }
.to-top { position: fixed; right: clamp(12px, 2vw, 24px); bottom: clamp(12px, 2vw, 24px); z-index: 40; inline-size: 2.9rem; block-size: 2.9rem; border-radius: 50%;
  border: 1px solid var(--ring); background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--ink); display: grid; place-items: center; cursor: pointer; opacity: 0; transform: translateY(10px); transition: opacity .3s var(--ease), transform .3s var(--ease), border-color .3s;
  pointer-events: none; box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--royal) 70%, transparent); }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { border-color: color-mix(in srgb, var(--gold) 55%, transparent); }
.to-top svg { inline-size: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.fx-spot { isolation: isolate; }
.fx-spot::before, .fx-spot::after { content: ""; position: absolute; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .45s var(--ease); }
.fx-spot::after { inset: 0; z-index: -1; background: radial-gradient(420px circle at var(--x, 50%) var(--y, 50%), var(--glow), transparent 45%); }
/* Border glow: royal blue at the cursor, fading through violet to a faint gold edge. */
.fx-spot::before { inset: -1px; padding: 1px;
  background: radial-gradient(300px circle at var(--x, 50%) var(--y, 50%), var(--glow-edge), color-mix(in srgb, var(--royal-2) 45%, transparent) 30%, color-mix(in srgb, var(--gold) 22%, transparent) 48%, transparent 62%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.fx-spot:hover::before, .fx-spot:hover::after { opacity: 1; }
.kpi, .insight, .mini, .tier, .verdict, .plan li, .anomaly { position: relative; }

:root[data-theme="dark"] .hero { background: transparent; }
:root[data-theme="dark"] .hero::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(80% 110% at 85% -10%, rgba(34, 50, 160, .36), transparent 60%), radial-gradient(60% 80% at -5% 100%, rgba(66, 28, 124, .26), transparent 60%);
  -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
:root[data-theme="dark"] .hero-grid { -webkit-mask-image: radial-gradient(70% 70% at 70% 15%, #000 15%, transparent 68%); mask-image: radial-gradient(70% 70% at 70% 15%, #000 15%, transparent 68%); }
.maplibregl-ctrl.maplibregl-ctrl-attrib, .maplibregl-ctrl.maplibregl-ctrl-attrib a { color: var(--ink-2) !important; }
.maplibregl-ctrl.maplibregl-ctrl-group { background: var(--surface) !important; }
:root[data-theme="dark"] .maplibregl-ctrl-group button:not(:disabled):hover { background-color: rgba(52, 70, 190, .22); }
:root[data-theme="dark"] .maplibregl-ctrl.maplibregl-ctrl-attrib { background: rgba(0, 0, 0, .72) !important; }
:root[data-theme="dark"] .hero-grid { background-image: linear-gradient(rgba(120, 135, 220, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(120, 135, 220, .06) 1px, transparent 1px); }
:root[data-theme="dark"] .hero h1 { background: linear-gradient(100deg, #ffffff 34%, #c9cff2 68%, #d8c49a); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="dark"] .hero .eyebrow { color: #cdb27c; letter-spacing: .14em; }
:root[data-theme="dark"] .hero .chips li { background: rgba(42, 58, 168, .14); border-color: rgba(120, 135, 220, .22); color: #d9ddf4; }
:root[data-theme="dark"] .btn-primary { box-shadow: 0 10px 30px -12px rgba(42, 58, 168, .85), inset 0 0 0 1px rgba(201, 169, 110, .35); }
:root[data-theme="dark"] .btn-glass { background: rgba(42, 58, 168, .12); border-color: rgba(120, 135, 220, .30); }
:root[data-theme="dark"] .btn-glass:hover { background: rgba(42, 58, 168, .24); border-color: rgba(201, 169, 110, .45); }
:root[data-theme="dark"] .plan li::before { background: linear-gradient(180deg, #16206a, #080b2c); color: #e6d3a3;
  box-shadow: inset 0 0 0 1px rgba(201, 169, 110, .45), 0 6px 18px -8px rgba(8, 11, 44, .9); }
:root[data-theme="dark"] .section-num { background: rgba(42, 58, 168, .18); color: #b3bdf0; box-shadow: inset 0 0 0 1px rgba(120, 135, 220, .16); }
/* A live backdrop blur over an animated background is recomputed every frame; near-opaque black looks the same on OLED. */
:root[data-theme="dark"] .topbar { background: #000; backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom-color: rgba(120, 135, 220, .10); }
:root[data-theme="dark"] .filter-row { background: #05060f; }
:root[data-theme="dark"] .to-top { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(10, 11, 26, .92); }
:root[data-theme="dark"] .footer { border-top-color: rgba(120, 135, 220, .10); }
:root[data-theme="dark"] .card, :root[data-theme="dark"] .kpi, :root[data-theme="dark"] .insight, :root[data-theme="dark"] .verdict { border-color: rgba(120, 135, 220, .10); }
:root[data-theme="dark"] ::selection { background: rgba(42, 58, 168, .6); }
noscript .noscript { display: block; max-inline-size: 40rem; margin: 2rem auto; padding: 1rem 1.2rem; border-radius: 12px; border: 1px solid var(--ring); background: var(--card); }

/* ---------- tab transitions ---------- */
/* Controls ease between states instead of snapping. */
.nav a, .ghost, .chip-toggles button, .segmented button, .icon-btn, .select-wrap select {
  transition: color .3s var(--ease), background-color .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease); }
.chip-toggles button::before { transition: transform .3s var(--ease); }
.chip-toggles button:active, .segmented button:active, .ghost:active { transform: scale(.97); }

/* Section nav: one pill slides to the active section instead of each link lighting up on its own. */
.nav { position: relative; }
.nav a { position: relative; z-index: 1; }
.nav.has-ink a.active { background: transparent; }
.nav-ink { position: absolute; z-index: 0; left: 0; top: var(--ink-y, 0); block-size: var(--ink-h, 0); inline-size: var(--ink-w, 0); border-radius: 999px; pointer-events: none;
  transform: translateX(var(--ink-x, 0)); opacity: 0; background: color-mix(in srgb, var(--s1) 14%, transparent);
  transition: transform .5s var(--ease), inline-size .5s var(--ease), opacity .3s; }
.nav-ink.on { opacity: 1; }

/* Segmented toggles: a thumb glides under the selected option. */
.segmented { position: relative; isolation: isolate; }
.segmented.has-thumb button[aria-checked="true"] { background: transparent; box-shadow: none; }
.seg-thumb { position: absolute; z-index: -1; inset-block: 3px; left: 0; inline-size: var(--seg-w, 0); border-radius: 8px; pointer-events: none;
  transform: translateX(var(--seg-x, 0)); background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
  transition: transform .45s var(--ease), inline-size .45s var(--ease); }

/* Table view opens and closes with a short slide. */
@keyframes tv-in { from { opacity: 0; transform: translateY(-6px); } }
.table-view:not([hidden]) { animation: tv-in .35s var(--ease); }
/* Charts dim briefly while a filter swaps their data, then ECharts morphs the marks. */
.chart { transition: opacity .25s var(--ease); }
.chart.swapping { opacity: .55; }

:root[data-theme="dark"] .nav-ink { background: linear-gradient(180deg, rgba(42, 58, 168, .30), rgba(42, 58, 168, .18));
  box-shadow: inset 0 0 0 1px rgba(120, 135, 220, .22), inset 0 -1px 0 rgba(201, 169, 110, .45); }
:root[data-theme="dark"] .nav a.active { color: #d5daf6; }
:root[data-theme="dark"] .nav:not(.has-ink) a.active { background: rgba(42, 58, 168, .24); }
:root[data-theme="dark"] .segmented { background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px rgba(120, 135, 220, .10); }
:root[data-theme="dark"] .seg-thumb { background: linear-gradient(180deg, #1d2670, #151b52); box-shadow: inset 0 0 0 1px rgba(120, 135, 220, .30), 0 6px 16px -8px rgba(42, 58, 168, .9); }
:root[data-theme="dark"] .segmented button[aria-checked="true"] { color: #fff; }
:root[data-theme="dark"] .segmented:not(.has-thumb) button[aria-checked="true"] { background: #1d2670; }
:root[data-theme="dark"] .chip-toggles button[aria-pressed="true"] { background: rgba(42, 58, 168, .20); border-color: rgba(120, 135, 220, .38); color: #d5daf6; }
:root[data-theme="dark"] .chip-toggles button[aria-pressed="true"]::before { background: var(--gold); }
:root[data-theme="dark"] .chip-toggles button:hover { border-color: rgba(120, 135, 220, .45); }
:root[data-theme="dark"] .ghost[aria-pressed="true"] { background: rgba(42, 58, 168, .22); color: #d5daf6; box-shadow: inset 0 0 0 1px rgba(120, 135, 220, .25); }
:root[data-theme="dark"] .ghost:hover, :root[data-theme="dark"] .icon-btn:hover { background: rgba(42, 58, 168, .16); border-color: rgba(120, 135, 220, .30); }
:root[data-theme="dark"] .select-wrap select:hover, :root[data-theme="dark"] .select-wrap select:focus-visible { border-color: rgba(120, 135, 220, .40); }
:root[data-theme="dark"] .meter i { background: linear-gradient(90deg, var(--royal), #5b6fd8); }

/* Theme switch: the new theme spreads out from the toggle button as a circle. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: theme-reveal .7s var(--ease); }
@keyframes theme-reveal { from { clip-path: circle(0 at var(--vt-x, 100%) var(--vt-y, 0)); } to { clip-path: circle(var(--vt-r, 150vmax) at var(--vt-x, 100%) var(--vt-y, 0)); } }

/* ---------- royal refinements: editorial serif, gold hairlines ---------- */
.hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.7rem, 1.6rem + 5vw, 5.6rem); line-height: 1.02; letter-spacing: 0; max-inline-size: 14ch; }
.hero h1 em { font-style: italic; padding-inline-end: .06em; background: linear-gradient(100deg, #f3e6c4 10%, #c9a96e 60%, #a8884f);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="dark"] .hero h1 { background: linear-gradient(180deg, #ffffff 40%, #d6dbf3); -webkit-background-clip: text; background-clip: text; color: transparent; }
.section-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.05rem, 1.4rem + 2.4vw, 3.3rem); line-height: 1.06; letter-spacing: .004em; }
.insight-num { font-family: var(--serif); font-weight: 400; font-size: clamp(3rem, 2.4rem + 2vw, 4rem); letter-spacing: -.01em; color: #141f63; }
:root[data-theme="dark"] .insight-num { color: #e6d3a3; }

/* Section numerals: gold serif figures over a hairline that draws in when the heading appears. */
.section-num { font-family: var(--serif); font-weight: 400; font-size: clamp(1.7rem, 1.4rem + 1vw, 2.3rem); line-height: 1; color: var(--gold);
  background: none; padding: 0; border-radius: 0; margin-top: .25rem; display: grid; gap: .55rem; justify-items: start; box-shadow: none; }
.section-num::after { content: ""; inline-size: 1.9rem; block-size: 1px; background: linear-gradient(90deg, var(--gold), transparent); transform-origin: 0 50%; }
:root[data-theme="dark"] .section-num { background: none; color: var(--gold); box-shadow: none; }
.section { background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--gold) 30%, transparent) 50%, transparent) top / 100% 1px no-repeat; }
.subhead { font-family: var(--serif); font-weight: 400; font-size: clamp(1.6rem, 1.25rem + 1vw, 2.1rem); letter-spacing: .004em; }

/* Cards: a faint royal sheen from the top edge. */
:root[data-theme="dark"] :is(.card, .kpi, .insight, .verdict, .mini, .tier, .anomaly, .plan li) { background-image: linear-gradient(180deg, rgba(90, 105, 210, .07), transparent 38%); }
:root[data-theme="dark"] :is(.mini, .tier, .anomaly, .plan li) { border-color: rgba(120, 135, 220, .10); }
:root[data-theme="dark"] .tier-primary { border-top-color: var(--s2); }
:root[data-theme="dark"] .tier-secondary { border-top-color: var(--s1); }
:root[data-theme="dark"] .tier-none { border-top-color: var(--muted); }
:root[data-theme="dark"] .anomaly { border-left-color: var(--serious); }

/* Links and buttons */
.more { display: inline-flex; align-items: center; gap: .35rem; }
.more .arr { transition: transform .4s var(--ease); }
.more:hover .arr { transform: translateX(4px); }
.btn { position: relative; overflow: hidden; isolation: isolate; transition: transform .35s var(--ease), background-color .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease); }
.btn-primary::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; transform: translateX(-110%);
  background: linear-gradient(105deg, transparent 30%, rgba(201, 169, 110, .38) 50%, transparent 70%); transition: transform .9s var(--ease); }
.btn-primary:hover::after { transform: translateX(110%); }
.btn:hover { transform: translateY(-2px); }

/* Footer brand */
.footer-brand { display: flex; align-items: center; gap: .65rem; }
.footer-brand .brand-mark { inline-size: 1.9rem; block-size: 1.9rem; }
.footer-inner > div .brand-text { display: flex; }
.footer { background-image: linear-gradient(90deg, transparent, color-mix(in srgb, var(--gold) 28%, transparent) 50%, transparent); background-size: 100% 1px; background-repeat: no-repeat; }

/* Details: gold focus ring, royal scrollbars, refined popups */
:root[data-theme="dark"] { scrollbar-color: #262d6b #000; }
:root[data-theme="dark"] .maplibregl-popup-content { box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(201, 169, 110, .22); }
:root[data-theme="dark"] .callout { background: color-mix(in srgb, var(--s4) 8%, rgba(8, 9, 22, .8)); }

/* Map placeholder: a slow royal shimmer until the first frame is drawn. */
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.map-wrap::before { content: "Loading map"; position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; pointer-events: none; font-size: .85rem; color: var(--muted);
  letter-spacing: .08em; text-transform: uppercase; background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--royal) 18%, transparent) 50%, transparent 70%) 0 0 / 200% 100%;
  animation: shimmer 1.8s linear infinite; transition: opacity .6s var(--ease); }
.map-wrap.ready::before, .map-wrap:has(.map-fallback:not([hidden]))::before { opacity: 0; animation: none; }

/* ---------- motion ---------- */
/* Hero enters in sequence on load. */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.hero-inner > * { animation: rise .9s var(--ease) both; }
.hero-inner > :nth-child(2) { animation-delay: .08s; }
.hero-inner > :nth-child(3) { animation-delay: .18s; }
.hero-inner > :nth-child(4) { animation-delay: .28s; }
.hero-inner > :nth-child(5) { animation-delay: .38s; }

/* Scroll reveal: longer, softer ease; siblings cascade (delay set in JS). */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease), box-shadow .5s var(--ease), border-color .5s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.section-head .section-num::after { transform: scaleX(0); transition: transform 1.1s var(--ease) .35s; }
.section-head.in .section-num::after, .section-head:not(.reveal) .section-num::after { transform: none; }
.mini .meter i { transform: scaleX(0); transform-origin: 0 50%; transition: transform 1.2s var(--ease) .3s; }
.mini.in .meter i, .mini:not(.reveal) .meter i { transform: none; }
@media (hover: hover) {
  :is(.kpi, .insight, .verdict, .mini, .tier, .anomaly, .plan li).reveal.in:hover { transform: translateY(-3px); }
  :root[data-theme="dark"] :is(.kpi, .insight, .verdict, .mini, .tier, .anomaly, .plan li):hover { box-shadow: var(--shadow), 0 18px 40px -22px rgba(42, 58, 168, .75); }
}
/* Theme icon turns in when it swaps. */
@keyframes turn-in { from { opacity: 0; transform: rotate(-80deg) scale(.6); } }
#theme-toggle svg { animation: turn-in .6s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  .to-top, .fx-spot::before, .fx-spot::after, .nav-ink, .seg-thumb, .chart, .nav a, .ghost, .chip-toggles button, .segmented button { transition: none; }
  .table-view:not([hidden]), .hero-inner > *, #theme-toggle svg, .map-wrap::before { animation: none; }
  .reveal, .section-head .section-num::after, .mini .meter i, .btn, .btn-primary::after, .more .arr { transition: none; }
  :is(.kpi, .insight, .verdict, .mini, .tier, .anomaly, .plan li).reveal.in:hover, .btn:hover { transform: none; }
  .chip-toggles button:active, .segmented button:active, .ghost:active { transform: none; }
}
