/*
ChangeLog:
2026.07.14	100% Google Gemini - im Zuge von BMB/sd_bilder.php-Renewal eingeführt um von Javascript-URALT-Lightbox wegzukommen 
			HTML Popover API war (noch) nicht praktikabel weil entweder 1 langes Alben-Bilder-"Band" (mit Pfeilen vor/zurück bewegt) und hierbei IMMER 1.Alben-Bild geöffnet wurde, egal auf welches Thumb geklickt wurde
																ODER jedes IMG in eigenem Popover-div, dann ÜBERLAGERTEN sich aber bei Bilder-klicken aber Bild-Container und jedes Bild-Overlay musste einzeln geschlossen werden!!
*/

/* ==========================================================================
   1. THUMBNAIL-GRID (Unverändert gut)
   ========================================================================== */
.galerie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  padding: 20px;
}

.thumb-btn {
  display: block;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  border-radius: 8px;
  transition: transform 0.2s ease-in-out;
}

.thumb-btn:hover {
  transform: scale(1.05);
}

.thumb-btn img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

/* ==========================================================================
   DIE ZWEITE, DUNKLE GRUNDSCHICHT (Backdrop - verhindert "durchscheinen" der Website bei Bildwechsel in Lightbox mittels rechts/links-Pfeilen)
   ========================================================================== */
/* Standardmäßig schläft die Schicht unsichtbar im Hintergrund */
.lightbox-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000000; /* Absolut deckendes Tiefschwarz */
  z-index: 99990;      /* Liegt exakt HINTER den Lightbox-Modals */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}

/* Der Zaubertrick: Sobald IRGENDEINE Lightbox aktiv (:target) ist, 
   wird diese schwarze Wand SOFORT und permanent deckend eingeblendet */
:has(.lightbox-modal:target) .lightbox-backdrop {
  opacity: 0.95;       /* Gewünschte Dunkelheit des Hintergrunds */
  pointer-events: auto;
}

/* ==========================================================================
   2. REINE CSS-LIGHTBOX (mit Animation & Flex-Layout)
   ========================================================================== */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: transparent; /* da die .lightbox-backdrop Schicht das Abdunkeln übernimmt! */
  z-index: 99995;
  
  /* WICHTIG FÜR DIE ANIMATION: */
  display: flex !important;
  opacity: 0;
  pointer-events: none; /* Klicks gehen durch, solange unsichtbar */
  transition: opacity 0.25s ease-in-out; /* Der weiche Blend-Effekt */
  
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

/* Wenn das Bild aktiv ist: Sichtbar machen */
.lightbox-modal:target {
  opacity: 1;
  pointer-events: auto; /* Aktiviert Klicks */
}

/* Container für Bild und Beschreibung */
.slide-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  max-width: 75%;
}

.slide-content img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.8);
  
  /* Kleiner Animationstrick: Das Bild zoomt minimal beim Öffnen rein */
  transform: scale(0.95);
  transition: transform 0.3s ease-in-out;
}

/* Wenn aktiv, zoomt das Bild sanft auf 100% */
.lightbox-modal:target .slide-content img {
  transform: scale(1);
}

.caption {
  color: #ffffff;
  margin-top: 15px;
  font-family: sans-serif;
  text-align: center;
  font-size: 1.2rem;
}

/* ==========================================================================
   3. CONTROLS (Pfeile & Schließen)
   ========================================================================== */
.nav-arrow-btn {
  color: rgba(255, 255, 255, 0.5);
  font-size: 5rem;
  padding: 0 40px;
  height: 100%;
  display: flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  z-index: 99992;
  user-select: none;
  transition: color 0.2s, background-color 0.2s;
}

.nav-arrow-btn:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.05);
}

.close-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  text-decoration: none;
  font-size: 2.5rem;
  width: 50px;
  height: 50px;
  cursor: pointer;
  border-radius: 50%;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   4. MOBILE OPTIMIERUNG (Für Smartphones)
   ========================================================================== */
@media (max-width: 768px) {
  .lightbox-modal {
    flex-direction: column; /* Elemente untereinander anordnen */
    justify-content: center;
  }

  .slide-content {
    max-width: 95%; /* Fast die volle Breite auf Handys ausnutzen */
    height: auto;
    margin-top: 60px; /* Platz wegen Schließen-Button oben */
  }

  .slide-content img {
    max-height: 65vh; /* Bild kriegt den Hauptplatz */
  }

  /* Pfeile werden zu einer Navigationsleiste ganz unten am Bildschirm */
  .nav-arrow-btn {
    height: 70px;
    position: fixed;
    bottom: 10px;
    font-size: 3.5rem;
    padding: 0 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
  }
  
  .prev-btn {
    left: 20px;
  }
  
  .next-btn {
    right: 20px;
  }
}