/* ============================================================
   WATER·21 — Digital Report
   Water in the Context of Global Warming in the 21st Century
   H Heuristics · Climate Intelligence
   Palette: economist paper + red, deep-slate data sections
   ============================================================ */

:root {
  --paper: #ffffff;
  --paper-warm: #f4f0e8;
  --ink: #1a1a1a;
  --ink-soft: #3d454d;
  --muted: #6b7280;
  --slate: #0f172a;
  --slate-2: #16233b;
  --slate-3: #1e2f4a;
  --line: rgba(26, 26, 26, 0.14);
  --line-light: rgba(244, 240, 232, 0.16);
  --red: #e3120b;
  --red-dark: #b30d07;
  --blue: #2563eb;
  --cyan: #38bdf8;
  --amber: #f59e0b;
  --green: #34d399;
  --violet: #a78bfa;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  --maxw: 1140px;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 22px 60px rgba(15, 23, 42, 0.16);
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  font-family: var(--sans);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper-warm);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--red); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--red-dark); }

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 200;
  background: var(--red);
  color: #fff;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { left: 0; color: #fff; }

/* ---------- Masthead ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--slate);
  color: #e8eef5;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
.masthead-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.brand-mark { color: var(--red); font-size: 0.9rem; transform: translateY(-1px); }
.brand-text { font-size: var(--text-lg); }
.brand-sub {
  font-family: var(--mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: #93a7bc;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-left: 1px solid rgba(255,255,255,0.2);
  padding-left: 0.6rem;
}
.primary-nav {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.primary-nav::-webkit-scrollbar { display: none; }
.primary-nav a {
  color: #c9d6e3;
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  white-space: nowrap;
}
.primary-nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.primary-nav a[aria-current="true"] { color: #fff; background: rgba(227, 18, 11, 0.85); }

.progress-track {
  height: 3px;
  width: 100%;
  background: rgba(255,255,255,0.08);
}
.progress-bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--red), #ff7a59);
  transition: width 0.08s linear;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background:
    radial-gradient(900px 420px at 78% -10%, rgba(56, 189, 248, 0.22), transparent 60%),
    radial-gradient(700px 380px at 8% 20%, rgba(227, 18, 11, 0.18), transparent 55%),
    linear-gradient(180deg, #0b1526 0%, #0f1f36 55%, #122741 100%);
  color: #eef4fa;
  padding: 5.5rem 1.25rem 7rem;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.8), transparent 85%);
  pointer-events: none;
}
.hero-inner { max-width: var(--maxw); margin: 0 auto; position: relative; z-index: 1; }
.eyebrow {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7fb4d9;
  margin-bottom: 1rem;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.25rem, 5.2vw, 4.1rem);
  line-height: 1.04;
  font-weight: 700;
  max-width: 16ch;
  letter-spacing: -0.015em;
  color: #fff;
  margin-bottom: 1.25rem;
}
.hero-deck {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.55;
  color: #c9d6e3;
  max-width: 46ch;
  margin-bottom: 1.75rem;
}
.hero-actions { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-bottom: 3.5rem; }
.btn {
  display: inline-block;
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); color: #fff; }
.btn-ghost { border: 1px solid rgba(255,255,255,0.35); color: #fff; }
.btn-ghost:hover { border-color: #fff; color: #fff; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  border-top: 1px solid var(--line-light);
  padding-top: 2rem;
}
.hero-stat { display: flex; flex-direction: column; gap: 0.3rem; }
.stat-value {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 2.9rem);
  font-weight: 700;
  color: #fff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-value .stat-suffix { color: var(--red); }
.stat-label { font-size: var(--text-sm); color: #a9bccd; max-width: 22ch; }

.hero-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  width: 100%;
  height: 90px;
  display: block;
}

/* ---------- Sections ---------- */
.section { padding: 4.5rem 1.25rem; }
.section-light { background: var(--paper-warm); }
.section-paper { background: var(--paper); }
.section-conclusion {
  background:
    radial-gradient(800px 360px at 50% 0%, rgba(56, 189, 248, 0.12), transparent 60%),
    var(--slate);
  color: #dbe6f0;
}
.container { max-width: var(--maxw); margin: 0 auto; }

.section-label {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.65rem;
}
.section-conclusion .section-label { color: #ff8d84; }
.section-num {
  display: inline-block;
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 0.05rem 0.4rem;
  margin-right: 0.5rem;
}

.section h2 {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  max-width: 26ch;
  margin-bottom: 2rem;
}
.section-conclusion h2 { color: #fff; }

.section h3 {
  font-family: var(--serif);
  font-size: var(--text-xl);
  line-height: 1.3;
  margin: 1.6rem 0 0.7rem;
}
.prose h3:first-child { margin-top: 0; }

.section-intro {
  font-size: var(--text-lg);
  color: var(--ink-soft);
  max-width: 60ch;
  margin: -1rem 0 2rem;
}

/* ---------- Layout helpers ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}
.stack { display: flex; flex-direction: column; gap: 1.75rem; }
.prose-grid { margin-bottom: 2.5rem; }

.prose p { margin-bottom: 1.1rem; max-width: 68ch; }
.prose li { margin-bottom: 0.5rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin-bottom: 1.1rem; }
.prose strong { font-weight: 700; }

/* ---------- Key facts ---------- */
.key-facts {
  background: var(--slate);
  color: #e8eef5;
  border-radius: var(--radius);
  padding: 1.9rem;
  box-shadow: var(--shadow);
}
.key-facts h3 {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #93a7bc;
  margin: 0 0 0.75rem;
}
.key-facts-lede {
  font-family: var(--serif);
  font-size: var(--text-xl);
  line-height: 1.3;
  color: #fff;
  margin-bottom: 1.2rem;
}
.key-facts ul { list-style: none; padding: 0; }
.key-facts li {
  padding: 0.7rem 0;
  border-top: 1px solid var(--line-light);
  color: #c9d6e3;
  font-size: var(--text-sm);
}
.key-facts li strong { color: #fff; }

/* ---------- Chart cards ---------- */
.chart-card {
  background: var(--slate);
  color: #e8eef5;
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.15rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.chart-head { margin-bottom: 1rem; }
.chart-head h3 { color: #fff; margin: 0 0 0.3rem; font-size: var(--text-lg); }
.chart-sub { font-size: var(--text-sm); color: #93a7bc; max-width: 52ch; }
.chart-wrap { position: relative; height: 340px; }
.chart-wrap-short { height: 300px; }
.chart-note {
  margin-top: 0.9rem;
  font-size: var(--text-xs);
  line-height: 1.5;
  color: #8195ab;
}
.section-light .chart-note { color: var(--muted); }

/* ---------- Risk board ---------- */
.risk-board {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.risk-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--line);
}
.risk-item:last-child { border-bottom: 0; }
.risk-symbol { color: var(--red); font-size: 1rem; margin-top: 0.3rem; }
.risk-item h3 { margin: 0 0 0.25rem; font-size: var(--text-base); font-family: var(--sans); font-weight: 800; }
.risk-item p { margin: 0; font-size: var(--text-sm); color: var(--ink-soft); }

/* ---------- Tables ---------- */
.table-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  min-width: 0;
}
.table-card h3 { margin: 0 0 1rem; font-size: var(--text-lg); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.data-table th, .data-table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.data-table thead th {
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.data-table tbody th { font-weight: 700; }
.data-table tbody tr:last-child th, .data-table tbody tr:last-child td { border-bottom: 0; }

.scenario-table-wrap { margin-top: 3rem; overflow-x: auto; }
.scenario-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: var(--text-sm);
  min-width: 720px;
}
.scenario-table caption {
  caption-side: top;
  text-align: left;
  font-family: var(--serif);
  font-size: var(--text-lg);
  font-weight: 700;
  padding-bottom: 0.75rem;
}
.scenario-table th, .scenario-table td {
  padding: 0.85rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.scenario-table thead th {
  background: var(--slate);
  color: #fff;
  font-family: var(--mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.scenario-table tbody th { font-weight: 700; background: #faf8f3; }
.scenario-table tbody tr:last-child th, .scenario-table tbody tr:last-child td { border-bottom: 0; }

/* ---------- Hotspots ---------- */
.hotspot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
.hotspot-card {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
}
.hotspot-card h3 { margin: 0 0 0.6rem; font-size: var(--text-lg); }
.hotspot-card p { margin: 0; color: var(--ink-soft); }

/* ---------- Adaptation ---------- */
.adaptation-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-top: 2.5rem;
}
.adapt-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.adapt-num {
  font-family: var(--mono);
  font-size: var(--text-xs);
  color: var(--red);
  letter-spacing: 0.1em;
}
.adapt-card h3 { margin: 0.4rem 0 0.4rem; font-size: var(--text-base); }
.adapt-card p { margin: 0; font-size: var(--text-sm); color: var(--ink-soft); }

/* ---------- Conclusion ---------- */
.binding-term {
  margin-top: 1.75rem;
  padding: 1.4rem 1.6rem;
  border-left: 4px solid var(--red);
  background: rgba(255,255,255,0.06);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #f3f7fb;
  font-family: var(--serif);
  font-size: var(--text-lg);
  line-height: 1.5;
}
.binding-term strong { color: #ff8d84; }

/* ---------- Sources ---------- */
.source-list { list-style: decimal; }
.source-list li { margin-bottom: 0.6rem; padding-left: 0.3rem; }
.source-list a { color: var(--ink); }
.section-light .source-list a:hover { color: var(--red); }

/* ---------- Footer ---------- */
.footer {
  background: #0a1322;
  color: #93a7bc;
  padding: 3rem 1.25rem 2.5rem;
}
.footer-inner { display: grid; gap: 0.5rem; }
.footer-brand { color: #fff; font-weight: 800; font-size: var(--text-lg); letter-spacing: 0.04em; }
.footer-brand span { color: #93a7bc; font-weight: 500; font-size: var(--text-sm); }
.footer p { font-size: var(--text-sm); }
.footer-meta { color: #6e8298; font-size: var(--text-xs); }
.back-to-top { margin-top: 1rem; color: #c9d6e3; font-weight: 700; }

/* ---------- Noscript & sr-only ---------- */
.noscript-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--amber);
  color: #1a1a1a;
  padding: 0.8rem 1.2rem;
  font-weight: 700;
  text-align: center;
  z-index: 150;
}
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .two-col { grid-template-columns: 1fr; gap: 2rem; }
  .adaptation-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
}
@media (max-width: 768px) {
  .section { padding: 3.25rem 1.25rem; }
  .hero { padding: 4rem 1.25rem 6.5rem; }
  .masthead-inner { gap: 1rem; }
  .primary-nav { width: 100%; margin-left: 0; padding-bottom: 0.4rem; }
  .hotspot-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .adaptation-grid { grid-template-columns: 1fr; }
  .hero-actions { margin-bottom: 2.5rem; }
  .chart-wrap, .chart-wrap-short { height: 260px; }
}

/* ---------- Print ---------- */
@media print {
  .masthead, .hero-actions, .footer, .back-to-top, .progress-track { display: none !important; }
  .hero { padding: 2rem 1rem; color: #1a1a1a; background: #fff; }
  .hero h1, .stat-value { color: #1a1a1a; }
  .hero-deck, .stat-label { color: #3d454d; }
  .section { padding: 1.5rem 1rem; page-break-inside: avoid; }
  .chart-card, .key-facts { background: #fff; color: #1a1a1a; box-shadow: none; border: 1px solid #ddd; }
  .chart-head h3, .key-facts-lede, .key-facts li strong { color: #1a1a1a; }
  .chart-note, .chart-sub { color: #6b7280; }
  a { color: #1a1a1a; text-decoration: none; }
}
