:root {
  --page-bg: #f5f3ee;
  --card-bg: #ffffff;
  --text: #202020;
  --muted: #6f6b64;
  --border: #d8d4cc;
  --accent: #b5524a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --map-1: #fff7ec;
  --map-2: #fee8c8;
  --map-3: #fdbb84;
  --map-4: #e34a33;
  --map-5: #b30000;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--page-bg); color: var(--text); font-family: Arial, Helvetica, sans-serif; }
button { font: inherit; }
.page-shell { width: min(1280px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 48px; }
.story-header { max-width: 860px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.13em; }
h1 { margin: 0; max-width: 860px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(34px, 5.2vw, 60px); font-weight: 500; line-height: 1.02; letter-spacing: -0.025em; }
.dek { max-width: 780px; margin: 18px 0 0; color: var(--muted); font-family: Georgia, "Times New Roman", serif; font-size: 18px; line-height: 1.55; }
.interactive-card { overflow: hidden; border: 1px solid var(--border); background: var(--card-bg); box-shadow: var(--shadow); }
.timeline-toolbar { display: grid; grid-template-columns: auto minmax(320px, 1fr) auto; gap: 24px; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.play-button { display: inline-flex; gap: 8px; align-items: center; justify-content: center; min-width: 94px; padding: 10px 15px; border: 1px solid #aaa69d; border-radius: 999px; background: #fff; color: var(--text); cursor: pointer; }
.play-button:hover, .play-button:focus-visible { border-color: var(--text); outline: none; }
.timeline-wrap { width: 100%; }
.timeline { display: flex; align-items: flex-start; width: 100%; }
.year-step { display: flex; flex: 0 0 auto; flex-direction: column; gap: 8px; align-items: center; border: 0; background: transparent; color: #77736c; cursor: pointer; }
.year-step:hover, .year-step:focus-visible { color: var(--text); outline: none; }
.year-dot { width: 14px; height: 14px; border: 2px solid #aaa69d; border-radius: 50%; background: #fff; transition: transform 180ms ease, background 180ms ease, border-color 180ms ease; }
.year-label { font-size: 13px; font-weight: 700; }
.year-step.active { color: var(--text); }
.year-step.active .year-dot { border-color: var(--accent); background: var(--accent); transform: scale(1.2); }
.timeline-line { height: 2px; flex: 1 1 auto; min-width: 24px; margin-top: 6px; background: #cbc7bf; }
.current-year-panel { min-width: 76px; text-align: right; }
.current-year-label { display: block; margin-bottom: 2px; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
#current-year { font-family: Georgia, "Times New Roman", serif; font-size: 26px; font-weight: 500; }
.map-wrap { position: relative; }
#map { width: 100%; height: min(72vh, 720px); min-height: 520px; background: #ecebe7; }
.legend { position: absolute; right: 18px; bottom: 18px; z-index: 500; width: 210px; padding: 14px 16px; border: 1px solid rgba(0,0,0,.09); border-radius: 5px; background: rgba(255,255,255,.95); box-shadow: 0 3px 16px rgba(0,0,0,.12); }
.legend h2 { margin: 0 0 10px; font-size: 13px; line-height: 1.25; }
.legend-row { display: flex; gap: 9px; align-items: center; margin: 6px 0; color: #444; font-size: 12px; }
.legend-swatch { display: inline-block; width: 28px; height: 10px; }
.swatch-1 { background: var(--map-1); }
.swatch-2 { background: var(--map-2); }
.swatch-3 { background: var(--map-3); }
.swatch-4 { background: var(--map-4); }
.swatch-5 { background: var(--map-5); }
.source-line { display: flex; gap: 22px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.leaflet-tooltip { padding: 8px 10px; border: 0; border-radius: 4px; box-shadow: 0 2px 12px rgba(0,0,0,.16); font-size: 12px; }

/* Muted basemap so complaint data stands out */
.muted-basemap {
  filter:
    grayscale(80%)
    saturate(30%)
    brightness(115%)
    contrast(80%);
  opacity: 0.62;
}

@media (max-width: 780px) {
  .page-shell { width: 100%; padding-top: 20px; }
  .story-header { padding: 0 18px; }
  .interactive-card { border-right: 0; border-left: 0; }
  .timeline-toolbar { grid-template-columns: auto 1fr; gap: 14px; }
  .timeline-wrap { grid-column: 1 / -1; grid-row: 2; }
  .current-year-panel { justify-self: end; }
  #map { height: 68vh; min-height: 480px; }
  .legend { right: 10px; bottom: 10px; width: 178px; }
  .source-line { gap: 8px; flex-direction: column; }
}
