/* Statistics story (build/stats_page.py + stats.js) */
.st-page { --st-a: #a78bfa; --st-a2: rgba(167, 139, 250, 0.38); --st-rest: rgba(255, 255, 255, 0.1); --st-ink: #ece6ff; overflow-x: clip; }
.st-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 1200; height: 2px; pointer-events: none; }
.st-progress i { display: block; height: 100%; background: linear-gradient(90deg, #7a5af0, #c4b5fd); transform-origin: 0 50%; transform: scaleX(0); box-shadow: 0 0 10px rgba(167, 139, 250, 0.8); }

/* chapter rail */
.st-rail { position: fixed; z-index: 50; left: 1.4rem; top: 50%; transform: translateY(-50%); }
.st-rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; }
.st-rail a { display: flex; align-items: center; gap: 0.7rem; padding: 0.3rem 0; text-decoration: none; color: var(--faint, #6f6c80); font: 400 0.62rem/1 var(--font-mono, monospace); letter-spacing: 0.14em; text-transform: uppercase; }
.st-rail a::before { content: ''; width: 18px; height: 1px; background: currentColor; transition: width 0.35s ease, background 0.35s ease; }
.st-rail a span { opacity: 0; transform: translateX(-6px); transition: opacity 0.3s ease, transform 0.3s ease; white-space: nowrap; }
.st-rail a:hover span, .st-rail a.is-on span { opacity: 1; transform: none; }
.st-rail a.is-on { color: #fff; } .st-rail a.is-on::before { width: 34px; background: var(--st-a); box-shadow: 0 0 8px var(--st-a); }
@media (max-width: 1180px) { .st-rail { display: none; } }

/* hero */
.st-hero { position: relative; min-height: 100vh; min-height: 100svh; display: grid; place-items: center; text-align: center; padding: 8rem 1.5rem 5rem; overflow: hidden; }
.st-hero .container { position: relative; z-index: 2; max-width: 980px; }
.st-hero h1 { margin: 1rem 0 1.4rem; font-size: clamp(2.6rem, 7vw, 5.6rem); line-height: 1.02; font-weight: 300; letter-spacing: -0.03em; }
.st-hero p { max-width: 640px; margin: 0 auto; font-size: 1.12rem; line-height: 1.65; color: var(--silver, #b9b6c8); }
.st-hero-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin: 3.4rem auto 0; max-width: 980px; }
.st-kpi { padding: 1.1rem 1rem; border-radius: 16px; border: 1px solid var(--line-2, rgba(255, 255, 255, 0.1)); background: rgba(255, 255, 255, 0.02); text-align: left; text-decoration: none; color: inherit; transition: border-color 0.3s ease, transform 0.4s var(--ease-out, ease); }
.st-kpi:hover { border-color: rgba(167, 139, 250, 0.45); transform: translateY(-3px); }
.st-kpi b { display: block; font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 300; letter-spacing: -0.02em; color: #fff; }
.st-kpi span { display: block; margin-top: 0.3rem; font-size: 0.8rem; line-height: 1.4; color: var(--silver, #b9b6c8); }
.st-cue { position: absolute; left: 50%; bottom: 2rem; z-index: 2; transform: translateX(-50%); font: 400 0.62rem/1 var(--font-mono, monospace); letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint, #6f6c80); }
.st-cue::after { content: ''; display: block; width: 1px; height: 38px; margin: 0.8rem auto 0; background: linear-gradient(var(--st-a), transparent); animation: stCue 2s ease-in-out infinite; }
@keyframes stCue { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }
.st-orb { position: absolute; border-radius: 50%; filter: blur(60px); pointer-events: none; will-change: transform; }
.st-orb.o1 { width: 520px; height: 520px; left: -140px; top: 10%; background: radial-gradient(circle, rgba(124, 92, 240, 0.35), transparent 70%); }
.st-orb.o2 { width: 420px; height: 420px; right: -120px; top: 40%; background: radial-gradient(circle, rgba(80, 40, 160, 0.4), transparent 70%); }
.st-grid-bg { position: absolute; inset: -20% 0; background-image: linear-gradient(rgba(167, 139, 250, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(167, 139, 250, 0.06) 1px, transparent 1px); background-size: 64px 64px; -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%); mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%); pointer-events: none; will-change: transform; }

/* chapters */
.st-chapter { position: relative; padding: 10rem 0 2rem; overflow: hidden; }
.st-chapter .container { position: relative; z-index: 2; }
.st-chnum { position: absolute; right: 4vw; top: 2rem; z-index: 1; font: 200 clamp(9rem, 26vw, 22rem)/0.8 var(--font-sans, inherit); letter-spacing: -0.06em; color: transparent; -webkit-text-stroke: 1px rgba(167, 139, 250, 0.16); pointer-events: none; will-change: transform; user-select: none; }
.st-chapter h2 { margin: 0.8rem 0 0; max-width: 16em; font-size: clamp(2.1rem, 5vw, 3.8rem); line-height: 1.05; font-weight: 300; letter-spacing: -0.025em; }
.st-chapter p { max-width: 38em; margin: 1.2rem 0 0; color: var(--silver, #b9b6c8); font-size: 1.05rem; line-height: 1.7; }

/* scenes */
.st-scene { position: relative; min-height: 78vh; display: flex; align-items: center; padding: 4rem 0; }
.st-scene .container { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 6rem); align-items: center; }
.st-scene.flip .st-copy { order: 2; }
.st-copy, .st-viz { opacity: 0; transform: translateY(40px); transition: opacity 0.9s ease, transform 1.1s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)); }
.st-scene.is-in .st-copy, .st-scene.is-in .st-viz { opacity: 1; transform: none; }
.st-scene.is-in .st-viz { transition-delay: 0.15s; }
.st-tag { display: inline-flex; gap: 0.5rem; align-items: center; font: 400 0.64rem/1 var(--font-mono, monospace); letter-spacing: 0.16em; text-transform: uppercase; color: var(--st-a); }
.st-tag .mx, .st-tag .gl { padding: 0.25rem 0.45rem; border-radius: 4px; border: 1px solid currentColor; }
.st-tag .gl { color: #8fd3ff; }
.st-fig { display: block; margin: 0.9rem 0 0.4rem; font-size: clamp(3.2rem, 9vw, 7.2rem); line-height: 0.95; font-weight: 200; letter-spacing: -0.045em; background: linear-gradient(180deg, #fff 30%, #b9a6ff); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.st-fig small { font-size: 0.42em; letter-spacing: -0.02em; }
.st-cap { margin: 0 0 1.2rem; font-size: 1.25rem; line-height: 1.4; color: #fff; max-width: 24em; }
.st-copy p { margin: 0 0 1rem; color: var(--silver, #b9b6c8); line-height: 1.7; max-width: 34em; }
.st-src { display: inline-block; margin-top: 0.4rem; font: 400 0.68rem/1.5 var(--font-mono, monospace); letter-spacing: 0.04em; color: var(--faint, #6f6c80); text-decoration: none; border-bottom: 1px dashed rgba(255, 255, 255, 0.18); }
.st-src:hover { color: #fff; border-color: var(--st-a); }
.st-more { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 1.2rem; font-size: 0.92rem; color: var(--st-a); text-decoration: none; }
.st-more:hover { color: #fff; }

/* viz: meters */
.st-viz { display: grid; gap: 1.4rem; }
.st-meter { display: grid; gap: 0.55rem; }
.st-meter-h { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.92rem; color: var(--st-ink); }
.st-meter-h b { font-weight: 500; font-variant-numeric: tabular-nums; }
.st-track { position: relative; height: 12px; border-radius: 999px; background: var(--st-rest); overflow: hidden; }
.st-track i { position: absolute; inset: 0 auto 0 0; width: var(--v); border-radius: 999px; background: linear-gradient(90deg, #7a5af0, #c4b5fd); transform: scaleX(0); transform-origin: 0 50%; transition: transform 1.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s; box-shadow: 0 0 16px rgba(167, 139, 250, 0.5); }
.st-scene.is-in .st-track i { transform: none; }
.st-track.muted i { background: rgba(255, 255, 255, 0.35); box-shadow: none; }

/* viz: unit grid */
.st-dots { display: grid; grid-template-columns: repeat(var(--cols, 20), 1fr); gap: var(--gap, 5px); }
.st-dots i { aspect-ratio: 1; border-radius: 50%; background: var(--st-rest); opacity: 0; transform: scale(0.4); transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease; transition-delay: calc(var(--d) * 1.4s); }
.st-dots i.a { background: var(--st-a); box-shadow: 0 0 8px rgba(167, 139, 250, 0.6); }
.st-dots i.b { background: var(--st-a2); }
.st-dots i:hover { background: #fff; }
.st-scene.is-in .st-dots i { opacity: 1; transform: none; }
.st-legend { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; font-size: 0.82rem; color: var(--silver, #b9b6c8); }
.st-legend span { display: inline-flex; align-items: center; gap: 0.45rem; }
.st-legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--st-rest); }
.st-legend i.a { background: var(--st-a); } .st-legend i.b { background: var(--st-a2); }

/* viz: bar compare */
.st-bars { display: grid; gap: 1.1rem; }
.st-bar { display: grid; grid-template-columns: 9.5rem 1fr auto; gap: 0.9rem; align-items: center; font-size: 0.9rem; color: var(--st-ink); }
.st-bar .st-track { height: 26px; border-radius: 4px 6px 6px 4px; }
.st-bar .st-track i { border-radius: 0 6px 6px 0; }
.st-bar b { font-weight: 500; font-variant-numeric: tabular-nums; min-width: 5.5rem; text-align: right; }

/* viz: big quote / stat stack */
.st-stack { display: grid; gap: 1rem; }
.st-stat { padding: 1.3rem 1.4rem; border-radius: 16px; border: 1px solid var(--line-2, rgba(255, 255, 255, 0.1)); background: rgba(255, 255, 255, 0.02); }
.st-stat b { display: block; font-size: clamp(1.9rem, 3.6vw, 2.8rem); font-weight: 300; letter-spacing: -0.03em; color: #fff; font-variant-numeric: tabular-nums; }
.st-stat span { display: block; margin-top: 0.3rem; color: var(--silver, #b9b6c8); line-height: 1.5; font-size: 0.92rem; }
.st-stat a { color: var(--faint, #6f6c80); font: 400 0.66rem/1.5 var(--font-mono, monospace); text-decoration: none; }
.st-stat a:hover { color: #fff; }

/* closing: table + links */
.st-end { padding: 8rem 0 4rem; }
.st-table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line-2, rgba(255, 255, 255, 0.1)); }
.st-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.st-table th, .st-table td { padding: 0.85rem 1rem; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: top; }
.st-table th { font: 400 0.64rem/1 var(--font-mono, monospace); letter-spacing: 0.14em; text-transform: uppercase; color: var(--st-a); background: rgba(167, 139, 250, 0.06); }
.st-table td:first-child { color: #fff; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-table td { color: var(--silver, #b9b6c8); }
.st-table a { color: var(--silver, #b9b6c8); }
.st-method { margin-top: 1.4rem; max-width: 52em; color: var(--faint, #6f6c80); font-size: 0.85rem; line-height: 1.7; }
.st-tip { position: fixed; left: 0; top: 0; z-index: 2000; max-width: 260px; padding: 0.45rem 0.65rem; border-radius: 8px; background: rgba(12, 10, 20, 0.95); border: 1px solid rgba(167, 139, 250, 0.35); color: #fff; font-size: 0.78rem; pointer-events: none; opacity: 0; transition: opacity 0.15s ease; }
.st-tip.is-on { opacity: 1; }

@media (max-width: 900px) {
    .st-hero-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .st-scene { min-height: 0; padding: 3rem 0; }
    .st-scene .container { grid-template-columns: 1fr; gap: 2rem; }
    .st-scene.flip .st-copy { order: 0; }
    .st-chapter { padding-top: 6rem; }
    .st-bar { grid-template-columns: 1fr auto; } .st-bar .st-track { grid-column: 1 / -1; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) {
    .st-copy, .st-viz, .st-dots i, .st-track i { transition: none !important; opacity: 1 !important; transform: none !important; }
    .st-cue::after { animation: none; }
}
/* fixes after review: rail clear of the text, compact 10x10 grids, source and link on their own lines, KPI on one line */
.st-rail { left: 0.7rem; }
.st-rail a.is-on span { opacity: 0; transform: translateX(-6px); }
.st-rail a:hover span { opacity: 1; transform: none; background: rgba(7, 7, 10, 0.9); padding: 0.3rem 0.5rem; border-radius: 6px; }
@media (max-width: 1500px) { .st-rail { display: none; } }
.st-dots[style*="--cols:10"] { width: 100%; max-width: 360px; }
.st-viz:has(.st-dots[style*="--cols:10"]) { justify-items: start; }
.st-more { display: flex; width: fit-content; }
.st-src { margin-right: 0.8rem; }
.st-kpi b { white-space: nowrap; font-size: clamp(1.4rem, 2.4vw, 2.1rem); }

/* ---------- motion & more chart types ---------- */
/* words rise in, blurred to sharp */
.st-w { display: inline-block; opacity: 0; transform: translateY(0.55em) rotate(2deg); filter: blur(8px); transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), filter 0.8s ease; transition-delay: calc(var(--i, 0) * 45ms + 0.1s); }
.is-in .st-w { opacity: 1; transform: none; filter: none; }
.st-copy p:not(.st-cap) { opacity: 0; filter: blur(4px); transition: opacity 0.9s ease 0.5s, filter 0.9s ease 0.5s; }
.st-scene.is-in .st-copy p { opacity: 1; filter: none; }
.st-chapter p { opacity: 0; transform: translateY(18px); transition: opacity 0.9s ease 0.6s, transform 1s cubic-bezier(0.16, 1, 0.3, 1) 0.6s; }
.st-chapter.is-in p { opacity: 1; transform: none; }
.st-chnum { transition: opacity 1.2s ease, letter-spacing 1.6s cubic-bezier(0.16, 1, 0.3, 1); opacity: 0; letter-spacing: 0.1em; }
.st-chapter.is-in .st-chnum { opacity: 1; letter-spacing: -0.06em; }
/* chapter illustrations draw themselves */
.st-ill { position: absolute; right: 8vw; top: 50%; width: min(300px, 30vw); height: auto; margin-top: -120px; z-index: 1; fill: none; stroke: rgba(196, 181, 253, 0.55); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 10px rgba(124, 92, 240, 0.45)); pointer-events: none; }
.st-ill > * { stroke-dasharray: 800; stroke-dashoffset: 800; transition: stroke-dashoffset 2.4s cubic-bezier(0.65, 0, 0.35, 1); }
.st-ill > *:nth-child(2) { transition-delay: 0.2s; } .st-ill > *:nth-child(3) { transition-delay: 0.4s; } .st-ill > *:nth-child(n+4) { transition-delay: 0.6s; }
.st-chapter.is-in .st-ill > * { stroke-dashoffset: 0; }
.st-ill .sw { transform-origin: 100px 100px; animation: stSweep 4s linear infinite; }
@keyframes stSweep { to { transform: rotate(360deg); } }
@media (max-width: 900px) { .st-ill { width: 150px; right: 1rem; top: 3rem; margin: 0; opacity: 0.5; } }
/* ring meter */
.st-ring { position: relative; width: min(300px, 70vw); margin: 0 auto; }
.st-ring svg { width: 100%; transform: rotate(-90deg); }
.st-ring circle { fill: none; stroke-width: 9; }
.st-ring .trk { stroke: var(--st-rest); }
.st-ring .val { stroke: url(#none) var(--st-a); stroke: #a78bfa; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 2s cubic-bezier(0.16, 1, 0.3, 1) 0.3s; filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.7)); }
.st-scene.is-in .st-ring .val { stroke-dashoffset: calc(100 - var(--p)); }
.st-ring figcaption { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 0.3rem; padding: 0 18%; }
.st-ring figcaption b { font-size: clamp(2rem, 5vw, 3rem); font-weight: 200; color: #fff; letter-spacing: -0.03em; }
.st-ring figcaption span { font-size: 0.82rem; color: var(--silver, #b9b6c8); line-height: 1.35; }
/* split bar */
.st-split-h { font-size: 0.92rem; color: var(--st-ink); }
.st-split { display: flex; gap: 2px; height: 44px; border-radius: 6px; overflow: hidden; }
.st-split i { width: var(--w); background: var(--st-rest); transform: scaleX(0); transform-origin: 0 50%; transition: transform 1.4s cubic-bezier(0.16, 1, 0.3, 1); }
.st-split i.a { background: linear-gradient(90deg, #7a5af0, #c4b5fd); }
.st-split i:nth-child(2) { transition-delay: 0.35s; }
.st-scene.is-in .st-split i { transform: none; }
.st-legend--split b { color: #fff; font-weight: 500; margin-left: 0.2rem; }
.st-legend i.r { background: var(--st-rest); }
/* live counter */
.st-live { padding: 1.6rem 1.6rem 1.4rem; border-radius: 18px; border: 1px solid rgba(167, 139, 250, 0.3); background: radial-gradient(ellipse at 0% 0%, rgba(124, 92, 240, 0.18), transparent 60%), rgba(255, 255, 255, 0.02); }
.st-live-k { display: block; font: 400 0.66rem/1.4 var(--font-mono, monospace); letter-spacing: 0.14em; text-transform: uppercase; color: var(--st-a); }
.st-live-k::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 0.5rem; border-radius: 50%; background: #ff5c8a; box-shadow: 0 0 8px #ff5c8a; animation: skoPulseSt 1.2s ease-in-out infinite; vertical-align: 0.05em; }
@keyframes skoPulseSt { 50% { opacity: 0.3; } }
.st-live-n { display: block; margin: 0.6rem 0 0.9rem; font-size: clamp(2.6rem, 7vw, 5rem); font-weight: 200; letter-spacing: -0.04em; color: #fff; font-variant-numeric: tabular-nums; line-height: 1; }
.st-live-bar { height: 4px; border-radius: 999px; background: var(--st-rest); overflow: hidden; }
.st-live-bar i { display: block; height: 100%; background: linear-gradient(90deg, #7a5af0, #c4b5fd); transform-origin: 0 50%; transform: scaleX(0); }
.st-live small { display: block; margin-top: 0.8rem; color: var(--faint, #6f6c80); font-size: 0.76rem; line-height: 1.5; }
@media (prefers-reduced-motion: reduce) { .st-w, .st-copy p, .st-chapter p, .st-chnum { opacity: 1 !important; transform: none !important; filter: none !important; } .st-ill > * { stroke-dashoffset: 0 !important; } .st-ill .sw { animation: none; } .st-ring .val { transition: none; } .st-split i { transform: none !important; } }
.st-chnum { font-family: var(--font-display, 'Manrope', sans-serif); font-size: clamp(9rem, 26vw, 22rem); font-weight: 200; line-height: 0.8; }
@media (min-width: 901px) { .st-ill { right: auto; left: 50%; width: min(260px, 22vw); } }

/* ---------- depth: per-scene illustration far back, chart mid, copy front ---------- */
.st-scene { overflow: hidden; }
.st-scene .container { position: relative; z-index: 2; }
.st-sill { position: absolute; z-index: 0; top: 50%; right: -4vw; width: min(560px, 46vw); margin-top: calc(min(560px, 46vw) / -2); fill: none; stroke: rgba(196, 181, 253, 0.2); stroke-width: 0.9; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; will-change: translate; filter: drop-shadow(0 0 18px rgba(124, 92, 240, 0.35)); }
.st-scene.flip .st-sill { right: auto; left: -4vw; }
.st-sill > * { stroke-dasharray: 900; stroke-dashoffset: 900; transition: stroke-dashoffset 3s cubic-bezier(0.65, 0, 0.35, 1) 0.2s; }
.st-sill > *:nth-child(2) { transition-delay: 0.5s; } .st-sill > *:nth-child(n+3) { transition-delay: 0.8s; }
.st-scene.is-in .st-sill > * { stroke-dashoffset: 0; }
.st-viz, .st-copy { will-change: translate; }
/* static figures: a wipe instead of a count */
.st-fig.is-wipe { clip-path: inset(-10% 100% -10% 0); transition: clip-path 1.3s cubic-bezier(0.77, 0, 0.18, 1) 0.15s; }
.st-scene.is-in .st-fig.is-wipe { clip-path: inset(-10% -5% -10% 0); }
@media (max-width: 900px) { .st-sill { width: 70vw; margin-top: -35vw; right: -20vw; opacity: 0.7; } .st-scene.flip .st-sill { left: auto; right: -20vw; } }
@media (prefers-reduced-motion: reduce) { .st-sill > * { stroke-dashoffset: 0 !important; } .st-fig.is-wipe { clip-path: none !important; } }
.st-live, .st-stat { background-color: rgba(10, 8, 16, 0.86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
/* ring: let the glow spill past the svg box instead of being clipped at its edge */
.st-ring { padding: 24px; }
.st-ring svg { overflow: visible; }
.st-ring figcaption { inset: 24px; }
.st-ring .trk { fill: rgba(9, 7, 14, 0.92); }
