:root {
  --bg: #EEF1F4;
  --card: #FFFFFF;
  --ink: #0F1B2D;
  --ink-2: #33414F;
  --ink-3: #4A5868;
  --line: #D5DBE1;
  --line-2: #B8C2CC;
  --soft: #EEF1F4;
  --header: #0F1B2D;
  --header-ink: #FFFFFF;
  --header-ink-2: #C8D2DD;
  --header-active: #22324A;
  --accent: #B4471F;
  --accent-ink: #9A3A16;
  --accent-soft: #F3E7E1;
  --accent-line: #E2C7BA;
  --ok: #3F7D58; --ok-soft: #E3F0E7; --ok-ink: #1F5A35; --ok-line: #BFDCC8;
  --warn: #C27A12; --warn-soft: #FBEFE0; --warn-ink: #7A4A0C; --warn-line: #EED3AE;
  --bad: #B42318;
  --ocean: #DCE4EA;
  --land: #C9CEC2;
  --land-line: #AEB5A6;
  --mars: #B4471F; --moon: #2B2F36; --icy: #4A90D0; --early: #6FA04A; --other: #7A5BB0;
  --pin-ring: #FFFFFF;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E141C; --card: #16202C; --ink: #E8EDF2; --ink-2: #C3CDD7; --ink-3: #9AA7B4;
    --line: #2A3746; --line-2: #3A4A5C; --soft: #1D2936; --header: #0A0F15; --header-active: #1E2B3B;
    --accent: #E07A50; --accent-ink: #F0A07C; --accent-soft: #3A2219; --accent-line: #5A3324;
    --ok: #6CBF8A; --ok-soft: #173023; --ok-ink: #A6DDB8; --ok-line: #2A5039;
    --warn: #E3A447; --warn-soft: #33260F; --warn-ink: #F2CB8A; --warn-line: #57421C; --bad: #F07468;
    --ocean: #1A2633; --land: #2E3A2F; --land-line: #435244;
    --moon: #B8C0CA; --pin-ring: #0E141C;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E141C; --card: #16202C; --ink: #E8EDF2; --ink-2: #C3CDD7; --ink-3: #9AA7B4;
  --line: #2A3746; --line-2: #3A4A5C; --soft: #1D2936; --header: #0A0F15; --header-active: #1E2B3B;
  --accent: #E07A50; --accent-ink: #F0A07C; --accent-soft: #3A2219; --accent-line: #5A3324;
  --ok: #6CBF8A; --ok-soft: #173023; --ok-ink: #A6DDB8; --ok-line: #2A5039;
  --warn: #E3A447; --warn-soft: #33260F; --warn-ink: #F2CB8A; --warn-line: #57421C; --bad: #F07468;
  --ocean: #1A2633; --land: #2E3A2F; --land-line: #435244;
  --moon: #B8C0CA; --pin-ring: #0E141C;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
details.more > summary { cursor: pointer; font-size: 15px; font-weight: 600; list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; font-family: var(--mono); color: var(--ink-3); }
details.more[open] > summary::after { content: "−"; }
details.more[open] > summary { margin-bottom: 14px; }
details.more > .stack { gap: 22px; }
html, body { margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--accent-ink); }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }

/* Header */
.site-header { background: var(--header); color: var(--header-ink); }
.site-header .inner { max-width: 1440px; margin: 0 auto; padding: 12px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--header-ink); text-decoration: none; }
.brand:hover { color: var(--header-ink); }
.brand span { font-size: 19px; font-weight: 600; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
.site-nav a { color: var(--header-ink-2); text-decoration: none; padding: 10px 14px; border-radius: 6px; font-size: 15px; }
.site-nav a:hover { color: var(--header-ink); background: var(--header-active); }
.site-nav a[aria-current="page"] { color: var(--header-ink); background: var(--header-active); }
.cite-btn { color: #0F1B2D; background: #FFFFFF; text-decoration: none; padding: 10px 16px; border-radius: 6px; font-size: 14px; font-weight: 600; }
.cite-btn:hover { color: #0F1B2D; background: #E9EDF1; }

/* Layout */
main { max-width: 1440px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.pad { padding: 20px 24px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); font-weight: 600; }
.chip.ok { background: var(--ok-soft); color: var(--ok-ink); border-color: var(--ok-line); font-weight: 600; }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); border-color: var(--warn-line); }
.tag { font-size: 14px; padding: 5px 11px; border-radius: 6px; background: var(--soft); border: 1px solid var(--line); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); text-decoration: none; font-size: 15px; cursor: pointer; }
.btn:hover { color: var(--ink); background: var(--soft); }
.btn.primary { background: var(--ink); color: var(--card); border-color: var(--ink); font-weight: 600; }
.btn.primary:hover { opacity: 0.9; color: var(--card); }
.btn.go { background: var(--accent); border-color: var(--accent); color: #FFFFFF; font-weight: 600; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--pin-ring); box-shadow: 0 0 0 1px var(--line-2); flex: none; }
.meter { display: flex; gap: 3px; align-items: center; }
.meter span { width: 16px; height: 6px; border-radius: 3px; background: var(--line); }
.meter.big span { flex: 1; height: 8px; border-radius: 4px; }
dl.facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
dl.facts.one { grid-template-columns: 1fr; }
dl.facts dt { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
dl.facts dd { margin: 4px 0 0; font-size: 15px; }

/* Map page */
.filters { flex: 1 1 260px; max-width: 100%; padding: 20px; display: flex; flex-direction: column; gap: 22px; }
.filters fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.filters legend { padding: 0; margin-bottom: 10px; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 12px; height: 44px; background: var(--card); }
.search input { border: 0; outline: none; flex: 1; min-width: 0; background: transparent; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { font-size: 14px; padding: 8px 12px; min-height: 40px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--card); border-color: var(--ink); }
.chips button .n { font-family: var(--mono); font-size: 12px; opacity: 0.75; margin-left: 4px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
input[type=range] { width: 100%; accent-color: var(--accent); }
select { height: 44px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; background: var(--card); font-size: 15px; }
.content { flex: 999 1 640px; min-width: 0; display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.mapcol { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.mapcol .head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.mapbox { padding: 12px; }
#map { width: 100%; aspect-ratio: 16 / 10; min-height: 300px; border-radius: 6px; background: var(--ocean); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 12px 4px 2px; font-size: 13px; color: var(--ink-2); align-items: center; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend .layer { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.legend .layer button { font-size: 12px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2); cursor: pointer; }
.legend .layer button[aria-pressed="true"] { background: var(--soft); color: var(--ink); font-weight: 600; }
.tablewrap { overflow-x: auto; }
table.sites { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
table.sites th { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 600; }
table.sites th button { all: unset; cursor: pointer; }
table.sites th button:focus-visible { outline: 2px solid var(--accent); }
table.sites td { padding: 10px 16px; border-bottom: 1px solid var(--soft); vertical-align: top; }
table.sites tr.sel td { background: var(--accent-soft); }
table.sites td .name { font: inherit; font-weight: 600; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.empty { padding: 24px; text-align: center; color: var(--ink-3); }
.selected { flex: 1 1 300px; min-width: 0; overflow: hidden; }
.selected .bar { height: 6px; }
.selected h2 { font-size: 24px; }
.leaflet-container { font-family: var(--sans); background: var(--ocean); }
.leaflet-tooltip { font-family: var(--sans); font-size: 13px; }

/* Site page */
.crumbs { font-size: 14px; color: var(--ink-3); display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs [aria-current] { color: var(--ink); }
.hero .bar { height: 6px; border-radius: 10px 10px 0 0; }
.hero .inner { padding: 24px 28px; display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: flex-end; justify-content: space-between; }
.hero h1 { font-size: 40px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.maincol { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.sidecol { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.section h2 { font-size: 21px; }
.section h3 { font-size: 16px; margin-top: 6px; }
.section p { font-size: 16px; line-height: 1.6; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.tile { background: var(--soft); border-radius: 8px; padding: 14px 16px; }
.tile .v { font-family: var(--mono); font-size: 22px; font-weight: 500; margin-top: 6px; }
ol.refs { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.5; }
ol.refs .meta { font-size: 13px; color: var(--ink-3); }
#minimap { width: 100%; aspect-ratio: 4 / 3; border-radius: 6px; background: var(--ocean); }
.note { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 10px; padding: 18px 22px; }
.note h2 { font-size: 16px; color: var(--accent-ink); margin-bottom: 6px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* Form page */
form.stack { gap: 24px; }
fieldset.card { margin: 0; padding: 24px 28px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
fieldset.card legend { float: left; width: 100%; padding: 0; font-size: 21px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field .hint { font-weight: 400; color: var(--ink-3); }
.field input[type=text], .field input[type=email], .field input[type=number], .field textarea, .field select { font-weight: 400; font-size: 15px; min-height: 44px; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 12px; background: var(--card); }
.field textarea { resize: vertical; min-height: 96px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 20px; font-size: 15px; }
.level { font: inherit; text-align: left; display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 8px; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink); width: 100%; }
.level[aria-pressed="true"] { border-color: var(--ink); background: var(--soft); box-shadow: inset 0 0 0 1px var(--ink); }
.level .n { font-family: var(--mono); font-weight: 500; width: 20px; }
.err { color: var(--bad); font-size: 13px; font-weight: 400; }
.banner { border-radius: 10px; padding: 16px 20px; font-size: 15px; }
.banner.ok { background: var(--ok-soft); border: 1px solid var(--ok-line); color: var(--ok-ink); }
.banner.warn { background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn-ink); }
#pickmap { width: 100%; aspect-ratio: 2 / 1; min-height: 220px; border-radius: 8px; border: 1px solid var(--line); background: var(--ocean); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.steps a { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; }
.steps a:hover { background: var(--soft); color: var(--ink); }
.steps .n { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-2); display: flex; align-items: center; justify-content: center; font-size: 13px; flex: none; }

/* About page */
.prose { max-width: 820px; }
.prose h2 { font-size: 22px; margin: 8px 0 4px; }
.prose p, .prose li { font-size: 16px; line-height: 1.65; }
.prose ul { margin: 0; padding-left: 22px; }
.prose code, .cite-box { font-family: var(--mono); font-size: 14px; }
.cite-box { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; line-height: 1.6; }
table.scale { width: 100%; border-collapse: collapse; font-size: 15px; }
table.scale th, table.scale td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.scale th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--card); }
.site-footer .inner { max-width: 1440px; margin: 0 auto; padding: 18px 24px; display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: 13px; color: var(--ink-2); }
.site-footer .wide { flex: 1 1 320px; }

@media (max-width: 640px) {
  main { padding: 16px; }
  .site-header .inner { padding: 12px 16px; }
  .hero h1 { font-size: 30px; }
  .hero .inner, fieldset.card, .pad { padding: 18px 16px; }
  dl.facts { grid-template-columns: 1fr; }
}

/* Map page layout: filters | big map | selected site */
main.wide { max-width: 1680px; }
.maplayout .filters { flex: 0 1 270px; }
.maplayout .mapcol { flex: 999 1 560px; }
#map.bigmap { aspect-ratio: 2 / 1; height: auto; min-height: 0; }
.mapwrap { position: relative; }
.preview { position: absolute; left: 12px; bottom: 12px; z-index: 1001; width: 310px; max-height: calc(100% - 24px); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 24px rgba(15, 27, 45, 0.18); }
.preview .bar { height: 5px; }
.preview .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.preview h2 { font-size: 17px; padding-right: 28px; }
.preview .loc { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview.right { left: auto; right: 12px; }
.preview .sum { font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.preview .mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 13px; }
.preview .mini > div { display: flex; flex-direction: column; gap: 4px; }
.preview .mini .label { font-size: 11px; }
.preview .chip { font-size: 12px; padding: 2px 8px; }
.preview .close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 6px; border: 0; background: transparent; color: var(--ink-3); font-size: 22px; line-height: 1; cursor: pointer; }
.preview .close:hover { background: var(--soft); color: var(--ink); }
.legend .layer button { font-size: 13px; padding: 6px 10px; }
.mapbox .empty { padding: 12px 4px 0; }
table.sites td a.name { color: var(--ink); text-decoration: none; }
table.sites td a.name:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .preview { position: static; width: auto; max-height: none; box-shadow: none; margin-top: 12px; }
}
@media (max-width: 700px) {
  .maplayout .filters { flex: 1 1 100%; }
}

/* Grey place names on maps */
.maplabel { pointer-events: none; }
.maplabel span { display: block; transform: translate(-50%, -50%); white-space: nowrap; color: var(--ink-3); text-align: center; text-shadow: 0 0 3px var(--land), 0 0 2px var(--land); }
.maplabel.continent span { font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.75; }
.maplabel.ocean span { font-size: 12px; font-style: italic; letter-spacing: 0.08em; opacity: 0.7; text-shadow: 0 0 3px var(--ocean); }
.maplabel.country span { font-size: 11px; opacity: 0.85; }

/* Site photos */
.photos { overflow: hidden; }
.hero-photo { margin: 0; background: #0F1B2D; }
.hero-photo img { display: block; width: 100%; height: clamp(240px, 42vw, 520px); object-fit: cover; }
.hero-photo figcaption { padding: 10px 16px; font-size: 14px; color: var(--ink-2); background: var(--card); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.hero-photo .credit { font-size: 12px; color: var(--ink-3); }
.thumbs { display: flex; gap: 8px; padding: 0 16px 14px; background: var(--card); flex-wrap: wrap; }
.thumbs button { padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; cursor: pointer; background: none; width: 96px; height: 64px; }
.thumbs button[aria-pressed="true"] { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Side-by-side comparison */
.compare h2 { font-size: 21px; }
.compare p { font-size: 15px; line-height: 1.6; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 0 24px 16px; }
.pane { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pane-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pane-head strong { font-size: 16px; }
.cmap { width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; background: #000; border: 1px solid var(--line); }
#earthMap { background: var(--ocean); }
.ctrls { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 14px; }
.ctrls .small { font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.ctrls select { height: 36px; font-size: 14px; max-width: 230px; }
.check.small input { width: 16px; height: 16px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { font-size: 13px; padding: 7px 10px; border: 0; background: var(--card); color: var(--ink-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--card); }
.info { font-size: 13px; line-height: 1.5; min-height: 20px; }
.keyitem { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; white-space: nowrap; }
.keydot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid #FFFFFF; box-shadow: 0 0 0 1px var(--line-2); }
.ramp { display: inline-block; width: 90px; height: 8px; border-radius: 4px; vertical-align: middle; margin-right: 6px; background: linear-gradient(90deg, #2C3E9E, #2E86DE, #27AE60, #F1C40F, #E67E22, #C0392B); }
@media (max-width: 760px) { .pair { grid-template-columns: 1fr; padding: 0 16px 16px; } }

/* Thumbnail in the map preview card */
.preview .thumb { display: block; width: 100%; height: 120px; object-fit: cover; }
.preview .close { top: 12px; background: var(--card); box-shadow: 0 1px 4px rgba(0,0,0,0.2); }
.cmap .leaflet-control-attribution { font-size: 10px; line-height: 1.3; max-width: 100%; }

/* Side-by-side panes: fixed header height so the two maps line up */
.pane-head { min-height: 44px; align-items: flex-end; }
.key { font-size: 12px; margin-top: 4px; }
.key summary { cursor: pointer; font-size: 13px; color: var(--muted, #555); margin-bottom: 6px; }
.keygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 12px; max-height: 260px; overflow: auto; padding-right: 4px; }
.keygrid .keyitem { white-space: normal; }
.keysw { width: 14px; height: 14px; border: 1px solid #888; border-radius: 3px; display: inline-block; flex: none; }
