/* ============================================================
   LA Power Equity Mapping Hub - UI chrome
   Design language: civic data tool. Neutral frosted panels,
   one teal accent, condensed display type over humanist sans.
   Map colors come from the data; the chrome stays quiet.
   ============================================================ */

:root {
  --ink: #14181d;
  --ink-soft: #3a424c;
  --muted: #6b7580;
  --line: rgba(20, 24, 29, 0.10);
  --line-strong: rgba(20, 24, 29, 0.16);
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --accent: #0e8a7d;          /* powered / active teal */
  --accent-ink: #0a6b60;
  --accent-wash: rgba(14, 138, 125, 0.12);
  --r-card: 14px;
  --r-ctrl: 9px;
  --shadow: 0 10px 34px -14px rgba(15, 23, 42, 0.34),
            0 2px 8px -3px rgba(15, 23, 42, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: "Source Sans Pro", system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#before, #after {
  width: 50%;
  height: 100vh;
  float: left;
}
#before { border-right: 1px solid rgba(20, 24, 29, 0.18); }

input, select { cursor: pointer; }
.maplibregl-ctrl-top-right { top: 84px; }
.maplibregl-ctrl-attrib { font-size: 10px; }

/* ---------------------------------------------- brand seam (map center) */
#brandbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px 7px 12px;
  background: rgba(20, 24, 29, 0.92);
  color: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.brand-mark {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: linear-gradient(90deg, #fff 0 50%, var(--accent) 50% 100%);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.55);
  flex: none;
}
.brand-name {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}
.brand-sub {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  border-left: 1px solid rgba(255, 255, 255, 0.22);
  padding-left: 10px;
  line-height: 1;
}
.map-tag {
  position: absolute;
  top: 16px;
  z-index: 4;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

/* ----------------------------------------------------------- panels */
.map-overlay,
.map-overlay-right,
.map-overlay-bottom-right {
  font: 13px/1.5 "Source Sans Pro", system-ui, sans-serif;
  position: absolute;
  width: 262px;
  padding: 14px;
}
.map-overlay { top: 0; left: 0; }
.map-overlay-right { top: 0; right: 0; }
.map-overlay-bottom-right { bottom: 0; right: 0; }

.map-overlay-inner {
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 14px 15px;
  margin-bottom: 12px;
}
#time-panel, #equity-matrix {
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}

/* panel header */
.panel-head {
  margin: -2px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.panel-kicker {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 1px;
}
.panel-title {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: 0.01em;
  line-height: 1.05;
  margin: 0;
  color: var(--ink);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}

.subheadline {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.map-overlay b,
.map-overlay-right b {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: inline-block;
  margin: 4px 0 2px;
}
label { color: var(--ink-soft); }

/* radios & checkboxes */
.map-overlay input[type="radio"],
.map-overlay-right input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-right: 6px;
  cursor: pointer;
}
.map-overlay-right label.em_factor,
.map-overlay label[for] {
  cursor: pointer;
  font-size: 13px;
}
.em_factor:hover { color: var(--accent-ink); }

/* range sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: 8px 0 4px;
  cursor: ew-resize;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(14, 138, 125, 0.5);
  transition: transform 0.12s ease;
}
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.18); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(14, 138, 125, 0.5);
}
input[type="range"]:disabled { opacity: 0.45; }

/* dropdown + select */
#causationButton {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctrl);
  padding: 4px 10px;
  font-size: 13px;
  color: var(--ink);
  margin-top: 2px;
  transition: border-color 0.15s ease;
}
#causationButton:hover { border-color: var(--accent); }
.map-overlay .dropdown-menu { font-size: 13px; border-radius: var(--r-ctrl); }
.dropdown-item.active, .dropdown-item:active { background: var(--accent); }

#time_of_day {
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctrl);
  padding: 0 8px;
  background: #fff;
  font-size: 13px;
  color: var(--ink);
  width: 100%;
  margin-top: 2px;
}
#time_of_day:focus, #causationButton:focus,
input:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

#yearLabel, #monthAllCheck, #monthLabel { font-weight: 400; color: var(--accent-ink); }
.scrollable-dropdown { max-height: 220px; overflow-y: auto; }
#monthInputs { display: none; }

/* ----------------------------------------------- legends (dynamic) */
.row { height: 11px; width: 92%; }
.colors {
  margin: 4px 0 5px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.labels { margin-top: 1px; margin-bottom: 2px; }
.label {
  width: 25%;
  display: inline-block;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
#outage-legend { margin-bottom: 2em; }
#outage-type-label {
  margin-top: 0.7em;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ----------------------------------------------- tract info panel */
.map-overlay-bottom-right h6 {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 8px;
}
#tract-info > div { display: flex; justify-content: space-between; gap: 8px; padding: 1px 0; }
#tract-info .fw-bold { font-weight: 600; color: var(--muted); font-size: 12px; }
#tract-info span { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
#tract-info > label.fw-bold { display: block; margin: 9px 0 4px; color: var(--muted); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.progress { border-radius: 999px; overflow: hidden; background: var(--line); }

/* race progress bar palette (Spectral, kept legible) */
#a-native-indian { background-color: #d53e4f; }
#a-asian { background-color: #f46d43; }
#a-black { background-color: #fdae61; }
#a-latino { background-color: #fee08b; }
#a-native-pacific { background-color: #e6f598; }
#a-white { background-color: #66c2a5; }
#a-other { background-color: #3288bd; }

/* ----------------------------------------------- burger toggles */
.burger-btn, .left-burger-btn {
  position: absolute;
  cursor: pointer;
  z-index: 6;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  transition: color 0.15s ease, transform 0.12s ease;
}
.burger-btn { right: 10px; top: 64px; }
.left-burger-btn { left: 10px; top: 64px; margin-left: 0; }
.burger-btn:hover, .left-burger-btn:hover { color: var(--accent); transform: translateY(-1px); }

/* ----------------------------------------------- equity tooltip */
#tooltip {
  position: absolute;
  top: 16px;
  right: 286px;
  background: rgba(20, 24, 29, 0.94);
  color: #f3f5f7;
  border: 0;
  padding: 11px 13px;
  border-radius: 11px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 1000;
  font-size: 12.5px;
  line-height: 1.5;
  width: 230px;
  backdrop-filter: blur(8px);
}

/* ----------------------------------------------- welcome modal */
.map-window { --bs-modal-bg: transparent; }
.map-window .modal-content {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 30px 80px -24px rgba(15, 23, 42, 0.5);
  overflow: hidden;
}
.map-window .modal-header {
  background: var(--ink);
  border: 0;
  padding: 20px 26px;
  align-items: center;
  gap: 12px;
}
.map-window .modal-header::before {
  content: "";
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(90deg, #fff 0 50%, var(--accent) 50% 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
  flex: none;
}
.modal-title {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 500;
  font-size: 26px;
  letter-spacing: 0.02em;
  color: #fff;
}
.map-window-content {
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--ink-soft);
  padding: 24px 26px 8px;
}
.map-window-content p { margin-bottom: 14px; }
.map-window-content ul { list-style: none; padding: 0; margin: 0 0 16px; }
.map-window-content li {
  position: relative;
  padding: 10px 0 10px 18px;
  border-top: 1px solid var(--line);
}
.map-window-content li::before {
  content: "";
  position: absolute;
  left: 0; top: 17px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.map-window-content b { color: var(--ink); }
.map-window .modal-footer {
  border-top: 1px solid var(--line);
  padding: 14px 26px;
  gap: 10px;
}
.map-window .modal-footer .form-switch input { accent-color: var(--accent); }
#nextTimeLabel {
  font-family: "Source Sans Pro", sans-serif;
  font-size: 13px;
  color: var(--muted);
  margin-right: auto;
}
#welcome-close {
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 8px 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.15s ease, transform 0.12s ease;
}
#welcome-close:hover { background: var(--accent-ink); }
#welcome-close:active { transform: scale(0.97); }

/* ----------------------------------------------- loader (CSS only) */
#loader {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(248, 249, 250, 0.82);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}
#loader::after {
  content: "";
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#displayWhenCollapsed { display: none; }

/* scrollbars */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(20, 24, 29, 0.18); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(20, 24, 29, 0.32); }

@media (prefers-reduced-motion: reduce) {
  #loader::after { animation: none; }
  * { transition: none !important; }
}
