/* ═══════════════════════════════════════════════════════════════════════════
   Where We Work — interactive service-area map
   Pairs with page-where-we-work.php + assets/js/service-map.js.
   Reuses .prog-hero from inner-pages.css; everything below the hero is here.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Neutral (non-dept) hero base — shortened (~half the standard 62vh) so the map
   sits high in the fold. */
.is-map-page .prog-hero { background: var(--cedars); min-height: 30vh; }
.is-map-page .prog-hero .prog-inner {
  padding-top: clamp(24px, 3.5vh, 48px);
  padding-bottom: clamp(28px, 4vh, 56px);
}
.is-map-page .prog-hero h1 { font-size: clamp(2.4rem, 4.4vw, 3.6rem); margin-bottom: 14px; }
.is-map-page .prog-hero-tagline { margin-bottom: 0; }
.is-map-page .prog-hero-ghost { font-size: clamp(64px, 10vw, 150px); }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.map-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  background: var(--cedars);
  position: relative;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.map-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.08);
  max-height: 80vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.map-sidebar-header {
  padding: 32px 28px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.map-sidebar-header h2 {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #fff;
  margin: 0;
}
.map-sidebar-header p {
  font-size: 0.82rem;
  line-height: 1.55;
  color: rgba(255,255,255,0.5);
  margin: 8px 0 0;
}

/* Accordion group */
.dept-group { border-bottom: 1px solid rgba(255,255,255,0.06); }
.dept-toggle {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  padding: 18px 28px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s var(--ease);
}
.dept-toggle:hover { background: rgba(255,255,255,0.04); }
.dept-toggle[aria-expanded="true"] { background: rgba(255,255,255,0.06); }
.dept-swatch {
  width: 4px; height: 34px;
  border-radius: 2px;
  flex-shrink: 0;
  transition: height 0.2s var(--ease);
}
.dept-toggle[aria-expanded="true"] .dept-swatch { height: 42px; }
.dept-toggle-text { flex: 1; min-width: 0; }
.dept-toggle-name {
  display: block;
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
  line-height: 1.2;
}
.dept-toggle-area {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  margin-top: 3px;
}
.dept-toggle-arrow {
  width: 18px; height: 18px;
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
  transition: transform 0.28s var(--ease), color 0.2s;
}
.dept-toggle[aria-expanded="true"] .dept-toggle-arrow { transform: rotate(180deg); color: rgba(255,255,255,0.6); }

/* Sub-programs */
.dept-programs {
  max-height: 0;
  overflow: hidden;
  background: rgba(0,0,0,0.16);
  transition: max-height 0.35s var(--ease);
}
.dept-programs.is-open { max-height: 460px; }
.program-btn {
  width: 100%;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 28px 13px 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.program-btn:hover { background: rgba(255,255,255,0.05); }
/* Selected program lights up in its department's color (--this-dept set on the
   parent .dept-group): tinted row, a dept accent bar, and a glowing dept dot. */
.program-btn.is-selected {
  background: color-mix(in srgb, var(--this-dept) 22%, transparent);
  box-shadow: inset 3px 0 0 var(--this-dept);
}
.program-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
}
.program-btn:hover .program-dot { opacity: 0.9; }
.program-btn.is-selected .program-dot {
  opacity: 1;
  transform: scale(1.4);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--this-dept) 30%, transparent);
}
.program-btn-text { min-width: 0; }
.program-btn-name {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  color: rgba(255,255,255,0.82);
  line-height: 1.3;
  transition: color 0.15s;
}
.program-btn:hover .program-btn-name { color: #fff; }
.program-btn.is-selected .program-btn-name { color: #fff; }
.program-btn-area {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(255,255,255,0.52);
  margin-top: 2px;
}
.program-btn.is-selected .program-btn-area { color: color-mix(in srgb, var(--this-dept) 45%, #fff); }

/* Info card */
.map-info {
  padding: 0 28px 28px;
  margin-top: auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.32s var(--ease), transform 0.32s var(--ease);
}
.map-info.is-visible { opacity: 1; transform: translateY(0); }
.map-info-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 3px;
  padding: 24px;
  margin-top: 24px;
}
.map-info-label {
  display: block;
  font-family: var(--body);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.map-info-name {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #fff;
  margin: 0 0 10px;
  line-height: 1.15;
}
.map-info-desc {
  font-size: 0.84rem;
  line-height: 1.65;
  color: rgba(255,255,255,0.62);
  margin: 0 0 16px;
}
.map-info-contact {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.5);
  margin: 0 0 18px;
  line-height: 1.5;
}
.map-info-contact strong { color: rgba(255,255,255,0.82); font-weight: 700; display: block; }
.map-info-btn { font-size: 12px; padding: 11px 20px; }
.map-info-btn:hover { filter: brightness(1.12); color: #fff; }

/* ── Map stage ──────────────────────────────────────────────────────────────── */
.map-stage {
  position: relative;
  height: 80vh;
  min-height: 560px;
  background: #0f2b26;
}
.map-canvas {
  position: absolute; inset: 0;
  background: #0f2b26;
  z-index: 1;
}

/* Subdue the raster basemap so brand-colored overlays dominate */
.map-stage .leaflet-tile-pane { filter: saturate(0.72) brightness(0.8) contrast(1.06); }

/* Clicking an SVG county path gives it browser focus, which draws a focus
   outline around its bounding BOX (a misleading rectangle). Suppress it. */
.map-stage .leaflet-interactive:focus { outline: none; }
.map-stage svg path:focus { outline: none; }

/* Empty hint (before any selection) */
.map-empty {
  position: absolute; inset: 0;
  z-index: 400;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  pointer-events: none;
  background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(15,43,38,0.55), transparent 70%);
  transition: opacity 0.4s var(--ease);
}
.map-empty.is-hidden { opacity: 0; }
.map-empty svg { width: 40px; height: 40px; color: rgba(245,240,232,0.4); }
.map-empty span {
  font-family: var(--body);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(245,240,232,0.5);
}

/* Zoom-scale label (top-left over map) */
.map-zoom-label {
  position: absolute; top: 18px; left: 60px;
  z-index: 500;
  font-family: var(--body);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(245,240,232,0.4);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.map-zoom-label.is-visible { opacity: 1; }

/* Legend (bottom-right over map) */
.map-legend {
  position: absolute; bottom: 22px; right: 22px;
  z-index: 500;
  display: flex; align-items: center; gap: 12px;
  background: rgba(23,57,51,0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  padding: 13px 18px;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
}
.map-legend.is-visible { opacity: 1; transform: translateY(0); }
.map-legend-swatch { width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; }
.map-legend-text {
  font-family: var(--body);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(255,255,255,0.78);
  white-space: nowrap;
}

/* ── Ronan pin (divIcon) ──────────────────────────────────────────────────────── */
.map-pin-icon { position: relative; }
.map-pin-dot {
  display: block;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--fec);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.map-pin-dot::after {
  content: '';
  position: absolute; left: 50%; top: 6px;
  width: 12px; height: 12px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.5);
  animation: mw-pin-ping 2s ease-out infinite;
}
@keyframes mw-pin-ping {
  0%   { transform: translate(-50%, -50%) scale(1);   opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(3);   opacity: 0; }
}
.map-pin-label {
  position: absolute; left: 18px; top: -2px;
  font-family: var(--body);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  white-space: nowrap;
}

/* ── Leaflet control + tooltip theming (dark) ─────────────────────────────────── */
.map-stage .leaflet-bar a {
  background: rgba(23,57,51,0.92);
  color: #f5f0e8;
  border-bottom-color: rgba(255,255,255,0.12);
}
.map-stage .leaflet-bar a:hover { background: rgba(37,78,105,0.95); color: #fff; }
.map-stage .leaflet-control-attribution {
  background: rgba(23,57,51,0.78);
  color: rgba(245,240,232,0.5);
  font-size: 10px;
}
.map-stage .leaflet-control-attribution a { color: rgba(245,240,232,0.75); }
.map-county-tip {
  background: rgba(23,57,51,0.95);
  border: 1px solid rgba(255,255,255,0.12);
  color: #f5f0e8;
  font-family: var(--body);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 2px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.map-county-tip::before { display: none; } /* hide tooltip arrow for sticky pill */

/* Permanent region labels on highlighted areas (county/state/reservation names).
   Bold white Raleway with a halo (no pill) so it matches the map's display type
   and reads on any dept-color fill. !important defeats Leaflet's tooltip box. */
.map-area-label,
.map-area-label.leaflet-tooltip {
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  color: #fff !important;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(11px, 0.85vw, 14px);
  line-height: 1.05;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.95), 0 0 10px rgba(0,0,0,0.85), 0 0 22px rgba(0,0,0,0.55);
  white-space: nowrap;
  pointer-events: none;
}
.map-area-label::before, .map-area-label::after { display: none !important; }

/* ── Responsive ───────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; }
  .map-sidebar {
    max-height: none;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .map-info { margin-top: 0; }
  .map-stage { height: 62vh; min-height: 420px; }
}
@media (max-width: 480px) {
  .map-sidebar-header { padding: 26px 20px 20px; }
  .dept-toggle { padding: 16px 20px; }
  .program-btn { padding-left: 36px; padding-right: 20px; }
  .map-info { padding: 0 20px 24px; }
  .map-legend { bottom: 16px; right: 16px; padding: 10px 14px; }
}
