:root {
  --ink: #15231b;
  --ink-soft: #4d5e55;
  --paper: #eef2ef;
  --panel: #ffffff;
  --rule: #d3dcd6;
  --patch: #1747e0;
  --gran: #1f5a3a;
  --tall: #9a6a2f;
  --lov: #8fb25a;
  --unjudged: #c9d0cc;
  --focus: #1747e0;
  --r0: #fdeec4;
  --r1: #fbd384;
  --r2: #f5a54a;
  --r3: #de6a27;
  --r4: #b1401a;
  --r5: #74250c;
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Libre Franklin', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-direction: column;
}

h1, h2, p { margin: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

button, .button {
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
}

.button {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  padding: 12px 22px;
  font-weight: 600;
  text-decoration: none;
}
.button:hover { background: #26392d; }

.quiet {
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 6px 12px;
  font-size: 14px;
}
.quiet:hover { border-color: var(--ink-soft); }

/* Masthead: the title is the page's one loud element. */
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 22px 28px 18px;
  background: var(--ink);
  color: #fff;
}
.masthead h1 {
  font-size: clamp(26px, 3.1vw, 44px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 30ch;
}
.lede {
  margin-top: 10px;
  max-width: 62ch;
  font-size: clamp(15px, 1.2vw, 19px);
  color: #cfe0d5;
}
.who { display: flex; gap: 12px; align-items: center; font-size: 14px; color: #cfe0d5; white-space: nowrap; }
.who .quiet { color: #fff; border-color: #50665a; }

.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 30vw);
}
.stage:has(> .rail[hidden]) { grid-template-columns: minmax(0, 1fr); }

.map-wrap { position: relative; min-height: 420px; }
.map { position: absolute; inset: 0; }

.rail {
  background: var(--panel);
  border-left: 1px solid var(--rule);
  overflow-y: auto;
}
.block { padding: 22px 24px; border-bottom: 1px solid var(--rule); }
.block h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }

.headline-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.headline-figures p { display: flex; flex-direction: column; }
.headline-figures strong {
  font-size: clamp(34px, 3.4vw, 54px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.headline-figures span { margin-top: 6px; color: var(--ink-soft); font-size: 14px; line-height: 1.3; }

.species { margin-top: 22px; }
.species-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 10px; margin-bottom: 8px; }
.species-label { font-size: 14px; color: var(--ink-soft); }
.bar { display: flex; height: 20px; border-radius: 3px; overflow: hidden; background: var(--paper); }
.bar span { display: block; height: 100%; }
.bar .gran { background: var(--gran); }
.bar .tall { background: var(--tall); }
.bar .lov { background: var(--lov); }

.species-table, .ranked { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 15px; }
.species-table th, .ranked th {
  text-align: right; font-weight: 600; font-size: 13px; color: var(--ink-soft);
  padding: 6px 6px; border-bottom: 1px solid var(--rule);
}
.species-table th:first-child, .ranked th:first-child { text-align: left; }
.species-table td, .ranked td { text-align: right; padding: 7px 6px; border-bottom: 1px solid #edf1ee; }
.species-table td:first-child, .ranked td:first-child { text-align: left; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }

.county, .coverage { margin-top: 16px; font-size: 15px; color: var(--ink); max-width: 60ch; }
.coverage { color: var(--ink-soft); }

.drone .why { margin-top: 6px; color: var(--ink-soft); font-size: 15px; }
.ranked tbody tr { cursor: pointer; }
.ranked tbody tr:hover, .ranked tbody tr[aria-selected='true'] { background: #eaf0fe; }
.ranked tbody tr:focus-visible { outline-offset: -3px; }
.ranked td.rank { font-weight: 700; }
.method-tag { font-size: 13px; color: var(--ink-soft); }
.more { margin-top: 12px; }

.method p { margin-top: 10px; font-size: 15px; max-width: 62ch; }
.method .fine { font-size: 13px; color: var(--ink-soft); }

/* Map furniture */
.legend, .compare, .notice {
  position: absolute;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(21, 35, 27, 0.18), 0 6px 20px rgba(21, 35, 27, 0.12);
}
.legend { left: 16px; bottom: 30px; padding: 12px 14px; font-size: 13px; max-width: 290px; }
.legend-title { font-weight: 600; margin-bottom: 8px; }
.ramp { list-style: none; margin: 0 0 10px; padding: 0; display: flex; }
.ramp li { flex: 1; font-size: 12px; color: var(--ink-soft); }
.ramp li::before { content: ''; display: block; height: 12px; margin-bottom: 3px; background: var(--c); }
.legend-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.swatch { width: 18px; height: 12px; display: inline-block; }
.swatch.patch { border: 2px solid var(--patch); background: rgba(23, 71, 224, 0.2); }
.swatch.unjudged { background: var(--unjudged); }

.compare { left: 16px; top: 16px; width: 320px; padding: 14px 16px 16px; }
.compare-head { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.compare-title { font-weight: 700; font-size: 16px; }
.close { background: none; border: 0; font-size: 24px; line-height: 1; padding: 0 4px; color: var(--ink-soft); }
.cell-facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 10px 0 12px; font-size: 14px; }
.cell-facts dt { color: var(--ink-soft); }
.cell-facts dd { margin: 0; text-align: right; font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--ink); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: var(--panel); color: var(--ink); padding: 8px 20px; font-weight: 600; }
.seg button[aria-pressed='true'] { background: var(--ink); color: #fff; }
.fade { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--ink-soft); }
.fade input { flex: 1; accent-color: var(--ink); }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; }
.no-images { font-size: 14px; color: var(--ink-soft); }

.notice {
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(460px, calc(100% - 32px));
  padding: 26px 28px;
}
.notice h2 { font-size: 22px; font-weight: 700; }
.notice p { margin-top: 8px; color: var(--ink-soft); }
.notice .button { margin-top: 18px; }

.rank-marker {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--patch); color: #fff; border: 2px solid #fff;
  display: grid; place-items: center;
  font: 700 13px/1 'Libre Franklin', system-ui, sans-serif;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

@media (max-width: 900px) {
  .masthead { padding: 18px 16px 14px; flex-direction: column; align-items: flex-start; }
  .stage { display: flex; flex-direction: column; }
  .map-wrap { height: 62vh; flex: none; }
  .rail { border-left: 0; overflow: visible; }
  .block { padding: 18px 16px; }
  .compare { left: 8px; right: 8px; top: 8px; width: auto; }
  .legend { left: 8px; bottom: 26px; }
  .species-row { grid-template-columns: 1fr; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
