:root {
  --bg:        #0f0d14;
  --bg-2:      #16131e;
  --surface:   #1b1725;
  --line:      rgba(255,255,255,0.09);
  --text:      #ece8f2;
  --text-soft: #b7b1c4;
  --muted:     #877f96;
  --amber:     #f0b948;
  --blue:      #60a5fa;
  --green:     #2ee6a6;
  --pink:      #f0648b;
  --grid:      rgba(255,255,255,0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 82% -6%, rgba(240,185,72,0.09), transparent 60%),
    radial-gradient(900px 500px at 6% 3%, rgba(96,165,250,0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}
a { color: var(--amber); text-decoration-color: rgba(240,185,72,0.4); }
a:hover { text-decoration-color: var(--amber); }
strong { color: #fff; font-weight: 600; }
em { color: var(--text); font-style: italic; }

/* ---------- hero ---------- */
.hero {
  min-height: 92vh;
  display: flex;
  align-items: center;
  padding: 40px clamp(20px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  position: relative;
}
.hero-inner { max-width: 820px; margin: 0 auto; width: 100%; }
.kicker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; letter-spacing: 0.22em; color: var(--amber);
  margin-bottom: 22px;
}
.hero h1 {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: clamp(52px, 12vw, 132px);
  line-height: 0.92; letter-spacing: -0.02em;
  margin: 0 0 26px; color: #fff;
  text-wrap: balance;
}
.lede {
  font-size: clamp(17px, 2.4vw, 22px);
  color: var(--text-soft); max-width: 620px; margin: 0;
  text-wrap: pretty;
}
.scroll-hint {
  position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.2em; color: var(--muted);
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 7px); } }

/* ---------- chapters ---------- */
main { max-width: 1000px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 64px); }
.chapter { padding: clamp(64px, 12vh, 130px) 0; border-bottom: 1px solid var(--line); }
.chapter-head { max-width: 660px; margin: 0 auto 44px; }
.chapter-num {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px;
  letter-spacing: 0.2em; color: var(--amber); margin-bottom: 12px;
}
.chapter h2 {
  font-family: 'Fraunces', serif; font-weight: 600;
  font-size: clamp(30px, 5.5vw, 50px); line-height: 1.05;
  letter-spacing: -0.01em; margin: 0 0 20px; color: #fff;
  text-wrap: balance;
}
.chapter-head p { font-size: clamp(15.5px, 2vw, 18px); color: var(--text-soft); margin: 0; }

/* ---------- charts ---------- */
.chart-figure { margin: 0; }
.chart {
  background: linear-gradient(180deg, rgba(255,255,255,0.028), rgba(255,255,255,0.008));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px clamp(14px, 3vw, 28px) 18px;
}
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-caption {
  font-size: 12.5px; color: var(--muted); margin: 14px 4px 0;
  line-height: 1.5; max-width: 640px;
}
.chart-title {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  letter-spacing: 0.14em; color: var(--text-soft); text-transform: uppercase;
  margin: 0 4px 16px;
}

/* svg text */
.ax { font-family: 'IBM Plex Mono', monospace; font-size: 11px; fill: var(--muted); }
.series-label { font-family: 'Inter', sans-serif; font-weight: 600; font-size: 13px; }
.val-label { font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

/* hover tooltip */
.tt {
  position: fixed; z-index: 50; pointer-events: none; opacity: 0;
  transform: translate(-50%, -120%); transition: opacity 0.12s;
  background: #241f31; border: 1px solid rgba(255,255,255,0.14);
  border-radius: 9px; padding: 8px 11px; font-size: 12.5px; color: var(--text);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5); white-space: nowrap;
}
.tt b { color: #fff; }
.tt .tt-mono { font-family: 'IBM Plex Mono', monospace; color: var(--amber); }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line); margin-top: 0; }
.footer-inner {
  max-width: 1000px; margin: 0 auto;
  padding: clamp(56px, 10vh, 96px) clamp(20px, 5vw, 64px);
  display: grid; gap: 40px; grid-template-columns: 1.1fr 1fr;
}
.takeaway h3 {
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 26px;
  margin: 0 0 14px; color: #fff;
}
.takeaway p { color: var(--text-soft); font-size: 16px; margin: 0; }
.meta { font-size: 13px; color: var(--muted); }
.meta p { margin: 0 0 12px; line-height: 1.6; }
.meta code { font-family: 'IBM Plex Mono', monospace; color: var(--text-soft); font-size: 12px; }
.disclaimer { font-size: 12px; opacity: 0.8; }

@media (max-width: 720px) {
  .footer-inner { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-hint { animation: none; }
}
