:root {
  --sky-top: #8fb9e3;
  --sky-mid: #c4dbf1;
  --sky-low: #eaf2fa;
  --ink: #1b2838;
  --ink-soft: #4a5a6e;
  --hairline: rgba(27, 40, 56, 0.18);
  --accent: #7a5a3c;   /* weathered-granite brown, dark enough to read on the pale sky */
  --font: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

body {
  background: linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-mid) 45%, var(--sky-low) 100%) fixed;
  background-color: var(--sky-mid);
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
}

/* White-out while flying through a cloud bank */
#mist {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.96) 0%, rgba(240,246,252,0.92) 60%, rgba(220,233,246,0.88) 100%);
}

html { scroll-snap-type: y proximity; }
#track { position: relative; z-index: -1; pointer-events: none; }
#track .stop { scroll-snap-align: start; }

.overlay, .panel {
  position: fixed;
  z-index: 2;
  will-change: opacity, transform;
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 400;
}

/* ---------- Intro ---------- */
/* Panel and outro copy sits in the upper left */
.panel, #outro {
  top: clamp(24px, 7vh, 80px);
  left: clamp(16px, 5vw, 80px);
  text-align: left;
}

/* Home fills the window: title block centred a quarter of the way down, sources in the lower left.
   A column, so on short windows the sources are pushed down instead of overlapping the text. */
#intro {
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 0 clamp(16px, 5vw, 80px) clamp(16px, 4vh, 40px);
  pointer-events: none;
  text-align: left;
}
#intro a { pointer-events: auto; }

#intro .intro-main {
  width: min(600px, 100%);
  margin: calc(25vh - 0.6em) 0 0 clamp(0px, 6vw, 110px);
  font-size: clamp(28px, 3.4vw, 48px); /* sets the em for the h1 offset above */
}

#intro h1 {
  margin: 0 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: 1em;
  letter-spacing: -0.02em;
  line-height: 1.02;
  color: #000;
}

#intro .lede {
  margin: 0 0 7px;
  max-width: 440px;
  font-size: 12px;
  line-height: 1.5;
  color: #000;
}

#intro .cue {
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 400;
}

#intro .sources {
  width: min(340px, 100%);
  margin: auto 0 0;
  padding-top: 16px;
  font-size: 9.5px;
  line-height: 1.45;
  color: #000;
}
#intro .sources-label {
  display: block;
  margin-bottom: 2px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
#intro .sources a { color: #000; text-decoration: underline; text-decoration-color: rgba(0,0,0,0.3); text-underline-offset: 2px; }
#intro .sources a:hover, #intro .sources a:focus-visible { color: var(--accent); text-decoration-color: currentColor; }
#intro .cue span { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(5px); } }

/* ---------- Peak panels ---------- */
.panel {
  width: min(400px, 36vw);
  opacity: 0;
  pointer-events: none;
}
.panel.active { pointer-events: auto; }

.panel .rank {
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-weight: 400;
  margin: 0 0 12px;
}

.panel h2 {
  margin: 0 0 6px;
  font-weight: 400;
  font-size: clamp(34px, 4vw, 56px);
  letter-spacing: -0.02em;
  line-height: 1.02;
}

.panel .range {
  margin: 0 0 26px;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.stats { margin: 0; }
.stat {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--hairline);
  align-items: baseline;
}
.stat:last-child { border-bottom: 1px solid var(--hairline); }
.stat dt {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 400;
}
.stat dd { margin: 0; font-size: 16px; line-height: 1.45; }
.stat .big { font-size: 28px; font-weight: 400; letter-spacing: -0.01em; }
.stat .sub { display: block; font-size: 13px; color: var(--ink-soft); }
.stat .temp { color: var(--accent); }

/* ---------- Outro ---------- */
#outro {
  width: min(560px, calc(100vw - 72px));
  opacity: 0;
  pointer-events: none;
}
#outro.active { pointer-events: auto; }
#outro h2 { margin: 0 0 24px; font-weight: 400; font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.01em; }
#index {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  text-align: left;
  columns: 2;
  column-gap: 32px;
}
#index li { break-inside: avoid; border-top: 1px solid var(--hairline); }
#index a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
}
#index a:hover .n, #index a:focus-visible .n { color: var(--accent); text-decoration: underline; }
#index .ft { color: var(--ink-soft); font-size: 13px; }
#back-top, #index a { cursor: pointer; }
#back-top {
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  background: none;
  border: none;
  padding: 8px 0;
}
#back-top:hover { text-decoration: underline; }

/* ---------- Progress dots ---------- */
#dots {
  position: fixed;
  right: clamp(14px, 2.4vw, 32px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#dots button {
  width: 9px;
  height: 9px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--ink-soft);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: background 0.3s, transform 0.3s;
}
#dots button.on { background: var(--accent); border-color: var(--accent); transform: scale(1.35); }
#dots button::after {
  content: attr(data-label);
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
#dots button:hover::after, #dots button:focus-visible::after { opacity: 1; }

#loading {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: opacity 0.6s;
}
#loading.done { opacity: 0; }

/* ---------- Narrow screens: panel sits under the peak ---------- */
@media (max-width: 760px) {
  .panel {
    top: 20px;
    left: 16px;
    right: 32px;
    width: auto;
  }
  #intro { padding-right: 32px; }
  #intro .intro-main { margin: calc(11vh - 0.6em) 0 0; }
  #intro .sources { width: auto; }
  .panel h2 { font-size: 32px; }
  .panel .range { margin-bottom: 14px; }
  .stat { grid-template-columns: 96px 1fr; padding: 9px 0; }
  .stat .big { font-size: 24px; }
  #dots { right: 8px; gap: 9px; }
  #dots button { width: 7px; height: 7px; }
  #index { columns: 1; }
  #index a { padding: 7px 0; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  #intro .cue span { animation: none; }
}
