:root {
  color-scheme: dark;
  --bg: #06101d;
  --bg-2: #0b1728;
  --card: rgba(14, 28, 49, 0.78);
  --card-strong: rgba(20, 39, 67, 0.92);
  --line: rgba(168, 199, 255, 0.18);
  --text: #eef6ff;
  --muted: #9fb2cc;
  --accent: #6df2c1;
  --accent-2: #8db7ff;
  --warn: #ffcf7a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --display-font: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  --body-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--body-font);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(109, 242, 193, 0.22), transparent 32rem),
    radial-gradient(circle at 80% 10%, rgba(141, 183, 255, 0.22), transparent 28rem),
    linear-gradient(145deg, #050911 0%, #07111f 46%, #0e1828 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent 75%);
}

.shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(480px, 1.1fr);
  gap: 28px;
  align-items: stretch;
  margin-bottom: 22px;
}

.hero-copy,
.counter-card,
.stats-grid article,
.chart-card,
.insights article,
.sources {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--card), rgba(8, 17, 31, 0.72));
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: clamp(28px, 5vw, 56px);
  border-radius: 34px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-family: var(--display-font);
  font-size: clamp(3.3rem, 8vw, 7.25rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.075em;
}

.lede {
  max-width: 68ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.22rem);
  line-height: 1.7;
}

.counter-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  container-type: inline-size;
  min-height: 100%;
  overflow: hidden;
  padding: 32px;
  border-radius: 34px;
  background:
    radial-gradient(circle at 20% 10%, rgba(109, 242, 193, 0.18), transparent 18rem),
    var(--card-strong);
}

.label,
.stats-grid span,
.scrubber label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.035em;
}

#liveCounter {
  display: block;
  max-width: 100%;
  margin: 18px 0 12px;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.35rem, 10.4cqw, 4.05rem);
  line-height: 0.95;
  letter-spacing: -0.065em;
  white-space: nowrap;
}

.subtle,
.stats-grid small,
.sources,
.insights p,
.fine-print {
  color: var(--muted);
  line-height: 1.6;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stats-grid article {
  min-height: 174px;
  padding: 22px;
  border-radius: 24px;
}

.stats-grid strong {
  display: block;
  margin: 14px 0 8px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: -0.055em;
}

.chart-card {
  padding: clamp(20px, 4vw, 36px);
  border-radius: 32px;
  margin-bottom: 22px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.section-head h2,
.sources h2 {
  margin: 0;
  font-family: var(--display-font);
  font-weight: 700;
  font-size: clamp(1.7rem, 3vw, 3rem);
  letter-spacing: -0.045em;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.history { background: var(--accent-2); }
.now { background: var(--accent); }
.projection { background: var(--warn); }

.chart-wrap {
  position: relative;
  height: clamp(330px, 48vw, 520px);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  background: rgba(4, 10, 19, 0.48);
}

svg {
  display: block;
  width: 100%;
  height: 100%;
}

.axis text {
  fill: #8fa3bf;
  font-size: 12px;
}

.axis .scale-note {
  fill: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.axis line,
.gridline {
  stroke: rgba(168, 199, 255, 0.15);
  stroke-width: 1;
}

.population-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 18px rgba(109, 242, 193, 0.2));
}

.population-area {
  opacity: 0.34;
}

.point {
  stroke: #06101d;
  stroke-width: 2;
}

.tooltip {
  position: absolute;
  z-index: 3;
  min-width: 160px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(4, 10, 19, 0.9);
  color: var(--text);
  box-shadow: 0 12px 36px rgba(0,0,0,0.38);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 16px));
}

.tooltip strong {
  display: block;
  font-size: 1.1rem;
}

.scrubber {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  margin-top: 22px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

output {
  min-width: 180px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.insights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.insights article {
  padding: 24px;
  border-radius: 24px;
}

.insights h3 {
  margin-bottom: 10px;
  font-size: 1.16rem;
}

.insights p {
  margin: 0;
}

.sources {
  padding: 28px;
  border-radius: 28px;
}

.sources h2 {
  margin-bottom: 14px;
}

.sources a {
  color: #c8fbe9;
}

.sources li + li {
  margin-top: 8px;
}

.fine-print {
  margin: 16px 0 0;
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .hero,
  .stats-grid,
  .insights {
    grid-template-columns: 1fr;
  }

  .section-head {
    flex-direction: column;
  }

  .scrubber {
    grid-template-columns: 1fr;
  }

  .legend {
    justify-content: flex-start;
  }

  output {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .chart-card {
    padding: 20px;
  }

  .axis text {
    font-size: 10px;
  }

  .axis .scale-note {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .counter-card,
  .stats-grid article,
  .chart-card,
  .insights article,
  .sources {
    animation: floatIn 620ms ease both;
  }

  .stats-grid article:nth-child(2) { animation-delay: 50ms; }
  .stats-grid article:nth-child(3) { animation-delay: 100ms; }
  .stats-grid article:nth-child(4) { animation-delay: 150ms; }

  @keyframes floatIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
