/* ── Reset & base ───────────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f3f6fa;
  color: #172033;
}
.page {
  width: min(1400px, 95vw);
  margin: 0 auto;
  padding: 48px 0 72px;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  min-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-bottom: 0;
}
.hero[hidden] {
  display: none;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: bold;
  color: #2b6cb0;
  margin-bottom: 12px;
}
h1 {
  font-size: clamp(42px, 6vw, 84px);
  line-height: 1.02;
  margin: 0 0 16px;
  max-width: 100%;
}
.byline {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin: 16px 0 0;
}

.subtitle {
  font-size: 18px;
  line-height: 1.55;
  color: #526173;
  max-width: 100%;
}

/* ── Chapter header ──────────────────────────────────────────────────────── */
.chapter-header {
  margin-bottom: 24px;
}
.chapter-header-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}
.chapter-number {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #2b6cb0;
}
.chapter-header h2 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 700;
  color: #172033;
  line-height: 1.1;
}
.chapter-header p {
  margin: 0;
  font-size: 16px;
  color: #526173;
  line-height: 1.55;
}
.chapter-dots {
  display: flex;
  flex-direction: row;
  gap: 8px;
  flex-shrink: 0;
}
.chapter-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #dbe3ee;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.18s, transform 0.18s;
}
.chapter-dot:hover {
  background: #93b4d4;
  transform: scale(1.2);
}
.chapter-dot.active {
  background: #2b6cb0;
  transform: scale(1.25);
}

/* ── Fixed story arrows ─────────────────────────────────────────────────── */
.story-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  background: rgba(23, 32, 51, 0.82);
  color: white;
  border: none;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, opacity 0.18s;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(20, 35, 60, 0.22);
  user-select: none;
}
.story-arrow:hover:not(:disabled) {
  background: rgba(23, 32, 51, 1);
}
.story-arrow:disabled {
  opacity: 0.22;
  cursor: default;
}
.story-arrow-prev { left: 14px; }
.story-arrow-next { right: 14px; }

/* ── Tab frame (iframe wrapper) ─────────────────────────────────────────── */
.tab-frame {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(20, 35, 60, 0.12);
  border: 1px solid #dbe3ee;
  background: white;
}

/* ── Transition animations ──────────────────────────────────────────────── */
@keyframes fade-slide-in {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-entering {
  animation: fade-slide-in 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.chapter-header-entering .chapter-header-top {
  animation: fade-slide-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.chapter-header-entering h2 {
  animation: fade-slide-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}
.chapter-header-entering p {
  animation: fade-slide-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

/* ── Tab panels ─────────────────────────────────────────────────────────── */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
  animation: fade-slide-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

/* ── Shared viz card ────────────────────────────────────────────────────── */
.viz-card {
  background: white;
  border-radius: 26px;
  padding: 40px;
  box-shadow: 0 18px 48px rgba(20, 35, 60, 0.12);
  border: 1px solid #dbe3ee;
}
.viz-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  margin-bottom: 24px;
}
.viz-header h2 {
  margin: 0 0 8px;
  font-size: 28px;
}
.viz-header p {
  margin: 0;
  color: #64748b;
  line-height: 1.55;
  max-width: 780px;
}

/* ════════════════════════════════════════
   LAND SCENARIO BUTTONS (shared with Land tab)
════════════════════════════════════════ */
.gas-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.gas-btn {
  padding: 8px 22px;
  border-radius: 22px;
  border: 1.5px solid #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: #64748b;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.gas-btn:hover { background: #f1f5f9; }
.gas-btn.active-co2 { background: #dbeafe; color: #1e40af; border-color: #3b82f6; }
.gas-btn.active-ch4 { background: #fef3c7; color: #92400e; border-color: #f59e0b; }
.gas-btn.active-n2o { background: #d1fae5; color: #065f46; border-color: #10b981; }

/* ════════════════════════════════════════
   SST SECTION STYLES
════════════════════════════════════════ */
.year-box {
  min-width: 160px;
  background: #172033;
  color: white;
  border-radius: 18px;
  padding: 18px;
  text-align: center;
  flex-shrink: 0;
}
.year-box span {
  display: block;
  font-size: 11px;
  color: #cbd5e1;
  margin-bottom: 6px;
  text-transform: uppercase;
  font-weight: bold;
}
.year-box strong {
  font-size: 36px;
}
.slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: #f8fafc;
  border: 1px solid #e1e8f0;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 26px;
}
.slider-row label {
  font-weight: bold;
}
#year-slider {
  flex: 1;
  accent-color: #2b6cb0;
}

#land-year-slider {
  flex: 1;
  accent-color: #2b6cb0;
}

.viz-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: stretch;
}
#sst-chart {
  width: 100%;
  min-height: 520px;
  display: block;
  background: #fbfdff;
  border: 1px solid #e1e8f0;
  border-radius: 20px;
  padding: 10px;
  overflow: visible;
}
.insight-panel {
  background: #172033;
  color: white;
  border-radius: 20px;
  padding: 24px;
}
.insight-panel h3 {
  margin-top: 0;
  font-size: 24px;
  line-height: 1.1;
}
.insight-panel p {
  color: #d4dce8;
  line-height: 1.55;
}
.scenario-readout {
  margin-top: 20px;
  display: grid;
  gap: 12px;
}
.readout-item {
  background: rgba(255, 255, 255, 0.09);
  border-left: 5px solid white;
  border-radius: 12px;
  padding: 12px;
}
.readout-item span {
  display: block;
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 4px;
}
.readout-item strong {
  font-size: 22px;
}

/* D3 axis styles for SST chart */
.axis path,
.axis line {
  stroke: #cbd5e1;
}
.axis text {
  fill: #64748b;
  font-size: 12px;
}

/* ── Shared tooltip ─────────────────────────────────────────────────────── */
.tooltip {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  background: #172033;
  color: white;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 10px 24px rgba(20, 35, 60, 0.25);
  z-index: 10;
}


/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .viz-header {
    flex-direction: column;
  }
  .viz-layout {
    grid-template-columns: 1fr;
  }
  .ghg-layout {
    grid-template-columns: 1fr;
  }
  h1 {
    font-size: 38px;
  }
  .viz-card {
    padding: 24px;
  }

  #sst-chart {
    min-height: 400px;
  }

  .story-arrow {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
}