/* =============================================================================
   lp24-map.css
   Mapbox GL JS component styles for las-palmas-24.com
   Ergänzung zu lp24.css — als separate Datei oder ans Ende von lp24.css anhängen
   ============================================================================= */

/* ── Karten-Container ────────────────────────────────────────────────────── */

.lp24-map {
  width: 100%;
  height: 480px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: var(--lp24-gray-100, #f3f4f6);
}

/* Höhenvarianten via data-Attribut oder Modifier-Klasse */
.lp24-map--tall   { height: 600px; }
.lp24-map--short  { height: 320px; }
.lp24-map--full   { height: 100vh; border-radius: 0; }

/* ── Store-Locator Layout ────────────────────────────────────────────────── */

.lp24-map-locator {
  display: flex;
  gap: 0;
  height: 520px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
}

.lp24-map-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--lp24-gray-200, #e5e7eb);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lp24-map-sidebar__inner {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Scrollbar styling (WebKit) */
.lp24-map-sidebar__inner::-webkit-scrollbar { width: 4px; }
.lp24-map-sidebar__inner::-webkit-scrollbar-track { background: transparent; }
.lp24-map-sidebar__inner::-webkit-scrollbar-thumb {
  background: var(--lp24-gray-300, #d1d5db);
  border-radius: 2px;
}

.lp24-map-locator__map {
  flex: 1;
  height: 100% !important;
  border-radius: 0 !important;
}

/* ── Sidebar Items ───────────────────────────────────────────────────────── */

.lp24-map-sidebar__list {
  padding: 8px;
}

.lp24-map-sidebar__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s ease;
  border-bottom: 1px solid var(--lp24-gray-100, #f3f4f6);
  position: relative;
}

.lp24-map-sidebar__item:hover {
  background: var(--lp24-gray-50, #f9fafb);
}

.lp24-map-sidebar__item--active {
  background: #fff5ec;
  border-left: 3px solid var(--lp24-orange, #cc6601);
}

.lp24-map-sidebar__thumb {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 5px;
  overflow: hidden;
}

.lp24-map-sidebar__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lp24-map-sidebar__info {
  flex: 1;
  min-width: 0;
}

.lp24-map-sidebar__name {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--lp24-gray-800, #1f2937);
  line-height: 1.3;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lp24-map-sidebar__teaser {
  display: block;
  font-size: .75rem;
  color: var(--lp24-gray-500, #6b7280);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.lp24-map-sidebar__link {
  display: inline-block;
  margin-top: 4px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--lp24-orange, #cc6601);
  text-decoration: none;
}

.lp24-map-sidebar__link:hover { text-decoration: underline; }

.lp24-map-sidebar__dist {
  font-size: .72rem;
  font-weight: 600;
  color: var(--lp24-gray-400, #9ca3af);
  white-space: nowrap;
  align-self: flex-start;
  padding-top: 2px;
}

/* ── Custom Marker ───────────────────────────────────────────────────────── */

.lp24-map-marker {
  width: 32px;
  height: 40px;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
  --marker-color: #555;
}

.lp24-map-marker svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
}

.lp24-map-marker:hover {
  transform: scale(1.15) translateY(-2px);
}

.lp24-map-marker--active {
  transform: scale(1.2) translateY(-3px);
  filter: brightness(1.1);
  z-index: 10;
}

/* ── Popup ───────────────────────────────────────────────────────────────── */

/* Override Mapbox default popup styles */
.lp24-mapbox-popup .mapboxgl-popup-content {
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  max-width: 280px;
  font-family: inherit;
}

.lp24-mapbox-popup .mapboxgl-popup-close-button {
  font-size: 18px;
  color: #fff;
  right: 6px;
  top: 4px;
  background: rgba(0,0,0,.25);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  line-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.lp24-mapbox-popup .mapboxgl-popup-close-button:hover {
  background: rgba(0,0,0,.45);
}

.lp24-map-popup {
  font-size: .875rem;
}

.lp24-map-popup__img {
  height: 140px;
  overflow: hidden;
}

.lp24-map-popup__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lp24-map-popup__body {
  padding: 12px 14px 14px;
}

.lp24-map-popup__title {
  margin: 0 0 6px;
  font-size: .95rem;
  font-weight: 700;
  color: var(--lp24-gray-800, #1f2937);
  line-height: 1.3;
}

.lp24-map-popup__teaser {
  margin: 0 0 10px;
  font-size: .8rem;
  color: var(--lp24-gray-500, #6b7280);
  line-height: 1.5;
}

.lp24-map-popup__link {
  display: inline-block;
  padding: 5px 12px;
  background: var(--lp24-orange, #cc6601);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-size: .8rem;
  font-weight: 600;
  transition: background .15s ease;
}

.lp24-map-popup__link:hover {
  background: #b35900;
  color: #fff;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .lp24-map {
    height: 340px;
  }

  .lp24-map-locator {
    flex-direction: column;
    height: auto;
    border-radius: 8px;
  }

  .lp24-map-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--lp24-gray-200, #e5e7eb);
    max-height: 240px;
  }

  .lp24-map-locator__map {
    height: 320px !important;
  }

  .lp24-mapbox-popup .mapboxgl-popup-content {
    max-width: 240px;
  }
}

@media (max-width: 480px) {
  .lp24-map-sidebar {
    max-height: 200px;
  }

  .lp24-map-locator__map {
    height: 260px !important;
  }
}

/* =============================================================================
   HERO MAP 3D
   Mapbox 3D-Terrain als Hero-Hintergrund mit Teaser-Text-Overlay.
   Wird über CP-Inhalt per {HEADER} eingebunden — siehe
   template/inc_cntpart/html/lp24-hero-map.tmpl

   Struktur im CP-HTML-Feld:
     .lp24-hero-text              (Titel/Subtitle/Teaser, als Overlay-Card)
     .lp24-hero-map-container     (Mapbox-Canvas, volle Hero-Fläche)
     .lp24-hero-map-lock          (kommt fix aus dem Template, Scroll-Schutz)
   Beide ersten zwei Blöcke müssen GESCHWISTER sein (gleiche
   Verschachtelungstiefe unter .lp24-hero-inner), sonst bezieht sich
   position:absolute auf den Textblock statt auf den ganzen Hero.
   ============================================================================= */

/* Erkennung über :has() statt fixer Modifier-Klasse auf der äußeren
   <section> — so bleibt layout.html für jeden Hero-CP-Inhalt
   unverändert. :has() ist in allen relevanten Browsern (Safari ab
   15.6, Chrome/Firefox seit 2022/2023) verfügbar. */
.lp24-hero:has(.lp24-hero-map-container) .lp24-hero-inner {
  min-height: 420px;
  height: 420px;
}
@media (min-width: 768px) {
  .lp24-hero:has(.lp24-hero-map-container) .lp24-hero-inner { min-height: 480px; height: 480px; }
}
@media (min-width: 1024px) {
  .lp24-hero:has(.lp24-hero-map-container) .lp24-hero-inner { min-height: 560px; height: 560px; }
}

/* Map füllt den kompletten Hero, kein 28%-Versatz wie beim Bild-Hero.
   WICHTIG: Mapbox GL JS fügt dem Container automatisch seine eigene
   Klasse .mapboxgl-map hinzu, die hier weiter oben (Store-Locator-
   Block) bzw. in mapbox-gl.css selbst "position: relative" setzt.
   Bei gleicher Selector-Spezifität gewinnt das per Source-Order,
   wenn mapbox-gl.css nach diesem Stylesheet lädt. !important
   stellt sicher, dass unsere Positionierung in jedem Fall greift,
   unabhängig von der <head>-Reihenfolge — exakt die gleiche
   Konvention wie bei .lp24-map-locator__map weiter oben in dieser
   Datei. */
.lp24-hero-map-container {
  position: absolute !important;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 420px;
}
@media (min-width: 768px)  { .lp24-hero-map-container { min-height: 480px; } }
@media (min-width: 1024px) { .lp24-hero-map-container { min-height: 560px; } }

/* Mapbox braucht explizite Höhe auf dem Canvas-Wrapper selbst */
.lp24-hero-map-container .mapboxgl-canvas-container,
.lp24-hero-map-container .mapboxgl-canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Dezenter Verlauf links für Textlesbarkeit, schwächer als beim
   Bild-Hero da die Karte heller/neutraler ist als ein Foto */
.lp24-hero-map-container::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg,
    rgba(255,255,255,.92) 0%,
    rgba(255,255,255,.55) 32%,
    rgba(255,255,255,0)   55%
  );
}
@media (max-width: 1023px) {
  .lp24-hero-map-container::after {
    background: linear-gradient(180deg,
      rgba(255,255,255,.25) 0%,
      rgba(255,255,255,.88) 55%,
      rgba(255,255,255,.96) 100%
    );
  }
}

/* Overlay-Card für den Teaser-Text, schwebt über der Karte.
   Bewusst kompakt und oben-links positioniert (statt der vollen
   Höhe/Breite, die .lp24-hero-text auf normalen Bild-Heros hat) —
   die Karte soll der visuelle Fokus bleiben, der Textblock ist
   hier nur ein kurzer Kontext-Hinweis. Gilt ausschließlich für
   die Map-Variante (via :has()), normale Heros bleiben unberührt. */
.lp24-hero:has(.lp24-hero-map-container) .lp24-hero-text {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  right: auto;
  bottom: auto;
  z-index: 2;
  width: auto;
  max-width: 20rem;
  margin: 0;
  padding: .875rem 1.125rem;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: var(--lp24-radius-sm, 0.5rem);
  box-shadow: var(--lp24-shadow, 0 4px 12px rgba(0,0,0,.10));
}

/* Innenelemente der kompakten Card deutlich kleiner/knapper als
   im normalen Hero-Text (dort: clamp(1.75rem, 4vw, 3rem) für h2) */
.lp24-hero:has(.lp24-hero-map-container) .lp24-hero-text .lp24-hero-label {
  font-size: .6875rem;
  margin-bottom: .25rem;
}
.lp24-hero:has(.lp24-hero-map-container) .lp24-hero-text .lp24-page-title {
  font-size: 1.125rem;
  line-height: 1.25;
  margin-bottom: .25rem;
}
.lp24-hero:has(.lp24-hero-map-container) .lp24-hero-text .lp24-hero-subtitle {
  font-size: .8125rem;
  margin-bottom: .375rem;
}
.lp24-hero:has(.lp24-hero-map-container) .lp24-hero-text .lp24-hero-teaser p {
  font-size: .8125rem;
  line-height: 1.45;
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .lp24-hero:has(.lp24-hero-map-container) .lp24-hero-text {
    top: 1.5rem;
    left: 1.5rem;
    max-width: 22rem;
  }
}

/* Scroll-Zoom-Lock Overlay: erst nach Klick wird die Karte interaktiv,
   verhindert versehentliches Hineinzoomen beim Seiten-Scrollen */
.lp24-hero-map-lock {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0);
  cursor: pointer;
}
.lp24-hero-map-lock-hint {
  background: rgba(31,41,55,.85);
  color: #fff;
  font-size: .8125rem; font-weight: 600;
  padding: .5rem 1rem;
  border-radius: var(--lp24-radius-sm, 0.5rem);
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}
.lp24-hero-map-lock:hover .lp24-hero-map-lock-hint { opacity: 1; }
.lp24-hero-map-lock.is-unlocked { display: none; }
