/* ─────────────────────────────────────────────────────────────────────
   Kentucky River Water Trail — "Bluegrass & Bourbon"
   True Kentucky bluegrass tones (cool blue-green/teal — NOT forest green).
   Distinct from PTJ (dark+cyan) and PTO (earthy green).
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* Bluegrass & Bourbon palette */
  --limestone:       #e8e4d8;
  --limestone-warm:  #d4c8a8;   /* Palisade cream */
  --limestone-dark:  #b8a98a;
  --bluegrass:       #16283a;   /* Primary dark surface — bluegrass field at dusk */
  --bluegrass-mid:   #213a52;   /* Mid blue-teal */
  --bluegrass-hi:    #2f4f6b;   /* Surface highlight */
  --bluegrass-leaf:  #5c8aa5;   /* Cool blue-green — the actual bluegrass leaf tone */
  --river-blue:      #3d6e8a;   /* River centerline + water elements */
  --river-deep:      #284e68;
  --slate:           #4a5d6c;   /* Secondary UI */
  --slate-deep:      #2c3a44;
  --bourbon:         #b8732a;   /* Primary accent */
  --bourbon-bright:  #d4892f;
  --bourbon-deep:    #8e5520;
  --signal-red:      #c44536;   /* Hazards / locks */
  --signal-amber:    #d9a441;
  --coal:            #0e1822;
  --paper:           #f5f1e6;
  --ink:             #2a2a2a;

  /* Semantic */
  --bg:              var(--bluegrass);
  --surface:         var(--bluegrass-mid);
  --surface-hi:      var(--bluegrass-hi);
  --text:            var(--limestone);
  --text-dim:        rgba(232, 228, 216, 0.65);
  --text-muted:      rgba(232, 228, 216, 0.45);
  --border:          rgba(212, 200, 168, 0.18);
  --border-strong:   rgba(212, 200, 168, 0.35);
  --accent:          var(--bourbon);
  --accent-hover:    var(--bourbon-bright);

  /* Type */
  --font-display:    'Fraunces', Georgia, serif;
  --font-body:       'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:       'JetBrains Mono', 'SF Mono', monospace;

  /* Radius / spacing */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* Layout */
  --topbar-h: 64px;
  --pool-ribbon-h: 56px;
  --left-panel-w: 320px;
  --right-panel-w: 420px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ─── Topbar ──────────────────────────────────────────────────────── */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  background: linear-gradient(180deg, rgba(22,40,58,0.96) 0%, rgba(22,40,58,0.88) 100%);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 50;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: var(--left-panel-w);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--bourbon) 0%, var(--bourbon-deep) 100%);
  color: var(--limestone);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.02em;
  box-shadow: 0 2px 8px rgba(184, 115, 42, 0.35);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--limestone);
}

.brand-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar-conditions {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-dim);
}

.conditions-placeholder {
  font-style: italic;
  color: var(--text-muted);
}

.topbar-actions { display: flex; gap: 8px; }

.btn-ghost {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.btn-ghost:hover { background: var(--surface); border-color: var(--border-strong); }
.btn-ghost svg { width: 18px; height: 18px; }

/* ─── Pool Ribbon ─────────────────────────────────────────────────── */

.pool-ribbon {
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0;
  height: var(--pool-ribbon-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  background: rgba(22, 40, 58, 0.92);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
  z-index: 40;
}
.pool-ribbon::-webkit-scrollbar { height: 4px; }
.pool-ribbon::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.pool-chip {
  flex: 0 0 auto;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pool-chip .pool-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--bourbon-bright);
}

.pool-chip:hover {
  background: var(--surface-hi);
  border-color: var(--bourbon);
}

.pool-chip.active {
  background: linear-gradient(135deg, var(--bourbon) 0%, var(--bourbon-deep) 100%);
  border-color: var(--bourbon);
  color: var(--limestone);
}
.pool-chip.active .pool-num { color: var(--limestone); }

/* ─── App Shell ───────────────────────────────────────────────────── */

.app-shell {
  position: fixed;
  top: calc(var(--topbar-h) + var(--pool-ribbon-h));
  left: 0; right: 0; bottom: 0;
  display: flex;
}

/* ─── Left Panel ──────────────────────────────────────────────────── */

.left-panel {
  width: var(--left-panel-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px;
}

.panel-section {
  margin-bottom: 28px;
}

.panel-h {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--limestone-warm);
  margin: 0 0 12px 0;
}

.panel-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
}

/* ─── Layer Toggles ───────────────────────────────────────────────── */

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

.layer-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: all 0.12s;
}
.layer-toggle:hover { background: var(--surface-hi); }
.layer-toggle.active { background: var(--surface-hi); border-color: var(--border-strong); }

.layer-toggle .swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 12px;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.2);
}

.layer-toggle .layer-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── Map ─────────────────────────────────────────────────────────── */

.map-wrap {
  flex: 1;
  position: relative;
}

#map {
  position: absolute;
  inset: 0;
}

.map-tagline {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
  z-index: 5;
  pointer-events: none;
}

.tag-pill {
  background: rgba(22, 40, 58, 0.85);
  border: 1px solid var(--border);
  color: var(--limestone-warm);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  backdrop-filter: blur(6px);
}

/* Mapbox overrides — give controls the limestone treatment */
.mapboxgl-ctrl-group {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
}
.mapboxgl-ctrl-group button {
  background-color: transparent !important;
}
.mapboxgl-ctrl-group button:hover {
  background-color: var(--surface-hi) !important;
}
.mapboxgl-ctrl-group button .mapboxgl-ctrl-icon {
  filter: invert(1) brightness(0.85) sepia(0.3);
}

.mapboxgl-popup-content {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  font-family: var(--font-body);
}
.mapboxgl-popup-tip { border-top-color: var(--surface) !important; }

/* ─── Right (Detail) Panel ────────────────────────────────────────── */

.right-panel {
  width: var(--right-panel-w);
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  position: relative;
  padding: 20px 24px 40px;
}
.right-panel[hidden] { display: none; }

.panel-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.panel-close:hover { background: var(--surface-hi); }
.panel-close svg { width: 16px; height: 16px; }

.detail-hero {
  margin: -20px -24px 16px;
  height: 220px;
  background: linear-gradient(180deg, var(--bluegrass-mid) 0%, var(--surface) 100%);
  background-size: cover;
  background-position: center;
  position: relative;
}
.detail-hero.no-image {
  background-image:
    linear-gradient(180deg, rgba(33,58,82,0.6) 0%, rgba(22,40,58,0.85) 100%),
    repeating-linear-gradient(135deg, rgba(212,200,168,0.06) 0 12px, transparent 12px 24px);
}
.detail-hero.has-image::after {
  /* darken the bottom for credit legibility */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(14,24,34,0.65) 100%);
  pointer-events: none;
}
.hero-credit {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--limestone-warm);
  background: rgba(14,24,34,0.6);
  padding: 3px 8px;
  border-radius: var(--r-pill);
  backdrop-filter: blur(4px);
  z-index: 1;
}

/* Image gallery strip (5 thumbnails max) */
.detail-gallery {
  display: flex;
  gap: 6px;
  margin: -8px 0 16px;
}
.gallery-thumb {
  flex: 1 1 0;
  height: 50px;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.15s, border-color 0.15s, transform 0.15s;
}
.gallery-thumb:hover { opacity: 1; transform: translateY(-1px); }
.gallery-thumb.active { opacity: 1; border-color: var(--bourbon); box-shadow: 0 0 0 1px var(--bourbon); }

/* Contact card extras (rating / phone link / hours) */
.rating-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.rating-stars { letter-spacing: 1px; line-height: 1; }
.rating-stars .star { color: var(--border-strong); font-size: 14px; }
.rating-stars .star.filled { color: var(--bourbon-bright); }
.rating-num { font-family: var(--font-mono); font-size: 13px; color: var(--limestone); }
.rating-count { font-size: 11px; color: var(--text-dim); }

.contact-link {
  color: var(--bourbon-bright) !important;
  text-decoration: none;
}
.contact-link:hover { text-decoration: underline; }

/* Address / phone rows inside the Contact card — single line, glyph + value */
.contact-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  line-height: 1.45;
  border-bottom: 1px solid var(--border);
}
.contact-line:last-of-type { border-bottom: none; }
.contact-glyph {
  flex: 0 0 auto;
  width: 16px;
  font-size: 13px;
  color: var(--bourbon-bright);
  opacity: 0.85;
  margin-top: 1px;
  text-align: center;
}
.contact-text {
  flex: 1 1 auto;
  color: var(--text);
  word-break: break-word;
}
.contact-address .contact-text { font-size: 12.5px; color: var(--text-dim); }

.hours-block { margin-top: 8px; }
.hours-h {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--limestone-warm);
  margin: 0 0 4px 0;
}
.hour-row {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  padding: 2px 0;
}

.detail-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--bourbon-bright);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.detail-link:hover { color: var(--bourbon); text-decoration: underline; }
.wiki-link {
  display: block;
  margin: -10px 0 16px;
  font-size: 12px;
  color: var(--text-dim);
}

/* Live gauge readings inside the panel */
.gauge-live { margin-top: 10px; }

/* ─── Conditions topbar ───────────────────────────────────────────── */
.topbar-conditions {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--limestone);
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  white-space: nowrap;
}
.cond-weather {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cond-emoji { font-size: 16px; line-height: 1; }
.cond-temp {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--limestone);
  font-size: 15px;
  letter-spacing: -0.01em;
}
.cond-short {
  color: var(--text-dim);
  font-size: 12px;
}
.cond-sep { color: var(--border-strong); margin: 0 2px; }
.cond-stages {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cond-stage {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  cursor: help;
}
.cond-stage.offline .cond-val { color: var(--text-muted); }
.cond-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.cond-val {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--bourbon-bright);
  font-weight: 500;
}
.cond-dot { color: var(--border-strong); }

@media (max-width: 1100px) {
  .cond-short { display: none; }
  .cond-stages { gap: 6px; }
  .cond-label { display: none; }
}
@media (max-width: 760px) {
  .topbar-conditions { font-size: 12px; gap: 8px; }
  .cond-stages .cond-stage:nth-child(n+5) { display: none; }
}

.detail-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 6px 0;
  color: var(--limestone);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 16px;
}

.meta-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--surface-hi);
  border: 1px solid var(--border);
  color: var(--limestone-warm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.meta-pill.amber { background: var(--bourbon-deep); color: var(--limestone); border-color: var(--bourbon); }
.meta-pill.red { background: rgba(196, 69, 54, 0.25); border-color: var(--signal-red); color: #f4b8b1; }

.detail-desc {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  margin: 0 0 18px 0;
}

.detail-card {
  background: var(--bluegrass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.detail-card-h {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--limestone-warm);
  margin: 0 0 8px 0;
}

.fact-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.fact-row:last-child { border-bottom: none; }
.fact-row .k { color: var(--text-dim); }
.fact-row .v { font-family: var(--font-mono); color: var(--text); }

.facility-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.facility-chip {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--limestone-warm);
}

/* ─── Bourbon Trail (left panel featured section) ─────────────────── */

.bourbon-section {
  background: linear-gradient(180deg, rgba(184, 115, 42, 0.10) 0%, rgba(184, 115, 42, 0.03) 100%);
  border: 1px solid rgba(184, 115, 42, 0.30);
  border-radius: var(--r-md);
  padding: 14px 14px 12px;
  margin: -8px -4px 24px;
}
.bourbon-h-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.bourbon-h {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 !important;
  color: var(--bourbon-bright) !important;
}
.bourbon-glyph { font-size: 16px; }
.bourbon-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--bourbon-bright);
  background: rgba(184, 115, 42, 0.20);
  border: 1px solid rgba(184, 115, 42, 0.50);
  padding: 2px 8px;
  border-radius: var(--r-pill);
}
.bourbon-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin: 0 0 10px 0;
  line-height: 1.4;
}
.bourbon-fit-all {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(184, 115, 42, 0.35);
  color: var(--bourbon-bright);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 7px;
  border-radius: var(--r-sm);
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.15s, border-color 0.15s;
}
.bourbon-fit-all:hover {
  background: rgba(184, 115, 42, 0.10);
  border-color: var(--bourbon);
}
.bourbon-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 380px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 2px;
}
.bourbon-list::-webkit-scrollbar { width: 4px; }
.bourbon-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.bt-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s;
}
.bt-item:hover {
  background: var(--surface-hi);
  border-color: rgba(184, 115, 42, 0.50);
}
.bt-thumb {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: var(--r-sm);
  background-size: cover;
  background-position: center;
  background-color: var(--bourbon-deep);
  display: flex;
  align-items: center;
  justify-content: center;
}
.bt-thumb-glyph { font-size: 20px; }
.bt-body { flex: 1 1 auto; min-width: 0; }
.bt-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--limestone);
  line-height: 1.2;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  align-items: center;
}
.bt-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--bourbon-bright);
  background: rgba(184, 115, 42, 0.12);
  padding: 1px 6px;
  border-radius: var(--r-pill);
}
.bt-pill-dim {
  color: var(--text-dim);
  background: rgba(245, 241, 230, 0.05);
}
.bt-rating {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.bt-star { color: var(--bourbon-bright); font-size: 10px; }
.bt-rating-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* ─── Nearby card (in feature detail panel) ───────────────────────── */
.nearby-group-h {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--limestone-warm);
  margin: 10px 0 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.nearby-group-h:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.nearby-glyph { font-size: 13px; }
.nearby-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  padding: 6px 0;
  cursor: pointer;
  border-bottom: 1px dashed var(--border);
  text-align: left;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  transition: color 0.12s;
}
.nearby-row:hover { color: var(--bourbon-bright); }
.nearby-row:last-child { border-bottom: none; }
.nearby-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
}
.nearby-dist {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--bourbon-bright);
  flex: 0 0 auto;
}

/* ─── Sidebar → map connector line ────────────────────────────────── */
.krw-connector {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}
.krw-connector.visible { opacity: 1; }
.krw-connector-shadow {
  fill: none;
  stroke: rgba(14, 24, 34, 0.7);
  stroke-width: 4;
  stroke-linecap: round;
}
.krw-connector-line {
  fill: none;
  stroke: var(--bourbon-bright);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 6 5;
  filter: drop-shadow(0 0 4px rgba(212, 137, 47, 0.7));
  animation: krw-conn-dash 0.6s linear infinite;
}
@keyframes krw-conn-dash {
  to { stroke-dashoffset: -8; }
}
.krw-connector-target {
  fill: rgba(212, 137, 47, 0.18);
  stroke: var(--bourbon-bright);
  stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(212, 137, 47, 0.6));
  animation: krw-conn-pulse 1.2s ease-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
@keyframes krw-conn-pulse {
  0%   { transform: scale(0.75); opacity: 1; }
  60%  { transform: scale(1.35); opacity: 0.3; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* ─── Detail panel: back arrow ────────────────────────────────────── */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 6px 12px 6px 8px;
  color: var(--bourbon-bright);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  max-width: calc(100% - 40px);
  transition: background 0.12s, border-color 0.12s;
}
.detail-back:hover {
  background: var(--surface-hi);
  border-color: var(--bourbon);
}
.detail-back-arrow {
  font-size: 14px;
  line-height: 1;
  color: var(--bourbon-bright);
}
.detail-back-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0.02em;
}

/* ─── Loading Overlay ─────────────────────────────────────────────── */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bluegrass);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 100;
  transition: opacity 0.5s;
}
.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Kentucky silhouette — the river is cut out of the image, so the dark
 * loading-overlay background shows through it as "water." Soft bourbon glow
 * underneath, gentle breathing animation. */
.ky-glyph {
  position: relative;
  width: min(340px, 56vw);
  aspect-ratio: 1566 / 738;
  filter: drop-shadow(0 0 32px rgba(212, 137, 47, 0.28))
          drop-shadow(0 12px 28px rgba(0, 0, 0, 0.55));
}
.ky-glyph .ky-river-flow {
  position: absolute;
  inset: -8% -4%;
  background: radial-gradient(ellipse 55% 45% at 60% 45%,
    rgba(212, 137, 47, 0.35) 0%,
    rgba(212, 137, 47, 0.10) 45%,
    rgba(212, 137, 47, 0) 75%);
  filter: blur(8px);
  z-index: 0;
  pointer-events: none;
  animation: ky-glow-pulse 4.4s ease-in-out infinite;
}
.ky-silhouette {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.95;
  z-index: 1;
  animation: ky-breathe 4.4s ease-in-out infinite;
}
@keyframes ky-glow-pulse {
  0%, 100% { opacity: 0.75; }
  50%      { opacity: 1; }
}
@keyframes ky-breathe {
  0%, 100% { opacity: 0.88; }
  50%      { opacity: 1; }
}

.loading-text {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--limestone-warm);
}

/* ─── Search Overlay ─────────────────────────────────────────────── */
.krw-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
}
.krw-search-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.krw-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 16, 24, 0.65);
  backdrop-filter: blur(6px);
}
.krw-search-panel {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  background: var(--bluegrass-mid);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.krw-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.krw-search-input-glyph {
  font-size: 18px;
  opacity: 0.7;
}
.krw-search-input {
  flex: 1 1 auto;
  background: transparent;
  border: none;
  outline: none;
  color: var(--limestone);
  font-size: 16px;
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.005em;
}
.krw-search-input::placeholder { color: var(--text-dim); }
.krw-search-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.krw-search-close:hover {
  color: var(--limestone);
  border-color: var(--bourbon);
  background: var(--surface-hi);
}
.krw-search-results {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 6px 0;
  max-height: calc(100vh - 220px);
}
.krw-search-hint {
  padding: 18px 20px;
  color: var(--text-dim);
  font-size: 13px;
  font-style: italic;
}
.krw-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.08s, border-color 0.08s;
}
.krw-search-row:hover,
.krw-search-row.active {
  background: var(--surface-hi);
  border-left-color: var(--bourbon);
}
.krw-search-glyph {
  flex: 0 0 auto;
  font-size: 16px;
  width: 22px;
  text-align: center;
}
.krw-search-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.krw-search-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--limestone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.krw-search-sub {
  font-size: 11.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .left-panel { display: none; }
  .right-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    max-height: 70vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    z-index: 30;
  }
  .topbar-brand { min-width: auto; }
}
