/* One good thermometer.
   Layout idea: a single reading column on cool chart-paper; figures break out wide;
   two "deep water" bands go dark where the page shows depth or 3D. */
@font-face { font-family: "Archivo"; src: url("../fonts/archivo-latin-standard-normal.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("../fonts/newsreader-latin-opsz-normal.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("../fonts/newsreader-latin-opsz-italic.woff2") format("woff2"); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #e9edeb;
  --paper-2: #dde3e0;
  --ink: #0e1a1f;
  --ink-2: #4a595f;
  --rule: #c2ccc8;
  --hot: #d1345b;        /* above the threshold */
  --hot-text: #a81e45;
  --cool: #17697a;       /* observed water, below threshold */
  --flag: #9a5f0c;       /* suggested / not yet known */
  --deep: #0b1519;       /* deep-water bands */
  --deep-2: #14242a;
  --deep-ink: #dfe7e4;
  --deep-ink-2: #8fa3a7;
  --deep-rule: #2a3d43;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --col: 40rem;
  --wide: 73rem;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: clamp(1.06rem, 0.98rem + 0.35vw, 1.22rem); line-height: 1.55;
  font-optical-sizing: auto; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration-color: var(--cool); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--hot); }
:focus-visible { outline: 2px solid var(--hot); outline-offset: 2px; border-radius: 2px; }
em { font-style: italic; }
strong { font-weight: 640; }

.mono, .eyebrow, .note, button, .chip, figcaption, .axis, .readout small, table { font-family: var(--mono); }
.eyebrow { font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 0.9rem; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 640; font-stretch: 88%; }

section { padding: clamp(3.2rem, 8vw, 6.5rem) var(--gutter); }
section + section { border-top: 1px solid var(--rule); }
.prose { max-width: var(--col); margin: 0 auto; }
.prose > p { margin: 0 0 1.05em; }
.wide { max-width: var(--wide); margin: 0 auto; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; font-stretch: 84%; line-height: 1.02; letter-spacing: -0.012em; text-wrap: balance; margin: 0; }
h2 { font-size: clamp(2rem, 1.3rem + 3.2vw, 3.7rem); margin-bottom: 1.4rem; }
h3 { font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.7rem); font-stretch: 90%; line-height: 1.12; margin: 2.6rem 0 0.8rem; }
.lede { font-size: 1.16em; line-height: 1.45; }
.aside { font-family: var(--mono); font-size: 0.78rem; line-height: 1.55; color: var(--ink-2); border-left: 2px solid var(--rule); padding-left: 0.9rem; margin: 1.4rem 0; }
.aside b { color: var(--ink); font-weight: 500; }
.tag { display: inline-block; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.18em 0.55em 0.14em; border: 1px solid currentColor; border-radius: 2px; vertical-align: 0.12em; white-space: nowrap; }
.tag.suggested { color: var(--flag); }
.tag.observed { color: var(--cool); }
.tag.unknown { color: var(--flag); border-style: dashed; }

/* ---------- hero */
#hero { padding-top: clamp(2.2rem, 6vw, 4.5rem); padding-bottom: clamp(2.4rem, 5vw, 4rem); }
.hero-grid { max-width: var(--wide); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: clamp(1.5rem, 5vw, 4.5rem); align-items: end; }
h1 { font-size: clamp(3rem, 1rem + 6.4vw, 6.6rem); font-weight: 760; font-stretch: 76%; line-height: 0.9; letter-spacing: -0.022em; }
.hero-deck { margin: 1.6rem 0 0; max-width: 34rem; }
.hero-panel { border-top: 2px solid var(--ink); padding-top: 0.9rem; }
.hero-q { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-2); min-height: 2.6em; margin: 0; }
.hero-q b { color: var(--ink); font-weight: 500; }
.hero-num { font-size: clamp(5rem, 2rem + 11vw, 10.5rem); line-height: 0.86; color: var(--hot); letter-spacing: -0.03em; margin: 0.1em 0 0.12em; display: flex; align-items: baseline; gap: 0.06em; }
.hero-num sup { font-size: 0.34em; font-weight: 600; vertical-align: baseline; align-self: flex-start; margin-top: 0.3em; }
.hero-sub { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-2); margin: 0 0 0.8rem; }
#heroStrip { width: 100%; height: 46px; display: block; }
.hero-dots { display: flex; gap: 6px; margin-top: 0.8rem; flex-wrap: wrap; }
.hero-dots button { all: unset; cursor: pointer; font-family: var(--mono); font-size: 0.72rem; padding: 0.35em 0.6em; border: 1px solid var(--rule); border-radius: 2px; color: var(--ink-2); }
.hero-dots button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.hero-dots button:focus-visible { outline: 2px solid var(--hot); outline-offset: 2px; }
@media (max-width: 820px) { .hero-grid { grid-template-columns: 1fr; align-items: start; } }

/* ---------- figures */
figure { margin: 2.4rem auto; max-width: var(--wide); }
figure.narrow { max-width: var(--col); }
figcaption { font-size: 0.74rem; line-height: 1.55; color: var(--ink-2); margin-top: 0.8rem; max-width: 60rem; }
figcaption b { color: var(--ink); font-weight: 500; }
.fig-head { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; align-items: baseline; justify-content: space-between; margin-bottom: 0.7rem; }
.fig-title { font-family: var(--display); font-weight: 650; font-stretch: 90%; font-size: 1.12rem; line-height: 1.2; margin: 0; max-width: 46rem; }
.controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.controls label { font-family: var(--mono); font-size: 0.74rem; color: var(--ink-2); display: inline-flex; gap: 0.45em; align-items: center; cursor: pointer; }
.chip, .seg button {
  appearance: none; background: transparent; color: var(--ink); border: 1px solid var(--ink-2); border-radius: 2px;
  font-size: 0.74rem; line-height: 1.2; padding: 0.5em 0.75em; cursor: pointer; text-align: left;
}
.chip:hover, .seg button:hover { border-color: var(--ink); background: var(--paper-2); }
.chip[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg { display: inline-flex; }
.seg button + button { border-left: 0; }
.seg button { border-radius: 0; }
.chart { position: relative; width: 100%; }
.chart svg, .chart canvas { display: block; width: 100%; }
.chart svg { overflow: visible; }
.axis text, svg text { font-family: var(--mono); font-size: 11px; fill: var(--ink-2); }
.axis line, .axis path { stroke: var(--rule); }
svg .lab { fill: var(--ink); font-size: 11.5px; }
svg .lab-hot { fill: var(--hot-text); }
svg .big { font-family: var(--display); font-weight: 650; font-size: 15px; fill: var(--ink); }
.tip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: 0.72rem; line-height: 1.45; padding: 0.5em 0.7em; border-radius: 2px;
  transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; opacity: 0; transition: opacity 0.12s;
}
.tip.on { opacity: 1; }
.tip b { font-weight: 500; color: #fff; }

/* ---------- baseline section */
#baselineBar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--rule); border-top: 1px solid var(--rule); margin: 2.2rem calc(-1 * var(--gutter)) 0; padding: 0.65rem var(--gutter); }
#baselineBar .inner { max-width: var(--wide); margin: 0 auto; display: flex; gap: 0.5rem 1rem; align-items: center; }
#baselineBar .q { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-2); white-space: nowrap; }
@media (max-width: 640px) { #baselineBar .q { display: none; } }
#baselineChips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; flex: 1; min-width: 0; }
#baselineChips::-webkit-scrollbar { display: none; }
#baselineChips .chip { white-space: nowrap; flex: none; }
#baselineChips .chip .pc { font-weight: 500; margin-left: 0.5em; opacity: 0.75; }
.readout { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr); gap: clamp(1rem, 3vw, 3rem); align-items: start; margin: 1.6rem auto 0.6rem; max-width: var(--wide); }
.readout .share { font-size: clamp(4rem, 2rem + 9vw, 8.5rem); line-height: 0.85; color: var(--hot); letter-spacing: -0.03em; }
.readout .share sup { font-size: 0.36em; }
.readout small { display: block; font-size: 0.76rem; color: var(--ink-2); line-height: 1.5; margin-top: 0.6rem; }
.readout h3 { margin: 0 0 0.5rem; }
.readout p { margin: 0 0 0.7rem; font-size: 0.98em; }
.readout p.aside { font-size: 0.78rem; margin-top: 1rem; }
@media (max-width: 760px) { .readout { grid-template-columns: 1fr; } }

.deepband { background: var(--deep); color: var(--deep-ink); border-top: 0 !important; }
.deepband + section { border-top: 0; }
.deepband .eyebrow, .deepband figcaption, .deepband .aside { color: var(--deep-ink-2); }
.deepband figcaption b, .deepband .aside b { color: var(--deep-ink); }
.deepband .aside { border-color: var(--deep-rule); }
.deepband .chip, .deepband .seg button { color: var(--deep-ink); border-color: var(--deep-ink-2); }
.deepband .chip:hover, .deepband .seg button:hover { background: var(--deep-2); border-color: var(--deep-ink); }
.deepband .chip[aria-pressed="true"], .deepband .seg button[aria-pressed="true"] { background: var(--deep-ink); color: var(--deep); border-color: var(--deep-ink); }
.deepband svg text { fill: var(--deep-ink-2); }
.deepband svg .lab { fill: var(--deep-ink); }
.deepband .axis line, .deepband .axis path { stroke: var(--deep-rule); }
.deepband a { text-decoration-color: var(--deep-ink-2); }
.deepband .controls label { color: var(--deep-ink-2); }

#terrain { overflow: hidden; position: relative; width: 100%; height: min(72vh, 660px); min-height: 380px; border: 1px solid var(--deep-rule); background: radial-gradient(120% 90% at 50% 0%, #12242a 0%, var(--deep) 70%); touch-action: pan-y; }
#terrain canvas { width: 100%; height: 100%; display: block; }
@media (max-width: 640px) { #terrain { height: 400px; min-height: 0; } }
#terrain .hud { position: absolute; left: 14px; top: 12px; font-family: var(--mono); font-size: 0.74rem; line-height: 1.5; color: var(--deep-ink-2); pointer-events: none; }
#terrain .hud b { color: var(--deep-ink); font-weight: 500; }
#terrain .hint { position: absolute; right: 14px; bottom: 10px; font-family: var(--mono); font-size: 0.68rem; color: var(--deep-ink-2); pointer-events: none; }
#terrain .axl { position: absolute; font-family: var(--mono); font-size: 0.66rem; color: var(--deep-ink-2); pointer-events: none; transform: translate(-50%, -50%); white-space: nowrap; }
#terrain .fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 2rem; text-align: center; font-family: var(--mono); font-size: 0.8rem; color: var(--deep-ink-2); }

/* ---------- small multiples / two-up */
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.2rem, 3vw, 3rem); max-width: var(--wide); margin: 0 auto; }
@media (max-width: 860px) { .two { grid-template-columns: 1fr; } }
.kv { font-family: var(--mono); font-size: 0.78rem; line-height: 1.6; margin: 0.8rem 0 0; display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 1rem; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; color: var(--ink); }
.deepband .kv dt { color: var(--deep-ink-2); } .deepband .kv dd { color: var(--deep-ink); }
.ratio-read { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 0.4rem 2rem; align-items: baseline; margin-top: 0.6rem; }
.ratio-read .num { font-size: 2.6rem; color: var(--ink); line-height: 1; margin-right: 0.3rem; }
input[type="range"] { accent-color: var(--hot); width: min(100%, 26rem); }

/* ---------- provenance chain */
.chain { list-style: none; margin: 2rem auto; padding: 0; max-width: var(--wide); display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; counter-reset: step; }
.chain li { position: relative; padding: 1rem 0.9rem 1rem 0; border-top: 3px solid var(--deep-ink); font-family: var(--mono); font-size: 0.72rem; line-height: 1.5; color: var(--deep-ink-2); }
.chain li::before { content: ""; position: absolute; top: -8px; left: 0; width: 13px; height: 13px; border-radius: 50%; background: var(--deep-ink); }
.chain li h4 { font-family: var(--display); font-stretch: 90%; font-weight: 650; font-size: 0.98rem; color: var(--deep-ink); margin: 0.2rem 0 0.4rem; line-height: 1.15; }
.chain li .state { display: block; font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.2rem; color: #7fd0c0; }
.chain li.unseen { border-top: 3px dashed var(--deep-rule); }
.chain li.unseen::before { background: var(--deep); border: 2px dashed var(--deep-ink-2); }
.chain li.unseen .state { color: #e2b25e; }
.chain li b { color: var(--deep-ink); font-weight: 500; }
@media (max-width: 980px) { .chain { grid-template-columns: 1fr; } .chain li { border-top: 0; border-left: 3px solid var(--deep-ink); padding: 0 0 1.3rem 1.2rem; } .chain li.unseen { border-top: 0; border-left: 3px dashed var(--deep-rule); } .chain li::before { top: 0; left: -8px; } }

/* ---------- map */
.mapgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1rem, 3vw, 2.5rem); max-width: var(--wide); margin: 2.4rem auto; align-items: start; }
@media (max-width: 900px) { .mapgrid { grid-template-columns: 1fr; } }
#map { background: #d2dcd9; border: 1px solid var(--rule); overflow: hidden; }
#map .land { fill: var(--paper); stroke: var(--ink-2); stroke-width: 0.6; }
#map .site { cursor: pointer; outline: none; }
#map .site circle { stroke: var(--paper); stroke-width: 1.5; }
#map .site.sel circle { stroke: var(--ink); stroke-width: 2.5; }
#map .site:focus-visible { outline: none; }
#map .site:focus-visible circle { stroke: var(--hot); stroke-width: 3; }
#sitePanel h3 { margin-top: 0; }

/* ---------- ledger */
.ledger { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2.5vw, 2.4rem); max-width: var(--wide); margin: 2.4rem auto 0; }
@media (max-width: 900px) { .ledger { grid-template-columns: 1fr; } }
.ledger h3 { margin: 0 0 0.3rem; padding-top: 0.8rem; border-top: 3px solid var(--ink); }
.ledger .col-s h3 { border-top-color: var(--flag); }
.ledger .col-n h3 { border-top: 3px dashed var(--ink-2); }
.ledger .sub { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-2); margin: 0 0 0.8rem; }
.ledger ul { list-style: none; padding: 0; margin: 0; }
.ledger li { padding: 0.7rem 0; border-top: 1px solid var(--rule); font-size: 0.95em; line-height: 1.4; }
.ledger li small { display: block; font-family: var(--mono); font-size: 0.7rem; color: var(--ink-2); margin-top: 0.25rem; line-height: 1.45; }

footer { padding: clamp(2.5rem, 6vw, 4.5rem) var(--gutter) 4rem; border-top: 2px solid var(--ink); font-family: var(--mono); font-size: 0.76rem; line-height: 1.6; color: var(--ink-2); }
footer .cols { max-width: var(--wide); margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
footer h4 { font-family: var(--display); font-size: 0.95rem; color: var(--ink); margin: 0 0 0.5rem; font-stretch: 90%; }
footer p { margin: 0 0 0.7rem; }
@media (max-width: 820px) { footer .cols { grid-template-columns: 1fr; } }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.loading { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-2); padding: 2rem 0; }

svg text.halo2 { paint-order: stroke; stroke: var(--paper); stroke-width: 3px; }
svg text.halo { paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }

/* preface and coda: the plain-language frame around the argument */
.preface p, .coda p { font-size: 1.32em; line-height: 1.36; margin: 0 0 0.75em; text-wrap: balance; }
.preface p:last-child, .coda p:last-child { margin-bottom: 0; }
.coda { margin-top: 4rem; padding-top: 2.2rem; border-top: 1px solid var(--rule); }
.coda p { font-family: var(--display); font-weight: 620; font-stretch: 88%; margin-bottom: 0.45em; }
