/* ===================================================================
   STATISTICS v2 (/statistics, /statistics/*)
   Loaded only on statistics pages, after style.css. Built by
   src/stats/build.js with components from src/stats/charts2.js.
   Six categorical colours (--c1..--c6) and a seven-step heat ramp,
   each redefined for dark mode.
   =================================================================== */
:root {
  --c0: #D5D9DF;
  --c1: #3557C9;   /* indigo blue */
  --c2: #0E8F80;   /* teal */
  --c3: #D9921A;   /* amber */
  --c4: #DD5F45;   /* coral */
  --c5: #7350D8;   /* violet */
  --c6: #C9407A;   /* raspberry */
  --c1-soft: #EBF0FD; --c2-soft: #E3F5F2; --c3-soft: #FCF2DF; --c4-soft: #FCEBE6; --c5-soft: #F0EBFC; --c6-soft: #FAE8F0;
  --heat-0: #F3F4F6;
  --heat-1: #FBEFC6; --heat-2: #D4F0D5; --heat-3: #95DAC3; --heat-4: #4DBDAF;
  --heat-5: #2A93AF; --heat-6: #2F62A8; --heat-7: #2D2E78;
  --sx-surface: #FFFFFF;
  --sx-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 28px rgba(16, 24, 40, 0.06);
}
html.dark-mode {
  --c0: #3A3D44;
  --c1: #7C9BFF; --c2: #3CC7B3; --c3: #F2B544; --c4: #FF8A70; --c5: #A98BFF; --c6: #F07AAE;
  --c1-soft: #1D2540; --c2-soft: #14302C; --c3-soft: #33280F; --c4-soft: #3A1E18; --c5-soft: #261E40; --c6-soft: #3A1A28;
  --heat-0: #1F2024;
  --heat-1: #1D3436; --heat-2: #1E4E4C; --heat-3: #22695F; --heat-4: #2C8A77;
  --heat-5: #45AA87; --heat-6: #8DCB86; --heat-7: #F1E287;
  --sx-surface: #18181A;
  --sx-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 28px rgba(0, 0, 0, 0.25);
}
@media (prefers-color-scheme: dark) {
  html:not(.light-mode) {
    --c0: #3A3D44;
    --c1: #7C9BFF; --c2: #3CC7B3; --c3: #F2B544; --c4: #FF8A70; --c5: #A98BFF; --c6: #F07AAE;
    --c1-soft: #1D2540; --c2-soft: #14302C; --c3-soft: #33280F; --c4-soft: #3A1E18; --c5-soft: #261E40; --c6-soft: #3A1A28;
    --heat-0: #1F2024;
    --heat-1: #1D3436; --heat-2: #1E4E4C; --heat-3: #22695F; --heat-4: #2C8A77;
    --heat-5: #45AA87; --heat-6: #8DCB86; --heat-7: #F1E287;
    --sx-surface: #18181A;
    --sx-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 28px rgba(0, 0, 0, 0.25);
  }
}

/* Tone helpers: each sets --tone for stripes, kickers and icons */
.sx-tone-0 { --tone: var(--c0); --tone-soft: var(--parchment-warm); }
.sx-tone-1 { --tone: var(--c1); --tone-soft: var(--c1-soft); }
.sx-tone-2 { --tone: var(--c2); --tone-soft: var(--c2-soft); }
.sx-tone-3 { --tone: var(--c3); --tone-soft: var(--c3-soft); }
.sx-tone-4 { --tone: var(--c4); --tone-soft: var(--c4-soft); }
.sx-tone-5 { --tone: var(--c5); --tone-soft: var(--c5-soft); }
.sx-tone-6 { --tone: var(--c6); --tone-soft: var(--c6-soft); }
.sx-bg-0 { background: var(--c0); } .sx-bg-1 { background: var(--c1); } .sx-bg-2 { background: var(--c2); }
.sx-bg-3 { background: var(--c3); } .sx-bg-4 { background: var(--c4); } .sx-bg-5 { background: var(--c5); } .sx-bg-6 { background: var(--c6); }
.sx-fill-1 { fill: var(--c1); } .sx-fill-2 { fill: var(--c2); } .sx-fill-3 { fill: var(--c3); } .sx-fill-5 { fill: var(--c5); }

/* Page shell */
.sx-page { max-width: 1120px; margin: 0 auto; padding: 28px 24px 80px; }
.sx-page .stats-crumbs { margin-bottom: 18px; }
.sx-narrow { max-width: 780px; margin-left: auto; margin-right: auto; }
.sx-kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; letter-spacing: 1.8px; text-transform: uppercase; color: var(--tone, var(--c1)); }
.sx-kicker::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }

/* Hero */
.sx-hero { position: relative; display: grid; grid-template-columns: 1.15fr 1fr; gap: 44px; align-items: center;
  padding: 40px 44px; margin-bottom: 30px; border-radius: 22px; overflow: hidden;
  background:
    radial-gradient(60% 80% at 0% 0%, var(--c1-soft) 0%, transparent 60%),
    radial-gradient(50% 70% at 100% 100%, var(--c2-soft) 0%, transparent 65%),
    radial-gradient(40% 50% at 70% 0%, var(--c3-soft) 0%, transparent 70%),
    var(--parchment-warm); }
.sx-hero.sx-tone-4 { background: radial-gradient(60% 80% at 0% 0%, var(--c4-soft), transparent 60%), radial-gradient(50% 70% at 100% 100%, var(--c5-soft), transparent 65%), var(--parchment-warm); }
.sx-hero.sx-tone-5 { background: radial-gradient(60% 80% at 0% 0%, var(--c5-soft), transparent 60%), radial-gradient(50% 70% at 100% 100%, var(--c1-soft), transparent 65%), var(--parchment-warm); }
.sx-hero.sx-tone-6 { background: radial-gradient(60% 80% at 0% 0%, var(--c6-soft), transparent 60%), radial-gradient(50% 70% at 100% 100%, var(--c1-soft), transparent 65%), var(--parchment-warm); }
.sx-hero.sx-tone-2 { background: radial-gradient(60% 80% at 0% 0%, var(--c2-soft), transparent 60%), radial-gradient(50% 70% at 100% 100%, var(--c3-soft), transparent 65%), var(--parchment-warm); }
.sx-hero.sx-tone-3 { background: radial-gradient(60% 80% at 0% 0%, var(--c3-soft), transparent 60%), radial-gradient(50% 70% at 100% 100%, var(--c4-soft), transparent 65%), var(--parchment-warm); }
.sx-hero.is-text { grid-template-columns: 1fr; }
.sx-hero.is-text .sx-dek { max-width: 720px; }
.sx-hero h1 { font-family: 'Cormorant Garamond', serif; font-size: 54px; font-weight: 600; line-height: 1.04; letter-spacing: -1.4px; color: var(--ink); margin: 14px 0 16px; }
.sx-hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--c1), var(--c5) 55%, var(--c6)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sx-dek { font-size: 18px; font-weight: 300; line-height: 1.6; color: var(--ink-soft); margin: 0; max-width: 560px; }
.sx-meta { font-size: 12.5px; color: var(--ink-faint); margin: 16px 0 0; }
.sx-hero .article-byline { margin-top: 14px; }
.sx-hero-art { position: relative; align-self: stretch; min-height: 300px; }
.sx-hero-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 16px; box-shadow: var(--sx-shadow); }
.sx-float { position: absolute; display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 12px;
  background: var(--sx-surface); box-shadow: var(--sx-shadow); font-size: 11.5px; color: var(--ink-muted); line-height: 1.3; border-left: 3px solid var(--tone); }
.sx-float b { font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -0.3px; }
.sx-float-1 { left: -18px; bottom: 26px; }
.sx-float-2 { right: -10px; top: 22px; }
.sx-float-3 { right: 24px; bottom: -12px; }

/* KPI tiles */
.sx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 0 0 40px; }
.sx-kpi { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 20px 20px 18px; border-radius: 16px;
  background: var(--sx-surface); border: 1px solid var(--border-soft); overflow: hidden; }
.sx-kpi::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--tone), color-mix(in srgb, var(--tone) 35%, transparent)); }
.sx-kpi-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--tone-soft); color: var(--tone); margin-bottom: 8px; }
.sx-kpi-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sx-kpi-value { font-size: 36px; font-weight: 600; letter-spacing: -1px; line-height: 1.05; color: var(--ink); font-variant-numeric: tabular-nums; }
.sx-kpi-label { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.sx-kpi-note { font-size: 12px; color: var(--ink-faint); }

/* Sections and cards */
.sx-section { margin: 56px 0; }
.sx-section-head { max-width: 720px; margin-bottom: 22px; }
.sx-section-head h2 { font-family: 'Cormorant Garamond', serif; font-size: 36px; font-weight: 600; letter-spacing: -0.6px; line-height: 1.12; color: var(--ink); margin: 10px 0 10px; }
.sx-intro { font-size: 16.5px; font-weight: 300; line-height: 1.7; color: var(--ink-soft); margin: 0; }
.sx-intro strong { font-weight: 500; color: var(--ink); }
.sx-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.sx-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.sx-card { position: relative; margin: 0; padding: 24px 24px 20px; border-radius: 18px; background: var(--sx-surface); border: 1px solid var(--border-soft); box-shadow: var(--sx-shadow); overflow: hidden; }
.sx-card::before { content: ""; position: absolute; left: 24px; top: 0; width: 44px; height: 3px; border-radius: 0 0 3px 3px; background: var(--tone); }
.sx-card-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 18px; }
.sx-card-title { font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.sx-card-sub { font-size: 13px; font-weight: 300; color: var(--ink-muted); line-height: 1.5; }
.sx-note { font-size: 12.5px; color: var(--ink-muted); line-height: 1.55; margin: 14px 0 0; }
.sx-card .sc-table summary { color: var(--tone); }
.sx-wide { grid-column: 1 / -1; }

/* Compass */
.sx-compass { position: relative; padding: 22px 26px; }
.sx-compass-grid { position: relative; display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; aspect-ratio: 1; }
.sx-compass-grid::before, .sx-compass-grid::after { content: ""; position: absolute; background: var(--ink); opacity: 0.18; pointer-events: none; z-index: 1; }
.sx-compass-grid::before { left: 50%; top: -6px; bottom: -6px; width: 1.5px; margin-left: -0.75px; }
.sx-compass-grid::after { top: 50%; left: -6px; right: -6px; height: 1.5px; margin-top: -0.75px; }
.sx-cell { border-radius: 4px; background: var(--heat-0); outline: none; transition: background-color 0.45s ease, transform 0.15s; }
.sx-cell[data-h="1"] { background: var(--heat-1); } .sx-cell[data-h="2"] { background: var(--heat-2); }
.sx-cell[data-h="3"] { background: var(--heat-3); } .sx-cell[data-h="4"] { background: var(--heat-4); }
.sx-cell[data-h="5"] { background: var(--heat-5); } .sx-cell[data-h="6"] { background: var(--heat-6); }
.sx-cell[data-h="7"] { background: var(--heat-7); }
.sx-cell:hover, .sx-cell:focus-visible { transform: scale(1.12); position: relative; z-index: 2; box-shadow: 0 0 0 2px var(--sx-surface), 0 0 0 3.5px var(--ink); }
.sx-ax { position: absolute; font-size: 10.5px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: var(--ink-muted); }
.sx-ax-top { top: 0; left: 50%; transform: translateX(-50%); }
.sx-ax-bottom { bottom: 0; left: 50%; transform: translateX(-50%); }
.sx-ax-left { left: 0; top: 50%; transform: translateY(-50%) rotate(-90deg); transform-origin: center; margin-left: -8px; }
.sx-ax-right { right: 0; top: 50%; transform: translateY(-50%) rotate(90deg); margin-right: -10px; }
.sx-q { position: absolute; z-index: 1; font-size: 10.5px; font-weight: 500; color: var(--ink); background: color-mix(in srgb, var(--sx-surface) 82%, transparent); padding: 2px 7px; border-radius: 6px; pointer-events: none; }
.sx-q-tl { left: 6px; top: 6px; } .sx-q-tr { right: 6px; top: 6px; } .sx-q-bl { left: 6px; bottom: 6px; } .sx-q-br { right: 6px; bottom: 6px; }
.sx-compass.is-small { padding: 0; }
.sx-compass.is-small .sx-compass-grid { gap: 1.5px; }
.sx-compass.is-small .sx-cell { border-radius: 2px; }
.sx-compass.is-small .sx-compass-grid::before, .sx-compass.is-small .sx-compass-grid::after { display: none; }
.sx-heat-legend { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-muted); }
.sx-heat-ramp { display: flex; gap: 2px; }
.sx-heat-ramp span { width: 16px; height: 10px; border-radius: 2px; }
.sx-heat-ramp [data-h="1"] { background: var(--heat-1); } .sx-heat-ramp [data-h="2"] { background: var(--heat-2); }
.sx-heat-ramp [data-h="3"] { background: var(--heat-3); } .sx-heat-ramp [data-h="4"] { background: var(--heat-4); }
.sx-heat-ramp [data-h="5"] { background: var(--heat-5); } .sx-heat-ramp [data-h="6"] { background: var(--heat-6); }
.sx-heat-ramp [data-h="7"] { background: var(--heat-7); }

/* Compass explorer */
.sx-explorer { padding: 22px; border-radius: 22px; background: var(--sx-surface); border: 1px solid var(--border-soft); box-shadow: var(--sx-shadow); }
.sx-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.sx-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--sx-surface);
  font: inherit; font-size: 13px; color: var(--ink-soft); cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s; }
.sx-chip img { width: 18px; height: 12px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); }
.sx-chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.sx-chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--parchment); }
.sx-chip:focus-visible { outline: 2px solid var(--c1); outline-offset: 2px; }
.sx-explorer-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.sx-explorer-panel { display: flex; flex-direction: column; gap: 16px; padding: 24px; border-radius: 16px; background: var(--parchment-warm); }
.sx-panel-kicker { font-size: 11px; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase; color: var(--ink-faint); margin-bottom: -12px; }
.sx-panel-title { font-family: 'Cormorant Garamond', serif; font-size: 34px; font-weight: 600; line-height: 1.1; color: var(--ink); }
.sx-panel-n { font-size: 14px; color: var(--ink-muted); margin-top: -10px; }
.sx-panel-n b { color: var(--ink); font-weight: 600; }
.sx-panel-link { font-size: 14px; font-weight: 500; color: var(--c1); text-decoration: none; }
.sx-panel-link::after { content: " \2192"; }
.sx-split { display: grid; gap: 7px; }
.sx-split-label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.sx-split-bar { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; }
.sx-split-seg { height: 100%; transition: flex-basis 0.5s ease; outline: none; }
.sx-split-keys { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-muted); }
.sx-split-keys i, .sx-div-keys i, .sx-gd-keys i, .sx-donut-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.sx-split-keys b { color: var(--ink); font-weight: 600; }

/* Donut */
.sx-donut-wrap { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.sx-donut { position: relative; width: 168px; height: 168px; border-radius: 50%; flex: none; }
.sx-donut-hole { position: absolute; inset: 24px; border-radius: 50%; background: var(--sx-surface); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.sx-donut-hole b { font-size: 26px; font-weight: 600; color: var(--ink); letter-spacing: -0.5px; }
.sx-donut-hole small { font-size: 11px; color: var(--ink-muted); max-width: 90px; line-height: 1.3; }
.sx-donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; min-width: 160px; }
.sx-donut-legend li { display: flex; align-items: center; gap: 4px; font-size: 13.5px; color: var(--ink-soft); padding: 3px 6px; border-radius: 6px; outline: none; }
.sx-donut-legend li:hover, .sx-donut-legend li:focus-visible { background: var(--parchment-warm); }
.sx-donut-legend li span { flex: 1; }
.sx-donut-legend li b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.sx-anim .sx-donut { transform: rotate(-90deg) scale(0.6); opacity: 0; transition: transform 0.9s cubic-bezier(.2,.8,.2,1), opacity 0.6s; }
.sx-anim .is-in .sx-donut { transform: none; opacity: 1; }

/* Waffle */
.sx-waffle { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; width: 200px; max-width: 100%; flex: none; }
.sx-waffle i { aspect-ratio: 1; border-radius: 3px; }
.sx-waffle i:not([class]) { background: var(--c0); opacity: 0.55; }
.sx-waffle i[class] { opacity: 1; }
.sx-anim .sx-waffle i[class] { transform: scale(0); transition: transform 0.35s cubic-bezier(.2,.9,.3,1.3); transition-delay: calc(var(--d) * 9ms); }
.sx-anim .is-in .sx-waffle i[class] { transform: none; }
.sx-waffle-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.sx-waffle-big { font-size: 56px; font-weight: 600; letter-spacing: -2px; line-height: 1; color: var(--tone); }
.sx-waffle-text { font-size: 14px; color: var(--ink-soft); max-width: 220px; line-height: 1.5; margin-top: 6px; }

/* Clock */
.sx-clock { max-width: 320px; margin: 0 auto; }
.sx-clock svg { width: 100%; height: auto; overflow: visible; }
.sx-clock path { outline: none; transition: opacity 0.15s; }
.sx-clock svg:hover path { opacity: 0.55; }
.sx-clock svg path:hover, .sx-clock path:focus-visible { opacity: 1; }
.sx-clock-ring { fill: none; stroke: var(--border-soft); stroke-width: 1; }
.sx-clock text { font-size: 11px; fill: var(--ink-faint); text-anchor: middle; font-family: inherit; }
.sx-clock .sx-clock-big { font-size: 24px; font-weight: 600; fill: var(--ink); }
.sx-clock .sx-clock-small { font-size: 11px; fill: var(--ink-muted); }
.sx-clock-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 12px; color: var(--ink-muted); margin-top: 8px; }
.sx-clock-keys i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.sx-anim .sx-clock path { transform-origin: 150px 150px; transform: scale(0.4); opacity: 0; transition: transform 0.8s cubic-bezier(.2,.8,.2,1), opacity 0.5s; }
.sx-anim .is-in .sx-clock path { transform: none; opacity: 1; }

/* Growth */
.sx-growth { position: relative; }
.sx-growth-plot { position: relative; height: 240px; }
.sx-growth-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sx-growth-area { fill: url(#sxg); }
.sx-growth-line { fill: none; stroke: var(--c1); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.sx-growth-weeks { position: absolute; inset: 0; }
.sx-growth-wk { position: absolute; bottom: 0; width: 10px; margin-left: -5px; border-radius: 4px 4px 0 0; background: var(--c3); opacity: 0.85; }
.sx-growth-dot { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--sx-surface); box-shadow: inset 0 0 0 2px var(--c1); outline: none; cursor: pointer; z-index: 1; }
.sx-growth-dot::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; }
.sx-growth-dot:hover, .sx-growth-dot:focus-visible { background: var(--c1); transform: scale(1.3); }
.sx-growth-x { position: relative; height: 22px; margin-top: 6px; border-top: 1px solid var(--border-soft); }
.sx-growth-x span { position: absolute; top: 5px; font-size: 11.5px; color: var(--ink-faint); }
.sx-growth-keys { display: flex; gap: 16px; font-size: 12px; color: var(--ink-muted); margin-top: 8px; }
.sx-growth-keys i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.sx-growth-ann { position: absolute; transform: translate(-108%, -50%); padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--parchment); font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 2; }
.sx-anim .sx-growth-plot svg { clip-path: inset(0 100% 0 0); transition: clip-path 1.6s cubic-bezier(.4,.1,.2,1); }
.sx-anim .is-in .sx-growth-plot svg { clip-path: inset(0 0 0 0); }
.sx-anim .sx-growth-wk { transform: scaleY(0); transform-origin: bottom; transition: transform 0.7s ease 0.6s; }
.sx-anim .is-in .sx-growth-wk { transform: none; }

/* Bars */
.sx-bars { display: grid; gap: 10px; }
.sx-bar-row { display: grid; grid-template-columns: minmax(110px, 30%) 1fr 64px; gap: 12px; align-items: center; border-radius: 8px; outline: none; }
.sx-bar-row[data-tip]:hover, .sx-bar-row[data-tip]:focus-visible { background: var(--parchment-warm); }
.sx-bar-label { font-size: 13.5px; color: var(--ink-soft); text-align: right; line-height: 1.25; }
.sx-bar-label small { display: block; font-size: 11.5px; color: var(--ink-faint); }
.sx-bar-track { height: 16px; border-radius: 8px; background: var(--parchment-warm); overflow: hidden; }
.sx-bar-fill { display: block; height: 100%; width: var(--w); border-radius: 8px; transition: width 0.9s cubic-bezier(.2,.8,.2,1); }
.sx-anim .sx-card:not(.is-in) .sx-bar-fill, .sx-anim .sx-section:not(.is-in) .sx-bar-fill { width: 0; }
.sx-bar-val { font-size: 13px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Columns */
.sx-cols { display: flex; align-items: stretch; gap: 6px; height: 230px; }
.sx-col { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-radius: 8px; outline: none; padding-bottom: 22px; }
.sx-col[data-tip]:hover, .sx-col[data-tip]:focus-visible { background: var(--parchment-warm); }
.sx-col-bar { display: block; width: min(34px, 78%); height: var(--h); border-radius: 7px 7px 3px 3px; transition: height 0.9s cubic-bezier(.2,.8,.2,1); transition-delay: calc(var(--i) * 40ms); }
.sx-anim .sx-card:not(.is-in) .sx-col-bar, .sx-anim .sx-section:not(.is-in) .sx-col-bar { height: 0; }
.sx-ramp { background: linear-gradient(180deg, var(--c5), var(--c1)); }
.sx-col:nth-child(1) .sx-ramp { background: linear-gradient(180deg, var(--c2), var(--c2)); }
.sx-col:nth-child(2) .sx-ramp { background: linear-gradient(180deg, var(--c2), var(--c1)); }
.sx-col:nth-child(3) .sx-ramp { background: linear-gradient(180deg, var(--c1), var(--c1)); }
.sx-col:nth-child(4) .sx-ramp { background: linear-gradient(180deg, var(--c5), var(--c1)); }
.sx-col:nth-child(5) .sx-ramp, .sx-col:nth-child(6) .sx-ramp { background: var(--c5); }
.sx-col:nth-child(n+7) .sx-ramp { background: linear-gradient(180deg, var(--c6), var(--c5)); }
.sx-col-top { font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 4px; min-height: 15px; }
.sx-col-label { position: absolute; bottom: 0; font-size: 11.5px; color: var(--ink-muted); white-space: nowrap; }

/* Diverging */
.sx-div { display: grid; gap: 6px; }
.sx-div-headrow:hover { background: none; }
.sx-div-halves { margin: 0 44px; display: grid; grid-template-columns: 1fr 1fr; font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-faint); }
.sx-div-halves span:first-child { text-align: right; padding-right: 10px; }
.sx-div-halves span:last-child { padding-left: 10px; }
.sx-div-row { display: grid; grid-template-columns: minmax(130px, 30%) 1fr; gap: 12px; align-items: center; border-radius: 8px; outline: none; }
.sx-div-row:hover, .sx-div-row:focus-visible { background: var(--parchment-warm); }
.sx-div-label { font-size: 13.5px; color: var(--ink-soft); text-align: right; line-height: 1.2; }
.sx-div-label small { display: block; font-size: 10.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.8px; }
.sx-div-track { position: relative; height: 30px; margin: 0 44px; background: linear-gradient(var(--border), var(--border)) 50% 0 / 1px 100% no-repeat; }
.sx-div-bar { position: absolute; top: 7px; height: 16px; width: var(--w); border-radius: 6px; transition: width 0.8s cubic-bezier(.2,.8,.2,1); }
.sx-anim .sx-card:not(.is-in) .sx-div-bar { width: 0; }
.sx-div-val { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.sx-div-keys, .sx-gd-keys { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12px; color: var(--ink-muted); }

/* Gender dots */
.sx-gd { display: grid; gap: 14px; }
.sx-gd-keys { margin: 0 0 4px; }
.sx-gd-row { display: grid; grid-template-columns: minmax(120px, 30%) 1fr; gap: 14px; align-items: center; }
.sx-gd-label { font-size: 13.5px; color: var(--ink-soft); text-align: right; }
.sx-gd-label small { display: block; font-size: 11px; color: var(--ink-faint); }
.sx-gd-track { position: relative; height: 28px; border-radius: 14px; background: linear-gradient(90deg, var(--c2-soft), var(--parchment-warm) 50%, var(--c3-soft)); }
.sx-gd-mid { position: absolute; left: 50%; top: 4px; bottom: 4px; width: 1px; background: var(--border); }
.sx-gd-link { position: absolute; top: 50%; height: 3px; transform: translateY(-50%); background: var(--ink-faint); opacity: 0.5; }
.sx-gd-dot { position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 3px var(--sx-surface); outline: none; }

/* Finding cards (feed) */
.sx-feed { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.sx-find { display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; background: var(--sx-surface); border: 1px solid var(--border-soft); color: inherit; text-decoration: none; transition: transform 0.2s, box-shadow 0.2s; }
.sx-find:hover { transform: translateY(-3px); box-shadow: var(--sx-shadow); }
.sx-find:focus-visible { outline: 2px solid var(--c1); outline-offset: 3px; }
.sx-find-img { position: relative; aspect-ratio: 16 / 9; background: var(--tone-soft); overflow: hidden; }
.sx-find-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.sx-find:hover .sx-find-img img { transform: scale(1.04); }
.sx-find-img .sc-thumb { position: absolute; inset: auto 18px 16px; width: auto; height: 60%; }
.sx-find-img .sc-thumb-col { background: color-mix(in srgb, var(--tone) 30%, transparent); }
.sx-find-img .sc-thumb-col.is-hl { background: var(--tone); }
.sx-find-stat { position: absolute; left: 14px; bottom: 14px; padding: 6px 11px; border-radius: 999px; background: var(--sx-surface); box-shadow: var(--sx-shadow); font-size: 13px; font-weight: 600; color: var(--tone); }
.sx-find-body { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 20px; flex: 1; }
.sx-find-title { font-family: 'Cormorant Garamond', serif; font-size: 23px; font-weight: 600; line-height: 1.18; color: var(--ink); }
.sx-find-text { font-size: 13.5px; color: var(--ink-muted); line-height: 1.5; }
.sx-find-date { margin-top: auto; font-size: 12px; color: var(--ink-faint); }
.sx-feed .sx-find:first-child { grid-column: span 2; flex-direction: row; }
.sx-feed .sx-find:first-child .sx-find-img { aspect-ratio: auto; flex: 1.2; min-height: 260px; }
.sx-feed .sx-find:first-child .sx-find-body { flex: 1; justify-content: center; padding: 28px; }
.sx-feed .sx-find:first-child .sx-find-title { font-size: 30px; }

/* Country cards */
.sx-countries { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.sx-country { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; background: var(--sx-surface); border: 1px solid var(--border-soft); color: inherit; text-decoration: none; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; }
.sx-country:hover { transform: translateY(-3px); box-shadow: var(--sx-shadow); border-color: var(--border); }
.sx-country:focus-visible { outline: 2px solid var(--c1); outline-offset: 3px; }
.sx-country-top { display: flex; align-items: center; gap: 10px; }
.sx-country-top img { width: 30px; height: 20px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); }
.sx-country-name { font-weight: 600; font-size: 15px; color: var(--ink); line-height: 1.2; }
.sx-country-n { font-size: 12px; color: var(--ink-muted); }
.sx-country .sx-compass { width: 100%; }
.sx-country-lean { display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 2px; }

/* Country page extras */
.sx-flag-hero { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 16px; overflow: hidden; background: var(--sx-surface); box-shadow: var(--sx-shadow); }
.sx-flag-hero::before { content: ""; position: absolute; inset: -30px; background: var(--flag) center / cover; filter: blur(28px) saturate(1.3); opacity: 0.45; }
.sx-flag-hero img { position: relative; width: 62%; height: auto; border-radius: 8px; box-shadow: 0 14px 40px rgba(0,0,0,0.22); }
.sx-callout { display: flex; gap: 14px; padding: 18px 20px; border-radius: 14px; background: var(--tone-soft); color: var(--ink-soft); font-size: 14.5px; line-height: 1.6; }
.sx-callout strong { color: var(--ink); font-weight: 600; }
.sx-prose { font-size: 16.5px; line-height: 1.75; font-weight: 300; color: var(--ink-soft); max-width: 720px; }
.sx-prose p { margin: 0 0 16px; }
.sx-prose strong { color: var(--ink); font-weight: 500; }
.sx-prose a { color: var(--c1); }
.sx-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--parchment-warm); margin-bottom: 14px; }
.sx-tab { padding: 6px 14px; border-radius: 999px; border: 0; background: none; font: inherit; font-size: 13px; color: var(--ink-muted); cursor: pointer; }
.sx-tab.is-on { background: var(--sx-surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.sx-party-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.sx-stat-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.sx-stat-line b { font-size: 44px; font-weight: 600; letter-spacing: -1.4px; color: var(--tone); line-height: 1; }
.sx-stat-line span { font-size: 14px; color: var(--ink-muted); max-width: 300px; line-height: 1.45; }

/* Legacy article charts, recoloured */
.sx-page .sc { border-radius: 18px; box-shadow: var(--sx-shadow); position: relative; overflow: hidden; padding: 24px 24px 18px; }
.sx-page .sc::before { content: ""; position: absolute; left: 24px; top: 0; width: 44px; height: 3px; border-radius: 0 0 3px 3px; background: var(--chart-a); }
.sx-page .sc-title { font-weight: 600; }
.sx-page .sc-bar, .sx-page .sc-colbar { background-image: linear-gradient(90deg, transparent, rgba(255,255,255,0.18)); }
.sx-page .sc-tiles .sc-tile { border-radius: 16px; position: relative; overflow: hidden; }
.sx-page .sc-tile::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; }
.sx-page .sc-tile:nth-child(4n+1)::after { background: var(--c1); } .sx-page .sc-tile:nth-child(4n+2)::after { background: var(--c2); }
.sx-page .sc-tile:nth-child(4n+3)::after { background: var(--c3); } .sx-page .sc-tile:nth-child(4n+4)::after { background: var(--c5); }
.sx-page .stats-body { max-width: 760px; margin: 0 auto; }
.sx-page .stats-body h2 { font-size: 32px; }
.sx-page .stats-more { max-width: 1120px; }
.sx-page .stats-partner-card, .sx-page .stats-method-card { max-width: 760px; margin-left: auto !important; margin-right: auto !important; border-radius: 18px !important; }
.sx-theme-teal { --chart-a: var(--c2); --chart-b: var(--c3); }
.sx-theme-violet { --chart-a: var(--c5); --chart-b: var(--c2); }
.sx-theme-coral { --chart-a: var(--c4); --chart-b: var(--c1); }
.sx-theme-pink { --chart-a: var(--c6); --chart-b: var(--c1); }
.sx-theme-indigo { --chart-a: var(--c1); --chart-b: var(--c3); }
.sx-theme-amber { --chart-a: var(--c3); --chart-b: var(--c5); }
.sx-answer { position: relative; overflow: hidden; background: var(--sx-surface); border-radius: 18px; box-shadow: var(--sx-shadow); padding: 24px 26px 8px; margin: 6px 0 34px; }
.sx-answer::before { content: ""; position: absolute; left: 26px; top: 0; width: 44px; height: 3px; border-radius: 0 0 3px 3px; background: var(--chart-a, var(--c1)); }
.sx-answer-kicker { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 6px; }
.sx-page .stats-body .sx-answer h2 { font-size: 26px; margin: 0 0 10px; }
.sx-answer p { color: var(--ink); }
.sx-faq h3 { font-size: 18px; font-weight: 600; color: var(--ink); margin: 26px 0 6px; line-height: 1.35; }
.sx-faq p { margin-bottom: 10px; }
.sx-inline-img { margin: 34px auto; max-width: 760px; }
.sx-inline-img img { width: 100%; height: auto; border-radius: 18px; display: block; }
.sx-inline-img figcaption { font-size: 12.5px; color: var(--ink-faint); margin-top: 8px; text-align: center; }

/* Reveal */
.sx-anim .sx-reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s ease, transform 0.7s ease; }
.sx-anim .sx-reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .sx-anim * { transition: none !important; }
}

@media (max-width: 960px) {
  .sx-hero { grid-template-columns: 1fr; padding: 30px 26px; gap: 26px; }
  .sx-hero-art { min-height: 240px; }
  .sx-float-1 { left: 10px; }
  .sx-float-2 { right: 10px; }
  .sx-feed { grid-template-columns: 1fr 1fr; }
  .sx-feed .sx-find:first-child { grid-column: 1 / -1; }
  .sx-explorer-body { grid-template-columns: 1fr; }
  .sx-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .sx-page { padding: 18px 16px 64px; }
  .sx-hero { padding: 24px 18px; border-radius: 18px; }
  .sx-hero h1 { font-size: 36px; letter-spacing: -0.8px; }
  .sx-answer { padding: 20px 18px 6px; border-radius: 16px; }
  .sx-answer::before { left: 18px; }
  .sx-page .stats-body .sx-answer h2 { font-size: 22px; }
  .sx-page .stats-body h2 { font-size: 26px; }
  .sx-dek { font-size: 16px; }
  .sx-float { font-size: 10.5px; padding: 8px 10px; }
  .sx-float b { font-size: 16px; }
  .sx-float-3 { display: none; }
  .sx-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .sx-kpi { padding: 16px 14px 14px; }
  .sx-kpi-value { font-size: 27px; }
  .sx-grid-2, .sx-grid-3 { grid-template-columns: 1fr; }
  .sx-feed { grid-template-columns: 1fr; }
  .sx-feed .sx-find:first-child { flex-direction: column; }
  .sx-feed .sx-find:first-child .sx-find-img { min-height: 0; aspect-ratio: 16 / 9; flex: none; }
  .sx-feed .sx-find:first-child .sx-find-body { padding: 18px 20px 20px; }
  .sx-feed .sx-find:first-child .sx-find-title { font-size: 25px; }
  .sx-section-head h2 { font-size: 29px; }
  .sx-card { padding: 20px 16px 16px; }
  .sx-explorer { padding: 14px; }
  .sx-compass { padding: 18px 18px; }
  .sx-q { font-size: 9px; padding: 1px 4px; }
  .sx-bar-row { grid-template-columns: minmax(80px, 30%) 1fr 52px; gap: 8px; }
  .sx-bar-label { font-size: 12.5px; }
  .sx-div-row { grid-template-columns: 1fr; gap: 2px; padding: 4px 0; }
  .sx-div-headrow > span:first-child { display: none; }
  .sx-div-label { text-align: left; display: flex; gap: 8px; align-items: baseline; }
  .sx-div-label small { display: inline; }
  .sx-div-track, .sx-div-halves { margin: 0 40px; }
  .sx-div-halves { font-size: 9.5px; letter-spacing: 0.5px; }
  .sx-div-label { font-size: 12.5px; }
  .sx-gd-row { grid-template-columns: 1fr; gap: 6px; }
  .sx-gd-label { text-align: left; }
  .sx-cols { height: 200px; gap: 3px; }
  .sx-col-label { font-size: 10px; }
  .sx-countries { grid-template-columns: 1fr 1fr; gap: 10px; }
  .sx-chip { padding: 6px 10px; font-size: 12.5px; }
}

/* Plain data table */
.sx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sx-table th, .sx-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); text-align: left; white-space: nowrap; }
.sx-table thead th { font-size: 12px; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.6px; }
.sx-table tbody th a { color: var(--ink); font-weight: 500; text-decoration: none; }
.sx-table tbody th a:hover { color: var(--c1); }
.sx-table tbody tr:hover { background: var(--parchment-warm); }
.sx-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Third series for stacked splits (biggest test, Finland, everyone else) */
.sc-c, .sc-key-c { background: var(--chart-c, var(--c4)); }
