/* ================================
Lightbox individuell programmiert
================================ */

.lightbox-overlay {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: fixed;
  inset: 0;
  background: rgb(12, 12, 12);
  z-index: 1500;
  overflow: hidden; /* verhindert äußeren Scrollbalken; Scroll nur in Bild-/Info-Containern */
}


/* ================================
Bildbereich
================================ */

.lightbox-bildbereich {
  position: absolute;
  top: 0;
  width: 100%;
  height: 83vh; /* ggf. feinjustieren */
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-bildbereich img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  margin-top: 0;
}


/* ================================
Scroll-Container für den Zoom
================================ */

/* Basis für alle Zustände */
.lightbox-scroll-container {
  width: 100%;
  height: 100%;
  overflow: auto;
  display: block;
  text-align: center; /* zentriert inline-block-Elemente wie img */
}

/* Nur im Zoom: scrollbarer Bereich mit reset */
.lightbox-scroll-container.zoomed {
  text-align: left; /* Für korrektes Scrollverhalten */
}

.lightbox-scroll-container img {
  display: inline-block;
  vertical-align: top;
}

/* im ungezoomten Zustand */
.lightbox-scroll-container:not(.zoomed) {
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-scroll-container:not(.zoomed) img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}


/* ================================
Infobereich
================================ */

.lightbox-infobereich {
  position: absolute;
  bottom: 0;
  height: calc(17vh);
  width: 100%;
  text-align: center;
  padding: 0.7rem 1rem 0.7rem 1rem;
  background: rgb(12, 12, 12);
  box-sizing: border-box;
  font-family: 'Quicksand', sans-serif;
  color: white;
  line-height: 1.25;
  overflow-y: auto; /* zeigt bei Bedarf eine Scrollbar; nichts wird abgeschnitten */
  scrollbar-width: none;        /* Firefox: Scrollbar ausblenden */
  -ms-overflow-style: none;     /* Legacy */
}

.lightbox-infobereich::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Laptop/knapper Viewport: Beschreibung nicht auf 3 Zeilen klemmen,
   damit .lightbox-infobereich den vollen Text scrollen kann */
@media (max-height: 800px) {
  .lightbox-infobereich .beschreibung {
    max-height: none;
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
  }
}

.lightbox-infobereich .titel {
  font-size: 1.3rem;
  font-weight: bold;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-infobereich .autor {
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-infobereich .beschreibung {
  font-size: 0.95rem;
  max-width: 750px;
  margin: 0 auto;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}


/* ================================
Vollbild + Schließen
================================ */

/* Beide Symbole sitzen in gleich großen Boxen und damit exakt auf einer Höhe */
.lightbox-fullscreen-btn,
.close-btn {
  position: absolute;
  top: 1rem;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  line-height: 1;
  z-index: 1600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.close-btn {
  right: 1rem;
  font-size: 2rem;
  color: white;
  cursor: pointer;
  pointer-events: auto;
}

.lightbox-fullscreen-btn {
  top: calc(1rem + 3px);
  right: 4.2rem;
  border: 0;
  background: transparent;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.85;
}

.lightbox-fullscreen-btn:hover,
.lightbox-fullscreen-btn:focus-visible {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.lightbox-fullscreen-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,.65);
  outline-offset: 2px;
}

.lightbox-fullscreen-btn svg {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

/* Echtes Browser-Vollbild */
#lightbox:fullscreen,
#lightbox:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  inset: 0;
  background: rgb(12, 12, 12);
}


/* ================================
Bild-Fade
================================ */

#lightbox-img {
  transition: opacity 0.3s ease-in-out;
  opacity: 1;
}

#lightbox-img.fade-out {
  opacity: 0;
}


/* ================================
Navigationsbereich
================================ */

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  font-weight: normal;
  color: white;
  cursor: pointer;
  user-select: none;
  z-index: 1501;
  padding: 0 1rem;
  opacity: 0.5;
}

.nav-prev {
  left: 0.5rem;
}

.nav-next {
  right: 0.5rem;
}


/* ================================
Zoombereich
================================ */

#lightbox-img.zoomed {
  display: block;
  object-fit: none !important;
  max-width: none;
  max-height: none;
  margin: 0 auto;
}


/* Link im Autor-Feld der Lightbox – gilt für alle Viewports */
#lightbox .lightbox-infobereich #info-autor a:link,
#lightbox .lightbox-infobereich #info-autor a:visited,
#lightbox .lightbox-infobereich #info-autor a:hover,
#lightbox .lightbox-infobereich #info-autor a:active {
  color: #f9f2e8 !important;
  text-decoration: underline;
}


/* ---- Safari-Fix: vermeidet seitliches Abschneiden bei Titel/Autor ---- */
@supports (-webkit-touch-callout: none) {
  .lightbox-infobereich .titel,
  .lightbox-infobereich .autor {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  .lightbox-infobereich {
    padding-inline: 16px;
  }
}


/* ================================
Smartphone-Optimierung
================================ */

@media (max-width: 767px) {
  .nav-arrow {
    display: none; /* Navigationspfeile auf Smartphone ausblenden – dort wird gewischt */
  }

  /* Bildbereich oben */
  .lightbox-bildbereich {
    height: 65vh;
    box-sizing: border-box;
    overflow: hidden;
  }

  .lightbox-bildbereich img {
    max-height: 100%;
    object-fit: contain;
  }

  /* Infobereich unten */
  .lightbox-infobereich {
    height: 35vh;
    max-height: 35vh;
    min-height: 5rem;
    overflow-y: auto;
    box-sizing: border-box;
    padding-top: 0.2rem;
  }

  .lightbox-infobereich .titel {
    font-size: 1rem;
    margin-bottom: 0.4rem;
    white-space: normal;
  }

  .lightbox-infobereich .autor {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .lightbox-infobereich .beschreibung {
    font-size: 0.85rem;
    max-width: none !important;
    margin: 0 !important;
    max-height: 10em;
    -webkit-line-clamp: 7;

    hyphens: auto;
    overflow-wrap: break-word;
    word-break: break-word;
  }
}

/* CSP 05: kein JS style-Attribut zum Öffnen/Schließen erforderlich. */
.lightbox-overlay.lb-is-open { display:block; }
.lb-hidden-trigger { display:none !important; }
.lightbox-overlay button.close-btn, .lightbox-overlay button.nav-arrow {
  background:transparent; border:0; font-family:inherit; line-height:inherit;
}
.lightbox-overlay button[hidden] { display:none !important; }
