:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --border: #e3ded3;
  --text: #1d2a2f;
  --muted: #5d6b70;
  --accent: #0f6e80;
  --accent-soft: #d9eef1;
  --water-top: #5cb8c9;
  --water-bottom: #1d5f74;
  --ground: #d9ccb2;
  --concrete: #a9a39a;
  --zone: #2b4650;
  --ok: #2f8f5b;
  --shadow: 0 1px 2px rgba(29, 42, 47, .05), 0 4px 16px rgba(29, 42, 47, .05);
  color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #0f1719;
    --surface: #172225;
    --border: #26363a;
    --text: #e7eef0;
    --muted: #93a6ab;
    --accent: #5cc8d6;
    --accent-soft: #163a41;
    --water-top: #3f9fb2;
    --water-bottom: #123f4d;
    --ground: #3a342a;
    --concrete: #6f6a63;
    --zone: #cfe3e8;
    --ok: #5ccf8e;
    --shadow: none;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 Inter, system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }

.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.site-nav { display: flex; gap: 20px; font-size: 14px; }
.site-nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.site-nav a[aria-current="page"] { color: var(--accent); }
.nav-soon { color: var(--muted); cursor: default; }
.site-nav { align-items: center; }
.theme-toggle { font: inherit; font-size: 13px; font-weight: 500; color: var(--text); background: none; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; cursor: pointer; white-space: nowrap; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
@media print { .theme-toggle { display: none; } }

.page { width: 100%; max-width: 1160px; margin: 0 auto; padding: 40px clamp(16px, 4vw, 40px) 56px; flex: 1; }
.page--narrow { max-width: 640px; }
.page > section { margin-top: 48px; }
.page > section:first-child { margin-top: 0; }

.eyebrow { margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.h-display { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; font-size: clamp(30px, 4.2vw, 46px); line-height: 1.1; margin: 0 0 16px; text-wrap: balance; }
.h-section { font-size: 18px; font-weight: 600; margin: 0 0 16px; }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 24px; max-width: 46ch; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }

.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; align-items: center; }
@media (max-width: 880px) { .hero { grid-template-columns: 1fr; gap: 28px; } }

.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); font-size: 13px; font-weight: 500; }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .status-pill .dot { animation: none; } }

.xsection { margin: 0; padding: 16px 16px 10px; overflow: hidden; }
.xsection svg { display: block; width: 100%; height: auto; }
.xsection figcaption { font-size: 12px; color: var(--muted); padding-top: 6px; }
.zone-line { stroke: var(--zone); stroke-width: 1; stroke-dasharray: 4 4; opacity: .55; }
.zone-label { font-size: 11px; fill: var(--zone); font-family: Inter, system-ui, sans-serif; }
.zone-label.muted { opacity: .7; }
.scale-break { stroke: var(--surface); stroke-width: 2; stroke-dasharray: 10 6; opacity: .6; }
.outlet-tick { stroke: var(--zone); stroke-width: 1.5; }
.dam-label { font-size: 12px; font-weight: 600; fill: var(--text); font-family: Inter, system-ui, sans-serif; }

.facts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 540px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fact { padding: 16px 18px; }
.fact__label { font-size: 13px; color: var(--muted); }
.fact__value { font-size: 24px; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; margin: 2px 0; }
.fact__note { font-size: 12px; color: var(--muted); }

.h-sub { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.river { padding: 28px; }
.river__line { list-style: none; margin: 0; padding: 0; position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 12px; }
.river__line::before { content: ""; position: absolute; left: 8px; right: 8px; top: 6px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--water-bottom), var(--water-top)); }
.river__line li { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.river__dot { width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); margin-bottom: 8px; }
.river__name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.river__mile { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .river__line { grid-auto-flow: row; gap: 0; }
  .river__line::before { left: 6px; right: auto; top: 4px; bottom: 22px; width: 4px; height: auto; background: linear-gradient(180deg, var(--water-bottom), var(--water-top)); }
  .river__line li { padding: 0 0 18px 28px; }
  .river__dot { position: absolute; left: 0; top: 1px; margin: 0; }
}

.modules { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .modules { grid-template-columns: 1fr; } }
.module { padding: 20px; position: relative; overflow: hidden; }
.module::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); }
.module h3 { margin: 0 0 6px; font-size: 16px; }
.module p { margin: 0; font-size: 14px; color: var(--muted); }

.source-note { margin-top: 40px; font-size: 12px; color: var(--muted); }

.button { display: inline-block; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: var(--surface); text-decoration: none; font-weight: 600; }

.site-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 18px clamp(16px, 4vw, 40px); border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }

.brand span { white-space: nowrap; }
@media (max-width: 480px) {
  .site-nav { gap: 12px; font-size: 13px; }
  .nav-soon { display: none; }
}

/* Rendered markdown (/docs/:name) */
.page--doc { max-width: 820px; }
.doc h1 { font-family: "Source Serif 4", Georgia, serif; font-size: clamp(28px, 4vw, 40px); line-height: 1.15; margin: 0 0 16px; }
.doc h2 { font-size: 22px; margin: 40px 0 12px; }
.doc h3 { font-size: 17px; margin: 28px 0 8px; }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.doc table { border-collapse: collapse; margin: 16px 0; font-size: 14px; display: block; overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--surface); }
.doc code { font-size: .9em; background: var(--surface); padding: 1px 5px; border-radius: 4px; }
.doc pre { background: var(--surface); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.doc pre code { background: none; padding: 0; }
.doc blockquote { margin: 16px 0; padding: 2px 16px; border-left: 3px solid var(--accent); color: var(--muted); }
.doc img { max-width: 100%; }
