/* ============================================
   Interactive Trail Map — Leaflet
   ============================================ */

.trail-world-map-section {
  padding: 40px 0 48px;
  background: var(--color-bg);
  overflow: hidden;
}

/* ── Horizontal header row ────────────────── */
.trail-map-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin-bottom: 40px;
}
.trail-map-header .section-title {
  margin-bottom: 0;
}
.trail-map-header .section-label {
  margin-bottom: 6px;
}
.trail-map-header-left {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.trail-map-header .section-subtitle {
  flex-shrink: 0;
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(107, 143, 113, 0.6);
}

.trail-map-wrap {
  margin-top: 20px;
  position: relative;
}

.trail-map-container {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Three-panel layout ───────────────────── */
.trail-map-panels {
  position: relative;
}

.trail-map-panel {
  display: none;
}
.trail-map-panel.active {
  display: block;
}

.trail-map-panel-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(107, 143, 113, 0.6);
  text-align: center;
  margin-bottom: 6px;
}

/* ── Leaflet map ───────────────────────────── */
.trail-leaflet-map {
  width: 100%;
  height: 520px;
  border-radius: 4px;
  border: 1px solid rgba(107, 143, 113, 0.15);
  z-index: 1;
}

/* Dark tiles + brand styling */
.leaflet-container {
  background: #1a1510;
  font-family: 'Inter', sans-serif;
}

/* Hide Leaflet attribution bar clutter */
.leaflet-control-attribution {
  background: rgba(26, 21, 16, 0.7) !important;
  color: rgba(154, 142, 126, 0.5) !important;
  font-size: 9px !important;
  backdrop-filter: blur(4px);
}
.leaflet-control-attribution a {
  color: rgba(107, 143, 113, 0.5) !important;
}

/* Zoom controls */
.leaflet-control-zoom a {
  background: rgba(26, 21, 16, 0.9) !important;
  color: #9a8e7e !important;
  border-color: rgba(107, 143, 113, 0.2) !important;
}
.leaflet-control-zoom a:hover {
  background: rgba(26, 21, 16, 1) !important;
  color: #6b8f71 !important;
}

/* ── Custom popups ─────────────────────────── */
.leaflet-popup-content-wrapper {
  background: rgba(26, 21, 16, 0.96);
  border: 1px solid rgba(107, 143, 113, 0.3);
  border-radius: 2px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.leaflet-popup-tip {
  background: rgba(26, 21, 16, 0.96);
  border: 1px solid rgba(107, 143, 113, 0.15);
}
.leaflet-popup-content {
  margin: 14px 18px;
  color: #e8e0d4;
  font-family: 'Inter', sans-serif;
}

.trail-popup-year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6b8f71;
  margin-bottom: 4px;
}
.trail-popup-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 400;
  color: #f4eee4;
  margin-bottom: 4px;
  line-height: 1.2;
}
.trail-popup-stats {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: #9a8e7e;
  margin-bottom: 10px;
}
.trail-popup-cta {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b8f71;
  border-top: 1px solid rgba(107, 143, 113, 0.2);
  padding-top: 8px;
  text-decoration: none;
  transition: color 0.2s ease;
}
.trail-popup-cta:hover {
  color: #9ac4a0;
}

/* Close button */
.leaflet-popup-close-button {
  color: #9a8e7e !important;
  font-size: 18px !important;
}
.leaflet-popup-close-button:hover {
  color: #6b8f71 !important;
}

/* ── Custom marker pulse ───────────────────── */
/* NOTE: do NOT set position on .trail-marker-icon — Leaflet applies
   position:absolute via .leaflet-marker-icon; same-specificity overrides
   here break marker geo-anchoring (markers drift on zoom/pan). */
.trail-marker-icon .marker-inner {
  width: 10px;
  height: 10px;
  background: #6b8f71;
  border-radius: 50%;
  border: 2px solid rgba(107, 143, 113, 0.4);
  box-shadow: 0 0 12px rgba(107, 143, 113, 0.5);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: background 0.2s, box-shadow 0.2s;
}
.trail-marker-icon .marker-pulse {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(107, 143, 113, 0.3);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: leaflet-pulse 2.5s ease-out infinite;
}
@keyframes leaflet-pulse {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

/* International markers slightly larger */
.trail-marker-icon.intl .marker-inner {
  width: 13px;
  height: 13px;
  box-shadow: 0 0 18px rgba(107, 143, 113, 0.6);
}

/* ── Region button bar ─────────────────────── */
.trail-map-regions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.trail-map-regions button {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #9a8e7e;
  background: rgba(107, 143, 113, 0.06);
  border: 1px solid rgba(107, 143, 113, 0.15);
  padding: 8px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.trail-map-regions button:hover,
.trail-map-regions button.active {
  color: #6b8f71;
  background: rgba(107, 143, 113, 0.12);
  border-color: rgba(107, 143, 113, 0.35);
}

/* ── Responsive ─────────────────────────── */
@media (max-width: 768px) {
  .trail-map-header {
    flex-direction: column;
    gap: 8px;
  }
  .trail-world-map-section {
    padding: 32px 0 32px;
  }
  .trail-map-container {
    padding: 0 8px;
  }
  .trail-leaflet-map {
    height: 380px;
  }
  .trail-map-regions button {
    font-size: 0.55rem;
    padding: 6px 12px;
  }
}

/* ── Permanent trail label tooltips ─────── */
.leaflet-tooltip.trail-marker-label {
  background: rgba(26, 21, 16, 0.92);
  color: #f4eee4;
  border: 1px solid rgba(107, 143, 113, 0.6);
  border-radius: 2px;
  padding: 4px 10px;
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}
.leaflet-tooltip.trail-marker-label::before { display: none; }
