/* Round 2: a survey atlas. Bodoni for engraved titles, Overpass (highway signage) for text, Overpass Mono only
   for measurements. One accent per screen: the spot height that matters. */
:root {
  --paper: #efebe3; --paper-2: #e7e2d7; --ink: #14213d; --ink-2: #47506a;
  --contour: #4f7cac; --contour-text: #35608f; --mark: #b8492a; --moss: #4f7356; --rule: #14213d2e;
  --up: var(--moss); --down: var(--mark);
  --serif: "Bodoni Moda", "Didot", Georgia, serif; --sans: "Overpass", system-ui, sans-serif;
  --mono: "Overpass Mono", ui-monospace, monospace;
  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 40px; --s6: 72px; --s7: 136px;
  --measure: 64ch; --wide: 1240px; --gut: clamp(16px, 4vw, 48px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1730; --paper-2: #131e3b; --ink: #ebe6db; --ink-2: #b1b8c9;
    --contour: #7fa5d0; --contour-text: #9dbbe0; --mark: #e8825c; --moss: #93b99a; --rule: #ebe6db30; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1730; --paper-2: #131e3b; --ink: #ebe6db; --ink-2: #b1b8c9;
  --contour: #7fa5d0; --contour-text: #9dbbe0; --mark: #e8825c; --moss: #93b99a; --rule: #ebe6db30; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 56px; scrollbar-color: var(--ink-2) var(--paper); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.62 var(--sans); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; caret-color: var(--mark); }
::selection { background: var(--ink); color: var(--paper); }
a { color: inherit; text-decoration-color: var(--contour); text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { text-decoration-color: var(--mark); }
:focus-visible { outline: 1px solid var(--mark); outline-offset: 4px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
p { margin: 0 0 var(--s3); text-wrap: pretty; }
.fig { font-weight: 600; white-space: nowrap; }
.lbl { font: italic 400 0.82em var(--serif); color: var(--ink-2); margin-left: 0.3em; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip { position: absolute; left: -999px; } .skip:focus { left: var(--s3); top: var(--s3); background: var(--paper); padding: var(--s2) var(--s3); z-index: 20; }

/* ---------- Masthead ---------- */
.mast { display: flex; align-items: baseline; gap: var(--s4); padding: 18px var(--gut); font-size: 15px; position: relative; z-index: 2; }
.mast .who { font: 600 20px var(--serif); text-decoration: none; margin-right: auto; white-space: nowrap; }
.mast a:not(.who) { text-decoration: none; } .mast a:not(.who):hover { color: var(--mark); }
.theme { background: none; border: 0; color: inherit; font: italic 15px var(--serif); cursor: pointer; padding: 0; }
.theme:hover { color: var(--mark); }
@media (max-width: 560px) { .mast .hide-s { display: none; } .mast { gap: var(--s3); } .mast .who { font-size: 18px; } }

/* ---------- Cover ---------- */
.cover { position: relative; min-height: min(94vh, 900px); display: grid; align-items: end; overflow: hidden; margin-top: -62px; padding-top: 62px; }
.cover canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.cover-text { position: relative; padding: var(--s6) var(--gut) 120px; max-width: 820px; pointer-events: none; }
.cover-text a { pointer-events: auto; }
.cover h1 { font-size: clamp(54px, 9.5vw, 132px); line-height: 0.92; letter-spacing: -0.025em; margin-bottom: var(--s4);
  text-shadow: 0 0 18px var(--paper), 0 0 6px var(--paper); }
.lede { font-size: clamp(18px, 2vw, 21px); max-width: 46ch; color: var(--ink); text-shadow: 0 0 10px var(--paper), 0 0 4px var(--paper); }
.cta { display: flex; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s4); font-size: 16px; }
.cta a { font-weight: 600; }
.stamp { position: absolute; left: var(--gut); bottom: var(--s4); font: 12px var(--mono); color: var(--ink-2); display: flex; gap: var(--s4); flex-wrap: wrap; }
.cover-hint { position: absolute; right: var(--gut); bottom: var(--s4); font: italic 14px/1.4 var(--serif); color: var(--ink-2); max-width: 30ch; margin: 0; }
@media (max-width: 760px) { .cover-hint { display: none; } .cover-text { padding-bottom: 90px; } }

/* ---------- Index ---------- */
.index { max-width: var(--wide); margin: 0 auto; padding: var(--s6) var(--gut) var(--s5); }
.index-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4); }
.index h2 { font-size: clamp(30px, 4vw, 44px); }
.index-head p { color: var(--ink-2); max-width: 52ch; margin: 0; }
#atlas-map { width: 100%; min-height: 200px; border: 1px solid var(--ink); outline: 1px solid var(--rule); outline-offset: 5px; margin: var(--s3) 0 var(--s5); }
.legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); list-style: none; padding: 0; margin: 0; }
@media (max-width: 900px) { .legend { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .legend { grid-template-columns: 1fr; } }
.legend h3 { font-size: 19px; border-bottom: 1px solid var(--ink); padding-bottom: 6px; margin-bottom: 6px; }
.legend ol { list-style: none; padding: 0; margin: 0; }
.legend li a { display: grid; grid-template-columns: 3.2em 1fr; gap: 6px; padding: 5px 0; text-decoration: none; font-size: 15px; line-height: 1.35; }
.legend li a:hover { color: var(--mark); }
.legend .n { font: 12px/1.9 var(--mono); color: var(--ink-2); }

/* ---------- Chapter openers ---------- */
.chapter { position: relative; }
.opener { position: relative; padding: var(--s6) 0 var(--s4); }
.band { display: block; width: 100%; min-height: 220px; }
@media (max-width: 640px) { .band { min-height: 150px; } }
.band canvas { display: block; width: 100%; }
.opener-text { max-width: var(--wide); margin: var(--s4) auto 0; padding: 0 var(--gut); display: grid; grid-template-columns: auto 1fr; gap: 0 var(--s5); align-items: end; position: relative; }
.roman { font: 400 clamp(96px, 16vw, 210px)/0.8 var(--serif); color: var(--ink); text-shadow: 0 0 20px var(--paper), 0 0 6px var(--paper); }
.opener h2 { font-size: clamp(34px, 5vw, 64px); line-height: 1; margin-bottom: var(--s3); }
.opener p { color: var(--ink-2); max-width: 54ch; font-size: 18px; margin: 0; }
@media (max-width: 700px) { .opener-text { grid-template-columns: 1fr; } .roman { margin-bottom: var(--s3); } }

/* ---------- Plates: three tiers ---------- */
.plates { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gut); }
.plate { position: relative; display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); column-gap: var(--s4); padding: var(--s6) 0; }
.plate + .plate { border-top: 1px solid var(--rule); }
.pn { font: 400 44px/1 var(--serif); color: var(--ink-2); padding-top: 4px; }
.pn small { display: block; font: 12px var(--mono); margin-top: 8px; color: var(--ink-2); }
.plate h3 { font-size: clamp(28px, 3.4vw, 42px); line-height: 1.08; margin-bottom: var(--s3); }
.plate .q { font-size: 19px; color: var(--ink-2); max-width: 58ch; }
.plate .how { max-width: var(--measure); font-size: 16px; }
.plate .src { font: italic 14px var(--serif); color: var(--ink-2); }

/* feature: the instrument leads, text follows in three columns */
.plate.feature .body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
.plate.feature .demo { min-height: 460px; }
.plate.feature .cols { display: grid; grid-template-columns: 1.1fr 1.2fr 0.9fr; gap: var(--s5); align-items: start; }
@media (max-width: 960px) { .plate.feature .cols { grid-template-columns: 1fr; gap: var(--s3); } }
.plate.feature h3 { font-size: clamp(32px, 4.4vw, 56px); max-width: 22ch; }

/* standard: text and instrument side by side, alternating */
.plate.standard .body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s5); align-items: start; }
.plate.standard.flip .body { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.plate.standard.flip .demo { order: -1; }
@media (max-width: 960px) { .plate.standard .body, .plate.standard.flip .body { grid-template-columns: minmax(0, 1fr); } .plate.standard.flip .demo { order: 0; } }

/* note: one line of field notes; the instrument folds away */
.plate.note { padding: var(--s5) 0; }
.plate.note .body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.plate.note h3 { font-size: clamp(24px, 2.6vw, 30px); }
.plate.note details { grid-column: 1 / -1; }
.plate.note summary { cursor: pointer; font: italic 16px var(--serif); color: var(--contour-text); list-style: none; display: inline-flex; gap: 8px; align-items: center; }
.plate.note summary::-webkit-details-marker { display: none; }
.plate.note summary::before { content: ""; width: 8px; height: 8px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(-45deg); transition: transform .2s; }
.plate.note details[open] summary::before { transform: rotate(45deg); }
.plate.note details .demo { margin-top: var(--s3); }
@media (max-width: 760px) { .plate.note .body { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .plate { grid-template-columns: minmax(0, 1fr); } .pn { font-size: 32px; margin-bottom: var(--s3); } .pn small { display: inline; margin-left: 10px; } }

/* spot height: the one figure that matters, the only accent on screen */
.spot { margin: var(--s4) 0; max-width: var(--measure); }
.spot-fig { display: flex; align-items: baseline; gap: 12px; font: 500 clamp(36px, 4vw, 52px)/1 var(--serif); letter-spacing: -0.01em; }
.spot-fig::before { content: ""; width: 14px; height: 12px; background: var(--mark); clip-path: polygon(50% 0, 100% 100%, 0 100%); flex: none; transform: translateY(-4px); }
.spot-fig .fig { font-weight: 500; }
.spot-cap { margin-top: 10px; font-size: 16px; color: var(--ink); }
.spot-cap + .spot-cap { color: var(--ink-2); margin-top: 6px; }

/* ---------- The instrument frame (map neatline) ---------- */
.demo { position: relative; border: 1px solid var(--ink); outline: 1px solid var(--rule); outline-offset: 5px; padding: 26px 18px 16px; min-height: 380px;
  display: flex; flex-direction: column; gap: var(--s3); align-self: start; background:
  repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 48px) top left / 100% 6px no-repeat,
  repeating-linear-gradient(180deg, var(--ink) 0 1px, transparent 1px 48px) top left / 6px 100% no-repeat; }
.demo-head { order: 99; align-self: flex-end; text-align: right; border: 1px solid var(--ink); padding: 6px 12px 5px; background: var(--paper); max-width: 100%; }
.demo-title { display: block; font: italic 500 16px/1.3 var(--serif); }
.demo-tag { display: block; font: 11px var(--mono); color: var(--ink-2); margin-top: 2px; }
.demo canvas, .demo svg.plot { width: 100%; height: 280px; display: block; }
.plate.feature .demo canvas { height: 340px; }
.demo .ctls { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; padding-top: var(--s3); border-top: 1px solid var(--rule); }
.demo .readout { font: 13px/1.7 var(--mono); color: var(--ink-2); }
.demo .readout b { color: var(--ink); font-weight: 500; }
.demo .note { font: italic 15px/1.45 var(--serif); color: var(--ink-2); margin: 0; }
.demo.loading::after { content: "Surveying…"; position: absolute; inset: 0; display: grid; place-items: center; font: italic 15px var(--serif); color: var(--ink-2); }
.demo.failed::after { content: "This instrument failed to load. The text beside it still holds."; position: absolute; inset: 0; display: grid; place-items: center; padding: var(--s4); text-align: center; font: italic 15px var(--serif); color: var(--mark); }
.demo select { font: 13px var(--sans); color: var(--ink); background: var(--paper); border: 1px solid var(--rule); padding: 3px 6px; }

/* controls: thin survey sliders with a diamond mark */
.ctl { display: inline-flex; align-items: center; gap: var(--s2); font-size: 14px; }
.ctl-name { color: var(--ink-2); }
.ctl output { min-width: 5ch; font: 13px var(--mono); color: var(--ink); }
.ctl input[type=range] { -webkit-appearance: none; appearance: none; width: 128px; height: 18px; background: transparent; cursor: pointer; }
.ctl input[type=range]::-webkit-slider-runnable-track { height: 1px; background: var(--ink); }
.ctl input[type=range]::-moz-range-track { height: 1px; background: var(--ink); }
.ctl input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; margin-top: -5px; background: var(--paper); border: 1px solid var(--ink); transform: rotate(45deg); }
.ctl input[type=range]::-moz-range-thumb { width: 9px; height: 9px; background: var(--paper); border: 1px solid var(--ink); border-radius: 0; transform: rotate(45deg); }
.ctl input[type=range]:hover::-webkit-slider-thumb, .ctl input[type=range]:focus-visible::-webkit-slider-thumb { background: var(--ink); }
.ctl input[type=range]:focus-visible { outline: none; }
.ctl:focus-within .ctl-name { color: var(--ink); text-decoration: underline; text-decoration-color: var(--mark); text-underline-offset: 4px; }
.btn { font: 600 14px var(--sans); color: var(--ink); background: none; border: 0; border-bottom: 1px solid var(--contour); padding: 2px 0; cursor: pointer; }
.btn:hover { border-color: var(--mark); color: var(--mark); }
.btn[aria-pressed="true"] { border-bottom: 2px solid var(--ink); }
.btn:disabled { color: var(--ink-2); border-color: var(--rule); cursor: default; }

/* ---------- How I work ---------- */
.method { max-width: var(--wide); margin: 0 auto; padding: var(--s7) var(--gut) var(--s5); }
.method h2 { font-size: clamp(34px, 5vw, 64px); margin-bottom: var(--s3); }
.method > p { color: var(--ink-2); max-width: 56ch; font-size: 18px; }
.protocol { list-style: none; padding: 0; margin: var(--s5) 0; counter-reset: p; max-width: 900px; }
.protocol li { counter-increment: p; display: grid; grid-template-columns: 4.5rem 1fr; gap: var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--rule); }
.protocol li::before { content: counter(p); font: 400 40px/1 var(--serif); color: var(--ink-2); }
.protocol h3 { font-size: 22px; margin-bottom: 4px; }
.protocol p { color: var(--ink-2); margin: 0; max-width: 60ch; }
#trap { margin: var(--s5) 0; }
#trap > .ctls { display: flex; gap: var(--s2); margin: var(--s3) 0; } #trap .ctls .ctls { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; }
.authorship { margin-top: var(--s5); max-width: var(--measure); font: italic 16px/1.55 var(--serif); color: var(--ink-2); }

/* ---------- Next: an itinerary of survey stations ---------- */
#ledger { grid-column: 1 / -1; margin-top: var(--s4); }
.next { max-width: var(--wide); margin: 0 auto; padding: var(--s6) var(--gut) var(--s4); }
.next h2 { font-size: clamp(34px, 5vw, 60px); margin-bottom: var(--s3); }
.next-lede { color: var(--ink-2); font-size: 18px; max-width: 54ch; }
.itinerary { list-style: none; padding: 0; margin: var(--s5) 0 0; max-width: 920px; position: relative; }
.itinerary::before { content: ""; position: absolute; left: 7.4rem; top: 10px; bottom: 10px; border-left: 1px dashed var(--ink-2); }
.itinerary li { display: grid; grid-template-columns: 6.5rem 1fr; gap: var(--s5); padding: 0 0 var(--s5); position: relative; }
.itinerary li::after { content: ""; position: absolute; left: calc(7.4rem - 4px); top: 9px; width: 7px; height: 7px; background: var(--paper); border: 1px solid var(--ink); transform: rotate(45deg); }
.itinerary li:first-child::after { background: var(--mark); border-color: var(--mark); }
.itinerary .when { font: 13px/1.9 var(--mono); color: var(--ink-2); text-align: right; }
.itinerary h3 { font-size: 22px; margin-bottom: 4px; }
.itinerary p { color: var(--ink-2); margin: 0; max-width: 60ch; }
@media (max-width: 600px) { .itinerary::before { left: 4px; } .itinerary li { grid-template-columns: 1fr; gap: 2px; padding-left: 24px; } .itinerary li::after { left: 1px; } .itinerary .when { text-align: left; } }

/* ---------- Ending ---------- */
footer { max-width: var(--wide); margin: 0 auto; padding: var(--s6) var(--gut) 120px; }
#route { width: 100%; height: 260px; display: block; }
.contact { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--s5); margin-top: var(--s4); align-items: end; }
.contact h2 { font-size: clamp(34px, 5vw, 60px); line-height: 1; margin-bottom: var(--s3); }
.contact ul { list-style: none; padding: 0; margin: 0; }
.contact li { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.contact .note-code { font: italic 15px var(--serif); color: var(--ink-2); }
@media (max-width: 760px) { .contact { grid-template-columns: 1fr; } }

/* ---------- Locator: you are here, and the 90-second route ---------- */
.locator { position: fixed; left: 0; right: 0; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; padding: 7px var(--gut);
  background: var(--paper); border-bottom: 1px solid var(--ink); font-size: 13px; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.locator.away { transform: translateY(-110%); }
.locator .track { display: flex; gap: 3px; align-items: center; }
.locator .track i { width: 6px; height: 6px; border: 1px solid var(--ink-2); transform: rotate(45deg); }
.locator .track i.ch { width: 1px; height: 12px; border: 0; background: var(--rule); transform: none; margin: 0 3px; }
.locator .track i.on { background: var(--mark); border-color: var(--mark); }
.locator .where { font: italic 15px var(--serif); margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.locator a, .locator button { font: 600 13px var(--sans); color: var(--ink); background: none; border: 0; border-bottom: 1px solid var(--contour); padding: 0; cursor: pointer; text-decoration: none; white-space: nowrap; }
@media (max-width: 600px) { .locator .track { display: none; } .locator { gap: 12px; } }

body.short .plate:not(.feature), body.short .index, body.short .opener p, body.short .method .protocol, body.short #trap { display: none; }
body.short .plates { border-left: 1px dashed var(--mark); margin-left: calc(var(--gut) + 2rem); padding-left: var(--s4); }
body.short .opener { padding-top: var(--s6); }

@media print { .locator, .cover canvas, .band, .demo { display: none; } body { font-size: 12pt; } }

/* Compact language links share the masthead baseline. */
.languages { white-space: nowrap; font-size: 12px; }
.languages [aria-current] { text-decoration: underline !important; text-underline-offset: 3px; }
@media (max-width: 560px) { .mast { gap: 10px; flex-wrap: wrap; } .mast .who { flex-basis: 100%; } }
