/* ============================================================
   Your City in 2080 — Apple-style climate explorable
   ============================================================ */

:root {
  /* light theme tokens */
  --ink: #1d1c1a;
  --ink-soft: #5a5752;
  --ink-faint: #8a8680;
  --paper: #faf8f3;
  --paper-warm: #f3ede2;
  --paper-deep: #ecdfc8;
  --line: #e2dbcd;

  /* dark theme tokens */
  --dark-bg: #0d0c0a;
  --dark-bg-2: #1a1816;
  --dark-ink: #f5f1e8;
  --dark-ink-soft: #b6b1a4;
  --dark-line: #2a2724;

  /* scenario palette — consistent across themes */
  --hist: #6b6862;
  --ssp126: #2a6f97;
  --ssp245: #f08a3e;
  --ssp585: #c1272d;
  --hist-dark: #888884;

  --ssp126-soft: #b6dcef;
  --ssp245-soft: #ffd6a8;
  --ssp585-soft: #f1a48c;

  --accent: #c1272d;
  --neutral: #888884;

  --shadow: 0 2px 10px rgba(40, 30, 10, 0.06), 0 18px 50px rgba(40, 30, 10, 0.07);
  --shadow-dark: 0 2px 10px rgba(0,0,0,0.4), 0 30px 60px rgba(0,0,0,0.4);

  --serif: "Fraunces", "Georgia", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow-x: hidden; }

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  opacity: 0.85;
}
a:hover { opacity: 1; color: var(--ssp585); }

/* ============================================================
   PROGRESS BAR + CITY PILL
   ============================================================ */
.progress-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px; background: transparent; z-index: 100;
}
.progress-bar .fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--ssp126), var(--ssp245), var(--ssp585));
  transition: width 0.1s linear;
}

.city-pill {
  position: fixed; top: 18px; right: 18px;
  background: rgba(250, 248, 243, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-soft);
  z-index: 90;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-10px);
  pointer-events: none;
}
.city-pill.visible {
  opacity: 1; transform: translateY(0);
  pointer-events: auto;
}
.city-pill:hover { background: var(--paper-warm); transform: translateY(0) scale(1.02); }
.city-pill .pill-city {
  color: var(--accent); font-weight: 700;
}
.city-pill .pill-arrow {
  color: var(--ink-faint); font-size: 11px;
  transition: transform 0.2s;
}
.city-pill:hover .pill-arrow { transform: translateX(3px); }

.city-pill.dark {
  background: rgba(13, 12, 10, 0.75);
  border-color: var(--dark-line);
  color: var(--dark-ink-soft);
}

/* ============================================================
   CHAPTER SYSTEM
   ============================================================ */
.chapter {
  position: relative;
  min-height: 100vh;
  padding: 56px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: visible;
}
.chapter.scrolly {
  justify-content: flex-start;
  padding-top: 64px;
}
/* Compact chapters: text-only sections, auto-height instead of forced 100vh */
.chapter.compact {
  min-height: auto;
  padding: 80px 32px;
}
/* Tight-coupled chapters: very small bottom padding so the next chapter feels continuous */
.chapter.tight-bottom { padding-bottom: 0; }
.chapter.tight-top { padding-top: 0; }

.chapter.dark {
  background: var(--dark-bg);
  color: var(--dark-ink);
}
.chapter.dark .ink-soft { color: var(--dark-ink-soft); }
.chapter.dark a { color: var(--dark-ink-soft); }
.chapter.dark a:hover { color: var(--ssp585); }

.chapter-content {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

/* common typography */
.kicker {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: var(--ink-faint);
  font-weight: 500;
  margin-bottom: 24px;
}
.chapter.dark .kicker { color: var(--dark-ink-soft); }

h1, h2, h3 { font-family: var(--serif); }

h2.chapter-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(40px, 5.5vw, 76px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin-bottom: 24px;
  max-width: 900px;
}
h2.chapter-title em { margin: 0 0.04em; }
h2.chapter-title em { color: var(--accent); font-style: italic; }
.chapter.dark h2.chapter-title em { color: var(--ssp585); }

.chapter-deck {
  font-size: clamp(17px, 1.7vw, 21px);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 700px;
  margin-bottom: 48px;
}
.chapter.dark .chapter-deck { color: var(--dark-ink-soft); }

.scroll-cue {
  position: absolute; bottom: 40px; left: 50%;
  transform: translateX(-50%);
  font-size: 24px; color: var(--ink-faint);
  animation: bob 1.6s ease-in-out infinite;
}
.chapter.dark .scroll-cue { color: var(--dark-ink-soft); }
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ============================================================
   FADE-IN ANIMATION (used via JS or scrollama)
   ============================================================ */
.fade-in {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1),
              transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.fade-in.in-view { opacity: 1; transform: translateY(0); }

/* ============================================================
   CHAPTER 1: HERO
   ============================================================ */
.hero {
  background: var(--paper);
  padding-top: 0;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(60px, 11vw, 168px);
  line-height: 0.92;
  letter-spacing: -0.035em;
  margin: 0 0 32px 0;
}
.hero h1 .year {
  color: var(--accent);
  font-style: italic;
}
.hero .subtitle {
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 720px;
}
.hero .subtitle em {
  color: var(--ink); font-style: normal; font-weight: 600;
  background: linear-gradient(180deg, transparent 60%, var(--ssp585-soft) 60%);
  padding: 0 4px;
}

/* ============================================================
   CHAPTER 2: STAKES — sequential prose
   ============================================================ */
.stakes-lines {
  display: flex; flex-direction: column;
  gap: 32px;
  max-width: 880px;
}
.stakes-line {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--dark-ink-soft);
  opacity: 0.3;
  transition: opacity 0.6s ease, color 0.6s ease;
}
.stakes-line.active {
  opacity: 1; color: var(--dark-ink);
}
.stakes-line strong {
  color: var(--ssp585);
  font-weight: 700;
}

/* ============================================================
   SCROLLY (pinned chart + scrolling steps)
   ============================================================ */
.scrolly {
  position: relative;
}
.scrolly-container {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 60px;
  align-items: start;
  max-width: 1320px;
  margin: 0 auto;
}
.scrolly-graphic {
  position: sticky;
  top: 80px;
  height: calc(100vh - 160px);
  display: flex;
  align-items: center;
}
.scrolly-graphic > * { width: 100%; }
.scrolly-steps {
  display: flex;
  flex-direction: column;
  padding: 18vh 0 24vh 0;
  gap: 40vh;
}
.scrolly-step {
  background: rgba(250, 248, 243, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 24px 28px;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  opacity: 0.6;
  transform: scale(0.97);
  transition: all 0.4s ease;
}
.scrolly-step.active {
  opacity: 1;
  transform: scale(1);
  border-color: var(--accent);
}
.scrolly-step h3 {
  font-family: var(--sans);
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent); margin-bottom: 8px;
  font-weight: 600;
}
.scrolly-step p { color: var(--ink); }
.scrolly-step em { color: var(--accent); font-style: normal; font-weight: 600; }

/* ============================================================
   CHAPTER 2.5: SSP EXPLAINER
   ============================================================ */
.ssp-explainer-chapter .ssp-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin: 48px 0 32px 0;
}
.ssp-card {
  padding: 28px 24px;
  border-radius: 16px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-top: 4px solid var(--neutral);
  transition: transform 0.2s, box-shadow 0.2s;
}
.ssp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.ssp-card.hist { border-top-color: var(--hist); }
.ssp-card.ssp126 { border-top-color: var(--ssp126); }
.ssp-card.ssp245 { border-top-color: var(--ssp245); }
.ssp-card.ssp585 { border-top-color: var(--ssp585); }
.ssp-tag {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
.ssp-card.hist .ssp-tag { color: var(--hist); }
.ssp-card.ssp126 .ssp-tag { color: var(--ssp126); }
.ssp-card.ssp245 .ssp-tag { color: var(--ssp245); }
.ssp-card.ssp585 .ssp-tag { color: var(--ssp585); }
.ssp-card h3 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.15;
  margin-bottom: 12px;
  color: var(--ink);
}
.ssp-card p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.ssp-card strong { color: var(--ink); font-weight: 600; }
.ssp-footnote {
  font-size: 13px;
  color: var(--ink-faint);
  font-style: italic;
  max-width: 720px;
}
@media (max-width: 900px) {
  .ssp-explainer-chapter .ssp-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
  .ssp-explainer-chapter .ssp-cards { grid-template-columns: 1fr; }
}

/* ============================================================
   CHAPTER 4: PICK A CITY
   ============================================================ */
.pick-city {
  text-align: center;
}
.pick-city h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(48px, 7vw, 100px);
  line-height: 1;
  letter-spacing: -0.025em;
  margin-bottom: 48px;
}
.pick-city .picker-row {
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center; gap: 18px;
  margin-bottom: 18px;
}

/* Custom city picker — big serif button + styled menu */
.city-picker-wrapper {
  position: relative;
  display: inline-block;
}
.city-picker-button {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 700;
  background: var(--paper);
  color: var(--accent);
  border: 3px solid var(--line);
  border-radius: 14px;
  padding: 12px 56px 12px 28px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  transition: all 0.2s;
  position: relative;
  min-width: 280px;
  justify-content: space-between;
}
.city-picker-button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.city-picker-button[aria-expanded="true"] {
  border-color: var(--accent);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.city-picker-arrow {
  font-size: 0.45em;
  color: var(--accent);
  transition: transform 0.2s;
}
.city-picker-button[aria-expanded="true"] .city-picker-arrow {
  transform: rotate(180deg);
}

.city-picker-menu {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--paper);
  border: 3px solid var(--accent);
  border-top: none;
  border-radius: 0 0 14px 14px;
  max-height: 360px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  font-family: var(--sans);
  box-shadow: 0 20px 50px rgba(40, 30, 10, 0.15);
}
.city-picker-menu[aria-hidden="false"] { display: block; }

.city-picker-item {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  border-bottom: 1px solid var(--line);
}
.city-picker-item:last-child { border-bottom: none; }
.city-picker-item:hover, .city-picker-item.highlighted {
  background: var(--paper-warm);
  color: var(--accent);
}
.city-picker-item.selected {
  background: var(--accent);
  color: white;
  font-weight: 600;
}
.city-picker-item.selected:hover {
  background: #a31d22;
}
.pick-city #random-btn {
  font-family: var(--sans); font-size: 16px; font-weight: 500;
  background: transparent; color: var(--ink-soft);
  border: 2px solid var(--line); border-radius: 12px;
  padding: 14px 22px; cursor: pointer;
  transition: all 0.15s ease;
}
.pick-city #random-btn:hover {
  background: var(--accent); color: white; border-color: var(--accent);
  transform: translateY(-1px);
}
.pick-city .hint {
  color: var(--ink-faint); font-size: 14px; margin-top: 16px;
}

/* ============================================================
   CHAPTER 5: BIG NUMBERS (scrolly with panel swap)
   ============================================================ */
.big-numbers-chapter .bn-stage {
  position: relative;
  width: 100%;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.big-numbers-chapter .bn-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.55s ease, transform 0.55s ease;
  pointer-events: none;
  padding: 0 20px;
  text-align: center;
}
.big-numbers-chapter .bn-panel.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.bn-label {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: var(--dark-ink-soft);
  margin-bottom: 24px;
  text-align: center;
}
.bn-megavalue {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(120px, 18vw, 280px);
  line-height: 0.88;
  letter-spacing: -0.045em;
  color: var(--ssp585);
  margin: 0;
}
.bn-unit {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  color: var(--dark-ink-soft);
  margin-top: 24px;
}
.bn-compare {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--dark-ink-soft);
  margin-top: 18px;
}
.bn-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}
.bn-side {
  display: flex; flex-direction: column; align-items: center;
}
.bn-side .bn-label { margin-bottom: 12px; }
.bn-side .bn-megavalue { font-size: clamp(80px, 12vw, 180px); }
.bn-side:first-child .bn-megavalue { color: var(--dark-ink); }
.bn-arrow-big {
  font-family: var(--serif);
  font-size: clamp(50px, 7vw, 90px);
  font-weight: 300;
  color: var(--dark-ink-soft);
  line-height: 1;
}
.bn-multiplier {
  font-family: var(--serif);
  font-weight: 700;
  font-style: italic;
  font-size: clamp(28px, 3.5vw, 48px);
  color: var(--ssp585);
  margin-top: 36px;
}

/* calendar panel */
.bn-calendar-wrap {
  display: flex;
  flex-direction: column;
  gap: 28px;
  align-items: center;
  width: 100%;
  max-width: 700px;
}
.bn-cal-block {
  width: 100%;
  display: flex; flex-direction: column; align-items: center;
}
.bn-cal-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  color: var(--dark-ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.bn-cal-title.future { color: var(--ssp585); }
.bn-cal-title span { color: var(--dark-ink); font-weight: 700; font-style: normal; text-transform: none; }
.bn-cal-title.future span { color: var(--ssp585); }
.bn-cal {
  display: grid;
  grid-template-columns: repeat(60, 1fr);
  gap: 2px;
  width: 100%;
}
.bn-cal-day {
  aspect-ratio: 1 / 1;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  transition: background 0.5s ease;
}
.bn-cal-day.hot {
  background: var(--ssp585);
  box-shadow: 0 0 6px rgba(193, 39, 45, 0.6);
}
.bn-cal-months {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  width: 100%;
  margin-top: 8px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--dark-ink-soft);
  text-align: center;
}
.bn-cal-months {
  /* override: render 12 evenly-spaced labels */
  display: flex;
  justify-content: space-around;
}

/* threshold bars panel */
.bn-threshold-bars {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 16px;
}
.bn-thr-row {
  display: grid;
  grid-template-columns: 70px 1fr 70px;
  gap: 14px;
  align-items: center;
}
.bn-thr-label {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  color: var(--dark-ink);
  text-align: right;
}
.bn-thr-bar-wrap {
  position: relative;
  height: 26px;
  background: rgba(255,255,255,0.07);
  border-radius: 999px;
  overflow: hidden;
}
.bn-thr-bar-today {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(255,255,255,0.45);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bn-thr-bar-future {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--ssp585);
  border-radius: 999px;
  opacity: 0.92;
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bn-thr-value {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  color: var(--ssp585);
}
.bn-thr-value .small {
  display: block;
  font-size: 11px;
  font-family: var(--sans);
  color: var(--dark-ink-soft);
  margin-top: 2px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ranking panel */
.bn-ranking {
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}
.bn-rank-row {
  display: grid;
  grid-template-columns: 130px 1fr 90px;
  gap: 14px;
  align-items: center;
  font-family: var(--sans);
  font-size: 14px;
  transition: transform 0.3s, color 0.3s;
}
.bn-rank-row.you {
  font-weight: 700;
}
.bn-rank-row.you .bn-rank-city { color: var(--ssp585); }
.bn-rank-city { color: var(--dark-ink); text-align: right; font-weight: 500; }
.bn-rank-bar-wrap { height: 18px; background: rgba(255,255,255,0.07); border-radius: 999px; overflow: hidden; position: relative; }
.bn-rank-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ssp585); border-radius: 999px; transition: width 0.6s; }
.bn-rank-row.you .bn-rank-bar { background: white; }
.bn-rank-value { color: var(--ssp585); font-weight: 700; font-family: var(--serif); font-size: 16px; }
.bn-rank-row.you .bn-rank-value { color: white; }

/* inline-text dynamic spans inside scrolly steps */
.big-numbers-chapter .scrolly-step em {
  color: var(--ssp585);
  font-style: normal;
  font-weight: 700;
}
.big-numbers-chapter .scrolly-step strong { color: var(--dark-ink); font-weight: 700; }
.big-numbers-chapter .scrolly-step {
  background: rgba(13, 12, 10, 0.85);
  border-color: rgba(255,255,255,0.1);
  color: var(--dark-ink);
}
.big-numbers-chapter .scrolly-step p { color: var(--dark-ink); }
.big-numbers-chapter .scrolly-step h3 { color: var(--ssp585); }
.big-numbers-chapter .scrolly-step.active { border-color: var(--ssp585); }

/* legacy big-numbers (kept for backward compat with old structure) */
.big-numbers-chapter .chapter-content {
  text-align: center;
}
.bn-frame {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 60px; align-items: center;
  margin: 60px auto;
  max-width: 1100px;
}
.bn-block {
  text-align: center;
}
.bn-block .bn-label {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  color: var(--dark-ink-soft);
  margin-bottom: 18px;
}
.bn-block .bn-value {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(80px, 12vw, 200px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--dark-ink);
}
.bn-block.future .bn-value { color: var(--ssp585); }
.bn-block .bn-unit {
  display: block;
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 13px;
  color: var(--dark-ink-soft);
  margin-top: 16px;
}
.bn-arrow-big {
  font-family: var(--serif);
  font-size: 60px;
  color: var(--dark-ink-soft);
  font-weight: 300;
}
.bn-caption {
  font-family: var(--serif);
  font-size: clamp(20px, 2.2vw, 28px);
  font-style: italic;
  color: var(--dark-ink-soft);
  margin-top: 40px;
}
.bn-caption strong {
  color: var(--ssp585); font-style: normal; font-weight: 700;
}

/* ============================================================
   CHART CONTAINERS
   ============================================================ */
#overview-chart, #trajectory-chart, #dumbbell-chart,
#choice-chart, #warming-chart, #temp-map, #precip-map {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.chapter.dark #overview-chart,
.chapter.dark #trajectory-chart,
.chapter.dark #dumbbell-chart,
.chapter.dark #choice-chart,
.chapter.dark #warming-chart {
  background: var(--dark-bg-2);
  border-color: var(--dark-line);
  box-shadow: var(--shadow-dark);
}

.trajectory-line { fill: none; stroke-width: 2.4; }
.trajectory-line.individual { stroke-width: 0.9; opacity: 0.4; }
.trajectory-line.dimmed { opacity: 0.15; }
.trajectory-band { opacity: 0.15; transition: opacity 0.5s; }
.trajectory-band.dimmed { opacity: 0.05; }
.paris-line { stroke: var(--ink); stroke-dasharray: 4 3; stroke-width: 1; opacity: 0.55; }
.chapter.dark .paris-line { stroke: var(--dark-ink-soft); }
.axis path, .axis line { stroke: var(--line); }
.axis text { fill: var(--ink-soft); font-size: 12px; font-family: var(--sans); }
.chapter.dark .axis path, .chapter.dark .axis line { stroke: var(--dark-line); }
.chapter.dark .axis text { fill: var(--dark-ink-soft); }

.hover-line { stroke: var(--ink); stroke-dasharray: 3 3; stroke-width: 1; }
.tooltip {
  position: absolute; pointer-events: none; opacity: 0;
  background: rgba(13, 12, 10, 0.94);
  color: white;
  padding: 12px 16px; border-radius: 10px; font-size: 13px;
  font-family: var(--sans);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transition: opacity 0.15s;
  min-width: 180px;
  z-index: 200;
  backdrop-filter: blur(10px);
}
.tooltip .tooltip-year { font-weight: 700; font-size: 14px; margin-bottom: 8px;
  padding-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,0.15); }
.tooltip .tooltip-row { display: flex; justify-content: space-between; gap: 14px; margin: 2px 0; }
.tooltip .tooltip-swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: 6px; vertical-align: middle;
}

/* ============================================================
   CHAPTER 7: THE FUTURE IS A CHOICE
   ============================================================ */
.future-choice .scenario-bars {
  display: flex; gap: 24px;
  justify-content: center; align-items: flex-end;
  margin-top: 60px;
}
.future-choice .bar-card {
  flex: 1; max-width: 280px;
  text-align: center;
  padding: 32px 24px;
  border-radius: 18px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  transition: transform 0.3s, box-shadow 0.3s;
}
.future-choice .bar-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.future-choice .bar-card .scen-name {
  font-family: var(--sans);
  font-size: 14px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.future-choice .bar-card .scen-desc {
  font-size: 13px; color: var(--ink-soft);
  margin-bottom: 20px;
}
.future-choice .bar-card .scen-value {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(48px, 5.5vw, 80px);
  line-height: 1;
  letter-spacing: -0.03em;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}
.future-choice .bar-card .scen-unit {
  font-size: 0.4em;
  font-weight: 600;
  letter-spacing: 0;
}
.future-choice .bar-card.ssp126 .scen-value { color: var(--ssp126); }
.future-choice .bar-card.ssp245 .scen-value { color: var(--ssp245); }
.future-choice .bar-card.ssp585 .scen-value { color: var(--ssp585); }
.future-choice .bar-card .scen-spread {
  font-size: 12px; color: var(--ink-faint); margin-top: 12px;
}

/* ============================================================
   CHAPTER 8: CLIMATE ANALOG (dark, dramatic)
   ============================================================ */
.analog-chapter .chapter-content { text-align: center; }
.analog-chapter .analog-lead {
  font-family: var(--serif);
  font-weight: 600;
  font-style: italic;
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1.15;
  color: var(--dark-ink-soft);
  margin-bottom: 24px;
}
.analog-chapter .analog-lead .analog-source-city {
  color: var(--dark-ink); font-style: normal; font-weight: 700;
}
.analog-chapter .analog-name {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(64px, 11vw, 168px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--ssp585);
  margin: 30px auto;
  max-width: 1000px;
  padding: 0 24px;
  word-break: break-word;
  hyphens: none;
}
/* Tighter font for multi-word analog cities so they fit on a single line */
.analog-chapter .analog-name.multi-word {
  font-size: clamp(56px, 8.5vw, 132px);
  letter-spacing: -0.025em;
}
.analog-chapter .analog-temps {
  font-family: var(--serif);
  font-size: clamp(18px, 2vw, 24px);
  color: var(--dark-ink-soft);
  margin-bottom: 24px;
}
.analog-chapter .analog-temps .future { color: var(--ssp585); font-weight: 700; }
.analog-chapter .analog-temps .approx { color: var(--dark-ink-soft); margin: 0 16px; }
.analog-chapter .analog-explain {
  max-width: 620px; margin: 0 auto;
  font-size: 14px; color: var(--dark-ink-soft);
  line-height: 1.55;
}

/* ============================================================
   DUMBBELL
   ============================================================ */
.dumbbell-line { stroke: var(--ssp585-soft); stroke-width: 2.5; }
.dumbbell-line.active { stroke: var(--ssp585); stroke-width: 3.5; }
.dumbbell-today { fill: var(--neutral); stroke: white; stroke-width: 1.5; }
.dumbbell-future { fill: var(--ssp585); stroke: white; stroke-width: 1.5; }
.dumbbell-row.active .city-label { font-weight: 700; fill: var(--ssp585); }
.city-label { font-size: 12px; fill: var(--ink); font-family: var(--sans); }
.dumbbell-value { font-size: 11px; font-family: var(--sans); font-weight: 600; }

/* ============================================================
   MAPS
   ============================================================ */
.map-controls-row {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
  margin: 16px 0 24px 0;
}
.map-var-toggle {
  display: inline-flex;
  background: var(--paper-warm);
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 4px;
  flex-shrink: 0;
}
.map-var-btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.15s;
}
.map-var-btn.active {
  background: var(--ssp585);
  color: white;
  box-shadow: 0 1px 4px rgba(193, 39, 45, 0.3);
}
.map-var-btn:not(.active):hover { background: var(--paper); color: var(--ink); }

.map-slider-wrapper {
  flex: 1;
  min-width: 280px;
  max-width: 540px;
  margin: 0;
}
.map-slider-readout {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 12px;
}
.slider-scen-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--accent);
  transition: color 0.3s;
  min-width: 140px;
  display: inline-block;
}
.slider-scen-sub {
  font-size: 14px; color: var(--ink-soft);
  font-style: italic;
}
.map-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(90deg,
    var(--ssp126) 0%, var(--ssp126) 33%,
    var(--ssp245) 50%, var(--ssp245) 50%,
    var(--ssp585) 67%, var(--ssp585) 100%);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
.map-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(40, 30, 10, 0.2);
  cursor: grab;
  transition: transform 0.15s, border-color 0.3s;
}
.map-slider::-webkit-slider-thumb:hover { transform: scale(1.1); }
.map-slider::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.05); }
.map-slider::-moz-range-thumb {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(40, 30, 10, 0.2);
  cursor: grab;
}
.map-slider-ticks {
  display: flex; justify-content: space-between;
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-faint);
  font-weight: 500;
}
.map-slider-ticks span {
  cursor: pointer;
  transition: color 0.15s;
}
.map-slider-ticks span:hover { color: var(--accent); }

.map-cell { stroke: none; }
.map-coastline { fill: none; stroke: rgba(29, 28, 26, 0.65); stroke-width: 0.5; }
.map-city-marker { fill: white; stroke: var(--ink); stroke-width: 1.5; }
.map-city-label { font-size: 11px; fill: var(--ink); font-weight: 600; font-family: var(--sans); pointer-events: none; }

/* ============================================================
   ABOUT / WRITEUP
   ============================================================ */
.about-chapter .chapter-content {
  max-width: 760px;
}
.about-chapter h2 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(36px, 5vw, 64px);
  margin-bottom: 40px; letter-spacing: -0.025em;
}
.about-chapter h3 {
  font-family: var(--sans); font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent); margin: 48px 0 12px 0;
  font-weight: 600;
}
.about-chapter p {
  font-size: 17px; line-height: 1.7; color: var(--ink);
  margin-bottom: 16px;
}
.about-chapter code {
  font-family: "SF Mono", Menlo, monospace; font-size: 14px;
  background: var(--paper-warm); padding: 1px 6px; border-radius: 4px;
}
.about-chapter em { font-style: italic; color: var(--accent); }
.about-chapter strong { font-weight: 600; }

footer {
  padding: 60px 32px 80px 32px;
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-soft);
  text-align: center;
}
footer p { margin: 8px 0; }
footer .tiny { font-size: 11px; opacity: 0.8; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .scrolly-container { grid-template-columns: 1fr; gap: 30px; }
  .scrolly-graphic { position: relative; top: 0; height: auto; min-height: 60vh; }
  .scrolly-steps { padding: 30px 0; gap: 30vh; }
  .bn-frame { grid-template-columns: 1fr; gap: 30px; }
  .bn-arrow-big { transform: rotate(90deg); }
  .future-choice .scenario-bars { flex-direction: column; align-items: stretch; }
}

@media (max-width: 600px) {
  .chapter { padding: 60px 20px; }
  .pick-city #city-select { font-size: 28px; padding: 10px 20px; }
}
