/* Map chrome — toolbar, popups, active marker. Ported from v1 (dark glass). */
.map-toolbar {
  position: absolute; right: 16px; z-index: 9;
  display: flex; flex-direction: column;
  border-radius: 999px; overflow: hidden;
  background: var(--glass-bg); backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
}
.map-toolbar button {
  width: 40px; height: 40px; border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.6); transition: color 0.15s, background 0.15s;
}
.map-toolbar button:hover { background: var(--glass-hover); color: var(--bright); }
.map-toolbar button.active { color: var(--bright); }
.map-rail { top: 16px; }   /* desktop: zoom +/− pair only */
.map-toolbar .tb-divider { height: 1px; margin: 0 8px; background: var(--glass-border); }

/* settings FAB → satellite/locate popover. Mobile: in the bottom bar (see base.css).
   Desktop: pinned bottom-right of the map, opposite the zoom pair up top. */
.map-settings { position: relative; }
/* floating FAB inside #map-wrap → auto-hidden on the chapters view (map is hidden there).
   Desktop: bottom-right corner. Mobile: bottom-right, lifted above the bottom toolbar. */
.map-settings-float { position: absolute; right: 16px; bottom: 16px; z-index: 9; }
@media (max-width: 768px) {
  .map-settings-float { right: 12px; bottom: calc(82px + env(safe-area-inset-bottom)); }
}
.map-settings-fab {
  width: 46px; height: 46px; border-radius: 50%; padding: 0; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
  color: rgba(255, 255, 255, 0.7); transition: color 0.15s, background 0.15s;
}
.map-settings-fab.active, .map-settings-fab:hover { color: var(--bright); }
.map-settings-pop {
  position: absolute; bottom: calc(100% + 10px); right: 0; z-index: 26;
  display: none; flex-direction: column; gap: 4px; padding: 6px; border-radius: 14px; min-width: 152px;
  background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
}
.map-settings-pop.open { display: flex; }
/* text menu: one option per row (SAT/B&W · Find Me) */
.map-settings-row { display: flex; flex-direction: column; gap: 2px; }
.map-settings-pop button {
  width: 100%; min-height: 32px; border: none; background: none; cursor: pointer; padding: 6px 10px; border-radius: 9px;
  display: flex; align-items: center; justify-content: flex-start;
  font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: 0.4px;
  color: rgba(255, 255, 255, 0.78); transition: color 0.15s, background 0.15s;
}
.map-settings-pop button:hover { background: var(--glass-hover); color: var(--bright); }
.map-settings-pop button.active { color: var(--bright); background: rgba(255, 255, 255, 0.12); }
/* map-data credit — the attribution, folded into the panel (no on-map control) */
.map-settings-credit {
  padding: 5px 6px 2px; margin-top: 2px; border-top: 1px solid var(--glass-border);
  font-family: var(--sans); font-size: 9.5px; line-height: 1.45; color: rgba(255, 255, 255, 0.58);
}

/* active-list filter chip on the map (name + ✕) */
.map-filter-chip {
  position: absolute; top: 16px; left: 16px; z-index: 9;
  display: none; align-items: center; gap: 6px;
  max-width: 55%;
  background: var(--glass-bg); backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
  border-radius: 999px; padding: 6px 6px 6px 15px;
}
.map-filter-chip.on { display: inline-flex; }
.map-filter-chip .mfc-title {
  font-family: var(--serif); font-size: 14px; color: var(--bright);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: var(--glass-text-shadow);
}
.map-filter-chip .mfc-x {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.14); color: var(--bright);
  border: none; cursor: pointer; font-size: 16px; line-height: 1; padding: 0;
  transition: background 0.15s;
}
.map-filter-chip .mfc-x:hover { background: rgba(255, 255, 255, 0.28); }
@media (max-width: 768px) { .map-filter-chip { top: calc(12px + env(safe-area-inset-top)); left: 12px; } }

/* popup — dark glass */
.maplibregl-popup-content {
  font-family: var(--sans); padding: 13px 15px; border-radius: 14px; max-width: 300px;
  background: var(--glass-bg); backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow); border: 1px solid var(--glass-border);
}
.maplibregl-popup-tip { border-top-color: rgba(40, 40, 40, 0.28) !important; }
.popup-title { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--bright); text-shadow: var(--glass-text-shadow); }
.popup-thesis { font-size: 12px; color: rgba(255, 255, 255, 0.6); line-height: 1.45; margin-top: 3px; }
.popup-dur { color: rgba(255, 255, 255, 0.45); font-variant-numeric: tabular-nums; }
/* the scrubber doubles as the divider between the text and the controls row */
.popup-scrub { height: 4px; background: rgba(255, 255, 255, 0.18); border-radius: 2px; margin: 11px 0; cursor: pointer; }
.popup-scrub .ps-fill { height: 100%; width: 0%; background: var(--bright); border-radius: 2px; }
/* foot: controls (left) | subtle separator | chips (right) */
.popup-foot { display: flex; align-items: center; gap: 10px; }
.popup-actions { display: flex; gap: 8px; flex-shrink: 0; }
.popup-btn {
  width: 32px; height: 32px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.14); color: var(--bright);
  border: 1px solid rgba(255, 255, 255, 0.28); cursor: pointer; transition: background 0.15s;
}
.popup-btn.play svg { margin-left: 2px; }   /* optical-center the play triangle */
.popup-btn:hover { background: rgba(255, 255, 255, 0.24); }
.popup-sep { width: 1px; align-self: stretch; min-height: 30px; background: rgba(255, 255, 255, 0.22); flex-shrink: 0; }
.popup-chips { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; min-width: 0; }
.popup-chip {
  font-family: var(--sans); font-size: 9px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75); background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 999px; padding: 3px 8px; cursor: pointer;
  white-space: nowrap; transition: background 0.15s, color 0.15s;
}
.popup-chip:hover { background: rgba(255, 255, 255, 0.2); color: var(--bright); }
.popup-waveform { display: flex; align-items: flex-end; gap: 2px; height: 14px; flex-shrink: 0; }
.popup-waveform .bar { width: 3px; background: var(--amber); border-radius: 1px; animation: waveform 0.8s ease-in-out infinite alternate; }
.popup-waveform .bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.popup-waveform .bar:nth-child(2) { height: 80%; animation-delay: 0.15s; }
.popup-waveform .bar:nth-child(3) { height: 55%; animation-delay: 0.3s; }
.popup-waveform .bar:nth-child(4) { height: 90%; animation-delay: 0.05s; }
@keyframes waveform { 0% { height: 20%; } 100% { height: 100%; } }

/* active map marker */
.active-marker { position: relative; display: inline-block; cursor: pointer; }
/* now-playing pin = white on black, to match the active chapter card */
.active-marker-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ink); border: 3px solid #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45), 0 2px 8px rgba(0, 0, 0, 0.45);
  animation: marker-ring 2s ease-out infinite;
}
@keyframes marker-ring {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4), 0 2px 8px rgba(0, 0, 0, 0.45); }
  70% { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0), 0 2px 8px rgba(0, 0, 0, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0), 0 2px 8px rgba(0, 0, 0, 0.45); }
}
.active-marker-dot .waveform { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.active-marker-dot .waveform .bar { width: 2.5px; background: var(--bright); border-radius: 1px; animation: waveform 0.8s ease-in-out infinite alternate; }
.active-marker-dot .waveform .bar:nth-child(1) { height: 35%; animation-delay: 0s; }
.active-marker-dot .waveform .bar:nth-child(2) { height: 75%; animation-delay: 0.15s; }
.active-marker-dot .waveform .bar:nth-child(3) { height: 50%; animation-delay: 0.3s; }
.active-marker-dot .waveform .bar:nth-child(4) { height: 85%; animation-delay: 0.05s; }
.active-marker-dot .waveform.paused .bar { animation-play-state: paused; }
/* paused: freeze the pulse ring AND the waveform bars, so stillness reads as paused */
.active-marker-dot.paused { animation-play-state: paused; }
.active-marker-dot.paused .waveform .bar { animation-play-state: paused; }
