:root {
  --paper: #eee7d7;
  --paper-deep: #d9cfba;
  --ink: #172d36;
  --ink-soft: #496069;
  --blue: #19677b;
  --blue-light: #8ec4c7;
  --clay: #b64b37;
  --brass: #b98833;
  --brass-light: #e0bd69;
  --hairline: rgba(23, 45, 54, 0.22);
  --shadow: 0 28px 80px rgba(28, 35, 32, 0.2);
  --measure: 70rem;
}

* { box-sizing: border-box; }

html {
  color-scheme: light;
  scroll-behavior: smooth;
  background: #26383c;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 13% 7%, rgba(255,255,255,.8), transparent 22rem),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(23,45,54,.025) 31px 32px),
    var(--paper);
  font-family: "Arial Narrow", "Roboto Condensed", "Aptos Narrow", Arial, sans-serif;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

a:hover { color: var(--clay); }

.skip-link {
  position: fixed;
  z-index: 50;
  inset: .75rem auto auto .75rem;
  transform: translateY(-180%);
  padding: .7rem 1rem;
  color: white;
  background: var(--ink);
}

.skip-link:focus { transform: none; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.1rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--hairline);
  font-size: .77rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.topbar a { text-decoration: none; }

.languages { display: flex; align-items: center; gap: .55rem; }
.languages [aria-current="page"] { color: var(--clay); }

.hero {
  position: relative;
  max-width: var(--measure);
  min-height: min(78vh, 52rem);
  margin: 0 auto;
  padding: clamp(4rem, 10vw, 8rem) clamp(1rem, 4vw, 2.5rem) 4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 24rem);
  align-items: end;
  gap: clamp(2rem, 7vw, 6rem);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  width: 1rem;
  height: 1rem;
  border-color: var(--clay);
  opacity: .6;
}

.hero::before { top: 2rem; left: 2rem; border-top: 1px solid; border-left: 1px solid; }
.hero::after { right: 2rem; bottom: 2rem; border-right: 1px solid; border-bottom: 1px solid; }

.eyebrow {
  margin: 0 0 1.25rem;
  color: var(--clay);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 12ch;
  margin-bottom: 1.4rem;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(4.25rem, 10.4vw, 9rem);
  font-weight: 900;
  letter-spacing: -.025em;
  line-height: .83;
  text-transform: uppercase;
}

.hero-lede {
  max-width: 39rem;
  margin-bottom: 0;
  font-size: clamp(1.12rem, 2vw, 1.42rem);
  line-height: 1.48;
}

.hero-number {
  align-self: center;
  padding: 1rem 0 1rem 1.25rem;
  border-left: 1px solid var(--ink);
}

.hero-number .from,
.hero-number .to {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-variant-numeric: tabular-nums;
}

.hero-number .value {
  font-family: "Courier New", monospace;
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  font-weight: 700;
  line-height: 1;
}

.hero-number .label { max-width: 10rem; color: var(--ink-soft); font-size: .78rem; line-height: 1.25; text-transform: uppercase; }
.hero-number .minus { margin: .65rem 0; color: var(--clay); font: 700 1rem/1 "Courier New", monospace; }
.hero-number .to { padding-top: .85rem; border-top: 2px solid var(--ink); }

.bench-wrap {
  position: relative;
  padding: clamp(1.5rem, 4vw, 4rem) clamp(.75rem, 3vw, 2rem) 5rem;
  background: #26383c;
}

.bench {
  position: relative;
  max-width: 84rem;
  margin: 0 auto;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255,255,255,.36), transparent 3rem),
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(23,45,54,.035) 23px 24px),
    var(--paper);
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: var(--shadow);
}

.bench-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(1.25rem, 3vw, 2.4rem);
  border-bottom: 1px solid var(--hairline);
}

.bench-kicker { margin: 0 0 .35rem; color: var(--clay); font: 700 .72rem/1.3 "Courier New", monospace; letter-spacing: .1em; text-transform: uppercase; }
.bench h2 { margin-bottom: 0; font-size: clamp(1.8rem, 3.8vw, 3.4rem); line-height: 1; text-transform: uppercase; }
.bench-instruction { max-width: 30rem; margin: 0; color: var(--ink-soft); }

.bench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(18rem, .78fr);
}

.map-panel {
  position: relative;
  min-width: 0;
  border-right: 1px solid var(--hairline);
}

.map-frame {
  position: relative;
  padding: clamp(1rem, 3vw, 2.5rem);
}

.map-frame::before {
  content: "";
  position: absolute;
  inset: 1.2rem;
  border: 1px solid var(--hairline);
  pointer-events: none;
}

.map {
  display: block;
  width: 100%;
  aspect-ratio: 1.72;
  min-height: 22rem;
  overflow: visible;
  touch-action: none;
  cursor: crosshair;
}

.country-paper {
  fill: rgba(255, 251, 237, .58);
  stroke: var(--ink);
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
}

.contour {
  fill: none;
  stroke: var(--blue);
  stroke-width: .8;
  stroke-opacity: .66;
  vector-effect: non-scaling-stroke;
}

.contour.major { stroke-width: 1.45; stroke-opacity: .9; }
.contour-label { fill: var(--blue); font: 700 12px/1 "Courier New", monospace; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; }
.grid-tick { stroke: var(--hairline); stroke-width: 1; vector-effect: non-scaling-stroke; }

.plumb-line {
  stroke: var(--clay);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.plumb-halo { fill: rgba(238, 231, 215, .82); stroke: var(--clay); stroke-width: 2; vector-effect: non-scaling-stroke; }
.plumb-point { fill: var(--brass-light); stroke: var(--ink); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.plumb-handle { cursor: grab; }
.plumb-handle:active { cursor: grabbing; }
.plumb-handle:focus { outline: none; }
.plumb-handle:focus .plumb-halo { stroke: #fff; stroke-width: 4; filter: drop-shadow(0 0 2px var(--ink)); }

.map-note {
  position: absolute;
  left: clamp(1.75rem, 4vw, 3.25rem);
  bottom: clamp(1.8rem, 4vw, 3rem);
  margin: 0;
  color: var(--ink-soft);
  font: 700 .7rem/1.3 "Courier New", monospace;
  letter-spacing: .04em;
  pointer-events: none;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  padding: 0 clamp(1rem, 3vw, 2.5rem) 1.8rem;
}

.preset {
  min-height: 2.75rem;
  padding: .55rem .8rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--hairline);
  cursor: pointer;
}

.preset:hover,
.preset:focus-visible,
.preset[aria-pressed="true"] { color: var(--paper); background: var(--ink); border-color: var(--ink); }

.readout {
  position: relative;
  padding: clamp(1.25rem, 3vw, 2.4rem);
  background: rgba(255,255,255,.16);
}

.readout::after {
  content: "";
  position: absolute;
  inset: 1rem;
  border: 1px solid var(--hairline);
  pointer-events: none;
}

.coords { position: relative; z-index: 1; margin-bottom: 2rem; color: var(--ink-soft); font: 700 .76rem/1.45 "Courier New", monospace; }

.height-row {
  position: relative;
  z-index: 1;
  padding: 1.15rem 0;
  border-top: 1px solid var(--hairline);
}

.height-row:first-of-type { border-top: 2px solid var(--ink); }
.height-row.result { border-top: 3px double var(--ink); }
.height-label { display: block; margin-bottom: .45rem; color: var(--ink-soft); font-size: .72rem; font-weight: 800; letter-spacing: .08em; line-height: 1.25; text-transform: uppercase; }
.height-value { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; font: 700 clamp(2rem, 4vw, 3.8rem)/1 "Courier New", monospace; font-variant-numeric: tabular-nums; }
.height-value small { color: var(--ink-soft); font-size: .72rem; text-transform: uppercase; }

.height-input {
  width: 7ch;
  padding: .12em .18em;
  color: var(--ink);
  background: rgba(255,255,255,.45);
  border: 1px solid var(--hairline);
  border-radius: 0;
  font: inherit;
  text-align: right;
}

.height-input:focus { outline: 3px solid var(--brass-light); outline-offset: 2px; }
.operator { color: var(--clay); }
.formula { position: relative; z-index: 1; margin: 1.35rem 0 0; font: 700 .88rem/1.5 "Courier New", monospace; }
.formula strong { color: var(--clay); }

.section-view {
  position: relative;
  min-height: 17rem;
  border-top: 1px solid var(--hairline);
  overflow: hidden;
}

.section-view svg { display: block; width: 100%; height: 17rem; }
.section-rule { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 3 6; }
.surface-ellipsoid { fill: none; stroke: var(--clay); stroke-width: 3; }
.surface-geoid { fill: none; stroke: var(--blue); stroke-width: 4; }
.section-plumb { stroke: var(--brass); stroke-width: 2; }
.section-gap { fill: var(--brass-light); stroke: var(--ink); stroke-width: 1; }
.section-text { fill: var(--ink); font: 700 13px/1 "Arial Narrow", Arial, sans-serif; letter-spacing: .05em; text-transform: uppercase; }
.section-number { fill: var(--clay); font: 700 17px/1 "Courier New", monospace; }

.story {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(5rem, 10vw, 9rem) clamp(1rem, 4vw, 2.5rem);
}

.story-grid {
  display: grid;
  grid-template-columns: minmax(12rem, .65fr) minmax(0, 1.35fr);
  gap: clamp(2.2rem, 9vw, 8rem);
  padding: clamp(3.5rem, 7vw, 6rem) 0;
  border-top: 1px solid var(--hairline);
}

.story-grid:first-child { border-top: 0; padding-top: 0; }
.story h2 { margin-bottom: .75rem; font-size: clamp(2.1rem, 5vw, 4.2rem); line-height: .96; text-transform: uppercase; }
.story .section-no { display: block; margin-bottom: 1rem; color: var(--clay); font: 700 .76rem/1 "Courier New", monospace; }
.story-copy { max-width: 43rem; font-family: Arial, Helvetica, sans-serif; font-size: clamp(1.03rem, 1.4vw, 1.17rem); line-height: 1.72; }
.story-copy p:last-child { margin-bottom: 0; }

.equation {
  display: grid;
  grid-template-columns: repeat(5, auto);
  align-items: center;
  justify-content: start;
  gap: .65rem;
  margin: 2rem 0;
  padding: 1.4rem 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  font: 700 clamp(1.5rem, 4vw, 3.4rem)/1 "Courier New", monospace;
}

.equation span:nth-child(even) { color: var(--clay); }
.range-line { margin: 2rem 0; font: 700 clamp(1.45rem, 3vw, 2.5rem)/1.25 "Courier New", monospace; }
.range-line strong { color: var(--clay); }

.sources {
  color: #edf1ec;
  background: #26383c;
}

.sources-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 7rem) clamp(1rem, 4vw, 2.5rem);
  display: grid;
  grid-template-columns: minmax(12rem, .65fr) minmax(0, 1.35fr);
  gap: clamp(2.2rem, 9vw, 8rem);
}

.sources h2 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1; text-transform: uppercase; }
.sources-copy { max-width: 44rem; font-family: Arial, Helvetica, sans-serif; line-height: 1.7; }
.sources a { color: #f2ca74; }
.source-list { padding-left: 1.15rem; }
.source-list li { margin-bottom: .75rem; }
.fine { color: #b9c7c6; font-size: .9rem; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.4rem clamp(1rem, 4vw, 2.5rem);
  color: #b9c7c6;
  background: #26383c;
  border-top: 1px solid rgba(255,255,255,.16);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.footer a { color: inherit; }

.back-to-top {
  position: fixed;
  z-index: 20;
  right: 1rem;
  bottom: 1rem;
  width: 3rem;
  height: 3rem;
  color: #fff;
  background: var(--clay);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 7px 24px rgba(0,0,0,.25);
  cursor: pointer;
  opacity: 0;
  transform: translateY(.7rem);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}

.back-to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.back-to-top:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 5.5rem; }
  .hero-number { max-width: 29rem; }
  .bench-head { align-items: start; flex-direction: column; }
  .bench-grid { grid-template-columns: 1fr; }
  .map-panel { border-right: 0; border-bottom: 1px solid var(--hairline); }
  .map { min-height: 0; }
  .readout { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
  .coords, .formula { grid-column: 1 / -1; }
  .height-row { min-width: 0; }
  .height-value { display: block; font-size: clamp(1.55rem, 7vw, 2.5rem); }
  .height-value small { display: block; margin-top: .3rem; }
  .height-input { width: 100%; }
  .story-grid, .sources-inner { grid-template-columns: 1fr; gap: 1.4rem; }
}

@media (max-width: 480px) {
  .topbar { padding-inline: 1rem; }
  .hero { padding-inline: 1rem; }
  h1 { font-size: clamp(3.65rem, 21vw, 5.25rem); }
  .hero-number .value { font-size: 2.65rem; }
  .bench-wrap { padding-inline: 0; }
  .bench { border-inline: 0; }
  .bench-head { padding: 1.25rem 1rem; }
  .map-frame { padding: 1rem .45rem; }
  .map-frame::before { inset: .75rem; }
  .map-note { left: 1.2rem; bottom: 1.15rem; font-size: .62rem; }
  .presets { padding-inline: 1rem; }
  .preset { flex: 1 1 calc(50% - .45rem); }
  .readout { padding: 1.25rem 1rem; gap: .55rem; }
  .readout::after { inset: .55rem; }
  .height-label { min-height: 2.7rem; font-size: .62rem; }
  .height-value { font-size: 1.55rem; }
  .section-view, .section-view svg { height: 14rem; min-height: 14rem; }
  .equation { grid-template-columns: repeat(5, auto); gap: .35rem; font-size: 1.38rem; }
  .footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .topbar, .presets, .back-to-top { display: none; }
  body, .sources, .footer { color: #000; background: #fff; }
  .bench-wrap { background: #fff; padding: 0; }
  .bench { box-shadow: none; }
}
