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

:root {
  --bg: #212121;
  --surface:#3d3d3d;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8e4dc;
  --muted: #7a7870;
  --accent: #0084b4;
  --accent2: #4a90c4;
  --red: #c0392b;
  --font-head: "Franklin Gothic Medium", serif;
  --font-body: "Satoshi", "Satoshi Placeholder", monospace;
  --font-ui: "DM Sans", system-ui, sans-serif;
  --ease: cubic-bezier(0.65, 0, 0.35, 1);
  --slide-h: 100dvh;
}

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400;1,700&family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500&display=swap');

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
}

#app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

#header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 18px 40px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  z-index: 10;
}

#site-title {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-style: italic;
  letter-spacing: 0.01em;
  color: var(--accent);
}

#slide-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

#progress-bar-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  z-index: 100;
}

#progress-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.5s var(--ease);
}

#slide-viewport {
  position: relative;
  overflow: hidden;

}

#content {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 24px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;

  /* slide-in animation hook */
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}

#content.visible {
  opacity: 1;
  transform: translateX(0);
}

#footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 40px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}


/*  Overlay nav buttons  */
.nav-btn {
  position: absolute;
  bottom: 28px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(13, 15, 20, 0.72);
  border: 1px solid var(--border);
  padding: 16px 32px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.nav-btn svg {
  transition: transform 0.15s;
}

#prev-btn {
  right: 180px; 
  left: auto;
}

#prev-btn:hover:not(:disabled) svg {
  transform: translateX(-3px);
}

#next-btn {
  right: 28px;
}

#next-btn:hover:not(:disabled) svg {
  transform: translateX(3px);
}

#restart-btn {
  right: 28px;
  bottom: 95px;
}

.nav-btn:hover:not(:disabled) {
  background: rgba(232, 160, 69, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.nav-btn:disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}


#content h1 {
  font-family: var(--font-head);
  font-size: clamp(2rem, 4vw, 3.6rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.5em;
}

#content h2 {
  font-family: var(--font-head);
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  font-weight: 700;
  font-style: italic;
  color: var(--accent);
  margin-bottom: 0.6em;
}

#content h3 {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.2em;
}

#content p {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  line-height: 1.6;
  color: #c0bab0;
  max-width: 680px;
  margin-bottom: 1em;
}

#content .lead {
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  line-height: 1.65;
  color: #d8d2c8;
}

.intro-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  width: 100%;
}

.intro-headline-block {
  border-left: 3px solid var(--accent);
  padding-left: 30px;
}

.intro-headline {
  font-family: var(--font-head);
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.intro-headline em {
  font-style: italic;
  color: var(--accent);
}

.intro-body {
  color: #b0ac9f;
  line-height: 1.8;
  font-family: var(--font-ui);
  font-size: 1rem;
}

.intro-meta {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stat-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.stat-value {
  font-family: var(--font-head);
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;

  color: #ffffff;

  text-shadow:
    0 0 8px rgba(0,132,180,0.25),
    0 2px 8px rgba(0,0,0,0.45);

  letter-spacing: -0.03em;
}

.stat-label {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.06em;
}

/* slide 2*/
.chart-header {
  margin-bottom: 16px;
}

.chart-header h1 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  margin-bottom: 4px;
}

.chart-subhead {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--muted);
}

#chart-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}

.chart-btn {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 18px;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  transition: background 0.2s, color 0.2s;
}

.chart-btn:hover:not(:disabled) {
  background: var(--accent);
  color: var(--bg);
}

.chart-btn:disabled {
  border-color: var(--border);
  color: var(--muted);
  cursor: default;
}

.chart-btn.secondary {
  border-color: var(--border);
  color: var(--muted);
}

.chart-btn.secondary:hover:not(:disabled) {
  border-color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

#chart svg text {
  fill: var(--muted);
  font-family: var(--font-body);
  font-size: 11px;
}

#chart svg .axis path,
#chart svg .axis line {
  stroke: rgba(255, 255, 255, 0.12);
}

#chart svg .grid line {
  stroke: rgba(255, 255, 255, 0.05);
}

#chart svg .grid path {
  stroke: none;
}

#legend {
  display: flex;
  gap: 20px;
  margin-top: 8px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted);
  align-items: center;
}

.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

/* slide3 */
.slide-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
  width: 100%;
  height: 100%;
}

.text-panel h3 {
  margin-bottom: 8px;
}

.text-panel h2 {
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-style: italic;
  color: var(--text);
  margin-bottom: 16px;
  font-weight: 700;
}

.text-panel p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 24px;
}

/* Slider */
#year-slider,
#year-slider-7,
#year-slider-10 {
  -webkit-appearance: none;
  width: 100%;
  height: 2px;
  background: var(--border);
  outline: none;
  margin-bottom: 6px;
  cursor: pointer;
}

#year-slider::-webkit-slider-thumb,
#year-slider-7::-webkit-slider-thumb,
#year-slider-10::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.15s;
}

#year-slider::-webkit-slider-thumb:hover,
#year-slider-7::-webkit-slider-thumb:hover,
#year-slider-10::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

#year-slider::-moz-range-thumb,
#year-slider-7::-moz-range-thumb,
#year-slider-10::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

.year-display {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

#map {
  width: 100%;
  height: 100%;
  min-height: min(440px, 52vh);
}

#map svg {
  width: 100%;
  height: 100%;
}

#map svg path {
  transition: opacity 0.15s;
}

#map svg path:hover {
  opacity: 0.8;
}

/* Colorbar legend */
.colorbar-wrap {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--muted);
}

.colorbar {
  width: 120px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(to right, #fff5f0, #fc8d59, #d73027);
}

/* Diverging blue→white→red anomaly scale (matches anomalyColor / RdBu) */
.colorbar-anomaly {
  background: linear-gradient(to right, #2166ac, #92c5de, #f7f7f7, #f4a582, #d6604d) !important;
  min-width: 80px;
}

.d3-tooltip {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 14px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text);
  pointer-events: none;
  z-index: 999;
  display: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.d3-tooltip strong {
  display: block;
  color: var(--accent);
  margin-bottom: 2px;
}

.text-slide {
  max-width: 780px;
}

.text-slide .eyebrow {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.text-slide blockquote {
  margin: 18px 0;
  font-size: 1.2rem;
  line-height: 1.4;
}

#comparison-cards {
  margin-top: 24px;
  max-width: 260px;
}

#us-map {
  width: 100%;
  height: 100%;
  min-height: min(450px, 52vh);
}

#us-map svg {
  width: 100%;
  height: 100%;
}

/* ─── SLIDE 6 — Question slide ─────────────────────────────────────────────── */

.question-slide h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin-bottom: 0.5em;
}

.question-slide h1 em {
  font-style: italic;
  color: var(--accent);
}

.question-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 0 4px;
}

.q-pill {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 12px 18px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  animation: pillIn 0.5s var(--ease) both;
}

.q-pill:nth-child(1) {
  animation-delay: 0.1s;
}

.q-pill:nth-child(2) {
  animation-delay: 0.25s;
}

.q-pill:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pillIn {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ─── SLIDE 7 — Season toggle ───────────────────────────────────────────────── */

.season-toggle {
  display: flex;
  gap: 10px;
}

.season-btn {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 8px 18px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.season-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(142, 24, 211, 0.12);
}

.season-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

/* Diverging colorbar for slide 7 */
.colorbar-div {
  background: linear-gradient(to right, #2166ac, #abd9e9, #f7f7f7, #fdae61, #d73027) !important;
}

/* ─── SLIDE 10 — Tradeoff list ──────────────────────────────────────────────── */

.slide-layout-wide {
  grid-template-columns: 320px 1fr;
}

/* Slide 10 text panel needs to scroll and clear the nav buttons */
.slide-layout-wide .text-panel {
  overflow-y: auto;
  max-height: 100%;
  padding-bottom: 120px;
}

.tradeoff-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.tradeoff-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--muted);
  background: transparent;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
  animation: tradeoffIn 0.4s var(--ease) both;
}

.tradeoff-row:nth-child(1) {
  animation-delay: 0.05s;
}

.tradeoff-row:nth-child(2) {
  animation-delay: 0.15s;
}

.tradeoff-row:nth-child(3) {
  animation-delay: 0.25s;
}

.tradeoff-row:nth-child(4) {
  animation-delay: 0.35s;
}

.tradeoff-row.active-row {
  border-left-color: var(--accent);
  color: var(--text);
  background: rgba(142, 24, 211, 0.07);
}

.tradeoff-row strong {
  color: var(--text);
}

.tradeoff-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

@keyframes tradeoffIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── us-map containers for new slides ─────────────────────────────────────── */

#us-map-5,
#us-map-8,
#us-map-9,
#us-map-10 {
  width: 100%;
  height: 100%;
  min-height: min(420px, 50vh);
}

#us-map-5 svg,
#us-map-8 svg,
#us-map-9 svg,
#us-map-10 svg {
  width: 100%;
  height: 100%;
}

/* ─── Slider step buttons ────────────────────────────────────────────────── */

.slider-step-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.slider-step-row input[type="range"] {
  flex: 1;
  min-width: 0;
}

/* Below-slider button strip */
.slider-btn-row {
  display: flex;
  gap: 4px;
  margin-top: 10px;
  justify-content: center;
}

.step-btn {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 3px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  user-select: none;
  flex: 1;
}

.step-btn:hover {
  background: rgba(0, 132, 180, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.step-btn:active {
  background: rgba(0, 132, 180, 0.28);
  transform: scale(0.95);
}

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Allow slide 2 to fit inside viewport */
#content {
  overflow-y: auto;
}

/* Better spacing/layout for chart slide */
#chart {
  width: 100%;
  max-height: 55vh;
  overflow: hidden;
}

/* Prevent SVG from expanding outside container */
#chart svg {
  display: block;
  max-height: 100%;
}

/* Optional: tighten spacing */
.chart-header {
  margin-bottom: 10px;
}

#chart-controls {
  margin-bottom: 10px;
}

#legend {
  margin-top: 6px;
  flex-wrap: wrap;
}

#map-7 {
  width: 100%;
  height: 100%;
  min-height: min(460px, 52vh);
  padding: 12px;
}

#map-7 svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
/* ---------- Slide 6 ---------- */

.slide6-layout {
  max-width: 900px;

  margin: 0 auto;

  display: flex;
  flex-direction: column;
  justify-content: flex-start;

  height: auto;
  min-height: 100%;

  padding-top: 30px;
  padding-bottom: 120px;
}

/* #content uses justify-content:center which swallows child padding-bottom.
   Override it so slide 6 flows from the top and the bottom padding is respected. */
#content:has(.slide6-layout) {
  justify-content: flex-start;
}
.slide6-layout .lead {
  font-size: 1rem;
  line-height: 1.55;
}