:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #1f2933;
  --muted: #5f6b76;
  --line: #ddd5c8;
  --accent: #b45309;
  --accent-dark: #7c2d12;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff8ec 0, var(--bg) 45%, #eaf0f1 100%);
}

.page-shell { max-width: 1240px; margin: 0 auto; padding: 36px 22px 48px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 28px;
  align-items: end;
  margin-bottom: 24px;
}

.eyebrow { margin: 0 0 8px; color: var(--accent-dark); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }

h1 { margin: 0; font-size: clamp(2rem, 4.2vw, 4.7rem); line-height: 0.98; max-width: 920px; letter-spacing: -0.055em; }

.lede { max-width: 760px; margin: 18px 0 0; font-size: 1.13rem; line-height: 1.55; color: var(--muted); }

.metric-card { background: #24180f; color: white; border-radius: 28px; padding: 24px 22px; box-shadow: 0 18px 50px rgba(40, 25, 10, 0.18); }
.metric-number { font-size: 4.8rem; line-height: 0.85; font-weight: 850; letter-spacing: -0.06em; }
.metric-label { margin-top: 12px; font-size: 0.95rem; color: #f7d8b5; }

.viz-card {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 0;
  min-height: 690px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: 0 24px 75px rgba(40, 30, 20, 0.12);
}

.controls { padding: 24px; border-right: 1px solid var(--line); background: linear-gradient(180deg, #fffdf9 0%, #f8f1e8 100%); }
.control-group { margin-bottom: 26px; }
.control-group h2, .layer-readout h2 { margin: 0 0 12px; font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; color: #45515d; }

button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #d8cfc2;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 9px;
  background: #fffaf2;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 720;
  cursor: pointer;
}
button span { color: var(--muted); font-weight: 600; font-size: 0.83rem; }
button:hover { border-color: #b45309; background: #fff4df; }
button.active { background: #9a3412; color: white; border-color: #9a3412; box-shadow: 0 9px 24px rgba(154, 52, 18, 0.22); }
button.active span { color: #ffe3c2; }

.layer-readout { margin: 28px 0 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.layer-readout h2 { text-transform: none; letter-spacing: 0; font-size: 1.08rem; color: var(--ink); }
.layer-readout p { margin: 0; color: var(--muted); line-height: 1.45; font-size: 0.92rem; }

.legend { margin-top: 20px; padding: 16px; border-radius: 18px; background: rgba(255,255,255,0.64); border: 1px solid var(--line); }
.legend-title { font-weight: 800; margin-bottom: 3px; }
.legend-subtitle { font-size: 0.78rem; color: var(--muted); margin-bottom: 11px; line-height: 1.35; }
.legend-row { display: flex; gap: 9px; align-items: center; margin: 7px 0; font-size: 0.87rem; color: #34404a; }
.swatch { width: 28px; height: 12px; border-radius: 999px; display: inline-block; border: 1px solid rgba(0,0,0,0.1); }

.map-wrap { position: relative; min-height: 690px; background: #dbe7ec; }
#map { position: absolute; inset: 0; }
.map-message { position: absolute; top: 16px; left: 16px; right: 16px; z-index: 500; background: white; border: 1px solid #f1b0a8; color: #7f1d1d; padding: 12px 14px; border-radius: 14px; font-weight: 700; }

.explain { max-width: 870px; margin: 26px auto 0; color: var(--muted); line-height: 1.65; font-size: 1rem; }
.explain h2 { color: var(--ink); margin-bottom: 6px; }
.caveat { font-size: 0.92rem; }

.leaflet-container { font-family: inherit; background: #dbe7ec; }
.leaflet-popup-content { font-size: 0.9rem; line-height: 1.4; }

@media (max-width: 850px) {
  .hero { grid-template-columns: 1fr; }
  .metric-card { max-width: 210px; }
  .viz-card { grid-template-columns: 1fr; }
  .controls { border-right: 0; border-bottom: 1px solid var(--line); }
  .map-wrap { min-height: 560px; }
}
