/* TERRA Lab · Forty years back. Forest scope around the pictures from space; gold is the deed line, teal is the data. Square corners. */
:root {
  --forest-deep: #161e19; --forest: #1f2a23; --sand: #e8e2d6; --sand-2: rgba(232,226,214,.8);
  --sand-3: rgba(232,226,214,.62); --line: rgba(232,226,214,.18);
  --gold: #c6a76a; --teal: #34b294;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --descend: cubic-bezier(.22,1,.36,1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--forest-deep); color: var(--sand); font: 400 14px/1.5 var(--sans); }
button, select { font: inherit; color: inherit; }
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.micro { margin: 0; font: 500 12px var(--mono); letter-spacing: .12em; color: var(--sand-3); text-transform: uppercase; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 6px 20px; border-bottom: 1px solid var(--line); }
.mark { font-weight: 500; letter-spacing: .22em; font-size: 15px; }
.lablink { display: inline-flex; align-items: center; min-height: 44px; color: var(--sand); text-decoration: none; }
.lablink span { margin-left: .5em; letter-spacing: .08em; font-weight: 400; color: var(--gold); }
.lablink:hover, .lablink:hover span { color: var(--gold); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.exp { font-size: 12px; letter-spacing: .12em; color: var(--gold); border: 1px solid rgba(198,167,106,.45); padding: 2px 7px; }

/* three blocks: intro and reading beside the picture on a wide screen, stacked in reading order on a phone */
.forty { display: grid; gap: 20px 28px; padding: 24px 20px 40px; max-width: 1280px; margin: 0 auto;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); grid-template-areas: "stage intro" "stage read"; align-items: start; }
.intro { grid-area: intro; display: flex; flex-direction: column; gap: 12px; }
.stagecol { grid-area: stage; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.read { grid-area: read; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 860px) {
  .forty { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "stage" "read"; padding: 16px 16px 32px; }
}

.eyebrow { margin: 0; font: 500 12px var(--mono); letter-spacing: .12em; color: var(--gold); text-transform: uppercase; }
h1 { margin: 0; font: 300 34px/1.1 var(--serif); letter-spacing: -.018em; }
.lede { margin: 0; font-size: 15px; line-height: 1.65; color: var(--sand-2); max-width: 44ch; }

.lands { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 4px; }
.land { min-height: 52px; padding: 8px 10px; text-align: left; background: transparent; border: 1px solid var(--line); cursor: pointer; transition: border-color .18s var(--descend), background-color .18s var(--descend); }
.land:hover { border-color: rgba(232,226,214,.5); }
.land[aria-pressed="true"] { background: var(--forest); border-color: var(--gold); }
.land b { display: block; font-weight: 500; font-size: 13.5px; }
.land span { display: block; margin-top: 2px; font-size: 12px; line-height: 1.35; color: var(--sand-3); }
.land[disabled] { opacity: .5; cursor: progress; }

/* the picture */
.stage { position: relative; width: 100%; aspect-ratio: 1; max-height: 82vh; background: var(--forest); border: 1px solid rgba(232,226,214,.14); overflow: hidden; user-select: none; -webkit-user-select: none; }
@media (min-width: 861px) { .stage { max-width: 82vh; } .stagecol { max-width: 82vh; } }
.stage > canvas, .stage > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tag { position: absolute; top: 10px; left: 12px; font-size: 13px; font-weight: 500; letter-spacing: .06em; color: var(--forest-deep); background: rgba(232,226,214,.92); padding: 2px 7px; pointer-events: none; }
.tag.right { left: auto; right: 12px; }
.north { position: absolute; bottom: 10px; right: 12px; padding: 2px 6px; font-size: 12px; letter-spacing: .08em; color: var(--sand); background: rgba(22,30,25,.72); pointer-events: none; }
.scale { position: absolute; left: 12px; bottom: 10px; display: flex; align-items: center; gap: 8px; padding: 3px 6px; font-size: 12px; color: var(--sand); background: rgba(22,30,25,.72); pointer-events: none; }
.scalebar { display: inline-block; height: 6px; border: 1px solid var(--sand); border-top: 0; }
.unseen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; text-align: center; background: var(--forest); pointer-events: none; }
.unseen[hidden] { display: none; }
.unseen .y { margin: 0; font: 400 28px var(--mono); color: var(--sand); }
.unseen .w { margin: 0; font-size: 14px; line-height: 1.5; color: var(--sand-2); max-width: 32ch; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; letter-spacing: .14em; color: var(--sand-3); background: var(--forest-deep); }
.loading[hidden] { display: none; }

/* then and now: a full-size range input carries the line; the drawn line follows it */
.split { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: ew-resize; opacity: 0; touch-action: pan-y; }
.split[hidden] { display: none; }
.split::-webkit-slider-runnable-track { height: 100%; background: transparent; }
.split::-webkit-slider-thumb { -webkit-appearance: none; width: 44px; height: 100%; background: transparent; }
.split::-moz-range-track { height: 100%; background: transparent; }
.split::-moz-range-thumb { width: 44px; height: 100%; border: 0; background: transparent; }
.divider { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--sand); pointer-events: none; box-shadow: 0 0 0 1px rgba(22,30,25,.35); }
.divider[hidden] { display: none; }
.divider span { position: absolute; top: 50%; left: -12px; width: 22px; height: 44px; margin-top: -22px; background: var(--sand); border: 1px solid rgba(22,30,25,.5); }
.divider span::before, .divider span::after { content: ""; position: absolute; top: 12px; bottom: 12px; width: 0; border-left: 1px solid var(--forest-deep); }
.divider span::before { left: 7px; }
.divider span::after { left: 12px; }
.split:focus-visible ~ .divider span { outline: 2px solid var(--gold); outline-offset: 2px; }

/* how to look */
.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.mode { min-height: 44px; padding: 0 12px; background: transparent; border: 1px solid var(--line); font-size: 13px; font-weight: 500; cursor: pointer; transition: border-color .18s var(--descend), background-color .18s var(--descend); }
.mode:hover { border-color: rgba(232,226,214,.5); }
.mode[aria-pressed="true"] { background: var(--forest); border-color: var(--gold); }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.row[hidden] { display: none; }
.btn { min-height: 44px; min-width: 88px; padding: 0 16px; border: 1px solid var(--sand); background: var(--sand); color: var(--forest-deep); font-weight: 500; font-size: 13px; cursor: pointer; transition: background-color .18s var(--descend), color .18s var(--descend); }
.btn:hover, .btn:active { background: transparent; color: var(--sand); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.yearnow { font-size: 22px; font-weight: 400; letter-spacing: .02em; }
.yearstate { font-size: 12px; letter-spacing: .1em; color: var(--sand-3); text-transform: uppercase; }
.pick { display: flex; align-items: center; gap: 8px; font: 500 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--sand-3); }
.pick select { min-height: 44px; min-width: 96px; padding: 0 10px; background: var(--forest); border: 1px solid rgba(232,226,214,.35); font: 400 15px var(--mono); letter-spacing: 0; color: var(--sand); cursor: pointer; }
.pick select:hover { border-color: var(--sand); }

/* the run of years: bars sit over the scrubber, one per dry season */
.run { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.run svg { display: block; width: 100%; height: 110px; overflow: visible; }
.run figcaption { margin-top: 2px; }
.scrub { width: 100%; height: 44px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.scrub::-webkit-slider-runnable-track { height: 2px; background: rgba(232,226,214,.35); }
.scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 28px; margin-top: -13px; background: var(--sand); border: 1px solid var(--forest-deep); }
.scrub::-moz-range-track { height: 2px; background: rgba(232,226,214,.35); }
.scrub::-moz-range-thumb { width: 14px; height: 28px; border: 1px solid var(--forest-deep); border-radius: 0; background: var(--sand); }
.scrub:focus-visible { outline-offset: 0; }
.legend { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; color: var(--sand-3); }
.sw { display: inline-block; width: 14px; height: 0; vertical-align: middle; }
.sw.parcel { border-top: 2px solid var(--gold); }
.sw.bar { width: 8px; height: 12px; background: var(--teal); }
.sw.miss { width: 8px; height: 8px; border: 1px solid var(--sand-3); }

/* the reading */
.facts { margin: 0; font-size: 12px; letter-spacing: .1em; color: var(--sand-3); text-transform: uppercase; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.figs { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.figs dd { margin: 4px 0 0; font: 300 19px/1.4 var(--serif); color: var(--sand); }
.figs dd .n { font: 400 15px var(--mono); color: var(--sand); }
.figs dd.small { font: 400 14px/1.55 var(--sans); color: var(--sand-2); }
.see { display: inline-flex; align-items: center; min-height: 44px; margin-top: 2px; padding: 0; background: none; border: 0; font: 500 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); cursor: pointer; }
.see:hover { color: var(--sand); }
.see[hidden] { display: none; }
.meaning { margin: 0; font-size: 13px; line-height: 1.6; color: var(--sand-2); border-left: 2px solid var(--teal); padding-left: 12px; }
.notes { border-top: 1px solid var(--line); padding-top: 12px; }
.notes ul { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 1.55; color: var(--sand-2); }
.notes li::marker { color: var(--gold); }
.cta { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); text-decoration: none; }
.cta:hover, .cta:active { color: var(--sand); }
.foot { max-width: 1280px; margin: 0 auto; padding: 16px 20px 32px; border-top: 1px solid var(--line); font: 400 12px var(--mono); letter-spacing: .06em; color: var(--sand-3); }
.foot a { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 860px) { .foot { padding: 12px 16px 28px; } }

@media (prefers-reduced-motion: reduce) {
  .land, .btn, .mode { transition: none; }
}
