/* Southern Ocean gateways story map ---------------------------------------
 *
 * Layout is a fixed full-viewport "stage" carrying the globe and chart, with
 * tall scene sections scrolling above it. A dark palette throughout: the maps
 * are dark ocean, and a light UI around them would fight for attention.
 */

:root {
  --ink: #e8f0f8;
  --ink-dim: rgba(232, 240, 248, 0.62);
  --bg: #070c16;
  --panel: rgba(9, 16, 28, 0.82);
  --edge: rgba(143, 212, 240, 0.22);
  --accent: #8fd4f0;
  --measure: 30rem;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: auto;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", sans-serif;
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.stage-layer {
  position: absolute;
  inset: 0;
}

.stage-globe canvas,
.stage-chart canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.globe-overlay { pointer-events: none; }

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 35%, rgba(7, 12, 22, 0.55) 100%),
    linear-gradient(to right, rgba(7, 12, 22, 0.75), transparent 45%);
}

.timecode {
  position: absolute;
  left: clamp(1rem, 4vw, 3rem);
  bottom: clamp(1rem, 4vh, 2.5rem);
  z-index: 3;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.timecode.is-on { opacity: 1; }

.timecode .age {
  display: block;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 200;
  line-height: 1;
  color: var(--ink);
}

.timecode .epoch {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  opacity: 0.62;
}

main {
  position: relative;
  z-index: 1;
}

.scene {
  min-height: 100vh;
  padding-top: clamp(2rem, 5vh, 4rem);
}

.step {
  max-width: var(--measure);
  margin: 0 0 70vh auto;
  padding: 1.4rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 4px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.step.is-visible {
  opacity: 1;
  transform: none;
}

.scene-a { min-height: 500vh; }

.step-title {
  padding-top: clamp(4rem, 10vh, 6rem);
}

.step-title h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  line-height: 1.05;
  margin-bottom: clamp(1rem, 2vh, 1.5rem);
}

.step-title .kicker {
  font-size: clamp(0.75rem, 1.5vw, 1rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
}

.step-title .standfirst {
  font-size: clamp(1rem, 2vw, 1.5rem);
  line-height: 1.4;
}

.step-title .scroll-cue {
  margin-top: clamp(2rem, 5vh, 3rem);
  font-size: clamp(0.75rem, 1.5vw, 1rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
}

.step h2 {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  line-height: 1.1;
}

.step p {
  margin-bottom: clamp(0.75rem, 1.5vh, 1.25rem);
}

.step p.aside {
  font-style: italic;
  opacity: 0.75;
}

.step p.chapter {
  font-size: clamp(1rem, 2vw, 1.5rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

/* Figure panels: photos, diagrams and maps dropped into the scroll. Wider than
 * the plain text column so a photo reads as a photo, but still a `.step` so
 * scroll.js fades it in/out with the same viewport-centre rule as the prose. */
.step-figure {
  max-width: 34rem;
  padding: 0.9rem;
}

@media (min-width: 900px) {
  .step-figure { max-width: 42rem; }
}

.figure {
  margin: 0;
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  border: 1px solid var(--edge);
  background: rgba(0, 0, 0, 0.25);
}

.figure figcaption {
  margin-top: 0.7rem;
  padding: 0 0.15rem;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink-dim);
}

.figure .credit {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  opacity: 0.55;
}

.figure .credit a {
  color: inherit;
}

/* Two figures side by side once there is room; stacked on narrow viewports. */
.figure-pair {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .figure-pair { grid-template-columns: 1fr 1fr; }
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.8s ease;
}

.loading span {
  font-size: clamp(1rem, 2vw, 1.5rem);
  opacity: 0;
}

.loading.is-done {
  opacity: 0;
  pointer-events: none;
}

.loading.is-done span {
  animation: fadeOut 1s ease forwards;
}

@keyframes fadeOut {
  to { opacity: 0; }
}
