/* ============================================================
   Monterey Art + Auto Map — Design System
   Minimal aesthetic, maximum functionality
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --col-art:    #C4784A;  /* copper / terracotta — galleries, art */
  --col-auto:   #4A8EC4;  /* steel blue — car venues, races */
  --col-race:   #E05252;  /* racing red — tracks, motorsport */
  --col-nature: #4AC487;  /* emerald — parks, beaches, nature */
  --col-food:   #C4A84A;  /* champagne gold — food & wine */
  --col-hotel:  #9B6DC4;  /* amethyst — hotels, stays */
  --col-event:  #A0B4C8;  /* ice steel — events */
  --col-hist:   #9E8C7A;  /* warm stone — historic sites */

  --bg-0: #0A0906;
  --bg-1: #111009;
  --bg-2: #181510;
  --bg-3: #221E18;
  --border: rgba(255,255,255,0.06);
  --text-1: #F0EAE0;
  --text-2: #9E9080;
  /* was #5A5248 — 2.37:1 on the panel background, below the 4.5:1 floor for
     the ~10 places this token is used (2026-07-31 contrast pass). */
  --text-3: #B0A79C;

  --radius-sm:  0.375rem;
  --radius-md:  0.625rem;
  --radius-lg:  1rem;
  --radius-xl:  1.5rem;

  /* V3 safe-area + layout tokens */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  /* Sheet snap heights. Peek 140→76 (2026-08-03): search moved to the
     header 🔍 bar and the countdown to the CTA bar, so the peek is just
     the drag handle + trip chips — "more map, less crap" (George). Keep in
     sync with PEEK_HEIGHT in bottom-sheet.js. */
  /* One source for the phone sheet's peek height (2026-11-18): bottom-sheet.js reads --sheet-peek-base, and the
     sheet rules below use --sheet-peek. It was 76 here and in the script, with a stale 140 in the base rule. */
  /* px-keep-decl: bottom-sheet.js reads this number with parseInt; in rem it would read 4, not 76 */ --sheet-peek-base: 76px;
  --sheet-peek: calc(var(--sheet-peek-base) + var(--safe-b));
  --sheet-half: 48vh;

  /* New layer group colors */
  --col-fire:    #E85A1A;  /* fire/emergency */
  --col-ocean:   #2A7AC4;  /* ocean/marine */
  --col-quake:   #C4A040;  /* earthquake */
  --col-traffic: #6AC44A;  /* transit/roads */
  --col-sky:     #8080C4;  /* planes/ships */
  --col-weather: #4AC4C4;  /* weather */
  --col-cell:    #C44A8A;  /* cell coverage */

  /* Bottom clear (ensures content doesn't hide behind sheet) */
  --bottom-clear: calc(var(--sheet-peek) + 0.5rem);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg-0);
  color: var(--text-1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* iOS Safari sizes 100vh against the largest viewport (toolbar collapsed);
   dvh tracks the visible viewport so bottom-anchored map UI clears the toolbar.
   body.h-screen out-specifies Tailwind's .h-screen (100vh) on the map page. */
body { height: 100vh; height: 100dvh; }
body.h-screen { height: 100vh; height: 100dvh; }

/* Prevent MapLibre tap highlight on mobile */
#map * { -webkit-tap-highlight-color: transparent; }

/* ---------- Header ---------- */
.mam-header {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}

.mam-logo-mark svg { display: block; }

.mam-tagline {
  color: var(--col-art);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;      /* WebKit wrapped "CAR CULTURE / MAP" onto 2 lines (2026-10-20) */
}
@media (max-width: 420px) { .mam-tagline { letter-spacing: 0.06em; } }

/* ---------- Sidebar ---------- */
.mam-sidebar {
  background: var(--bg-1);
  overflow: hidden;
}

/* Filter-chip (.mam-chip) rules removed 2026-07-31 with the dead
   quick-filter row — no template renders them anymore. */

/* ---------- Scrollbar hide ---------- */
.scrollbar-none { scrollbar-width: none; }
.scrollbar-none::-webkit-scrollbar { display: none; }

/* ============================================================
   FLOATING CALLOUT CARD
   ============================================================ */
.mam-callout {
  position: absolute;
  z-index: 40;
  width: 15rem;
  pointer-events: none;
  opacity: 0;
  transform: translateY(0.375rem) scale(0.97);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.mam-callout.mam-callout--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.mam-callout-inner {
  background: rgba(18, 14, 10, 0.96);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.875rem 0.625rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.7), 0 0 0 0.5px rgba(255,255,255,0.04) inset;
}
.mam-callout-arrow {
  position: absolute;
  bottom: -0.4375rem;
  left: 50%;
  transform: translateX(-50%);
  width: 0.875rem;
  height: 0.4375rem;
  overflow: hidden;
}
.mam-callout-arrow::before {
  content: '';
  display: block;
  width: 0.625rem;
  height: 0.625rem;
  background: rgba(18,14,10,0.96);
  border: 1px solid rgba(255,255,255,0.1);
  transform: rotate(45deg) translateY(-0.3125rem);
  margin: 0 auto;
}
.mam-callout--below .mam-callout-arrow {
  bottom: auto;
  top: -0.4375rem;
}
.mam-callout--below .mam-callout-arrow::before {
  transform: rotate(45deg) translateY(0.3125rem);
}

.mam-callout-badge {
  display: inline-block;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  background: rgba(196,120,74,0.2);
  color: var(--col-art);
  margin-bottom: 0.25rem;
}
.mam-callout-badge[data-cat="auto"],
.mam-callout-badge[data-cat="race_venue"],
.mam-callout-badge[data-cat="car_museum"],
.mam-callout-badge[data-cat="car_dealer"] {
  background: rgba(74,142,196,0.2); color: var(--col-auto);
}
.mam-callout-badge[data-cat="race_track"] {
  background: rgba(224,82,82,0.2); color: var(--col-race);
}
.mam-callout-badge[data-cat="park"],
.mam-callout-badge[data-cat="beach"],
.mam-callout-badge[data-cat="viewpoint"] {
  background: rgba(74,196,135,0.2); color: var(--col-nature);
}
.mam-callout-badge[data-cat="restaurant"],
.mam-callout-badge[data-cat="cafe"],
.mam-callout-badge[data-cat="winery"] {
  background: rgba(196,168,74,0.2); color: var(--col-food);
}
.mam-callout-badge[data-cat="hotel"],
.mam-callout-badge[data-cat="bnb"] {
  background: rgba(155,109,196,0.2); color: var(--col-hotel);
}

.mam-callout-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.25;
  margin: 0;
}
.mam-callout-desc {
  font-size: 0.6875rem;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0.25rem 0 0.375rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mam-callout-meta {
  font-size: 0.625rem;
  color: var(--text-3);
  margin-bottom: 0.5rem;
  line-height: 1.6;
}
.mam-callout-meta a { color: var(--col-art); text-decoration: none; }
.mam-callout-meta a:hover { text-decoration: underline; }

.mam-callout-expand-btn {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-1);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.5rem;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mam-callout-expand-btn:hover { background: rgba(255,255,255,0.12); }

.mam-callout-route-btn {
  flex-shrink: 0;
  font-size: 0.9375rem;
  background: rgba(124,58,237,0.18);
  border: 1px solid rgba(124,58,237,0.35);
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.5625rem;
  cursor: pointer;
  color: #c4b5fd;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}
.mam-callout-route-btn:hover { background: rgba(124,58,237,0.32); }

/* "Get here" transport deep-link row (Directions / Uber / Lyft) */
.mam-gethere-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}
.mam-gethere-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-1);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 0.3125rem 0.5625rem;
  text-decoration: none;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mam-gethere-link:hover { background: rgba(255,255,255,0.12); }
.mam-gethere-ico { font-size: 0.8125rem; line-height: 1; }

.mam-callout-close {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: color 0.1s;
}
.mam-callout-close:hover { color: var(--text-1); }

/* ============================================================
   MOBILE BOTTOM SHEET
   ============================================================ */
.mam-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--bg-2);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(calc(100% - var(--sheet-peek)));
  max-height: 90vh;
  /* Never shorter than the map area: bottom-sheet.js places the sheet by its own height, so a sheet with
     little in it (one place's details) stopped short of the bottom and left a strip of map under it
     (2026-11-18). */
  min-height: 100%;
  overflow: hidden;
  will-change: transform;
  /* iOS safe area — content not hidden under home indicator */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.mam-sheet[data-state="peek"]   { transform: translateY(calc(100% - var(--sheet-peek))); }
.mam-sheet[data-state="half"]   { transform: translateY(35%); }
.mam-sheet[data-state="full"]   { transform: translateY(0); }

.mam-sheet-handle-wrap {
  display: flex;
  justify-content: center;
  padding: 0.625rem 0 0.375rem;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
#sheet-drag-handle { touch-action: none; }
.mam-sheet-handle-wrap:active { cursor: grabbing; }
.mam-sheet-handle {
  width: 2.25rem;
  height: 0.25rem;
  background: rgba(255,255,255,0.18);
  border-radius: 0.125rem;
}

.mam-sheet-peek { padding-bottom: 0.25rem; }

.mam-sheet-content {
  overflow-y: auto;
  max-height: calc(90vh - 7.5rem);
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.mam-sheet-detail { min-height: 12.5rem; }

/* ============================================================
   LAYER CONTROL PANEL
   ============================================================ */
.lp-trigger-btn {
  background: rgba(18,14,10,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-1);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem 0.875rem;
  border-radius: 1.25rem;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.lp-trigger-btn:hover { background: rgba(30,24,16,0.96); border-color: rgba(196,120,74,0.4); }
.lp-trigger-btn--active { border-color: var(--col-art); color: var(--col-art); }
.lp-reset-saved { position: absolute; right: calc(100% + 0.5rem); bottom: 0; white-space: nowrap; color: var(--col-art); }

.lp-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 38;
  background: rgba(0,0,0,0.4);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.lp-backdrop--visible { display: block; }

.lp-panel {
  position: absolute;
  bottom: 8.125rem;
  right: 0.75rem;
  z-index: 39;
  width: 16.25rem;
  background: rgba(18,14,10,0.97);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 48px rgba(0,0,0,0.7);
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(0.625rem) scale(0.97);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.lp-panel--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Layer panel wrapper — positioned floating above the map */
.lp-panel-wrapper {
  position: absolute;
  right: 0.75rem;
  bottom: 5rem;
  z-index: 20;
}

@media (max-width: 767px) {
  /* On mobile, must sit above the 140px peek sheet + safe area.
     z-index must beat the bottom sheet (30): the fixed .lp-panel is trapped
     in this wrapper's stacking context, so the wrapper carries the z. */
  .lp-panel-wrapper {
    /* --bottom-clear = sheet peek + 8, safe-area included — the FAB was the
       last thing pinning the old 148px by hand (2026-08-03). */
    bottom: var(--bottom-clear);
    z-index: 40;
  }

  /* QA 2026-07-19, finding F: the FAB's bottom offset is pinned to the peek
     sheet's height, so when the sheet is dragged to half/full it grows over
     the FAB instead of the FAB moving with it — the button ends up sitting
     on top of the trip-chip/filter rows. Fade just the trigger button (not
     the whole wrapper, so an already-open panel isn't yanked away if the
     sheet gets dragged mid-interaction) whenever the sheet (#mobile-sheet,
     state owned by bottom-sheet.js) isn't at peek. `:has()` is already
     relied on elsewhere in this file (see the [data-embed="1"] rule above)
     so this needs no JS wiring. */
  .flex-1:has(#mobile-sheet[data-state="half"]) .lp-trigger-btn,
  .flex-1:has(#mobile-sheet[data-state="full"]) .lp-trigger-btn,
  .flex-1:has(#mobile-sheet[data-state="half"]) .mbmap-breadcrumb-btn:not(.recording),
  .flex-1:has(#mobile-sheet[data-state="full"]) .mbmap-breadcrumb-btn:not(.recording) {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
  }
  /* While recording, the stop button must stay reachable even with the
     sheet raised — ride above the sheet (z 30) instead of fading. */
  .mbmap-breadcrumb-btn.recording { z-index: 35; }

  /* Phone main map: the sheet's 140px peek buried the brand plate
     (bottom:34). Center it above the peek — the tools rail owns
     bottom-left, the Layers FAB owns bottom-right (2026-08-03). */
  #map .mam-brand {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    bottom: var(--bottom-clear);
  }

  /* Mobile panel: fixed bottom sheet so it covers viewport bottom correctly */
  .lp-panel {
    position: fixed !important;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
    max-height: 70vh;
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .lp-panel--open { transform: translateY(0); }

  /* iOS: prevent auto-zoom on input focus (font-size < 16px triggers zoom) */
  #mobile-search,
  #sidebar-search,
  .mam-input {
    /* px-keep-decl: iOS zooms the page on focus below 16 px; an absolute limit, not a text size */ font-size: 16px !important;
  }

  /* Ensure sheet scrollable content respects safe area at bottom */
  .mam-sheet-content {
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
  }

  /* ── Nav buttons — 44px tap height without wrecking layout ──────────────
     2026-08-03: the earlier version of this block let flex SHRINK every
     item to the 44px min-width floor (labels clipped mid-word, "Save ma"),
     and its display:inline-flex out-specified Tailwind's `hidden` so the
     desktop-only GoR link reappeared on phones. shrink-0 + slimmer padding
     fit all five items in the 220px the logo leaves; overflow-x-auto on
     the nav is the safety valve, not the default state. */
  .mam-header nav {
    gap: 0;
  }
  .mam-header nav button,
  .mam-header nav a {
    min-height: 2.75rem;
    min-width: 2.5rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.3125rem;
  }
  .mam-header nav button.hidden,
  .mam-header nav a.hidden {
    display: none;
  }

  /* ── Close buttons — 44×44 tap target, × stays visually centred ─────────── */
  .mam-callout-close,
  .lp-close-btn,
  .mam-modal-close {
    width: 2.75rem !important;
    height: 2.75rem !important;
    font-size: 1.375rem;
    border-radius: 0.5rem;
  }

  /* ── Satellite toggle — at least 44px tall ──────────────────────────────── */
  .sat-toggle-btn {
    padding: 0.75rem 0.875rem;
    min-height: 2.75rem;
  }

  /* ── MapLibre zoom + geolocate controls — override default 29×29 ────────── */
  .maplibregl-ctrl-zoom-in,
  .maplibregl-ctrl-zoom-out,
  .maplibregl-ctrl-geolocate {
    width: 2.75rem !important;
    height: 2.75rem !important;
  }
  .maplibregl-ctrl-group {
    border-radius: 0.625rem !important;
  }

  /* ── Layers trigger button — 36px → 44px ───────────────────────────────── */
  .lp-trigger-btn {
    padding: 0.75rem 0.875rem;
    min-height: 2.75rem;
  }

  /* ── Callout action strip — View details + 🗺 map icon ─────────────────── */
  .mam-callout-expand-btn,
  .mam-callout-route-btn {
    padding: 0.625rem 0.625rem;
    min-height: 2.75rem;
  }

  /* ── Trip chips in bottom sheet (Gallery Walk etc.) ───────────────────── */
  .mam-trip-chip {
    min-height: 2.5rem;
    padding: 0.625rem 0.875rem;
  }

  /* ── Car Week footer CTA link — bigger tap zone via padding ────────────── */
  .shrink-0.border-t a {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0.25rem 0.125rem;
  }
}

.lp-drag-handle {
  display: none;
  justify-content: center;
  padding: 0.625rem 0 0.25rem;
}
@media (max-width: 767px) { .lp-drag-handle { display: flex; } }
.lp-drag-handle::before {
  content: '';
  width: 2.25rem;
  height: 0.25rem;
  background: rgba(255,255,255,0.15);
  border-radius: 0.125rem;
}

.lp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem 0.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.lp-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}
.lp-close-btn {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: color 0.1s;
}
.lp-close-btn:hover { color: var(--text-1); }

.lp-layer-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.25rem 0 0.5rem;
  flex: 1;
}

.lp-group-header {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0.625rem 0.875rem 0.25rem;
}

.lp-empty {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-3);
  padding: 1.25rem;
}

.lp-row {
  display: flex;
  align-items: center;
  padding: 0.3125rem 0.875rem;
  gap: 0.625rem;
  cursor: pointer;
  transition: background 0.1s;
  min-height: 2.75rem;
}
.lp-row:hover { background: rgba(255,255,255,0.04); }

.lp-row-left  { flex: 1; min-width: 0; }
.lp-row-info  { display: flex; align-items: center; gap: 0.5rem; }

.lp-row-icon {
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 0.375rem;
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  flex-shrink: 0;
}
.lp-row-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lp-slider-wrap {
  padding: 0.1875rem 0 0 2.125rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.lp-slider-wrap--hidden { display: none; }
.lp-slider-label {
  font-size: 0.5625rem;
  color: var(--text-3);
  width: 2.25rem;
  flex-shrink: 0;
}
.lp-slider {
  flex: 1;
  height: 0.1875rem;
  accent-color: var(--col-art);
  cursor: pointer;
  min-width: 0;
}

.lp-toggle {
  flex-shrink: 0;
  position: relative;
  width: 2.375rem;
  height: 1.375rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lp-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.lp-toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 0.6875rem;
  transition: background 0.2s;
}
.lp-toggle-slider::before {
  content: '';
  position: absolute;
  width: 1rem;
  height: 1rem;
  left: 0.1875rem;
  top: 0.1875rem;
  background: rgba(255,255,255,0.4);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.lp-toggle input:checked + .lp-toggle-slider { background: rgba(196,120,74,0.45); }
.lp-toggle input:checked + .lp-toggle-slider::before {
  transform: translateX(1rem);
  background: var(--col-art);
}

/* ============================================================
   EVENT CARDS (in sheet/sidebar)
   ============================================================ */
.mam-event-card {
  display: flex;
  gap: 0.625rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity 0.15s;
  align-items: flex-start;
}
.mam-event-card:hover { opacity: 0.8; }
.mam-event-card:last-child { border-bottom: none; }

.mam-event-date {
  flex-shrink: 0;
  width: 2.5rem;
  text-align: center;
  padding-top: 1px;
}
.mam-event-date-month {
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--col-art);
  display: block;
}
.mam-event-date-day {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-1);
  line-height: 1;
  display: block;
}
.mam-event-body { flex: 1; min-width: 0; }
.mam-event-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.125rem;
}
.mam-event-meta {
  font-size: 0.625rem;
  color: var(--text-3);
  margin-top: 1px;
}
.mam-event-tag {
  display: inline-block;
  font-size: 0.5625rem;
  font-weight: 600;
  padding: 1px 0.3125rem;
  border-radius: 0.1875rem;
  background: rgba(196,120,74,0.15);
  color: var(--col-art);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.1875rem;
}
.mam-event-tag[data-cat="car_show"],
.mam-event-tag[data-cat="race"] {
  background: rgba(74,142,196,0.15);
  color: var(--col-auto);
}
.mam-event-tag[data-cat="festival"] {
  background: rgba(196,168,74,0.12);
  color: var(--col-food);
}

/* ============================================================
   MapLibre control overrides
   ============================================================ */
.maplibregl-ctrl-group {
  background: rgba(18,14,10,0.92) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4) !important;
  border-radius: 0.625rem !important;
  overflow: hidden;
}
.maplibregl-ctrl-group button {
  background-color: transparent !important;
  border-bottom: 1px solid rgba(255,255,255,0.06) !important;
}
.maplibregl-ctrl-group button:last-child { border-bottom: none !important; }
.maplibregl-ctrl-group button:hover { background: rgba(255,255,255,0.06) !important; }
.maplibregl-ctrl-group button span {
  filter: invert(0.8) sepia(0) saturate(0) brightness(1.2);
}
.maplibregl-ctrl-scale {
  background: rgba(18,14,10,0.7) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  border-top: none !important;
  color: var(--text-2) !important;
  font-size: 0.5625rem !important;
  padding: 0.125rem 0.25rem !important;
  border-radius: 0 0 0.25rem 0.25rem !important;
}

/* ============================================================
   Weather widget (sidebar footer)
   ============================================================ */
.mam-weather {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  color: var(--text-2);
}
.mam-weather-icon { font-size: 1rem; }
.mam-weather-temp { font-weight: 600; color: var(--text-1); }

/* ============================================================
   Alpine + v2 additions
   ============================================================ */

/* Hide Alpine-cloaked elements before Alpine initializes */
[x-cloak] { display: none !important; }

/* Layer panel v2 additions */
.lp-group-header--btn {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
}
.lp-sublayers {
  padding: 0.125rem 0 0.25rem 1.25rem;
}
.lp-sublayer-row {
  opacity: 0.85;
}
.lp-sublayer-row:hover {
  opacity: 1;
}

/* Bulk on/off row — sticky above the scrolling group list */
.lp-bulk-row {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem 0.5rem;
  background: rgba(18,14,10,0.97);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.125rem;
}
.lp-bulk-btn {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-2);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.3125rem 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.lp-bulk-btn:hover {
  background: rgba(196,120,74,0.15);
  border-color: rgba(196,120,74,0.4);
  color: var(--col-art);
}

/* Per-group toggle-all — tri-state dot button next to the expand chevron */
.lp-group-toggle-all {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}
.lp-group-toggle-all-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.25);
  background: transparent;
  transition: all 0.15s;
}
.lp-group-toggle-all--all .lp-group-toggle-all-dot {
  background: var(--col-art);
  border-color: var(--col-art);
}
.lp-group-toggle-all--some .lp-group-toggle-all-dot {
  background: linear-gradient(90deg, var(--col-art) 50%, transparent 50%);
  border-color: rgba(196,120,74,0.6);
}
.lp-group-toggle-all--none .lp-group-toggle-all-dot {
  background: transparent;
  border-color: rgba(255,255,255,0.25);
}
.lp-group-toggle-all:hover .lp-group-toggle-all-dot {
  border-color: var(--col-art);
}

/* Auth modal & shared modal styles */
.mam-modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.7); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.mam-modal {
  background: #1c1917; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.75rem; padding: 1.5rem; width: 100%; max-width: 23.75rem;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5);
  /* A long stop list must scroll inside the modal, not overflow past the
     viewport where the header and Save button become unreachable. */
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}
.mam-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.mam-modal-title { font-size: 1rem; font-weight: 600; color: #e7e5e4; }
.mam-modal-close { background: none; border: none; color: #78716c; font-size: 1.25rem; cursor: pointer; line-height: 1; }
.mam-modal-close:hover { color: #e7e5e4; }
.mam-input {
  width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.5rem; padding: 0.5rem 0.75rem; font-size: 0.875rem; color: #e7e5e4;
  outline: none;
}
.mam-input:focus { border-color: rgba(251,191,36,0.4); background: rgba(255,255,255,0.08); }
.mam-btn { width: 100%; padding: 0.5rem 1rem; border-radius: 0.5rem; font-size: 0.875rem;
           font-weight: 500; cursor: pointer; border: none; transition: opacity 0.15s; }
.mam-btn:hover { opacity: 0.85; }
.mam-btn--primary { background: #C4784A; color: white; }
.mam-btn--oauth { background: rgba(255,255,255,0.07); color: #e7e5e4;
                   border: 1px solid rgba(255,255,255,0.1);
                   display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.mam-btn--ghost { background: none; color: #a8a29e; border: 1px solid rgba(255,255,255,0.08); }

/* ── Day planner stop rows (Save & Share modal road-trip list) ───────────── */
.mam-stop {
  background: rgba(255,255,255,0.03);
  border-radius: 0.5rem;
  padding: 0.5rem;
}
/* Titles wrap to two lines instead of truncating — "Broad Arrow — The…"
   is not enough to identify a stop. */
.mam-stop-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.mam-stop-btn {
  width: 2.5rem; height: 2.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.5rem;
  background: rgba(255,255,255,0.04);
  color: #d6d3d1;
  font-size: 1rem; line-height: 1;
  cursor: pointer;
}
.mam-stop-btn:hover { background: rgba(255,255,255,0.10); color: #fafaf9; }
.mam-stop-btn:disabled { opacity: 0.3; cursor: default; }
.mam-stop-btn:disabled:hover { background: rgba(255,255,255,0.04); color: #d6d3d1; }
/* Delete reads as destructive and is spaced away from the ↓ arrow. */
.mam-stop-btn--del {
  color: #f87171;
  border-color: rgba(248,113,113,0.25);
  background: rgba(248,113,113,0.08);
  margin-left: 0.875rem;
}
.mam-stop-btn--del:hover { background: rgba(248,113,113,0.20); color: #fecaca; }
.mam-stop--flash { animation: mam-stop-flash 600ms ease-out; }
@keyframes mam-stop-flash {
  0%   { background: rgba(251,191,36,0.35); }
  100% { background: rgba(255,255,255,0.03); }
}
@media (prefers-reduced-motion: reduce) {
  .mam-stop--flash { animation: none; box-shadow: inset 0 0 0 1px rgba(251,191,36,0.7); }
}
.mam-stop-total {
  position: sticky; bottom: 0; z-index: 1;
  background: #1c1917;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 0.125rem;
  padding: 0.5rem 0;
  font-size: 0.75rem;
  color: #e7e5e4;
}

/* Embed mode — hide header, nav chrome */
[data-embed="1"] ~ header,
body:has([data-embed="1"]) header {
  display: none !important;
}
body:has([data-embed="1"]) main {
  height: 100vh;
  height: 100dvh;
}

/* Share page: hide weather and mobile sheet for cleaner share experience */
[data-embed="1"] ~ * #weather-pill,
[data-embed="1"] ~ * #mobile-sheet {
  display: none !important;
}
.mam-weather-desc { color: var(--text-3); font-size: 0.625rem; }

/* ============================================================
   SATELLITE TOGGLE BUTTON
   ============================================================ */
.sat-toggle-btn {
  position: absolute;
  left: 3.125rem;
  bottom: 5rem;
  z-index: 20;
  background: rgba(18,14,10,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-2);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: 1.25rem;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.3125rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  line-height: 1;
}
.sat-toggle-btn:hover { background: rgba(30,24,16,0.96); border-color: rgba(74,142,196,0.4); color: var(--text-1); }
.sat-toggle-btn--active { border-color: var(--col-auto); color: var(--col-auto); }

/* 3D shares .sat-toggle-btn styling but needs its own slot above Satellite —
   without this it renders at the same absolute position and is hidden under it */
#btn-3d { bottom: 8rem; }

/* The old mobile left-rail offsets (Satellite 148 / 3D 200 / GPS 256) are gone:
   map-tools-menu.js re-parents all three buttons into the tools FAB cluster
   below. The base absolute rules above/below stay as a no-JS fallback and are
   neutralised inside .mam-tools-cluster. */

/* ============================================================
   V3 UTILITY CLASSES
   ============================================================ */

/* Live data badge */
.mam-live-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.625rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: #4AC487; opacity: 0.85;
}
.mam-live-badge::before {
  content: ''; width: 0.375rem; height: 0.375rem; border-radius: 50%;
  background: #4AC487; animation: pulse 2s ease infinite;
}

/* Trip chip (larger, intent-driven) */
.mam-trip-chip {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.5rem 0.875rem; border-radius: 1.5rem;
  font-size: 0.8125rem; font-weight: 600;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-1);
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mam-trip-chip:active { transform: scale(0.96); }
.mam-trip-chip.active { background: rgba(196,120,74,0.2); border-color: var(--col-art); color: var(--col-art); }

/* GPS button */
.mam-gps-btn {
  position: absolute; bottom: calc(var(--bottom-clear) + 0.75rem); left: 0.75rem;
  z-index: 20; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 50%;
  width: 2.5rem; height: 2.5rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s;
  color: var(--text-2); box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.mam-gps-btn.active { color: #4A8EC4; border-color: #4A8EC4; background: rgba(74,142,196,0.15); }
.mam-gps-btn.follow { color: #4AC487; border-color: #4AC487; background: rgba(74,196,135,0.15); }

/* ============================================================
   MAP TOOLS MENU — Satellite + 3D + GPS behind one FAB
   (map-tools-menu.js moves the three buttons into the cluster)
   ============================================================ */
.mam-tools-menu {
  position: absolute;
  left: 0.75rem;
  /* --bottom-clear already includes the sheet peek + safe-area inset */
  bottom: calc(var(--bottom-clear) + 0.75rem);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Inside the cluster the tools stack in flow — the scattered absolute
   positions above no longer apply. class+id out-specifies the base #btn-3d
   and .mam-gps-btn rules. */
.mam-tools-cluster .sat-toggle-btn,
.mam-tools-cluster #btn-3d,
.mam-tools-cluster #gps-btn {
  position: static;
  left: auto;
  bottom: auto;
}

/* The collapsed cluster keeps a real (invisible) rect above the FAB — the
   wrapper must not eat taps over that dead zone (it swallowed map pans and
   covered the 🐞 rail button, 2026-08-03). Children re-enable their own
   pointer-events. */
.mam-tools-menu { pointer-events: none; }
.mam-tools-menu .mam-tools-fab { pointer-events: auto; }

.mam-tools-cluster {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
  opacity: 0;
  /* visibility (not display:none) so #btn-3d keeps a real bounding rect —
     terrain.js anchors its intensity popover to it */
  visibility: hidden;
  transform: translateY(0.625rem);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.mam-tools-menu.open .mam-tools-cluster {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

@media (max-width: 767px) {
  /* Phone: expand RIGHT along the bottom band, not upward — at 812px the
     left edge has no vertical room left (the upward cluster grew into the
     control rail's 🐞 button). FAB stays put; tools fan out beside it.
     Must come after the base cluster rules — same specificity. */
  .mam-tools-menu { display: flex; flex-direction: row-reverse; align-items: center; }
  .mam-tools-cluster {
    flex-direction: row;
    align-items: center;
    margin-bottom: 0;
    margin-left: 0.625rem;
    transform: translateX(-0.625rem);
  }
  .mam-tools-menu.open .mam-tools-cluster { transform: translateX(0); }
}

.mam-tools-fab {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18,14,10,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-2);
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.mam-tools-fab:hover,
.mam-tools-menu.open .mam-tools-fab {
  background: rgba(30,24,16,0.96);
  border-color: rgba(74,142,196,0.4);
  color: var(--text-1);
}
/* Status dot: some tool (satellite / 3D / GPS) is active while collapsed */
.mam-tools-fab--active::after {
  content: '';
  position: absolute;
  top: 1px;
  right: 1px;
  width: 0.5625rem;
  height: 0.5625rem;
  border-radius: 50%;
  background: var(--col-auto);
  border: 1px solid rgba(18,14,10,0.9);
}

@media (max-width: 767px) {
  .mam-tools-fab { width: 2.75rem; height: 2.75rem; }
}

/* Awareness banner (fire/quake/weather alerts) */
.mam-awareness-banner {
  position: absolute; top: 0; left: 0; right: 0; z-index: 25;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.875rem;
  background: rgba(232,90,26,0.9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 0.75rem; font-weight: 600; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  transform: translateY(-100%); transition: transform 0.3s ease;
}
.mam-awareness-banner.visible { transform: translateY(0); }
.mam-awareness-banner button { opacity: 0.7; cursor: pointer; padding: 0.125rem 0.375rem; }

/* Weather pill — kept small and quiet so the top-right of the map stays uncluttered */
.mam-weather-pill {
  position: absolute; top: 0.5rem; right: 0.5rem; z-index: 20;
  background: rgba(0,0,0,0.5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: 1.25rem;
  padding: 0.1875rem 0.5625rem; font-size: 0.6875rem; color: var(--text-2);
  cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 0.3125rem;
  transition: background 0.15s;
}
.mam-weather-pill:hover { background: rgba(255,255,255,0.08); }

/* Summary pill stack (galleries.js "N galleries", auto-venues.js "N auto") —
   fixed screen-space column, not map-anchored, so pills can never drift into
   the weather pill or zoom control regardless of pan (QA 2026-07-19, finding
   E). Sits below the weather pill on mobile (the pill is md:hidden, desktop
   has no weather pill so the stack just starts at the top). Individual pills
   (.gm-summary / .av-summary, defined in galleries.js / auto-venues.js)
   keep their own "house glass" look — this only controls placement. */
.mam-summary-stack {
  position: absolute; top: 0.5rem; right: 0.5rem; z-index: 15;
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
/* Count pills go quiet after their 5s debut (chrome-fade.js) — still
   tappable ghosts; hover/touch or a count change wakes them. */
#mam-summary-stack.is-quiet { opacity: 0.35; }

/* Sheet tuck (chrome-fade.js): 5s after boot or on the first map gesture
   the drawer slides fully away; the bottom-center "Trips ▴" tab restores
   it. !important beats bottom-sheet.js's inline snap transform. */
#mobile-sheet.mam-sheet-tucked {
  transform: translateY(102%) !important;
  transition: transform 0.25s ease;
}
.mam-sheet-restore-tab {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(0.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 29;
  align-items: center;
  gap: 0.25rem;
  min-height: 2rem;
  padding: 0 0.875rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(12,10,9,0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #d6d3d1;
  font-size: 0.75rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  -webkit-tap-highlight-color: transparent;
}
body.mam-sheet-hidden .mam-sheet-restore-tab { display: inline-flex; }
@media (max-width: 767px) {
  /* With the drawer gone, the whole FAB stack drops to reclaim the strip —
     everything bottom-anchored reads this token. 44 clears the tab. */
  body.mam-sheet-hidden { --bottom-clear: calc(2.75rem + var(--safe-b)); }
  .lp-panel-wrapper, .mam-tools-menu, #map .mam-brand, .mbmap-breadcrumb-btn {
    transition: bottom 0.25s ease;
  }
}

/* Chrome fades while the user is actually moving the map (chrome-fade.js
   flips body.mam-panning on gesture movestart) — the map is the point;
   everything returns on idle. Keep this list in sync with new chrome. */
body.mam-panning .maplibregl-ctrl-top-left,
body.mam-panning #weather-pill,
body.mam-panning #mam-summary-stack,
body.mam-panning .mam-tools-menu,
body.mam-panning .lp-panel-wrapper,
body.mam-panning .mbmap-breadcrumb-btn,
body.mam-panning .mam-brand,
body.mam-panning .mam-fb-btn,
body.mam-panning .mam-sheet-restore-tab {
  opacity: 0.25;
  transition: opacity 0.2s ease;
}
.mam-summary-stack > * { pointer-events: auto; }
@media (max-width: 767px) {
  .mam-summary-stack { top: 2.875rem; } /* clears the mobile-only weather pill */
}

/* ============================================================
   Awareness banner — pill stack (weather / fire / quake alerts)
   v3 addition: feat/v3-layers
   ============================================================ */
.mam-awareness-stack {
  position: absolute; top: 0.5rem; left: 3.75rem; z-index: 30;
  display: flex; flex-direction: column; gap: 0.375rem;
  pointer-events: none; max-width: calc(100vw - 5rem);
}
.mam-awareness-pill {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem; border-radius: 0.5rem;
  background: rgba(10,9,6,0.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid var(--awareness-color, #F59E0B);
  color: #E5D9C8; font-size: 0.75rem; line-height: 1.3;
  pointer-events: auto; cursor: default;
  animation: bannerSlideIn 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}
@keyframes bannerSlideIn {
  from { opacity:0; transform: translateY(-0.5rem); }
  to   { opacity:1; transform: translateY(0); }
}
.mam-awareness-pill button {
  background: none; border: none; cursor: pointer; font-size: 0.6875rem;
  color: inherit; opacity: 0.7; padding: 0.125rem 0.375rem; border-radius: 0.25rem;
  transition: opacity 0.15s;
}
.mam-awareness-pill button:hover { opacity: 1; background: rgba(255,255,255,0.08); }
.mam-awareness-pill .view-btn {
  color: var(--awareness-color, #F59E0B); font-weight: 600; opacity: 0.9;
}

/* ============================================================
   Place detail panel — enriched layout (hours, social, wiki)
   feat/v3-layers
   ============================================================ */
.mam-detail-card {
  padding: 0.75rem 1rem 1rem;
}
.mam-detail-body {
  display: flex; flex-direction: column; gap: 0.625rem;
  margin-top: 0.625rem;
}
.mam-detail-hours {
  display: flex; align-items: flex-start; gap: 0.5rem;
  font-size: 0.8125rem; color: var(--text-1);
}
.mam-detail-hours::before {
  content: "🕐"; flex-shrink: 0; margin-top: 1px;
}
.mam-detail-hours-note {
  font-size: 0.6875rem; color: var(--text-2); margin-top: 0.125rem;
}
.mam-detail-phone {
  font-size: 0.8125rem; color: var(--text-1);
}
.mam-detail-phone a {
  color: #4AC487; text-decoration: none;
}
.mam-detail-phone a:hover { text-decoration: underline; }
.mam-detail-long-desc {
  font-size: 0.8125rem; color: var(--text-2); line-height: 1.55;
}
.mam-social-links {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem;
}
.mam-social-link {
  display: inline-flex; align-items: center; gap: 0.3125rem;
  font-size: 0.75rem; font-weight: 600;
  padding: 0.25rem 0.625rem; border-radius: 1.25rem;
  border: 1px solid var(--border);
  color: var(--text-1); text-decoration: none;
  background: rgba(255,255,255,0.04);
  transition: background 0.15s, border-color 0.15s;
}
.mam-social-link:hover {
  background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.25);
}
.mam-detail-wiki-link {
  display: inline-flex; align-items: center; gap: 0.3125rem;
  font-size: 0.75rem; color: #7BAFD4; text-decoration: none;
  margin-top: 0.125rem;
}
.mam-detail-wiki-link:hover { text-decoration: underline; }

/* ---- Dark theme for ALL maplibregl Popups (2026-07-31) ----
   Every layer module builds popup HTML with light text, but stock MapLibre
   CSS gives popups a WHITE background. Half the modules never passed the
   .mbmap-popup className (racetrack corners, passport, golden-hour, …) and
   shipped white-on-white popups — George's screenshots. Dark is now the
   DEFAULT for every popup; .mbmap-popup rules below stay for specificity. */
/* ---- carsandcoast.com wordmark plate (lib/map-brand.js) ----
   Rally-plate, not billboard: glass chip, amber legend swatch, monospace
   lowercase. Lives on the map canvas so screenshots carry the name. Sits
   below popup z-order (popups are z8; this is chrome). */
.mam-brand {
  position: absolute; right: 0.5rem; bottom: 2.125rem; z-index: 4;
  display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.3125rem 0.5625rem;
  background: rgba(9,9,11,0.62);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px; letter-spacing: 0.07em; line-height: 1;
  color: #d6d3d1; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s, border-color .15s;
}
.mam-brand:hover { color: #FFB000; border-color: rgba(255,176,0,0.4); }

/* Map credits on phones (George 2026-10-21: "smaller and disappears ... less clutter").
   map-brand.js holds them open 5 s (OSM limit) then folds them to the (i); while open they are a
   small dark caption instead of MapLibre's white panel across the bottom of the map. */
@media (max-width: 600px) {
  .maplibregl-map .maplibregl-ctrl-attrib.maplibregl-compact.maplibregl-compact-show {
    background: rgba(9,9,11,0.72); color: #a8a29e;
    font-size: 0.625rem; line-height: 1.35; padding: 0.1875rem 1.625rem 0.1875rem 0.5rem;
    max-width: calc(100% - 5rem);
  }
  .maplibregl-map .maplibregl-ctrl-attrib.maplibregl-compact-show a { color: #d6d3d1; }
  /* MapLibre's (i) is a black glyph; keep it on a light disc against the dark caption */
  .maplibregl-map .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button {
    background-color: rgba(255,255,255,0.85);
  }
  .maplibregl-map .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner { margin: 0; color: #a8a29e; }
}
.mam-brand-dot { width: 0.375rem; height: 0.375rem; border-radius: 0.125rem; background: #FFB000; }
/* Focused pages put their zoom control in the same corner — sit above it. */
.ltm-wrap .mam-brand, .vn-wrap .mam-brand, .bsm-wrap .mam-brand,
.fkm-wrap .mam-brand, .enf-wrap .mam-brand, .csm-wrap .mam-brand {
  bottom: 6rem; right: 0.625rem;
}

/* Touch targets for the focused-page chips (2026-08-02, launch polish).
   The pills measure ~28-32px tall — under the 44px guideline — but their
   compact look is the design. Extend the HIT AREA, not the pixels: an
   invisible pseudo-element pads each chip's tap zone out to ~44px. Chips sit
   in flex rows with 7px gaps, so neighboring zones kiss but the nearest
   center still wins. */
/* Only the toggles need position:relative — the -copy buttons are already
   position:absolute in their page styles (equal specificity; do not fight
   the cascade over it). A pseudo-element anchors to any positioned box. */
.ltm-toggle, .vn-toggle, .bsm-toggle, .csm-toggle {
  position: relative;
}
.ltm-toggle::before, .ltm-copy::before, .vn-toggle::before, .vn-copy::before,
.enf-copy::before, .fkm-copy::before, .bsm-toggle::before, .bsm-copy::before,
.csm-toggle::before {
  content: '';
  position: absolute;
  inset: -0.4375rem -0.25rem;
}

/* Popups win their stacking fights EVERYWHERE (2026-08-01 review): MapLibre
   gives .maplibregl-popup no z-index at all, so any absolutely-positioned
   chip with one (page toggles/tally/copy are z:5) paints over an open popup.
   /livetraffic got this scoped in its template; /venues shipped the same DOM
   shape without it. House rule made global: floating chrome sits BELOW
   popups — anything that must beat a popup uses z > 8. */
.maplibregl-popup { z-index: 8; }
/* 2026-10-26: turnout popups now carry a satellite card + a shoot card and overflowed the
   embedded /bigsur map at the top. Cap the content and let it scroll instead. */
.maplibregl-popup-content { max-height: min(60vh, 28.75rem); overflow-y: auto; -webkit-overflow-scrolling: touch; }

.maplibregl-popup-content,
.maplibregl-popup .maplibregl-popup-content {
  /* the double selector outranks the vendor sheet even when the vendor CSS
     loads AFTER this file — which it does on every base_page-derived map
     page (bug report #6: white parking popup on /bigsur). */
  background: #16130E;
  color: #e7e5e4;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0.625rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  padding: 0.75rem 0.875rem;
  /* Ceiling only — modules that build narrower popups (inline max-width on
     their own inner div, or a smaller maxWidth on the popup itself) are
     unaffected. No !important here, so those keep winning. */
  max-width: 22.5rem;
  /* Tall cards (venue-outlines with 6 schedule rows) must scroll inside the
     popup, not clip under the map box's overflow:hidden — the map containers
     floor at 460px and MapLibre's anchor flip can't see past them. Same
     treatment chp-incidents gives its inner notes list (2026-08-01 review). */
  max-height: min(26.25rem, 62vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Phone clamp for EVERY page (2026-08-01, George: popups "too wide for a
   phone", and clipped off the edge of the map container). Popup HTML is built
   by ~20 modules with their own inline min-width/max-width, so this one has to
   be !important to actually bound them. calc leaves room for the marker offset
   and the map's own edge padding. */
@media (max-width: 640px) {
  .maplibregl-popup-content { max-width: min(20rem, calc(100vw - 3rem)) !important; }
}
.maplibregl-popup-close-button { color: #a8a29e; font-size: 1rem; padding: 0.125rem 0.4375rem; }
.maplibregl-popup-close-button:hover { color: #e7e5e4; background: transparent; }
.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: #16130E; }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: #16130E; }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: #16130E; }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: #16130E; }

.mbmap-popup .maplibregl-popup-content {
  background: #16130E;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0.625rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  padding: 0.75rem 0.875rem;
}
.mbmap-popup .maplibregl-popup-close-button {
  color: #a8a29e;
  font-size: 1rem;
  padding: 0.125rem 0.4375rem;
}
.mbmap-popup .maplibregl-popup-close-button:hover {
  color: #e7e5e4;
  background: transparent;
}
.mbmap-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: #16130E; }
.mbmap-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: #16130E; }
.mbmap-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: #16130E; }
.mbmap-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: #16130E; }


/* A drive that is closed has to LOOK closed. Big Sur is on fire and under
   evacuation orders, so its trip chip is flagged rather than quietly removed —
   someone who came looking for that drive needs to see WHY it is gone, not
   wonder whether the site is broken. Tapping it goes to /fire.
   REVERT WITH THE FIRE: drop .is-closed/.chip-flag from the chip in index.html. */
.mam-trip-chip.is-closed {
  border-color: rgba(239, 68, 68, 0.55) !important;
  color: #ffb4a8 !important;
  background: rgba(239, 68, 68, 0.13) !important;
}
.mam-trip-chip.is-closed .chip-flag {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.5625rem;
  letter-spacing: 0.1em;
  background: #EF4444;
  color: #fff;
  border-radius: 0.25rem;
  padding: 0.125rem 0.3125rem;
  margin-left: 0.375rem;
  vertical-align: 1px;
  white-space: nowrap;
}
.mam-trip-chip.is-limited .chip-flag {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.5625rem;
  letter-spacing: 0.1em;
  background: #FFB000;
  color: #16130E;
  border-radius: 0.25rem;
  padding: 0.125rem 0.3125rem;
  margin-left: 0.375rem;
  vertical-align: 1px;
  white-space: nowrap;
}


/* Fire + evacuation popups. MapLibre's default popup is white-on-white, which
   is unreadable against these dark map styles and against the callout text
   these layers emit. */
.fire-popup .maplibregl-popup-content {
  background: #12100e;
  color: #ededea;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.75rem;
  padding: 0.75rem 0.875rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
  font-size: 0.8125rem;
  line-height: 1.45;
}
.fire-popup .maplibregl-popup-content h2 { font-size: 0.9375rem; font-weight: 800; margin: 0.25rem 0 0.125rem; }
.fire-popup .maplibregl-popup-content p { margin: 0.125rem 0; color: #b9b4ac; }
.fire-popup .mam-callout-badge {
  display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  background: #EF4444; color: #fff; border-radius: 0.25rem; padding: 0.1875rem 0.375rem;
}
.fire-popup .maplibregl-popup-close-button { color: #9a968f; font-size: 1.125rem; padding: 0.125rem 0.4375rem; }
.fire-popup .maplibregl-popup-tip { border-top-color: #12100e; border-bottom-color: #12100e; }

/* ---------- Short maps (short-map.js sets body.mam-short) ----------
   George 2026-10-20, iPhone "a mess": Safari leaves ~517px of map where a
   Pixel gets ~692, and the left rail was a ~520px stack. On a short map the
   secondary rail buttons fold behind one "More" button; zoom + Transit stay. */
.mam-rail-more { display: none; }
body.mam-short .mam-rail-more {
  display: flex; flex-direction: column; align-items: center; gap: 0.125rem;
}
.mam-rail-more button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.375rem; height: 2.375rem; padding: 0;
  background: rgba(7,6,4,.72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.18); border-radius: 50%; cursor: pointer;
  color: #e7e5e4; font-size: 1.25rem; line-height: 1;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.mam-rail-more-cap {
  font-size: 0.5625rem; line-height: 1; color: #c8beb4; pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,.9);
}
body.mam-short:not(.mam-rail-open) .maplibregl-ctrl-top-left .mam-safety-links,
body.mam-short:not(.mam-rail-open) .maplibregl-ctrl-top-left .mam-weather-toggle,
body.mam-short:not(.mam-rail-open) .maplibregl-ctrl-top-left .maplibregl-ctrl:has(> .mam-fb-btn--rail) {
  display: none !important;
}
/* Opened on a short map the full stack would run under the bottom-left tools
   FAB: zoom steps aside (pinch still zooms) and the gaps tighten. */
body.mam-short .maplibregl-ctrl-top-left .maplibregl-ctrl { margin-top: 0.375rem; }
body.mam-short.mam-rail-open .maplibregl-ctrl-top-left .maplibregl-ctrl-group { display: none; }

/* ---------- Phone tools panel (phone-map-chrome.js sets body.mam-phone-tools) ----------
   Declutter 2026-10-21: on phones the top-left rail keeps only zoom; GPS, 3D,
   Satellite, Transit, Flock, Weather and 🐞 sit in one panel that
   opens above the bottom-left tools button. */
body.mam-phone-tools .mam-rail-more { display: none !important; }
@media (max-width: 767px) {
  body.mam-phone-tools .mam-tools-menu { display: block; }
  body.mam-phone-tools .mam-tools-cluster {
    position: absolute; left: 0; bottom: 3.375rem;
    display: grid; grid-template-columns: repeat(4, 4.125rem); gap: 0.75rem 0.125rem;
    align-items: start; justify-items: center;
    margin: 0; padding: 0.75rem 0.375rem 0.625rem;
    background: rgba(12,10,8,.94);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,.12); border-radius: 1rem;
    box-shadow: 0 8px 28px rgba(0,0,0,.55);
    transform: translateY(0.625rem);
  }
  body.mam-phone-tools .mam-tools-menu.open .mam-tools-cluster { transform: translateY(0); }
  .mam-tool-cell {
    display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
    min-width: 0;
  }
  .mam-tool-cap, .mam-tool-cell .maplibregl-ctrl span {
    font-size: 0.625rem; line-height: 1.1; color: #c8beb4; text-align: center;
  }
  .mam-tool-cell .maplibregl-ctrl { margin: 0 !important; float: none; }
  .mam-tool-cell .sat-toggle-btn,
  .mam-tool-cell .mam-gps-btn,
  .mam-tool-cell .mam-fb-btn--rail {
    position: static !important; inset: auto !important;
    width: 2.75rem !important; height: 2.75rem !important; min-height: 0;
    padding: 0 !important; border-radius: 50% !important;
    display: flex; align-items: center; justify-content: center;
    margin: 0 !important;
  }
  .mam-tool-cell #sat-toggle-btn { font-size: 0; }
  .mam-tool-cell #sat-toggle-btn svg { width: 1.25rem; height: 1.25rem; }
  .mam-tool-cell #btn-3d { font-size: 0.8125rem; }

  /* Top-right: the temperature only; the count pills go (their layers still
     show on the map and in Layers). */
  .mam-weather-pill > span:nth-child(3) { display: none; }
  #mam-summary-stack { display: none !important; }
}

/* Wordmark as a credit line on phones (map-brand.js adds .mam-brand--line and puts it
   in the attribution's MapLibre corner): small text beside the (i), no plate. */
@media (max-width: 767px) {
  .maplibregl-ctrl-bottom-left:has(> .mam-brand--line),
  .maplibregl-ctrl-bottom-right:has(> .mam-brand--line) { display: flex; align-items: flex-end; }
  .maplibregl-ctrl-bottom-left:has(> .mam-brand--line) .mam-brand--line { order: 2; }
  .maplibregl-map .mam-brand.mam-brand--line {
    position: static !important; inset: auto !important; transform: none !important;
    background: none; border: 0; padding: 0; margin: 0 0.125rem 1.0625rem;
    -webkit-backdrop-filter: none; backdrop-filter: none;
    font-size: 0.625rem; color: rgba(231,229,228,.8); text-shadow: 0 1px 3px rgba(0,0,0,.95);
    pointer-events: auto;
  }
  .maplibregl-map .mam-brand--line .mam-brand-dot { width: 0.3125rem; height: 0.3125rem; }
  .maplibregl-ctrl-attrib.maplibregl-compact-show ~ .mam-brand--line,
  .mam-brand--line:has(+ .maplibregl-ctrl-attrib.maplibregl-compact-show) { display: none; }
}

/* Phone, trips sheet showing: the sheet covers the bottom 76 px of the map, which is where the name and
   the credits (i) sit, and the credits' opening 5 seconds were spent under it (measured 2026-11-18). While
   the sheet shows, that corner sits in the button row instead, between the tools button and Layers (108 =
   the Layers button, 94 wide, plus its 12 px margin). It drops back when the sheet tucks
   (body.mam-sheet-hidden). The scale bar stays where it is. */
@media (max-width: 767px) {
  .flex-1:has(#mobile-sheet) .maplibregl-ctrl-bottom-right { transition: bottom 0.25s ease; }
  body:not(.mam-sheet-hidden) .flex-1:has(#mobile-sheet) .maplibregl-ctrl-bottom-right {
    bottom: var(--sheet-peek); right: 6.75rem;
  }
  /* opened credits must end before the tools button (12 + 44 wide): 225 = 108 + their 10 px margin and
     31 px of padding + the 56 px the tools button takes + 20 px of air */
  body:not(.mam-sheet-hidden) .flex-1:has(#mobile-sheet) .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact-show {
    max-width: calc(100vw - 14.0625rem);
  }
}

/* Short desktop-layout map (a phone held sideways, 844x390: the map is about 300 px tall). The left rail
   is 260 px of that, so the tools button sat on the rail's Weather link and its open panel on zoom-out,
   the compass and Transit (measured 2026-11-18). There the tools button stands beside the rail and its
   panel opens sideways. Taller windows are unchanged. */
@media (min-width: 768px) and (max-height: 500px) {
  .mam-tools-menu { left: 3.75rem; flex-direction: row-reverse; align-items: flex-end; }
  .mam-tools-cluster { flex-direction: row; align-items: flex-end; margin: 0 0 0 0.625rem; }
}

/* Location ask on phones (gps.js askChip): one small chip, top centre of the map,
   under the weather pill and clear of the zoom rail. */
.mam-loc-chip {
  position: absolute; top: 3rem; left: 50%; transform: translateX(-50%); z-index: 22;
  display: flex; align-items: center;
  background: rgba(28,25,23,.94); border: 1px solid #a16207; border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.mam-loc-chip button {
  background: none; border: 0; color: #fbbf24; font-size: 0.8125rem; font-weight: 700;
  padding: 0 0.375rem 0 0.875rem; min-height: 2.25rem; white-space: nowrap; cursor: pointer;
}
.mam-loc-chip button[data-a="no"] { color: #a8a29e; font-size: 1.125rem; padding: 0 0.75rem 0 0.375rem; }

/* feedback.js keepOffMaps: the fixed 🐞 steps aside while a page map is under it. */
.mam-fb-btn.mam-fb-btn--aside { opacity: 0; pointer-events: none; transform: translateX(-3.75rem); transition: opacity .2s, transform .2s; }


/* "Get there" buttons (lib/get-here.js buttons() + partials/get_there.html) */
.get-there { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.5rem; }
.get-there-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.5rem; padding: 0 0.6875rem; flex: 0 0 auto;
  font-size: 0.8125rem; font-weight: 600; line-height: 1; text-decoration: none;
  color: #fde68a; background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14); border-radius: 0.5rem;
  -webkit-tap-highlight-color: transparent;
}
.get-there-btn:hover, .get-there-btn:focus-visible { background: rgba(255,255,255,0.14); }
.get-there-wrap { margin: -0.375rem 0 0.375rem; padding: 0 0.25rem; }
.get-there-wrap .get-there { margin-top: 0; }
@media (max-width: 430px) { .get-there { gap: 0.3125rem; } .get-there-btn { padding: 0 0.5625rem; font-size: 12.5px; } }
/* Get-there row inside map popups / callouts: narrow (~260-300px), stays two rows max, taps >=36px */
.maplibregl-popup .get-there-btn, #callout-gethere .get-there-btn { min-height: 2.25rem; padding: 0 0.5625rem; font-size: 12.5px; }
.maplibregl-popup .get-there, #callout-gethere .get-there { gap: 0.3125rem; }
