/* lakes-hydro-lab — Sprint 2 — design v0.1
 *
 * Aesthetic: "Atmospheric scientific instrument".
 * Editorial broadsheet feel — Fraunces serif display + IBM Plex Sans body + Mono numerics.
 * Light parchment ground, deep flood-water teal accent, peat-amber for historical events.
 * Sharp 1px hairlines, no rounded cards, tabular numbers in mono.
 * Deliberately distinct from sister project LTV-5m's navy + gold palette.
 */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT@0,9..144,300..900,0..100;1,9..144,300..900,0..100&family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

:root {
  /* surface / ink */
  --paper:        #f6f4ef;   /* main parchment ground */
  --paper-bright: #fdfcf9;   /* card / panel surface */
  --paper-deep:   #ede9df;   /* deeper inset (status bar) */
  --ink:          #111317;   /* primary text, max contrast */
  --ink-sub:      #54595f;   /* secondary text */
  --ink-faint:    #8b8f95;   /* tertiary */
  --hair:         #d8d3c8;   /* hairline borders */
  --hair-strong:  #b8b1a3;   /* slightly stronger rules */

  /* the two project accents — deliberately not navy/gold */
  --water:        #0a6a7a;   /* deep flood-water teal — hero accent */
  --water-mid:    #1c8a9c;   /* hover state */
  --water-tint:   #d7e9ec;   /* soft layer-active background */
  --water-haze:   #eaf2f3;   /* subtlest tint for hover */

  --peat:         #c47533;   /* warm peat amber — historic events / warnings */
  --peat-deep:    #8a4f1c;   /* hover for amber */
  --peat-tint:    #f3e3d2;

  --ok:           #2f7a52;   /* sprint-done indicator */
  --live:         #c44a4a;   /* "live" red for future real-time data */

  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-body:    'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'IBM Plex Mono', 'SF Mono', Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  width: 100vw;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--water);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover {
  color: var(--water-mid);
}

/* =========================================================
 * TOP BAR — masthead-style with build stamp
 * ========================================================= */
.masthead {
  background: var(--paper-bright);
  border-bottom: 1px solid var(--hair-strong);
  padding: 0;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 340px 1fr auto;
  align-items: stretch;
}

.masthead-brand {
  padding: 18px 22px 14px;
  border-right: 1px solid var(--hair);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-title {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 144, 'SOFT' 30, 'wght' 600;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand-title em {
  font-style: italic;
  font-variation-settings: 'opsz' 144, 'SOFT' 80, 'wght' 500;
  color: var(--water);
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 6px;
}

.masthead-meta {
  padding: 18px 22px 14px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.tagline {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 36, 'wght' 400;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-sub);
  line-height: 1.2;
  max-width: 520px;
}

.masthead-stamp {
  border-left: 1px solid var(--hair);
  padding: 14px 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  background: var(--paper-deep);
}

.stamp-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.stamp-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stamp-value.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stamp-value.live::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--water);
  animation: water-pulse 2s ease-in-out infinite;
}

@keyframes water-pulse {
  0%, 100% { opacity: 1.0; box-shadow: 0 0 0 0 rgba(10, 106, 122, 0.35); }
  50%      { opacity: 0.55; box-shadow: 0 0 0 5px rgba(10, 106, 122, 0); }
}

/* =========================================================
 * MAIN — sidebar + map
 * ========================================================= */
.main {
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 0;
}

/* ============= SIDEBAR ============= */
.sidebar {
  background: var(--paper-bright);
  border-right: 1px solid var(--hair-strong);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--hair);
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--hair-strong);
}

.sidebar section {
  padding: 18px 22px;
  border-bottom: 1px solid var(--hair);
  animation: sidebar-in 600ms ease-out backwards;
}

.sidebar section:nth-child(1) { animation-delay: 50ms;  }
.sidebar section:nth-child(2) { animation-delay: 120ms; }
.sidebar section:nth-child(3) { animation-delay: 200ms; }
.sidebar section:nth-child(4) { animation-delay: 280ms; }

@keyframes sidebar-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-eyebrow {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.section-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--water);
  letter-spacing: 0.06em;
}

.section-title {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 36, 'wght' 600;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}

.section-lede {
  font-size: 12.5px;
  color: var(--ink-sub);
  line-height: 1.55;
  margin-bottom: 14px;
}

/* ----- LAYER CARDS ----- */
.layer-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;          /* 1px gap reveals --hair as separator */
  background: var(--hair);
  border: 1px solid var(--hair);
}

.layer-card {
  background: var(--paper-bright);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 12px;
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease;
}

.layer-card:hover {
  background: var(--water-haze);
}

.layer-card.active {
  background: var(--water-tint);
}

.layer-card input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--ink-sub);
  margin-top: 2px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.layer-card input[type="checkbox"]:checked {
  background: var(--water);
  border-color: var(--water);
}

.layer-card input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 4px;
  width: 5px;
  height: 9px;
  border: solid var(--paper-bright);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.layer-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.layer-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}

.layer-name {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 36, 'wght' 500;
  font-size: 15px;
  letter-spacing: -0.005em;
  color: var(--ink);
  line-height: 1.15;
}

.layer-cite {
  font-size: 11px;
  font-style: italic;
  color: var(--ink-sub);
  line-height: 1.4;
}

.layer-card.active .layer-id {
  color: var(--water);
}

.layer-swatch {
  width: 18px;
  height: 18px;
  border: 1px solid var(--hair-strong);
  flex-shrink: 0;
}

.swatch-dem {
  background: linear-gradient(135deg, #5e3f1f 0%, #afc483 45%, #305a82 100%);
}

.swatch-hand {
  background: linear-gradient(135deg, #fff3a8 0%, #e07a3b 50%, #3b2461 100%);
}

.swatch-streams {
  background: linear-gradient(135deg, #f8fbff 0%, #266daa 100%);
}

.swatch-slope {
  background: linear-gradient(135deg, #000004 0%, #b73779 50%, #fcfdbf 100%);
}

.swatch-twi {
  background: linear-gradient(135deg, #440154 0%, #21908c 50%, #fde725 100%);
}

/* ----- ROADMAP ----- */
.roadmap {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.roadmap li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  padding: 7px 0;
  font-size: 12.5px;
  color: var(--ink-sub);
  position: relative;
  border-bottom: 1px dashed var(--hair);
}

.roadmap li:last-child {
  border-bottom: none;
}

.roadmap li .num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  padding-top: 1px;
}

.roadmap li.done {
  color: var(--ok);
}

.roadmap li.done .num {
  color: var(--ok);
}

.roadmap li.done::after {
  content: '✓';
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ok);
  position: absolute;
  right: 0;
  top: 7px;
}

.roadmap li.active {
  color: var(--ink);
  font-weight: 500;
}

.roadmap li.active .num {
  color: var(--water);
}

.roadmap li.active::after {
  content: '→';
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--water);
  position: absolute;
  right: 0;
  top: 6px;
  animation: roadmap-arrow 2.4s ease-in-out infinite;
}

@keyframes roadmap-arrow {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(3px); }
}

/* ----- ATTRIBUTION ----- */
.attribution {
  font-size: 11px;
  color: var(--ink-faint);
  line-height: 1.55;
  border-top: 1px solid var(--hair);
  padding-top: 14px;
  margin-top: 6px;
}

.attribution strong {
  color: var(--ink-sub);
  font-weight: 500;
}

/* =========================================================
 * MAP
 * ========================================================= */
.map-pane {
  position: relative;
  background: var(--paper-deep);
}

#map {
  width: 100%;
  height: 100%;
  background: var(--paper-deep);
  cursor: crosshair;
}

/* Leaflet light-paper overrides */
.leaflet-container {
  background: var(--paper-deep) !important;
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
}

.leaflet-control-attribution {
  background: rgba(253, 252, 249, 0.92) !important;
  color: var(--ink-sub) !important;
  font-family: var(--font-mono) !important;
  font-size: 10px !important;
  border: 1px solid var(--hair) !important;
  border-radius: 0 !important;
  padding: 3px 8px !important;
}

.leaflet-control-attribution a {
  color: var(--water) !important;
  border-bottom: none !important;
}

.leaflet-control-zoom {
  border: 1px solid var(--hair-strong) !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.leaflet-control-zoom a {
  background: var(--paper-bright) !important;
  color: var(--ink) !important;
  border: none !important;
  border-bottom: 1px solid var(--hair) !important;
  font-family: var(--font-mono) !important;
  font-weight: 400 !important;
  border-radius: 0 !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 30px !important;
}

.leaflet-control-zoom a:last-child {
  border-bottom: none !important;
}

.leaflet-control-zoom a:hover {
  background: var(--water-haze) !important;
  color: var(--water) !important;
}

/* =========================================================
 * MAP OVERLAY READOUT — floating BNG / zoom display
 * ========================================================= */
.map-readout {
  position: absolute;
  bottom: 56px;      /* lifted clear of the attribution line */
  left: 18px;
  background: var(--paper-bright);
  border: 1px solid var(--hair-strong);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 28px;
  z-index: 500;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}

.readout-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.readout-label {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}

.readout-value {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* =========================================================
 * STATUS PILL — top right floating "build state"
 * ========================================================= */
.build-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--water);
  color: var(--water);
}

.build-pill.error {
  border-color: var(--live);
  color: var(--live);
}

.build-pill.ok {
  border-color: var(--ok);
  color: var(--ok);
}

/* =========================================================
 * INLINE TYPE HELPERS
 * ========================================================= */
.lede em {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink);
}

code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--paper-deep);
  padding: 1px 5px;
  color: var(--water);
  border: 1px solid var(--hair);
}

details.info-box {
  background: var(--paper);
  border: 1px solid var(--hair);
  padding: 0;
  margin-bottom: 12px;
}

details.info-box summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-sub);
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s ease;
}

details.info-box summary:hover {
  background: var(--water-haze);
  color: var(--water);
}

details.info-box summary::after {
  content: '+';
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-faint);
}

details.info-box[open] summary::after {
  content: '−';
  color: var(--water);
}

details.info-box[open] summary {
  border-bottom: 1px solid var(--hair);
}

details.info-box .info-body {
  padding: 12px 14px 14px;
  font-size: 12px;
  color: var(--ink-sub);
  line-height: 1.55;
}

details.info-box .info-body p + p {
  margin-top: 8px;
}

/* =========================================================
 * RESPONSIVE — collapse sidebar on narrow viewports
 * ========================================================= */
@media (max-width: 900px) {
  .masthead {
    grid-template-columns: 1fr;
  }
  .masthead-brand,
  .masthead-meta,
  .masthead-stamp {
    border: none;
    padding: 12px 18px;
  }
  .masthead-stamp {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
  }
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .sidebar {
    max-height: 38vh;
    border-right: none;
    border-bottom: 1px solid var(--hair-strong);
  }
}

/* =========================================================
 * LEGEND
 * ========================================================= */
.legend-group {
  margin: 14px 0;
  padding: 12px 14px;
  background: var(--paper-bright);
  border: 1px solid var(--hair);
  border-radius: 2px;
}
.legend-title {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.legend-unit {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-faint);
  text-transform: none;
  letter-spacing: 0;
}
.legend-bar {
  height: 12px;
  width: 100%;
  border: 1px solid var(--hair-strong);
}
.legend-ticks {
  display: flex;
  justify-content: space-between;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10px;
  color: var(--ink-sub);
  margin-top: 4px;
}
.legend-interp {
  font-size: 11.5px;
  color: var(--ink-sub);
  margin-top: 7px;
  line-height: 1.45;
}
.legend-interp strong {
  color: var(--ink);
  font-weight: 600;
}

/* =========================================================
 * FIRST-TIME INTRO CARD (top-right of map)
 * ========================================================= */
.intro-card {
  position: absolute;
  top: 70px;             /* below the guide-me button */
  right: 18px;
  width: 320px;
  z-index: 1000;
  padding: 18px 22px 16px;
  background: var(--paper-bright);
  border: 1px solid var(--hair-strong);
  box-shadow: 0 6px 22px rgba(0,0,0,0.10);
  border-radius: 3px;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}
.intro-card.dismissed {
  display: none;
}
.intro-card h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 8px;
  color: var(--ink);
}
.intro-card p {
  margin: 0 0 8px;
  color: var(--ink-sub);
}
.intro-card p:last-child {
  margin-bottom: 0;
}
.intro-card strong {
  color: var(--ink);
  font-weight: 600;
}
.intro-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  background: transparent;
  border: 1px solid var(--hair);
  color: var(--ink-faint);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
}
.intro-close:hover {
  background: var(--paper-deep);
  color: var(--ink);
  border-color: var(--hair-strong);
}

/* Lake + built-up swatches */
.swatch-lakes {
  background: linear-gradient(135deg, #2a6f9c 0%, #5fb5d6 100%);
}
.swatch-builtup {
  background: linear-gradient(135deg, #b88a5a 0%, #d9b48a 100%);
}

/* Leaflet vector overlay styling — class on layerGroup applied via SVG */
.layer-lakes path { stroke: #1d557c; stroke-width: 0.5; fill: #4d8eba; fill-opacity: 0.55; }
.layer-builtup path { stroke: #6e3e1c; stroke-width: 0.4; fill: #b88a5a; fill-opacity: 0.40; }
.place-marker { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: #2a2118; }
.place-marker-major { font-weight: 600; font-size: 11px; }

/* Place markers — visual hierarchy */
.place-marker-wrapper { background: transparent !important; border: none !important; }
.place-marker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: #2a2118;
  background: rgba(253, 252, 249, 0.78);
  padding: 1px 5px;
  border-radius: 2px;
  white-space: nowrap;
  border: 1px solid rgba(180, 175, 165, 0.45);
}
.place-marker-major {
  font-weight: 600;
  font-size: 11px;
  background: rgba(253, 252, 249, 0.92);
  border-color: rgba(110, 62, 28, 0.5);
}
.place-marker-minor {
  color: #54595f;
  font-size: 9.5px;
}

.swatch-historic { background: linear-gradient(135deg, #b71c1c 0%, #ef9a9a 100%); }

/* =========================================================
 * "GUIDE ME" BUTTON — top-right of map, sits above intro card
 * ========================================================= */
.guide-me-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 1001;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--water);
  color: white;
  border: 1px solid var(--water);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  transition: background 0.15s ease, transform 0.1s ease;
}
.guide-me-btn:hover {
  background: var(--water-mid);
  transform: translateY(-1px);
  color: white;
}
.guide-me-btn em {
  font-style: normal;
  font-weight: 400;
  font-size: 14px;
  line-height: 1;
  margin-left: -2px;
}
.guide-me-icon {
  font-size: 14px;
  line-height: 1;
}
/* When the intro card is showing, the guide button moves below it */
.intro-card:not(.dismissed) ~ .guide-me-btn,
.intro-card:not(.dismissed) + .guide-me-btn {
  /* If intro shows above, guide stays in top-right corner — they're both there */
  /* Actually let me change the order so guide is always visible */
}
.intro-cta {
  margin-top: 12px !important;
  padding-top: 10px;
  border-top: 1px solid var(--hair);
  font-size: 12px !important;
}
.intro-cta a {
  color: var(--water);
  font-weight: 600;
  border-bottom: 1px solid var(--water);
}

/* =========================================================
 * LAYER MASTER CONTROLS — All on / All off / Reset
 * ========================================================= */
.layer-controls {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.layer-ctrl-btn {
  flex: 1;
  padding: 6px 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-sub);
  background: var(--paper-bright);
  border: 1px solid var(--hair);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.layer-ctrl-btn:hover {
  background: var(--water-tint);
  color: var(--water);
  border-color: var(--water);
}
.layer-ctrl-btn:active {
  transform: translateY(1px);
}

/* Gauges swatch + Leaflet marker styling */
.swatch-gauges {
  background: radial-gradient(circle at 50% 50%, #c44a4a 0%, #c44a4a 50%, #fff 51%, #fff 100%);
  border: 1px solid var(--hair-strong);
}
.ea-gauge-marker {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--live);  /* "live" red — same hue as the masthead pulse */
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(196, 74, 74, 0.6), 0 1px 3px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.ea-gauge-marker:hover { transform: scale(1.4); }
.ea-gauge-marker.loading { background: #999; }
.ea-gauge-popup .ga-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 2px;
}
.ea-gauge-popup .ga-river {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--water);
  margin-bottom: 8px;
}
.ea-gauge-popup .ga-level {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin: 4px 0;
}
.ea-gauge-popup .ga-stamp {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--ink-faint);
}
.ea-gauge-popup .ga-loading {
  color: var(--ink-faint);
  font-style: italic;
  font-size: 11px;
}
.ea-gauge-popup .ga-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  color: var(--water);
}

/* =========================================================
 * EVENT MODAL — click a historic flood polygon → opens with case-study detail
 * ========================================================= */
.event-modal {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.event-modal[hidden] { display: none; }
.event-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(20, 20, 20, 0.55);
  backdrop-filter: blur(2px);
}
.event-modal-card {
  position: relative;
  max-width: 720px; max-height: 86vh;
  background: var(--paper-bright);
  border: 1px solid var(--hair-strong);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  overflow-y: auto;
  padding: 28px 36px 32px;
  font-family: var(--font-body);
  animation: event-modal-in 200ms ease-out;
}
@keyframes event-modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.event-modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid var(--hair);
  color: var(--ink-faint);
  font-size: 20px; line-height: 1;
  cursor: pointer; border-radius: 50%;
  font-family: var(--font-body);
}
.event-modal-close:hover {
  background: var(--paper-deep); color: var(--ink); border-color: var(--hair-strong);
}
.event-modal-content .em-eyebrow {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--peat); margin-bottom: 8px;
}
.event-modal-content .em-headline {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 144, 'wght' 600;
  font-size: 32px; line-height: 1.05; color: var(--ink);
  margin-bottom: 4px;
}
.event-modal-content .em-tagline {
  font-family: var(--font-display); font-style: italic;
  font-size: 17px; color: var(--ink-sub);
  margin-bottom: 18px;
}
.event-modal-content .em-summary {
  font-size: 14px; color: var(--ink); line-height: 1.55;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--peat-tint);
  border-left: 3px solid var(--peat);
}
.event-modal-content .em-stats {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  font-size: 13px;
  margin-bottom: 16px;
}
.event-modal-content .em-stat-label {
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-sub);
  align-self: start; padding-top: 2px;
}
.event-modal-content .em-stat-value {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.event-modal-content .em-meta {
  display: flex; gap: 14px;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-faint); letter-spacing: 0.06em;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--hair);
}
.event-modal-content .em-source {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-faint); margin-top: 12px;
}
.event-modal-content .em-source code {
  background: var(--paper-deep);
  padding: 1px 4px;
  font-size: 10px;
  border-radius: 2px;
}

/* Minor-event variant — when no rich case study matches */
.event-modal-content.em-minor .em-headline { font-size: 22px; }
.event-modal-content.em-minor .em-eyebrow { color: var(--water); }

/* Forecast links — external sources block */
.forecast-links {
  display: flex; flex-direction: column;
  border: 1px solid var(--hair);
  background: var(--paper-bright);
  margin-top: 4px;
}
.forecast-link {
  display: flex; flex-direction: column;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hair);
  text-decoration: none; color: var(--ink);
  transition: background 0.15s ease;
  position: relative;
}
.forecast-link:last-child { border-bottom: none; }
.forecast-link:hover { background: var(--water-haze); color: var(--ink); }
.forecast-link .fl-name {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 36, 'wght' 600;
  font-size: 13.5px;
  color: var(--ink);
  margin-bottom: 2px;
}
.forecast-link .fl-meta {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.04em;
  color: var(--ink-sub);
}
.forecast-link .fl-arrow {
  position: absolute; top: 50%; right: 14px;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--water);
}
.forecast-link:hover .fl-arrow { color: var(--water-mid); transform: translateY(-50%) translateX(2px); }
