/* ============================================================
   Climate Futures Explorer — presentation stylesheet
   Tech Stack: D3.js v7 + Scrollama + TopoJSON
   ============================================================ */

:root {
  --ink: #14202c;
  --muted: #647484;
  --paper: #fbfcf8;
  --panel: #ffffff;
  --line: #d9e1df;
  --ocean: #1d6b7a;
  --forest: #286052;
  --amber: #d67b2a;
  --coral: #c44f3d;
  --night: #0b1320;
  --story-card-width: 390px;
  --story-gap: clamp(1.5rem, 3vw, 3.5rem);
  --page-gutter: clamp(1rem, 4vw, 4rem);
  --shadow: 0 18px 50px rgba(20, 32, 44, 0.14);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  min-width: 320px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(3rem, 7.4vw, 5.65rem);
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.7rem);
}

p {
  color: #2d3b47;
  font-size: 1.03rem;
}

strong {
  color: #0c5d69;
  font-weight: 750;
}

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(20, 32, 44, 0.1);
  background: rgba(251, 252, 248, 0.84);
  color: var(--ink);
  backdrop-filter: blur(16px);
}

.nav-brand {
  font-size: 0.88rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 2vw, 1.4rem);
}

.nav-links a {
  color: rgba(20, 32, 44, 0.66);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.16s ease;
}

.nav-links a:hover {
  color: #8fe0d2;
}

#hero {
  position: relative;
  min-height: 86vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 18%, rgba(143, 224, 210, 0.18), transparent 32%),
    linear-gradient(180deg, #f8fbf7 0%, #eef5f2 100%);
  isolation: isolate;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(rgba(20, 32, 44, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 32, 44, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, #000 0%, #000 72%, transparent 100%);
}

.hero-content {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 6.2rem 0 4.75rem;
}

.eyebrow,
.section-kicker,
.step-kicker {
  color: var(--ocean);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-content .eyebrow {
  color: var(--ocean);
  margin-bottom: 1rem;
}

.hero-title {
  max-width: 840px;
  color: var(--ink);
  text-wrap: balance;
}

.hero-subtitle {
  max-width: 760px;
  margin-top: 1.35rem;
  color: #344552;
  font-size: clamp(1.12rem, 2vw, 1.45rem);
  line-height: 1.55;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  width: min(820px, 100%);
  margin-top: 2rem;
  overflow: hidden;
  border: 1px solid rgba(112, 132, 143, 0.24);
  border-radius: 8px;
  background: rgba(112, 132, 143, 0.22);
  box-shadow: 0 18px 48px rgba(20, 32, 44, 0.08);
}

.hero-stats div {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.76);
}

.hero-stats span {
  display: block;
  color: var(--ink);
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  font-weight: 850;
  line-height: 1;
}

.hero-stats strong {
  display: block;
  margin-top: 0.35rem;
  color: #51646d;
  font-size: 0.82rem;
  font-weight: 700;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.72rem 1rem;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 850;
}

.primary-link {
  background: #8fe0d2;
  color: #07131d;
}

.secondary-link {
  border: 1px solid rgba(112, 132, 143, 0.34);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
}

.scroll-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 2.2rem;
  color: var(--ocean);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: float-y 2.4s ease-in-out infinite;
}

.scroll-indicator svg {
  width: 20px;
  height: 20px;
}

@keyframes float-y {
  0%,
  100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

.section-shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.section-shell.compact {
  width: min(820px, calc(100% - 2rem));
  text-align: center;
}

.section-header {
  max-width: 100%;
  margin-bottom: 2.25rem;
}

.section-header h2,
.section-shell.compact h2,
.method-section h2 {
  margin-top: 0.35rem;
  text-wrap: balance;
}

.section-header h2 {
  max-width: 780px;
}

.section-header p:not(.section-kicker),
.section-shell.compact p:not(.section-kicker) {
  max-width: 100%;
  margin-top: 1rem;
  color: #3f4e59;
  font-size: 1.08rem;
  line-height: 1.8;
}

.primer-section,
.evidence-section,
.method-section {
  position: relative;
  z-index: 30;
  background: var(--paper);
}

.primer-section {
  padding: 4.75rem 0 5.5rem;
  scroll-margin-top: 4.5rem;
}

#evidence,
#interactive-intro,
#interactive-viz-section,
#method,
#takeaway {
  scroll-margin-top: 4.5rem;
}

.primer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.primer-card,
.scenario-card,
.method-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.primer-card {
  padding: 1.35rem;
}

.card-kicker,
.scenario-code {
  color: var(--ocean);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.primer-card h3,
.scenario-card h3,
.method-grid h3 {
  margin: 0.55rem 0 0.65rem;
  color: var(--ink);
  font-size: 1.18rem;
}

.primer-card p:not(.card-kicker),
.scenario-card p:not(.scenario-code),
.method-grid p {
  color: #3c4b56;
  font-size: 0.98rem;
  line-height: 1.72;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.scenario-card {
  min-height: 100%;
  padding: 1.25rem;
  border-top-width: 5px;
}

.scenario-card.low {
  border-top-color: #2f8f70;
}

.scenario-card.mid {
  border-top-color: #d29a2d;
}

.scenario-card.high {
  border-top-color: #d45b3f;
}

.scenario-card.very-high {
  border-top-color: #9c2f45;
}

.scenario-card strong {
  color: var(--ink);
}

.evidence-section {
  position: relative;
  z-index: 30;
  padding: 6rem 0;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, #f9fbf7 0%, #eef5f2 100%);
}

.evidence-header {
  margin-bottom: 2rem;
}

.evidence-stack {
  display: grid;
  gap: 1.2rem;
}

.evidence-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.42fr) minmax(0, 0.58fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
  padding: clamp(1rem, 2vw, 1.35rem);
  border: 1px solid rgba(112, 132, 143, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 50px rgba(20, 32, 44, 0.1);
}

.evidence-panel.reverse {
  grid-template-columns: minmax(0, 0.58fr) minmax(280px, 0.42fr);
}

.evidence-panel.reverse .evidence-copy {
  grid-column: 2;
}

.evidence-panel.reverse .evidence-chart {
  grid-column: 1;
  grid-row: 1;
}

.evidence-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1rem, 2vw, 1.75rem);
}

.evidence-number {
  width: max-content;
  margin-bottom: 1.2rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--ocean);
  color: var(--ocean);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.evidence-copy h3 {
  max-width: 440px;
  margin: 0.45rem 0 0.9rem;
  color: var(--ink);
  font-size: clamp(1.65rem, 3vw, 2.55rem);
  line-height: 1.05;
  text-wrap: balance;
}

.evidence-copy p:not(.step-kicker):not(.evidence-number) {
  max-width: 440px;
  color: #3f4e59;
  font-size: 1.03rem;
  line-height: 1.75;
}

.evidence-finding {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: #21313c !important;
  font-weight: 750;
}

.evidence-chart {
  aspect-ratio: 1.58;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(112, 132, 143, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 253, 248, 0.94));
}

.evidence-chart .story-chart-shell {
  padding: 0.4rem;
}

.evidence-chart .chart-title {
  font-size: 24px;
}

.evidence-chart .chart-subtitle {
  font-size: 12px;
}

main {
  position: relative;
  background:
    linear-gradient(180deg, var(--paper) 0%, #eff5f2 44%, #f8faf7 100%);
}

main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(20, 32, 44, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 32, 44, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, transparent, #000 12%, #000 86%, transparent);
}

#viz-container {
  position: sticky;
  top: 8vh;
  z-index: 10;
  width: 100%;
  height: 84vh;
  display: grid;
  grid-template-columns: var(--story-card-width) minmax(0, 1120px);
  gap: var(--story-gap);
  align-items: center;
  justify-content: center;
  padding: 0 var(--page-gutter);
}

#viz-panel {
  grid-column: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(112, 132, 143, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

#viz-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: clamp(0.75rem, 2vw, 1.5rem);
  transition: opacity 0.35s ease;
  pointer-events: none;
}

#viz-d3 {
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
}

.story-chart-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(0.35rem, 1vw, 0.75rem);
}

.story-chart-shell svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-loading,
.chart-error {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chart-title {
  fill: var(--ink);
  font-size: 26px;
  font-weight: 850;
}

.chart-subtitle {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.chart-source {
  fill: #7a8992;
  font-size: 10px;
  font-weight: 650;
}

.chart-axis path,
.chart-axis line {
  stroke: #9eb0b6;
  shape-rendering: crispEdges;
}

.chart-axis text,
.axis-label,
.legend-axis text,
.region-axis text {
  fill: #344552;
  font-size: 12px;
  font-weight: 700;
}

.region-axis text {
  font-size: 13px;
}

.axis-label {
  font-size: 13px;
  font-weight: 800;
}

.chart-grid line {
  stroke: rgba(93, 113, 122, 0.16);
  shape-rendering: crispEdges;
}

.chart-grid path {
  display: none;
}

.plot-frame {
  fill: rgba(252, 253, 248, 0.72);
  stroke: rgba(78, 102, 111, 0.24);
}

.legend-label {
  fill: #344552;
  font-size: 11px;
  font-weight: 800;
}

.legend-ramp {
  stroke: rgba(50, 65, 72, 0.22);
  stroke-width: 1px;
}

.data-mark {
  transition: opacity 0.16s ease, stroke 0.16s ease, stroke-width 0.16s ease;
}

.data-mark:hover {
  opacity: 0.86;
  stroke: #14202c;
  stroke-width: 1.5px;
}

.map-cell {
  shape-rendering: crispEdges;
}

.chart-callout line {
  stroke: rgba(20, 32, 44, 0.65);
  stroke-width: 1.5px;
}

.chart-callout text {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.chart-callout-small {
  fill: var(--muted) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
}

.scenario-line {
  filter: drop-shadow(0 2px 2px rgba(20, 32, 44, 0.16));
}

.line-endpoint {
  stroke: #ffffff;
  stroke-width: 2px;
}

.line-labels text {
  font-size: 12px;
  font-weight: 850;
}

.zero-line {
  stroke: rgba(20, 32, 44, 0.48);
  stroke-width: 1.2px;
  stroke-dasharray: 4 4;
}

.region-bar {
  rx: 4px;
}

.bar-value {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.chart-note rect {
  fill: rgba(246, 248, 244, 0.92);
  stroke: rgba(78, 102, 111, 0.22);
}

.chart-note text {
  fill: var(--forest);
  font-size: 15px;
  font-weight: 850;
}

.chart-note-small {
  fill: #61727b !important;
  font-size: 11px !important;
  font-weight: 700 !important;
}

.scatter-point circle {
  stroke: #ffffff;
  stroke-width: 2px;
  filter: drop-shadow(0 3px 5px rgba(20, 32, 44, 0.18));
}

.point-label {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 800;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.quadrant-label {
  fill: #6f7f87;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.heat-cell {
  stroke: rgba(255, 255, 255, 0.74);
  stroke-width: 1px;
}

.heat-cell-value {
  fill: rgba(20, 32, 44, 0.76);
  font-size: 10px;
  font-weight: 850;
  pointer-events: none;
}

.heatmap-x text {
  font-size: 10px;
}

#scrolly {
  position: relative;
  z-index: 20;
  margin-top: -84vh;
  pointer-events: none;
}

.step {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: min(calc(1120px + var(--story-card-width) + var(--story-gap)), calc(100% - (2 * var(--page-gutter))));
  margin: 0 auto;
  padding: 6rem 0;
  pointer-events: auto;
}

.step-card {
  width: var(--story-card-width);
  max-width: 100%;
  padding: 1.35rem;
  border: 1px solid rgba(112, 132, 143, 0.26);
  border-top: 5px solid var(--ocean);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 42px rgba(20, 32, 44, 0.15);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease, border-color 0.25s ease;
}

.step.active .step-card {
  opacity: 1;
  transform: translateY(0);
}

.step-kicker {
  margin-bottom: 0.7rem;
  color: var(--forest);
}

.step-card h2 {
  margin-bottom: 0.85rem;
  font-size: clamp(1.35rem, 2.1vw, 1.85rem);
}

.step-card p {
  margin-bottom: 0.9rem;
  color: #30404e;
  font-size: 0.98rem;
}

.step-label {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: #62707a;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

#interactive-intro {
  position: relative;
  z-index: 30;
  min-height: 72vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 1rem;
  background: #f6f8f4;
}

#interactive-intro::before,
#method::before,
#takeaway::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: min(1120px, calc(100% - 2rem));
  height: 1px;
  background: var(--line);
  transform: translateX(-50%);
}

.interactive-intro-content {
  width: min(720px, 100%);
}

.section-kicker {
  margin-bottom: 0.75rem;
}

.interactive-intro-content h2 {
  margin-bottom: 1.1rem;
}

.interactive-intro-text {
  color: #3f4e59;
  font-size: 1.1rem;
  line-height: 1.8;
}

.interactive-intro-content .scroll-indicator {
  color: var(--ocean);
}

#interactive-viz-section {
  position: relative;
  z-index: 30;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2rem);
  background:
    radial-gradient(circle at 50% 35%, rgba(46, 125, 139, 0.22), transparent 36%),
    linear-gradient(180deg, #08111d 0%, #0b1320 100%);
}

#viz-d3-centered {
  position: relative;
  width: min(1220px, 100%);
  min-height: 680px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(154, 188, 192, 0.18);
  border-radius: 8px;
  background: rgba(8, 17, 29, 0.72);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

#viz-d3-centered .choropleth-map-container {
  position: relative;
  flex: 1;
  min-height: 540px;
}

.map-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  align-items: center;
  width: 100%;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 12, 21, 0.88);
  backdrop-filter: blur(10px);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-group-slider {
  margin-left: auto;
}

.control-label {
  color: #9fb4bd;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.control-hint {
  color: #d2e5e7;
  font-size: 0.85rem;
}

.btn-group {
  display: flex;
  gap: 0.3rem;
}

.btn,
.map-reset-btn,
.map-autorotate-btn {
  min-height: 34px;
  padding: 0.4rem 0.72rem;
  border: 1px solid rgba(190, 217, 221, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #dce9ea;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 750;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.btn:hover,
.map-reset-btn:hover,
.map-autorotate-btn:hover {
  border-color: rgba(143, 224, 210, 0.7);
  background: rgba(143, 224, 210, 0.12);
  color: #ffffff;
}

.btn:active,
.map-reset-btn:active,
.map-autorotate-btn:active {
  transform: translateY(1px);
}

.btn.active,
.map-autorotate-btn.active {
  border-color: #8fe0d2;
  background: #8fe0d2;
  color: #07131d;
}

.decade-slider {
  width: 150px;
  height: 6px;
  border-radius: 999px;
  outline: none;
  background: rgba(255, 255, 255, 0.18);
  appearance: none;
  cursor: pointer;
}

.decade-slider::-webkit-slider-thumb {
  width: 17px;
  height: 17px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--amber);
  appearance: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.decade-slider::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.decade-label {
  min-width: 82px;
  color: #f6fbf9;
  font-size: 0.82rem;
  font-weight: 800;
}

.btn-play {
  min-width: 38px;
  padding-inline: 0.55rem;
}

.map-reset-btn,
.map-autorotate-btn {
  position: absolute;
  z-index: 4;
  top: 1rem;
}

.map-reset-btn {
  left: 1rem;
}

.map-autorotate-btn {
  left: 5.85rem;
}

.map-tooltip {
  z-index: 5;
  max-width: 230px;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(143, 224, 210, 0.28);
  border-radius: 8px;
  background: rgba(5, 12, 21, 0.92);
  color: #effafa;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.method-section {
  position: relative;
  z-index: 30;
  padding: 6rem 1rem;
  background: var(--paper);
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.method-grid article {
  padding: 1.35rem;
}

.method-grid span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #e3f2ee;
  color: var(--forest);
  font-size: 0.78rem;
  font-weight: 850;
}

#takeaway {
  position: relative;
  z-index: 30;
  min-height: 82vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 1rem;
  text-align: center;
  background:
    radial-gradient(circle at 50% 20%, rgba(143, 224, 210, 0.18), transparent 34%),
    linear-gradient(180deg, #fbfcf8 0%, #eef5f2 100%);
}

.takeaway-content {
  width: min(760px, 100%);
}

.takeaway-content h2 {
  margin-bottom: 1.2rem;
  font-size: clamp(2.1rem, 5vw, 4rem);
  text-wrap: balance;
}

.takeaway-content p {
  color: #30404e;
  font-size: 1.12rem;
  line-height: 1.8;
}

.attribution {
  margin-top: 2rem;
  color: #687984;
  font-size: 0.84rem;
}

@media (max-width: 980px) {
  :root {
    --story-card-width: min(420px, calc(100vw - 2rem));
  }

  #hero {
    min-height: auto;
  }

  .hero-content {
    padding: 6.5rem 0 5rem;
  }

  .hero-stats {
    grid-template-columns: 1fr;
    width: min(460px, 100%);
  }

  .section-header,
  .primer-grid,
  .scenario-grid,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .primer-section,
  .evidence-section,
  .method-section {
    padding-block: 4.5rem;
  }

  .evidence-panel,
  .evidence-panel.reverse {
    grid-template-columns: 1fr;
  }

  .evidence-panel.reverse .evidence-copy,
  .evidence-panel.reverse .evidence-chart {
    grid-column: auto;
    grid-row: auto;
  }

  .evidence-copy {
    padding: 1rem;
  }

  .evidence-copy h3,
  .evidence-copy p:not(.step-kicker):not(.evidence-number) {
    max-width: 100%;
  }

  .evidence-chart {
    min-height: 430px;
  }

  #viz-container {
    top: 0;
    height: 52vh;
    display: flex;
    padding: 1rem;
    background: rgba(246, 248, 244, 0.92);
  }

  #scrolly {
    margin-top: -52vh;
  }

  .step {
    width: 100%;
    justify-content: center;
    padding: 4rem 1rem;
  }

  .step-card {
    background: #ffffff;
  }

  #viz-panel {
    width: 100%;
  }

  #interactive-viz-section {
    align-items: flex-start;
  }

  #viz-d3-centered {
    min-height: 620px;
  }

  .control-group-slider {
    width: 100%;
    margin-left: 0;
  }

}

@media (max-width: 640px) {
  .site-nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.7rem 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
    gap: 0.45rem;
  }

  .nav-links a {
    font-size: 0.68rem;
  }

  h1 {
    font-size: clamp(2.6rem, 14vw, 3.8rem);
  }

  .hero-content {
    padding: 5.25rem 0 3.75rem;
  }

  .hero-content .eyebrow {
    margin-bottom: 0.75rem;
    font-size: 0.68rem;
  }

  .hero-subtitle,
  .interactive-intro-text,
  .takeaway-content p {
    font-size: 1rem;
  }

  .hero-subtitle {
    margin-top: 1rem;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    margin-top: 1.5rem;
  }

  .hero-stats div {
    padding: 0.85rem 0.55rem;
  }

  .hero-stats span {
    font-size: 1.55rem;
  }

  .hero-stats strong {
    font-size: 0.66rem;
    line-height: 1.25;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: min(320px, 100%);
    margin-top: 1.5rem;
  }

  .hero-content .scroll-indicator {
    display: none;
  }

  #viz-container {
    height: 42vh;
  }

  #scrolly {
    margin-top: -42vh;
  }

  #viz-img {
    padding: 0.5rem;
  }

  .evidence-section {
    padding: 3.5rem 0;
  }

  .evidence-stack {
    gap: 1rem;
  }

  .evidence-panel {
    padding: 0.75rem;
  }

  .evidence-copy h3 {
    font-size: clamp(1.45rem, 9vw, 2.05rem);
  }

  .evidence-chart {
    min-height: 260px;
    aspect-ratio: auto;
  }

  .evidence-chart .story-chart-shell {
    padding: 0;
  }

  .step {
    padding: 3rem 1rem;
  }

  .step-card {
    padding: 1.1rem;
  }

  .evidence-section {
    padding: 3.5rem 0;
  }

  .evidence-stack {
    gap: 1rem;
  }

  .evidence-panel {
    padding: 0.75rem;
  }

  .evidence-copy h3 {
    font-size: clamp(1.45rem, 9vw, 2.05rem);
  }

  .evidence-chart {
    min-height: 260px;
    aspect-ratio: auto;
  }

  .evidence-chart .story-chart-shell {
    padding: 0;
  }

  #interactive-intro,
  #method,
  #takeaway {
    padding: 4rem 1rem;
  }

  #interactive-viz-section {
    padding: 0.5rem;
  }

  #viz-d3-centered {
    min-height: 560px;
  }

  .map-controls {
    align-items: flex-start;
    gap: 0.75rem;
  }

  .control-group {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .btn-group {
    flex-wrap: wrap;
  }

  .decade-slider {
    width: min(100%, 220px);
  }

  .map-reset-btn,
  .map-autorotate-btn {
    top: 0.75rem;
  }
}

/* ============================================================
   SSP Tab Layout — Primer Section
   ============================================================ */

.ssp-tabs {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(20, 32, 44, 0.08);
}

.ssp-tab-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
  background: #f4f7f4;
}

.ssp-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.9rem 1.1rem;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.ssp-tab:not(:last-child) {
  border-right: 1px solid var(--line);
}

.ssp-tab:hover {
  background: rgba(255,255,255,0.7);
}

.ssp-tab.active {
  background: #ffffff;
  border-bottom-color: var(--ocean);
}

.ssp-tab[data-tab="ssp1"].active { border-bottom-color: #2f8f70; }
.ssp-tab[data-tab="ssp2"].active { border-bottom-color: #d29a2d; }
.ssp-tab[data-tab="ssp3"].active { border-bottom-color: #d45b3f; }
.ssp-tab[data-tab="ssp5"].active { border-bottom-color: #9c2f45; }

.ssp-tab-code {
  color: var(--ocean);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ssp-tab[data-tab="ssp1"] .ssp-tab-code { color: #2f8f70; }
.ssp-tab[data-tab="ssp2"] .ssp-tab-code { color: #d29a2d; }
.ssp-tab[data-tab="ssp3"] .ssp-tab-code { color: #d45b3f; }
.ssp-tab[data-tab="ssp5"] .ssp-tab-code { color: #9c2f45; }

.ssp-tab-name {
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 750;
}

/* Panels */
.ssp-tab-panels {
  position: relative;
}

.ssp-panel {
  display: none;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 1.5rem;
  padding: 1.75rem;
  border-left: 5px solid transparent;
  animation: fadeInPanel 0.28s ease;
}

.ssp-panel.active {
  display: grid;
}

.ssp-panel.low  { border-left-color: #2f8f70; }
.ssp-panel.mid  { border-left-color: #d29a2d; }
.ssp-panel.high { border-left-color: #d45b3f; }
.ssp-panel.very-high { border-left-color: #9c2f45; }

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

.ssp-panel-left {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 560px;
}

.ssp-panel-code {
  color: var(--ocean);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ssp-panel.low  .ssp-panel-code { color: #2f8f70; }
.ssp-panel.mid  .ssp-panel-code { color: #d29a2d; }
.ssp-panel.high .ssp-panel-code { color: #d45b3f; }
.ssp-panel.very-high .ssp-panel-code { color: #9c2f45; }

.ssp-panel-left h3 {
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.15;
}

.ssp-panel-left p {
  color: #3c4b56;
  font-size: 1rem;
  line-height: 1.72;
}

.ssp-panel-stats {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.1rem 1.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
  min-width: 160px;
  align-self: start;
}

.ssp-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ssp-stat-value {
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 850;
  line-height: 1;
}

.ssp-panel.low  .ssp-stat-value { color: #2f8f70; }
.ssp-panel.mid  .ssp-stat-value { color: #b87e1a; }
.ssp-panel.high .ssp-stat-value { color: #d45b3f; }
.ssp-panel.very-high .ssp-stat-value { color: #9c2f45; }

.ssp-stat-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ssp-panel-nav {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.ssp-next-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ocean);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.ssp-next-btn:hover {
  background: var(--ocean);
  color: #ffffff;
}

/* Mobile */
@media (max-width: 640px) {
  .ssp-tab-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .ssp-tab:nth-child(2) {
    border-right: none;
  }

  .ssp-tab:nth-child(1),
  .ssp-tab:nth-child(2) {
    border-bottom: 1px solid var(--line);
  }

  .ssp-panel {
    grid-template-columns: 1fr;
  }

  .ssp-panel-stats {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: unset;
  }

  .ssp-stat {
    flex: 1;
    min-width: 100px;
  }
}

/* ============================================================
   Tooltip definitions
   ============================================================ */

.tooltip-word {
  border-bottom: 1.5px dashed var(--ocean);
  color: var(--ocean);
  cursor: help;
  position: relative;
  display: inline;
}

.tooltip-word::after {
  content: attr(data-def);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(112, 132, 143, 0.28);
  border-radius: 8px;
  background: #ffffff;
  color: #2d3b47;
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 0 12px 32px rgba(20, 32, 44, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  transform: translateX(-50%) translateY(4px);
  z-index: 100;
  white-space: normal;
}

.tooltip-word:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* flip tooltip downward if word is near top of section */
.tooltip-word.flip-down::after {
  bottom: auto;
  top: calc(100% + 10px);
  transform: translateX(-50%) translateY(-4px);
}

.tooltip-word.flip-down:hover::after {
  transform: translateX(-50%) translateY(0);
}

#hero {
  background-image: 
    linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(248,251,247,1) 100%),
    url('../design_img/darker-earth-x.jpg');
  background-size: cover;
  background-position: center;
}

/* ============================================================
   Sea Level Rise Section
   ============================================================ */

.sea-level-section {
  position: relative;
  z-index: 30;
  padding: 4.75rem 0 5.5rem;
  scroll-margin-top: 4.5rem;
  background: #f6f8f4;
}

.sea-level-viz-container {
  margin-top: 2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(20, 32, 44, 0.1);
  overflow: hidden;
}

.slr-chart-wrapper {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 560px;
}

.slr-thermo-svg {
  flex: 0 0 28%;
  min-width: 160px;
  background: linear-gradient(180deg, #fefefe 0%, #f8f6f0 100%);
  border-right: 1px solid var(--line);
}

.slr-scene-svg {
  flex: 1 1 72%;
  background: linear-gradient(180deg, #e8f4f8 0%, #e0eef4 35%, #edebd8 70%, #f0ece0 100%);
}

/* Thermometer styles */
.slr-tube-bg {
  fill: #e8e4d8;
  stroke: none;
}

.slr-tube-border {
  pointer-events: none;
}

.slr-mercury-fill {
  transition: y 0.25s ease, height 0.25s ease;
}

.slr-bulb {
  filter: drop-shadow(0 2px 4px rgba(180, 40, 40, 0.35));
}

.slr-temp-label {
  pointer-events: none;
  transition: fill 0.3s ease;
}

.slr-ticks line {
  stroke: #889;
  stroke-width: 1;
}

.slr-tick-labels text {
  dominant-baseline: middle;
}

.slr-ssp-dot {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
  transition: r 0.2s ease;
}

.slr-ssp-dot:hover {
  r: 6.5;
}

/* Scene styles */
.slr-ground {
  shape-rendering: crispEdges;
}

.slr-ground-fill {
  shape-rendering: crispEdges;
}

.slr-baseline {
  shape-rendering: crispEdges;
}

.slr-water-fill {
  transition: y 0.8s cubic-bezier(0.4, 0, 0.2, 1), height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.slr-water-line {
  transition: y1 0.8s cubic-bezier(0.4, 0, 0.2, 1), y2 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.slr-value-label {
  transition: y 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.slr-ref-marks text {
  dominant-baseline: middle;
}

/* Readout panel */
.slr-readout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
  background: #fafcf8;
  text-align: center;
}

.slr-readout-temp,
.slr-readout-slr {
  font-size: 1rem;
  color: #3f4e59;
}

.slr-readout-temp strong {
  color: #c44f3d;
}

.slr-readout-slr strong {
  color: var(--ocean);
  font-size: 1.2rem;
}

.slr-readout-risk {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.slr-risk-low { background: #e3f2ee; color: #286052; }
.slr-risk-moderate { background: #fff3e0; color: #d67b2a; }
.slr-risk-high { background: #fde8e8; color: #c44f3d; }
.slr-risk-extreme { background: #fce4ec; color: #8b1a1a; }

.sea-level-attribution {
  margin-top: 1rem;
  color: #687984;
  font-size: 0.82rem;
  text-align: center;
}

/* Mobile: stack thermometer above scene */
@media (max-width: 700px) {
  .slr-chart-wrapper {
    flex-direction: column;
    min-height: auto;
  }

  .slr-thermo-svg {
    flex: 0 0 auto;
    min-width: unset;
    width: 100%;
    height: 220px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .slr-scene-svg {
    flex: 0 0 auto;
    width: 100%;
    height: 380px;
  }

  .slr-readout {
    flex-direction: column;
    gap: 0.4rem;
  }
}