:root {
  --bg: #f6f1e7;
  --bg-surface: #fffdf8;
  --bg-raised: #ece4d2;
  --bg-deep: #1c1712;
  --text-primary: #1e1810;
  --text-secondary: #4b4132;
  --text-muted: #675b48;
  --accent: #8a5a12;
  --accent-strong: #6e4408;
  --border: #d9cfb8;
  --border-strong: #b7a985;
  --cultural: #b4571c;
  --cultural-strong: #8d4213;
  --natural: #2f7a4a;
  --natural-strong: #205a35;
  --danger: #b8232f;
  --danger-strong: #8e1a24;
  --map-bg: #efe8d8;
  --map-land: #e3d9c1;
  --map-county: #c9bc9c;
  --map-outline: #7a6a4a;
  --map-water: #cfdde3;
  --map-label: #2a2218;
  --map-dim: #b9ad92;
  --shadow: 0 1px 3px rgba(40, 30, 10, 0.14), 0 8px 24px rgba(40, 30, 10, 0.08);
  --focus: #1d5fae;
  --hero-ink: #f6efe0;
  --hero-sub: #cdbf9e;
  --gold: #d8a94a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141110; --bg-surface: #1c1815; --bg-raised: #262019; --bg-deep: #0f0c0a;
    --text-primary: #f2eadb; --text-secondary: #cfc3a8; --text-muted: #ab9e82;
    --accent: #dfae5c; --accent-strong: #eec277; --border: #3a3226; --border-strong: #55492f;
    --cultural: #e08a4d; --cultural-strong: #f0a86f; --natural: #5db97c; --natural-strong: #82d19c;
    --danger: #ef6b74; --danger-strong: #f59aa0;
    --map-bg: #17130f; --map-land: #262019; --map-county: #3b3325; --map-outline: #b19a6c; --map-water: #1f2a30;
    --map-label: #f2eadb; --map-dim: #4b4130;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.35); --focus: #7ab4ff;
    --hero-ink: #f6efe0; --hero-sub: #cdbf9e; --gold: #e3b45a;
  }
}
:root[data-theme="dark"] {
  --bg: #141110; --bg-surface: #1c1815; --bg-raised: #262019; --bg-deep: #0f0c0a;
  --text-primary: #f2eadb; --text-secondary: #cfc3a8; --text-muted: #ab9e82;
  --accent: #dfae5c; --accent-strong: #eec277; --border: #3a3226; --border-strong: #55492f;
  --cultural: #e08a4d; --cultural-strong: #f0a86f; --natural: #5db97c; --natural-strong: #82d19c;
  --danger: #ef6b74; --danger-strong: #f59aa0;
  --map-bg: #17130f; --map-land: #262019; --map-county: #3b3325; --map-outline: #b19a6c; --map-water: #1f2a30;
  --map-label: #f2eadb; --map-dim: #4b4130;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.35); --focus: #7ab4ff;
  --hero-ink: #f6efe0; --hero-sub: #cdbf9e; --gold: #e3b45a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }
body { margin: 0; background: var(--bg); color: var(--text-primary); font-family: "Fraunces", Georgia, "Iowan Old Style", serif; line-height: 1.6; font-size: 1.04rem; }
.sans, .kicker, .byline, .topbar, .chip, .console, .stat, .legend, table, .site-meta, figcaption, .map-caption, .rail .label, .tag, .crit, details summary, .search, .site-footer, .pager, .tl-date, .side { font-family: "Inter", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; }
a { color: var(--accent-strong); }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
section, article[id] { scroll-margin-top: 3.6rem; }
img { max-width: 100%; height: auto; }

/* Top bar ------------------------------------------------------------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 0.9rem; height: 3.1rem; padding: 0 1rem; background: var(--bg-surface); border-bottom: 1px solid var(--border); }
.topbar .home { font-size: 0.82rem; color: var(--text-secondary); text-decoration: none; white-space: nowrap; }
.topbar .home:hover { color: var(--accent-strong); }
.topnav { display: flex; gap: 1rem; overflow-x: auto; scrollbar-width: none; white-space: nowrap; font-size: 0.85rem; min-width: 0; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { text-decoration: none; color: var(--text-secondary); padding: 0.3rem 0; border-bottom: 2px solid transparent; }
.topnav a[aria-current="true"], .topnav a:hover { color: var(--accent-strong); border-bottom-color: var(--accent-strong); }
.spacer { flex: 1; }
.chip { font-size: 0.78rem; text-decoration: none; color: var(--text-secondary); border: 1px solid var(--border-strong); border-radius: 999px; padding: 0.25rem 0.7rem; white-space: nowrap; }
.chip:hover { color: var(--accent-strong); border-color: var(--accent-strong); }
.icon-btn { width: 2rem; height: 2rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; padding: 0; }
.icon-btn:hover { color: var(--accent-strong); border-color: var(--accent-strong); }
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }

/* Hero ------------------------------------------------------------------ */
.hero { background: var(--bg-deep); color: var(--hero-ink); padding: 2.6rem 1.3rem 1.2rem; }
.hero-inner { max-width: 72rem; margin: 0 auto; }
.kicker { font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--hero-sub); margin: 0 0 0.6rem; }
.hero h1 { font-size: clamp(1.9rem, 4.6vw, 3.3rem); line-height: 1.1; margin: 0 0 1rem; font-weight: 500; letter-spacing: -0.01em; max-width: 24ch; font-variation-settings: "SOFT" 60, "opsz" 144; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero .deck { font-size: 1.15rem; line-height: 1.5; color: var(--hero-sub); max-width: 44rem; margin: 0 0 1rem; }
.hero .byline { font-size: 0.8rem; color: var(--hero-sub); margin: 0 0 1.2rem; opacity: 0.85; }

/* Map console -------------------------------------------------------- */
.console { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1rem; align-items: start; }
.map-box { position: relative; background: var(--map-bg); border-radius: 0.8rem; overflow: hidden; border: 1px solid rgba(255,255,255,0.07); }
.map-svg { width: 100%; height: auto; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.map-svg .county { fill: var(--map-land); stroke: var(--map-county); stroke-width: 0.7; }
.map-svg .land { fill: none; stroke: var(--map-outline); stroke-width: 1.3; }
.map-svg .pt { cursor: pointer; transition: opacity 0.35s, r 0.25s; }
.map-svg .pt.cultural { fill: var(--cultural); }
.map-svg .pt.natural { fill: var(--natural); }
.map-svg .pt.danger { fill: var(--danger); }
.map-svg .pt.dim { opacity: 0.12; pointer-events: none; }
.map-svg .pt.sel { stroke: var(--gold); stroke-width: 2.2; }
.map-svg .halo { fill: none; stroke: var(--gold); stroke-width: 1.4; opacity: 0.9; pointer-events: none; }
.map-svg .lbl { font-family: "Inter", -apple-system, sans-serif; font-size: 11px; fill: var(--map-label); pointer-events: none; paint-order: stroke; stroke: var(--map-bg); stroke-width: 3px; stroke-linejoin: round; }
.map-tools { position: absolute; right: 0.6rem; top: 0.6rem; display: flex; flex-direction: column; gap: 0.3rem; }
.map-tools button { width: 2rem; height: 2rem; border-radius: 0.4rem; border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--text-primary); font-size: 1.05rem; cursor: pointer; line-height: 1; padding: 0; }
.map-tools button:hover { border-color: var(--accent-strong); color: var(--accent-strong); }
.map-hint { position: absolute; left: 0.7rem; bottom: 0.5rem; font-size: 0.72rem; color: var(--text-muted); pointer-events: none; }
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0 0.4rem; }
.filters button, .steps button { font: inherit; font-size: 0.8rem; border: 1px solid rgba(255,255,255,0.22); background: transparent; color: var(--hero-ink); border-radius: 999px; padding: 0.32rem 0.75rem; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem; }
.filters button[aria-pressed="true"] { background: var(--hero-ink); color: var(--bg-deep); border-color: var(--hero-ink); }
.filters .sw { width: 0.6rem; height: 0.6rem; border-radius: 999px; display: inline-block; }
.sw.cultural { background: #e08a4d; } .sw.natural { background: #5db97c; } .sw.danger { background: #ef6b74; }
.steps { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0 0; }
.steps button[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--bg-deep); font-weight: 600; }
.steps .n { opacity: 0.7; font-variant-numeric: tabular-nums; }
.side { background: var(--bg-surface); color: var(--text-primary); border-radius: 0.8rem; padding: 1rem 1.1rem; min-height: 12rem; box-shadow: var(--shadow); font-size: 0.9rem; }
.side h2 { font-family: "Fraunces", Georgia, serif; font-size: 1.15rem; margin: 0 0 0.35rem; line-height: 1.25; }
.side .site-line { color: var(--text-muted); font-size: 0.8rem; margin: 0 0 0.6rem; }
.side dl { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.7rem; margin: 0.4rem 0 0.7rem; }
.side dt { color: var(--text-muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 0.15rem; }
.side dd { margin: 0; }
.side .story { color: var(--text-secondary); line-height: 1.5; }
.side .story strong { color: var(--text-primary); }
.side .more { display: inline-block; margin-top: 0.4rem; font-size: 0.82rem; }
.side .close { float: right; background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 0 0 0.5rem; }
.side .close:hover { color: var(--accent-strong); }
.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; font-size: 0.76rem; color: var(--hero-sub); margin: 0.6rem 0 0; }
.legend .sw { width: 0.55rem; height: 0.55rem; border-radius: 999px; display: inline-block; margin-right: 0.3rem; vertical-align: middle; }
.map-caption { font-size: 0.78rem; color: var(--hero-sub); margin: 0.6rem 0 0; }
.tip { position: absolute; pointer-events: none; background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border); border-radius: 0.4rem; padding: 0.3rem 0.55rem; font-size: 0.76rem; box-shadow: var(--shadow); transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; max-width: 18rem; overflow: hidden; text-overflow: ellipsis; z-index: 5; }
.tip[hidden] { display: none; }

/* Body -------------------------------------------------------------- */
main { max-width: 44rem; margin: 0 auto; padding: 0 1.3rem; }
main .wide { max-width: 72rem; margin-left: calc(50% - 36rem); margin-right: calc(50% - 36rem); }
@media (max-width: 76rem) { main .wide { margin-left: 0; margin-right: 0; } }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); margin: 3rem 0 0.9rem; line-height: 1.2; font-weight: 500; }
h3 { font-size: 1.15rem; margin: 1.6rem 0 0.5rem; font-weight: 600; }
p { margin: 0 0 1.05rem; }
.lede { font-size: 1.14rem; }
.note { background: var(--bg-raised); border-left: 3px solid var(--accent); border-radius: 0.3rem; padding: 0.9rem 1.1rem; margin: 1.3rem 0; font-size: 0.96rem; }
.note.danger { border-left-color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.7rem; margin: 1.2rem 0 1.6rem; }
.stat { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 0.6rem; padding: 0.8rem 0.9rem; }
.stat b { display: block; font-family: "Fraunces", Georgia, serif; font-size: 1.9rem; font-weight: 500; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.78rem; color: var(--text-muted); }
.stat.cultural b { color: var(--cultural-strong); } .stat.natural b { color: var(--natural-strong); } .stat.danger b { color: var(--danger-strong); }

/* Site cards ----------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1.4rem; margin: 1.4rem 0; }
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 0.9rem; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card.feature { grid-column: 1 / -1; }
.card figure { margin: 0; position: relative; }
.card figure img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.card.feature figure img { aspect-ratio: 21 / 9; }
.card figcaption { font-size: 0.72rem; color: var(--text-muted); padding: 0.4rem 1.1rem 0; }
.card figcaption a { color: var(--text-muted); }
.card .tags { position: absolute; top: 0.7rem; left: 0.7rem; display: flex; gap: 0.35rem; flex-wrap: wrap; }
.tag { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.22rem 0.55rem; border-radius: 999px; background: rgba(20, 15, 10, 0.72); color: #fff; backdrop-filter: blur(3px); }
.tag.cultural { background: #8d4213; } .tag.natural { background: #205a35; } .tag.danger { background: #8e1a24; }
.card-body { padding: 0.9rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.card h3 { margin: 0; font-size: 1.35rem; line-height: 1.2; font-weight: 500; }
.card .kind { font-size: 0.82rem; color: var(--text-muted); margin: 0; }
.card .lede { font-size: 1rem; margin: 0.2rem 0 0; }
.card .body { font-size: 0.95rem; color: var(--text-secondary); margin: 0; }
.card .hook { font-size: 0.92rem; margin: 0.2rem 0 0; padding: 0.55rem 0.8rem; background: var(--bg-raised); border-radius: 0.4rem; border-left: 3px solid var(--gold); }
.site-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.45rem 0.8rem; font-size: 0.8rem; color: var(--text-secondary); margin: 0.4rem 0 0; padding: 0.7rem 0 0; border-top: 1px solid var(--border); }
.site-meta span { display: block; color: var(--text-muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; }
.crits { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.2rem 0 0; }
.crit { font-size: 0.74rem; padding: 0.2rem 0.55rem; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text-secondary); }
.crit b { color: var(--text-primary); }
details { margin: 0.4rem 0 0; }
details summary { cursor: pointer; font-size: 0.84rem; color: var(--accent-strong); font-weight: 600; }
details ol, details ul { font-size: 0.86rem; color: var(--text-secondary); margin: 0.5rem 0 0; padding-left: 1.3rem; }
details li { margin-bottom: 0.25rem; }
.card-links { display: flex; gap: 0.7rem 1.1rem; flex-wrap: wrap; font-size: 0.82rem; margin-top: auto; padding-top: 0.5rem; }

/* Tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 1rem 0; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .sw { width: 0.55rem; height: 0.55rem; border-radius: 999px; display: inline-block; margin-right: 0.35rem; }
.search { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.8rem 0; align-items: center; }
.search input, .search select { font: inherit; font-size: 0.9rem; padding: 0.45rem 0.7rem; border: 1px solid var(--border-strong); border-radius: 0.4rem; background: var(--bg-surface); color: var(--text-primary); min-width: 0; }
.search input { flex: 1 1 14rem; }
.search .count { font-size: 0.8rem; color: var(--text-muted); }
.pager { display: flex; align-items: center; gap: 0.8rem; margin: 0.6rem 0 1rem; font-size: 0.84rem; color: var(--text-muted); }
.pager button { font: inherit; font-size: 0.84rem; padding: 0.45rem 0.9rem; border: 1px solid var(--border-strong); border-radius: 0.4rem; background: var(--bg-surface); color: var(--text-primary); cursor: pointer; }
.pager button:hover { border-color: var(--accent-strong); color: var(--accent-strong); }
.pager button[disabled] { opacity: 0.5; cursor: default; }
.tbl-empty { color: var(--text-muted); font-style: italic; }
.locate { font: inherit; font-size: 0.8rem; color: var(--accent-strong); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }

/* Timeline ---------------------------------------------------------- */
.timeline { list-style: none; padding: 0; margin: 1.2rem 0; border-left: 2px solid var(--border-strong); }
.timeline li { position: relative; padding: 0 0 1rem 1.3rem; }
.timeline li::before { content: ""; position: absolute; left: -0.42rem; top: 0.45rem; width: 0.7rem; height: 0.7rem; border-radius: 999px; background: var(--cultural); }
.timeline li.natural::before { background: var(--natural); }
.timeline li.danger::before { background: var(--danger); }
.tl-date { font-size: 0.78rem; color: var(--text-muted); letter-spacing: 0.03em; }
.timeline li b { font-weight: 500; }
.timeline li small { display: block; color: var(--text-secondary); font-size: 0.88rem; }

/* Sources and footer --------------------------------------------------- */
.sources-list { font-size: 0.9rem; padding-left: 1.2rem; }
.sources-list li { margin-bottom: 0.45rem; }
footer.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding: 1.6rem 1.3rem 2.6rem; font-size: 0.82rem; color: var(--text-muted); max-width: 44rem; margin-left: auto; margin-right: auto; }
footer.site-footer a { color: var(--text-muted); }
footer.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-bottom: 0.8rem; }

/* Reading rail -------------------------------------------------------- */
.rail { position: fixed; right: 1.4rem; top: 50%; transform: translateY(-50%); display: none; flex-direction: column; gap: 0.85rem; z-index: 20; }
.rail a { position: relative; display: flex; align-items: center; text-decoration: none; }
.rail .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--border-strong); transition: transform 0.15s, background 0.15s; }
.rail a[aria-current="true"] .dot { background: var(--accent-strong); transform: scale(1.45); }
.rail .label { position: absolute; right: 100%; margin-right: 0.6rem; font-size: 0.76rem; color: var(--text-secondary); opacity: 0; transform: translateX(4px); transition: opacity 0.15s, transform 0.15s; white-space: nowrap; background: var(--bg-surface); padding: 0.15rem 0.5rem; border-radius: 0.3rem; border: 1px solid var(--border); }
.rail a:hover .label, .rail a:focus-visible .label { opacity: 1; transform: translateX(0); }
@media (min-width: 76rem) { .rail { display: flex; } }
@media print { .rail, .topbar, .map-tools, .filters, .steps { display: none; } }

/* Responsive -------------------------------------------------------- */
@media (max-width: 60rem) {
  .console { grid-template-columns: 1fr; }
  .side { min-height: 0; }
}
@media (max-width: 30rem) {
  main { padding: 0 1rem; }
  .hero { padding: 2rem 1rem 1rem; }
  .hero .deck { font-size: 1.05rem; }
  .cards { grid-template-columns: 1fr; }
  .card.feature figure img { aspect-ratio: 16 / 9; }
  .filters button, .steps button { font-size: 0.76rem; padding: 0.3rem 0.6rem; }
}
