/* Full-viewport background map (when enabled in settings) */
.sound-map { width: 100%; }
.sound-map.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: -1; /* keeps map behind normal content */
}

/* Front page takeover mode: map becomes the whole page, content hidden */
html.sound-map-takeover,
html.sound-map-takeover body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

/* Space backdrop for globe takeover (behind the WebGL canvas) */
html.sound-map-takeover body {
  background: radial-gradient(circle at 30% 20%, #0b1b3a 0%, #000510 38%, #000000 100%);
}

html.sound-map-takeover body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.65;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,0.9) 40%, rgba(255,255,255,0) 60%),
    radial-gradient(1px 1px at 32% 78%, rgba(255,255,255,0.8) 40%, rgba(255,255,255,0) 60%),
    radial-gradient(1px 1px at 58% 34%, rgba(255,255,255,0.7) 40%, rgba(255,255,255,0) 60%),
    radial-gradient(1px 1px at 74% 66%, rgba(255,255,255,0.75) 40%, rgba(255,255,255,0) 60%),
    radial-gradient(1px 1px at 86% 22%, rgba(255,255,255,0.6) 40%, rgba(255,255,255,0) 60%),
    radial-gradient(2px 2px at 45% 55%, rgba(255,255,255,0.55) 35%, rgba(255,255,255,0) 60%),
    radial-gradient(1px 1px at 8% 62%, rgba(255,255,255,0.55) 40%, rgba(255,255,255,0) 60%),
    radial-gradient(1px 1px at 92% 84%, rgba(255,255,255,0.6) 40%, rgba(255,255,255,0) 60%);
}

html.sound-map-takeover .sound-map.fullscreen.takeover {
  /* In takeover we want the map to be the whole page (not behind content). */
  z-index: 99999;
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
}

html.sound-map-takeover .sound-map.fullscreen.takeover,
html.sound-map-takeover .sound-map.fullscreen.takeover canvas {
  background: transparent !important;
}

/* Hide common theme content containers so text like "Hello world" doesn't show */
html.sound-map-takeover body > *:not(#wpadminbar):not(#sound-map) {
  display: none !important;
}

/* Keep debug banner visible even in takeover (when injected outside #sound-map). */
html.sound-map-takeover body > #sound-map-debug {
  display: block !important;
}

/* Ensure pins/markers draw above the WebGL canvas. */
.maplibregl-marker {
  z-index: 3;
}

/* Keep admin bar accessible if logged in */
html.sound-map-takeover #wpadminbar {
  z-index: 9999999;
}

/* In-map overlay UI (used for takeover mode) */
.sound-map {
  position: relative;
}

.sound-map-overlay {
  position: absolute;
  z-index: 100000;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.sound-map-overlay--top-right {
  top: 12px;
  right: 12px;
}

.sound-map-menu-button {
  appearance: none;
  border: 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.sound-map-search-ctrl {
  margin-top: 8px;
}

.sound-map-search-input {
  appearance: none;
  border: 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(0,0,0,0.65);
  color: #fff !important;
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
  font: inherit;
  line-height: 1;
  width: 220px;
  max-width: 60vw;
}

.sound-map-search-input::placeholder {
  color: rgba(255,255,255,0.75);
}

.sound-map-search-input:focus {
  outline: 2px solid rgba(255,255,255,0.7);
  outline-offset: 2px;
}

/* Reduce visible raster tile seams at higher zoom by slightly blurring the WebGL canvas only.
   Markers/popups are separate DOM layers and remain crisp. */
#sound-map.sound-map-seam-smooth .maplibregl-canvas {
  /* Keep imagery sharp; seam mitigation is handled via raster paint properties. */
  filter: blur(0px);
  transform: translateZ(0);
}

.sound-map-menu-button:focus {
  outline: 2px solid rgba(255,255,255,0.7);
  outline-offset: 2px;
}

/* Cluster / point visuals */
.sound-map-marker { width: 24px; height: 24px; background: #e74c3c; border-radius: 50%; border: 2px solid white; }
/* Apply globally (class is only added by this plugin) so it works even if the map
   container is not nested under #sound-map for some templates. */
.sound-map-marker--hidden {
  display: none !important;
}

/* Popup audio styling */
.sound-map-popup p,
.sound-map-popup .sound-map-player-time,
.sound-map-popup .sound-map-player-status,
.sound-map-popup .sound-map-player-meta {
  font-family: Helvetica, Arial, sans-serif;
}

/* Front page pin popup: translucent container + white text */
#sound-map .maplibregl-popup-content,
#sound-map .mapboxgl-popup-content {
  background: transparent;
  box-shadow: none;
  color: #fff;
}

#sound-map .maplibregl-popup-tip,
#sound-map .mapboxgl-popup-tip {
  /* Tip triangle should disappear with transparent popup. */
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-left-color: transparent;
  border-right-color: transparent;
}

#sound-map .sound-map-popup,
#sound-map .sound-map-popup * {
  color: #fff;
}

#sound-map .sound-map-popup h3 {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 14pt;
  margin: 0 0 6px;
}

#sound-map .sound-map-popup .sound-map-player {
  margin-top: 6px;
}

#sound-map .sound-map-player-time,
#sound-map .sound-map-player-status,
#sound-map .sound-map-player-meta {
  color: #fff;
}

#sound-map .sound-map-player-btn {
  background: transparent;
  color: #fff;
  border: 1px solid #fff;
  padding: 6px 10px;
  width: auto;
  height: 34px;
  min-width: 70px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

#sound-map .sound-map-player-wave-scroll {
  border: 1px solid #fff;
  background: transparent;
}

/* Bottom info button row (date moved here) */
#sound-map .sound-map-player-info-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 6px;
}

#sound-map .sound-map-info {
  position: relative;
  display: inline-flex;
  align-items: center;
}

#sound-map .sound-map-info-btn {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #fff;
  background: transparent;
  color: #fff;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

#sound-map .sound-map-info-pop {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 12px;
  z-index: 5;
}

.sound-map-popup audio { width: 100%; height: auto; }

/* Waveform player inside popup */
.sound-map-player {
  margin-top: 8px;
}

.sound-map-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.sound-map-player-btn {
  appearance: none;
  border: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  cursor: pointer;
}

.sound-map-player-time {
  font-size: 12px;
  color: rgba(0,0,0,0.7);
}

.sound-map-player-wave {
  width: 100%;
  height: 56px;
  display: block;
  border-radius: 6px;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.12);
}

.sound-map-player-wave-scroll {
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.04);
}

.sound-map-player-wave-inner {
  position: relative;
  height: 56px;
  width: 100%;
}

.sound-map-player-wave-base,
.sound-map-player-wave-overlay {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  height: 56px;
}

.sound-map-player-wave-overlay {
  pointer-events: none;
}

.sound-map-player-status {
  font-size: 12px;
  color: rgba(0,0,0,0.70);
  margin: 0 0 6px;
}

.sound-map-player-meta {
  font-size: 12px;
  color: rgba(0,0,0,0.70);
  margin: 6px 0 0;
}

/* On small screens, ensure popups are readable */
@media (max-width: 600px) {
  .mapboxgl-popup-content { max-width: 260px; }
}
