/* Kruger Gate Hotel Map - frontend.
   Editorial / luxury-safari aesthetic matching krugergatehotel.com.
   Antic Didone serif + DM Sans, sharp rectangles, letter-spaced caps.
   All rules scoped under .kgm-root. */

.kgm-root {
  position: relative;
  display: block;
  width: 100%;
  min-height: 420px;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--kgm-ink);
  box-sizing: border-box;
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
  padding: 0;
}
.kgm-root *, .kgm-root *::before, .kgm-root *::after { box-sizing: border-box; }
.kgm-root img { max-width: none; }

.kgm-root.kgm-fullscreen {
  position: relative;
  height: 100vh;
  min-height: 560px;
  width: 100%;
  overflow: hidden;
}

.kgm-root .kgm-map {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
  z-index: 1;
  background: #e8e4dc;
}
.kgm-root.kgm-inline .kgm-map { box-shadow: 0 8px 40px rgba(0,0,0,0.08); }

/* Defend against themes that target .leaflet-* globally — but do NOT touch
   .leaflet-pane or .leaflet-tile, Leaflet manages those z-indexes and tile
   opacity dynamically and any blanket rule breaks tile fade-in. */
.kgm-root .leaflet-container { outline: none; }

/* Serif type helper */
.kgm-root .kgm-serif { font-family: 'Antic Didone', 'Prata', Georgia, serif; font-weight: 400; }

/* ---------- Hero overlay ---------- */
.kgm-root .kgm-hero {
  position: absolute; inset: 0; z-index: 3000;
  background: #0b0e16;
  color: #f5efe4;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.9s ease;
  padding: 40px;
  cursor: pointer;
}
.kgm-root .kgm-hero.kgm-dismissed { opacity: 0; pointer-events: none; }

/* JS-free hero dismiss: hidden checkbox driven by the close button + the
   inner card itself. Survives even if Leaflet/our JS never runs, so the
   visitor can always get past the hero to whatever is below. */
.kgm-hero-toggle { position: absolute; opacity: 0; pointer-events: none; }
.kgm-hero-toggle:checked ~ .kgm-hero { opacity: 0; pointer-events: none; }
.kgm-root .kgm-hero-close {
  position: absolute; top: 28px; right: 32px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; line-height: 1;
  color: rgba(245, 239, 228, 0.7);
  cursor: pointer;
  border: 1px solid rgba(245, 239, 228, 0.25);
  transition: color 0.2s ease, border-color 0.2s ease;
  z-index: 1;
  user-select: none;
}
.kgm-root .kgm-hero-close:hover {
  color: var(--kgm-gold);
  border-color: var(--kgm-gold);
}
.kgm-root .kgm-hero-inner { cursor: pointer; }
.kgm-root .kgm-hero::before {
  content: '';
  position: absolute; inset: 24px;
  border: 1px solid rgba(245, 239, 228, 0.18);
  pointer-events: none;
}
.kgm-root .kgm-hero-inner {
  max-width: 560px;
  text-align: center;
  position: relative;
}
.kgm-root .kgm-hero-eyebrow {
  text-transform: uppercase;
  letter-spacing: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--kgm-gold);
  margin-bottom: 28px;
}
.kgm-root .kgm-hero-title {
  font-family: 'Antic Didone', 'Prata', Georgia, serif;
  font-weight: 400;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.1;
  margin: 0 0 36px 0;
  color: #f5efe4;
  letter-spacing: 0.5px;
}
.kgm-root .kgm-hero-rule {
  width: 60px; height: 1px;
  background: var(--kgm-gold);
  margin: 0 auto 36px auto;
}
.kgm-root .kgm-hero-facts { list-style: none; padding: 0; margin: 0 0 40px 0; }
.kgm-root .kgm-hero-facts li {
  font-size: 15px;
  color: rgba(245, 239, 228, 0.88);
  padding: 16px 0;
  border-top: 1px solid rgba(245, 239, 228, 0.12);
  display: flex; align-items: baseline; gap: 18px;
  text-align: left;
  letter-spacing: 0.2px;
}
.kgm-root .kgm-hero-facts li:last-child { border-bottom: 1px solid rgba(245, 239, 228, 0.12); }
.kgm-root .kgm-num {
  font-family: 'Antic Didone', 'Prata', Georgia, serif;
  color: var(--kgm-gold);
  font-size: 18px;
  width: 24px;
  flex-shrink: 0;
}
.kgm-root .kgm-hero-cue {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 10.5px;
  font-weight: 500;
  color: rgba(245, 239, 228, 0.55);
  margin-top: 12px;
}
.kgm-root .kgm-hero-cue::after {
  content: '↓';
  display: block; margin-top: 12px;
  letter-spacing: 0; font-size: 14px;
  animation: kgm-float 2.6s ease-in-out infinite;
}
@keyframes kgm-float { 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(6px); } }

/* ---------- Side panel ---------- */
.kgm-root .kgm-panel {
  position: absolute; top: 24px; left: 24px; z-index: 1000;
  background: var(--kgm-paper);
  padding: 26px 28px 24px 28px;
  width: 300px;
  line-height: 1.5;
  box-shadow: 0 12px 50px rgba(11, 14, 22, 0.18);
  color: var(--kgm-ink);
}
.kgm-root .kgm-eyebrow {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--kgm-gold);
  margin: 0 0 14px 0;
}
.kgm-root .kgm-panel-title {
  font-family: 'Antic Didone', 'Prata', Georgia, serif;
  font-weight: 400;
  font-size: 26px;
  line-height: 1.15;
  margin: 0 0 12px 0;
  color: var(--kgm-ink);
}
.kgm-root .kgm-panel-rule {
  width: 36px; height: 1px;
  background: var(--kgm-gold);
  margin: 0 0 14px 0;
}
.kgm-root .kgm-panel-intro {
  margin: 0;
  font-size: 13.5px;
  color: #4a4a4a;
  line-height: 1.55;
}

.kgm-root .kgm-section-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: #8a857a;
  margin: 22px 0 10px 0;
  font-weight: 500;
}

/* Toggle-row buttons: text-only with animated underline. */
.kgm-root .kgm-filters {
  display: flex; flex-wrap: wrap;
  column-gap: 14px; row-gap: 4px;
}
.kgm-root .kgm-filters button {
  background: none; border: none; padding: 4px 0;
  font-family: inherit;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
  color: #999488;
  cursor: pointer;
  position: relative;
  transition: color 0.25s ease;
}
.kgm-root .kgm-filters button::after {
  content: '';
  display: block;
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--kgm-gold);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s ease;
}
.kgm-root .kgm-filters button:hover { color: var(--kgm-ink); }
.kgm-root .kgm-filters button.on { color: var(--kgm-ink); }
.kgm-root .kgm-filters button.on::after { transform: scaleX(1); }

/* View selector: two thin-bordered rectangles, fill on active. */
.kgm-root .kgm-view-buttons { display: flex; gap: 0; border: 1px solid #d8d2c2; }
.kgm-root .kgm-view-buttons button {
  flex: 1; padding: 9px 6px;
  font-family: inherit;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  font-weight: 500;
  background: transparent;
  border: none;
  border-right: 1px solid #d8d2c2;
  color: var(--kgm-ink);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.kgm-root .kgm-view-buttons button:last-child { border-right: none; }
.kgm-root .kgm-view-buttons button:hover { background: #ece6d6; }
.kgm-root .kgm-view-buttons button.active { background: var(--kgm-ink); color: #f5efe4; }

/* Drive times list with serif accents. */
.kgm-root .kgm-drives { margin: 0; padding: 0; list-style: none; }
.kgm-root .kgm-drives li {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 9px 0;
  font-size: 12.5px;
  border-bottom: 1px solid #ece6d6;
  color: var(--kgm-ink);
}
.kgm-root .kgm-drives li:last-child { border-bottom: none; }
.kgm-root .kgm-drives .kgm-drive-label {
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 10.5px;
  color: #54595F;
  font-weight: 500;
}
.kgm-root .kgm-drives .kgm-drive-value {
  font-family: 'Antic Didone', 'Prata', Georgia, serif;
  font-size: 16px;
  color: var(--kgm-ink);
  letter-spacing: 0.2px;
}

/* ---------- Legend ---------- */
.kgm-root .kgm-legend {
  position: absolute; bottom: 30px; right: 24px; z-index: 1000;
  background: var(--kgm-paper);
  padding: 16px 20px;
  font-size: 11px;
  box-shadow: 0 8px 30px rgba(11, 14, 22, 0.12);
}
.kgm-root .kgm-legend-title {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: #8a857a;
  font-weight: 500;
  margin-bottom: 10px;
}
.kgm-root .kgm-legend .kgm-row {
  display: flex; align-items: center; gap: 10px;
  margin: 6px 0;
  color: var(--kgm-ink);
  font-size: 11.5px;
}
.kgm-root .kgm-legend .kgm-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.kgm-root .kgm-legend .kgm-dot--hotel {
  width: 11px; height: 11px;
  border: 2px solid var(--kgm-gold);
  background: transparent;
  border-radius: 50%;
}
.kgm-root .kgm-legend .kgm-dot--airport {
  width: 10px; height: 10px;
  background: var(--kgm-paper);
  border: 1px solid var(--kgm-ink);
  border-radius: 0;
}
.kgm-root .kgm-legend .kgm-line {
  display: inline-block; width: 18px; height: 2.5px;
  background: var(--kgm-green); flex-shrink: 0;
}

.kgm-root .kgm-disclaimer {
  position: absolute; bottom: 8px; left: 24px; z-index: 1000;
  background: transparent;
  padding: 0;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(11, 14, 22, 0.5);
}

/* ---------- Pin styles ---------- */
.kgm-root .kgm-pin-wrap { position: relative; display: flex; align-items: center; justify-content: center; }
.kgm-root .kgm-pin-dot {
  border-radius: 50%;
  position: relative; z-index: 2;
  box-shadow: 0 2px 8px rgba(11, 14, 22, 0.35);
}
.kgm-root .kgm-pin--hotel {
  background: transparent !important;
  border: 2.5px solid var(--kgm-gold) !important;
  box-shadow: 0 0 0 4px rgba(11, 14, 22, 0.9), 0 4px 14px rgba(11, 14, 22, 0.5);
}
.kgm-root .kgm-pin--hotel-inner {
  position: absolute; top: 50%; left: 50%;
  width: 6px; height: 6px;
  background: var(--kgm-gold);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.kgm-root .kgm-pin-gate {
  border: 2px solid var(--kgm-paper);
  box-shadow: 0 2px 8px rgba(11, 14, 22, 0.5), 0 0 0 1px var(--kgm-red);
}
.kgm-root .kgm-pin-airport {
  display: flex; align-items: center; justify-content: center;
  background: var(--kgm-paper);
  border: 1px solid var(--kgm-ink);
  position: relative; z-index: 2;
  box-shadow: 0 2px 6px rgba(11, 14, 22, 0.35);
}
.kgm-root .kgm-pin-airport svg { display: block; }
.kgm-root .kgm-pin-pulse {
  position: absolute; top: 50%; left: 50%;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--kgm-gold);
  transform: translate(-50%, -50%);
  animation: kgm-pulse 2.4s ease-out infinite;
  z-index: 1;
  opacity: 0;
}
@keyframes kgm-pulse {
  0%   { transform: translate(-50%, -50%) scale(0.7); opacity: 0.75; }
  80%  { opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(3.5); opacity: 0; }
}

/* ---------- Leaflet label variants ---------- */
.leaflet-tooltip.kgm-label-hero,
.leaflet-tooltip.kgm-label-hero-light {
  background: transparent;
  border: none;
  box-shadow: none;
  font-family: 'Antic Didone', 'Prata', Georgia, serif;
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.3px;
  padding: 0;
}
.leaflet-tooltip.kgm-label-hero {
  color: #0b0e16;
  text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0 0 6px rgba(255,255,255,0.95);
}
.leaflet-tooltip.kgm-label-hero-light {
  color: #f5efe4;
  text-shadow: 0 1px 3px rgba(0,0,0,0.65), 0 0 1px rgba(0,0,0,0.85);
}
.leaflet-tooltip.kgm-label-hero::before,
.leaflet-tooltip.kgm-label-hero-light::before { display: none; }

.leaflet-tooltip.kgm-label-river {
  background: transparent; border: none; box-shadow: none;
  color: #2c5775; font-size: 13px;
  font-family: 'Antic Didone', 'Prata', Georgia, serif;
  font-style: italic; letter-spacing: 0.5px;
  text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0 0 5px rgba(255,255,255,0.95);
}
.leaflet-tooltip.kgm-label-river::before { display: none; }

.leaflet-tooltip.kgm-label-park {
  background: transparent; border: none; box-shadow: none;
  color: #1f4022;
  font-size: 11px; font-weight: 500;
  letter-spacing: 5px;
  text-transform: uppercase;
  text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0 0 5px rgba(255,255,255,0.95);
}
.leaflet-tooltip.kgm-label-park::before { display: none; }

.leaflet-tooltip.kgm-label-region {
  background: transparent; border: none; box-shadow: none;
  color: #5a4628;
  font-family: 'Antic Didone', 'Prata', Georgia, serif;
  font-style: italic;
  font-size: 14px;
  letter-spacing: 2px;
  text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0 0 5px rgba(255,255,255,0.95);
}
.leaflet-tooltip.kgm-label-region::before { display: none; }

.leaflet-tooltip.kgm-label-drive {
  background: var(--kgm-ink);
  color: #f5efe4;
  border: none;
  padding: 5px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.leaflet-tooltip.kgm-label-drive::before { display: none; }

.leaflet-tooltip.kgm-label-distance {
  background: #f5efe4;
  color: var(--kgm-ink);
  border: 1px solid var(--kgm-gold);
  padding: 4px 11px;
  font-family: 'Antic Didone', 'Prata', Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.6px;
  box-shadow: 0 2px 8px rgba(11, 14, 22, 0.2);
}
.leaflet-tooltip.kgm-label-distance::before { display: none; }

/* ---------- Popups ---------- */
.kgm-root + * .leaflet-popup-content-wrapper,
.leaflet-popup-content-wrapper {
  border-radius: 0;
  padding: 0;
  background: var(--kgm-paper);
  box-shadow: 0 16px 50px rgba(11, 14, 22, 0.25);
}
.leaflet-popup-tip { background: var(--kgm-paper); }
.leaflet-popup-content { margin: 0; min-width: 280px; }
.leaflet-popup-close-button {
  color: var(--kgm-ink) !important;
  padding: 8px 10px !important;
  font-size: 18px !important;
}
.kgm-popup { padding: 0; }
.kgm-popup-photo {
  width: 100%; height: 170px; object-fit: cover;
  display: block;
}
.kgm-popup-body { padding: 22px 24px 22px 24px; }
.kgm-popup-eyebrow {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--kgm-gold);
  margin-bottom: 8px;
  font-weight: 500;
}
.kgm-popup-body h4 {
  margin: 0 0 8px 0;
  font-family: 'Antic Didone', 'Prata', Georgia, serif;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.2;
  color: var(--kgm-ink);
  letter-spacing: 0.3px;
}
.kgm-popup-rule {
  width: 32px; height: 1px;
  background: var(--kgm-gold);
  margin: 0 0 12px 0;
}
.kgm-popup-body p {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: #54595F;
  line-height: 1.6;
}
.kgm-popup-body p:last-of-type { margin-bottom: 0; }
.kgm-popup-actions {
  display: flex; gap: 14px;
  margin-top: 18px;
  align-items: center;
}
.kgm-popup-cta {
  display: inline-block;
  padding: 11px 22px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 3px;
  background: var(--kgm-ink);
  color: #f5efe4 !important;
  text-decoration: none;
  border: 1px solid var(--kgm-ink);
  transition: background 0.25s ease, color 0.25s ease;
}
.kgm-popup-cta:hover {
  background: transparent;
  color: var(--kgm-ink) !important;
}
.kgm-popup-directions {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--kgm-ink) !important;
  text-decoration: none;
  font-weight: 500;
  position: relative;
  padding-bottom: 3px;
}
.kgm-popup-directions::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: var(--kgm-ink);
  transform: scaleX(1); transform-origin: left;
  transition: transform 0.3s ease;
}
.kgm-popup-directions:hover::after { transform: scaleX(0); transform-origin: right; }
.kgm-popup-directions::before {
  content: '→';
  margin-right: 6px;
  transition: margin 0.25s ease;
}
.kgm-popup-directions:hover::before { margin-right: 10px; }

/* Leaflet attribution refinement */
.kgm-root .leaflet-control-attribution {
  background: rgba(245, 239, 228, 0.85) !important;
  font-size: 9.5px !important;
  letter-spacing: 0.3px;
  padding: 2px 8px !important;
}
.kgm-root .leaflet-control-attribution a { color: var(--kgm-ink) !important; }

/* Zoom control restyle */
.kgm-root .leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 4px 16px rgba(11, 14, 22, 0.18) !important;
}
.kgm-root .leaflet-control-zoom a {
  background: var(--kgm-paper) !important;
  color: var(--kgm-ink) !important;
  border: none !important;
  border-bottom: 1px solid #ece6d6 !important;
  width: 32px !important; height: 32px !important;
  line-height: 32px !important;
  font-size: 18px !important;
}
.kgm-root .leaflet-control-zoom a:last-child { border-bottom: none !important; }
.kgm-root .leaflet-control-zoom a:hover { background: #ece6d6 !important; }

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  /* Collapsible bottom sheet: collapsed by default, expands on tap of handle. */
  .kgm-root.kgm-fullscreen .kgm-panel {
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%;
    padding: 0;
    border-top: 1px solid var(--kgm-gold);
    background: var(--kgm-paper);
    max-height: 75vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .kgm-root.kgm-fullscreen .kgm-panel-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .kgm-root.kgm-fullscreen .kgm-panel--open .kgm-panel-body {
    max-height: 70vh;
    overflow-y: auto;
    padding: 4px 22px 28px 22px;
  }
  .kgm-root.kgm-fullscreen .kgm-panel-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 22px 14px 22px;
    cursor: pointer;
    user-select: none;
    position: sticky;
    top: 0;
    background: var(--kgm-paper);
    z-index: 2;
  }
  .kgm-root.kgm-fullscreen .kgm-panel-handle::before {
    content: '';
    display: block;
    width: 36px; height: 3px;
    background: #d8d2c2;
    margin-bottom: 8px;
  }
  .kgm-root.kgm-fullscreen .kgm-panel-handle-label {
    font-family: 'Antic Didone', 'Prata', Georgia, serif;
    font-size: 16px;
    color: var(--kgm-ink);
    letter-spacing: 0.3px;
  }
  .kgm-root.kgm-fullscreen .kgm-panel-handle-cue {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--kgm-gold);
    margin-top: 3px;
  }
  .kgm-root.kgm-fullscreen .kgm-panel-handle-cue::after {
    content: ' ↑';
    transition: transform 0.3s ease;
    display: inline-block;
  }
  .kgm-root.kgm-fullscreen .kgm-panel--open .kgm-panel-handle-cue::after {
    content: ' ↓';
  }
  .kgm-root.kgm-fullscreen .kgm-eyebrow { margin-top: 0; }
  .kgm-root .kgm-legend { display: none; }
  .kgm-root .kgm-disclaimer {
    bottom: auto; top: 12px; left: 12px;
    background: rgba(245, 239, 228, 0.85);
    padding: 4px 8px;
  }
  /* Hero */
  .kgm-root .kgm-hero { padding: 24px; }
  .kgm-root .kgm-hero::before { inset: 16px; }
  .kgm-root .kgm-hero-title { font-size: 32px; }
  .kgm-root .kgm-hero-facts li { font-size: 14px; padding: 13px 0; }
  .kgm-root .kgm-hero-eyebrow { font-size: 9.5px; letter-spacing: 3px; margin-bottom: 22px; }
  /* Popups slightly smaller on phones */
  .leaflet-popup-content { min-width: 240px; }
  .kgm-popup-photo { height: 140px; }
  .kgm-popup-body { padding: 18px 20px; }
  .kgm-popup-body h4 { font-size: 20px; }
}

/* Hide handle entirely on desktop */
@media (min-width: 769px) {
  .kgm-root .kgm-panel-handle { display: none; }
}
