/* site/style.css · The Pacific Cascade
   Type, colour and spacing follow the supplied front-end design: Libre
   Baskerville for the title, Outfit 300 for body prose, Inter for anything
   that labels a chart. */

:root {
  --background: #ffffff;
  --foreground: #020817;
  --muted-foreground: #9ca3af;
  --primary: #2a78d6;
  --accent: #e8833a;
  --danger: #c1362f;
  --border: #e2e8f0;
  --text-body: #3a2d2d;
  --text-secondary: #494949;
  --column: 600px;
  --font-body: 'Outfit', system-ui, sans-serif;
  --font-title: 'Libre Baskerville', Georgia, serif;
  --font-ui: 'Inter', system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

/* Highcharts 13 injects `color-scheme: light dark` on every chart container,
   which flips the charts to a dark palette regardless of the page setting.
   The library honours this ancestor class as the escape hatch. */
.highcharts-light .highcharts-container { color-scheme: light !important; }

.column { max-width: var(--column); margin: 0 auto; }

/* ── hero ────────────────────────────────────────────────────────────────── */

.hero { padding: 7rem 2rem 3rem; }

.kicker {
  font-size: 1.125rem;
  line-height: 1.625;
  color: var(--text-secondary);
  margin: 0 0 1rem;
}

h1 {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 3rem;
  line-height: 1.1;
  letter-spacing: -1.8px;
  color: var(--foreground);
  margin: 0 0 2rem;
}

/* ── cascade flow ────────────────────────────────────────────────────────── */

.cascade { padding: 2rem 0; overflow-x: auto; }

.cascade-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0 2rem;
  min-width: 600px;
  font-size: 15px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.cascade-wrap { max-width: 138px; white-space: normal; text-align: center; }

.arrow { width: 31px; height: 6px; flex-shrink: 0; }

/* ── prose ───────────────────────────────────────────────────────────────── */

main { padding: 0 2rem 8rem; max-width: 1167px; margin: 0 auto; }

.s-lg { padding-top: 5rem; }
.s-md { padding-top: 3rem; }

.body {
  font-size: 1.125rem;
  line-height: 25px;
  color: var(--text-body);
  margin: 0 0 1.5rem;
}
.body:last-child { margin-bottom: 0; }
.body.strong { font-weight: 500; color: var(--foreground); }

.body code, footer code, .caption code, .pending-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: #f1f0ee;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

/* Figures written into the prose by main.js. Until the data lands they read
   as an em dash, so a failed load looks broken rather than plausible. */
.body span[id^='fig-'] {
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
  font-weight: 400;
}

.label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  margin: 0 0 1rem;
}

.caption {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted-foreground);
  margin: 0.875rem 0 0;
}

.band-title {
  font-size: 11px;
  text-align: center;
  color: #000;
  margin: 0 0 0.75rem;
}

/* ── charts ──────────────────────────────────────────────────────────────── */

.chart { width: 100%; }

.chart.pending {
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  background: #fbfaf9;
}

.pending-title {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6b7280;
  margin: 0 0 0.5rem;
}

.pending-body {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--muted-foreground);
  margin: 0;
}

/* ── scrubbers ───────────────────────────────────────────────────────────── */

.scrubber, .map-ui {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-top: 1rem;
}

.scrubber button, .map-ui .play-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.scrubber button:hover, .map-ui .play-btn:hover {
  background: #eff6ff;
  border-color: var(--primary);
}
.map-ui .play-btn.playing { background: #eff6ff; border-color: var(--primary); }

.scrubber input[type='range'] {
  flex: 1;
  accent-color: var(--primary);
}

.scrubber-year, .map-ui-year {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  min-width: 3.25rem;
  text-align: right;
}

.timeline-track {
  position: relative;
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: #ededeb;
  cursor: pointer;
}
.timeline-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: rgba(42, 120, 214, 0.38);
}
.timeline-handle {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  margin-left: -6.5px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid var(--primary);
  transform: translateY(-50%);
  pointer-events: none;
}

/* ── dumbbells ───────────────────────────────────────────────────────────── */

.dumbbell-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.3125rem 0;
}

.dumbbell-label {
  flex: 0 0 8.5rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dumbbell-track {
  position: relative;
  flex: 1;
  height: 12px;
  border-bottom: 1px solid #f4f3f1;
}

.dumbbell-line {
  position: absolute;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: #e5e3e0;
  border-radius: 999px;
}

.dumbbell-dot {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 999px;
}
.dot-blue { background: var(--primary); }
.dot-orange { background: var(--accent); }
.dot-red { background: var(--danger); }
.dot-grey { background: #c4c1bd; }

.dumbbell-value {
  flex: 0 0 3.25rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.value-red { color: var(--danger); font-weight: 500; }
.value-blue { color: var(--primary); }
.text-muted { color: var(--muted-foreground); }

/* ── shoreline balance rows ───────────────────────────────────────────────
   Diverging bars around a shared centre line: retreating left, accreting
   right, both as a share of that territory's good-quality transects. The two
   halves use one scale so rows are comparable down the column. */

.balance-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.3125rem 0;
}

.balance-label {
  flex: 0 0 8.5rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.balance-track {
  position: relative;
  flex: 1;
  height: 14px;
  border-bottom: 1px solid #f4f3f1;
}

.balance-mid {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #e5e3e0;
}

.balance-bar {
  position: absolute;
  top: 3px;
  height: 8px;
  border-radius: 2px;
}
.bar-red { background: var(--danger); opacity: 0.78; }
.bar-blue { background: var(--primary); opacity: 0.78; }

.balance-value {
  flex: 0 0 3.5rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.key {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin: 0 0.25rem 0 0.75rem;
  vertical-align: baseline;
}
.key:first-child { margin-left: 0; }
.key-blue { background: var(--primary); }
.key-orange { background: var(--accent); }

/* ── footer ──────────────────────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
}
footer p {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--muted-foreground);
  margin: 0 0 0.5rem;
}
footer p:last-child { margin-bottom: 0; }

/* ── narrow screens ──────────────────────────────────────────────────────── */

@media (max-width: 680px) {
  .hero { padding: 4rem 1.25rem 2rem; }
  main { padding: 0 1.25rem 4rem; }
  h1 { font-size: 2.125rem; letter-spacing: -1px; }
  .s-lg { padding-top: 3.5rem; }
  .s-md { padding-top: 2rem; }
  .dumbbell-label { flex-basis: 6rem; font-size: 0.6875rem; }
  footer { padding: 1.5rem 1.25rem; }
}

/* ── SST map: drilldown ──────────────────────────────────────────────────── */

/* The map is the primary object on the page, so it breaks out of the reading
   column and takes the full width of the layout. */
.map-section {
  width: 100vw;
  max-width: 1167px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  padding-left: 2rem;
  padding-right: 2rem;
}

.map-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.5rem;
  margin: -0.25rem 0 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
}
.crumb-here { color: var(--text-secondary); }
.crumb-sep { color: #d4d0ca; }
.crumb-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--primary);
  cursor: pointer;
}
.crumb-link::before { content: '← '; }
.crumb-link:hover { text-decoration: underline; }

.map-hint {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0.75rem 0 0;
}

.map-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.map-key {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
.key-nodata {
  width: 12px;
  height: 8px;
  border-radius: 2px;
  background: #E4E2DE;
  border: 1px dashed #B9B4AC;
  margin-left: 0.75rem;
}

.key-ramp {
  width: 110px;
  height: 7px;
  border-radius: 2px;
  background: linear-gradient(to right, #4A90E2, #F4F1EA, #D95F52);
}

/* The detail sits over the map's right-hand side rather than beside it, so
   opening a territory does not resize the map underneath. */
.map-pane { position: relative; }

.detail-pop {
  position: absolute;
  top: 0;
  right: 0;
  width: 360px;
  max-width: calc(100% - 2rem);
  padding: 1rem 1.125rem 0.75rem;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 2px 14px rgba(25, 25, 25, 0.06);
  z-index: 3;
  animation: pop-in 0.28s ease both;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .detail-pop { animation: none; }
}

.detail-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 0.875rem;
  margin: 0 0 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--text-secondary);
}
.dk { display: inline-flex; align-items: center; gap: 0.3125rem; }
.dk-line { width: 12px; height: 2px; border-radius: 1px; flex-shrink: 0; }
.dk-dash {
  width: 12px;
  height: 0;
  border-top: 1.5px dashed var(--accent);
  flex-shrink: 0;
}

/* The information block: what the rest of the project knows about the
   selected territory. A plain list, not a row of cards. */
.detail-facts {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0 0.125rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 0.6875rem;
}
.fx {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.1875rem 0;
}
.fx-k { color: var(--muted-foreground); white-space: nowrap; }
.fx-v {
  color: var(--foreground);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.fx-sub { color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.fx-none { color: var(--muted-foreground); font-style: italic; }

.detail-close {
  position: absolute;
  top: 0.5rem;
  right: 0.625rem;
  padding: 0;
  width: 20px;
  height: 20px;
  border: 0;
  background: none;
  color: var(--muted-foreground);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.detail-close:hover { color: var(--foreground); }

.map-lede {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  margin: -0.5rem 0 0.75rem;
}

/* ── sea-surface strips ──────────────────────────────────────────────────── */

.strip-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2px;
}
.strip-label {
  flex: 0 0 8.5rem;
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--text-secondary);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.strip {
  display: flex;
  flex: 1;
  height: 13px;
  border-radius: 2px;
  overflow: hidden;
}
.strip i { flex: 1 1 0; }
.strip .strip-gap { background: #F4F2EE; }

.strip-axis {
  display: flex;
  justify-content: space-between;
  margin: 0.5rem 0 0 9.25rem;
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

.detail-title {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--foreground);
  margin: 0 0 0.25rem;
}

.detail-sub {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0 0 0.5rem;
}

/* tooltips stay quiet: no big boxes */
.tt-name { font-weight: 600; color: var(--foreground); }
.tt-year { color: var(--muted-foreground); }
.tt-val { font-weight: 500; color: var(--foreground); font-variant-numeric: tabular-nums; }
.tt-ref { color: var(--muted-foreground); font-size: 11px; }

/* Too narrow to float over the map without covering it, so it becomes a
   block beneath instead. */
@media (max-width: 760px) {
  .detail-pop {
    position: static;
    width: auto;
    max-width: none;
    margin-top: 1.25rem;
    box-shadow: none;
  }
}

@media (max-width: 680px) {
  .map-section { padding-left: 1.25rem; padding-right: 1.25rem; }
  .strip-label { flex-basis: 5.5rem; font-size: 0.625rem; }
  .strip-axis { margin-left: 6.25rem; }
}
