:root {
    --bg: #0d0d0d;
    --surface: #151515;
    --border: #2a2a2a;
    --text: #e8e2d9;
    --text-muted: #6b6459;
    --accent: #e63946;
    --accent-dim: rgba(230, 57, 70, 0.15);
    --who-blue: #4fc3f7;
    --dot-safe: #4fc3f7;
    --dot-warn: #ffb347;
    --dot-danger: #e63946;
    --dot-neutral: #5a5a5a;
    --font-display: Georgia, 'DM Serif Display', serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.7;
    overflow-x: hidden;
}

/* ─── HEADER ─── */
header {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 4rem 3rem 5rem;
    position: relative;
    border-bottom: 1px solid var(--border);
    background: 
        radial-gradient(ellipse 60% 50% at 80% 30%, rgba(230,57,70,0.06) 0%, transparent 70%),
        var(--bg);
}

header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 39px, var(--border) 39px, var(--border) 40px),
        repeating-linear-gradient(90deg, transparent, transparent 39px, var(--border) 39px, var(--border) 40px);
    opacity: 0.2;
    pointer-events: none;
}

.header-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 2rem;
}

header h1 {
    font-family: var(--font-display);
    font-size: clamp(3.5rem, 9vw, 8rem);
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 2rem;
    max-width: 14ch;
}

header h1 em {
    font-style: italic;
    color: var(--accent);
}

.header-sub {
    max-width: 42ch;
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 3rem;
}

.scroll-hint {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(4px); }
}

/* ─── SCROLLY LAYOUT ─── */
#scrolly {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* article hugs left */
}

.sticky-graphic {
    position: sticky;
    top: var(--header-h, 0px);
    width: 100%;
    height: calc(100vh - var(--header-h, 0px));
    z-index: 0;
    background: var(--bg);
    overflow: hidden;
}

#viz {
    width: 100%;
    height: 100%;
    display: block;
}

/* ─── CHART OVERLAY ─── */
.chart-overlay {
    position: absolute;
    top: 2rem;
    right: 2rem;
    text-align: right;
    z-index: 10;
    pointer-events: none;
}

.count-display {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.count-number {
    font-family: var(--font-mono);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 500;
    color: var(--text);
    line-height: 1;
    transition: color 0.4s;
    min-width: 3ch;
    text-align: right;
}

.count-unit {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.who-marker {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    color: var(--who-blue);
    opacity: 0;
    transition: opacity 0.5s;
}

.who-marker.visible { opacity: 1; }

.chart-caption {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-transform: uppercase;
    text-align: center;
    transition: opacity 0.4s;
    white-space: nowrap;
}

/* ─── ARTICLE / STEPS ─── */
article {
    position: relative;
    /* Left column: 38% wide, pinned to the left */
    padding: 0 2rem 0 3rem;
    width: 38%;
    max-width: 26rem;
    min-width: 260px;
    z-index: 1;
    pointer-events: none;
}

.step {
    margin: 0 0 80vh 0;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    background: rgba(13, 13, 13, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2rem 2rem;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-left: 3px solid var(--accent);
    pointer-events: all;
}


.step:first-child { margin-top: -60vh; }
.step:last-child { margin-bottom: 60vh; }

.step::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
}

.step > * { position: relative; z-index: 1; }

.step.is-active {
    opacity: 1;
    transform: translateY(0);
}

.step-num {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.step h2 {
    font-family: var(--font-display);
    font-size: clamp(20px, 3.5vw, 22px);
    font-weight: 400;
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
    color: var(--text);
    line-height: 1.2;
}

.step p {
    font-size: clamp(15px, 3vw, 16px);
    color: rgba(232, 226, 217, 0.75);
    line-height: 1.85;
    margin-bottom: 0.75rem;
}

.step p:last-child { margin-bottom: 0; }

.step strong {
    color: var(--text);
    font-weight: 500;
}

.dot-label {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: midle;
}

.dot-safe     { background: #4fc3f7; }
.dot-good { background: #ffb347; }
.dot-fair { background: #e8714a; }
.dot-unhealthy { background: #e63946; }

/* ─── SVG DOT STYLES ─── */
.dot {
    transition: cx 0.9s cubic-bezier(0.4, 0, 0.2, 1),
                cy 0.9s cubic-bezier(0.4, 0, 0.2, 1),
                fill 0.6s ease,
                opacity 0.5s ease,
                r 0.4s ease;
}

#dot-tooltip {
    z-index: 9999;
    position: fixed;
    pointer-events: none;
}

.month-label {
    font-family: 'DM Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.08em;
    fill: #6b6459;
    text-transform: uppercase;
}

.month-avg-label {
    font-family: 'DM Mono', monospace;
    font-size: 8px;
    fill: #e8e2d9;
    opacity: 0.7;
}

.who-line-svg {
    stroke: #4fc3f7;
    stroke-width: 1;
    stroke-dasharray: 3 4;
    opacity: 0.6;
}

.who-line-text {
    font-family: 'DM Mono', monospace;
    font-size: 7px;
    fill: #4fc3f7;
    letter-spacing: 0.1em;
    opacity: 0.8;
}

/* ─── FOOTER ─── */
footer {
    padding: 3rem;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }


@media (max-width: 768px) {

  article {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0 1.25rem;
  }

  .step {
    padding: 1.25rem ;
    margin: 0 0 70vh 0;
    font-size: 0.95rem;
  }

  .step:first-child {
    margin-top: -20;
  }

  .step:last-child {
    margin-bottom: 40vh;
  }

  .step h2 {
    font-size: 1.25rem;
  }

  .step p {
    font-size: 0.85rem;
    line-height: 1.7;
  }

  .step-num {
    font-size: 0.55rem;
  }
}