/* =============================================================
   08-modal-lightbox.css – Alcedo Media
   Gemeinsames Panel-Design für YouTube-Modal und Bild-Lightbox.
   ============================================================= */

/* ── Backdrop (Overlay) ───────────────────────────────────── */
.modal,
#image-lightbox {
  display: none;               /* .modal: per JS auf flex; Lightbox: per .active */
  position: fixed;
  inset: 0;
  z-index: 2000;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  justify-content: center;
  align-items: center;
}

#image-lightbox.active {
  display: flex;
}

/* ── Panel (die abgerundete Fläche) ───────────────────────── */
.viewer-panel {
  position: relative;
  width: min(100%, 1000px);
  background: rgb(255, 255, 255);
  border: 1px solid rgba(186, 126, 186, 0.3);
  border-radius: 16px;
  overflow: hidden;
}

/* Ohne Text: Panel schmaler, damit das Bild nicht verloren wirkt */
.viewer-panel:has(.viewer-text p:empty) {
  width: min(100%, 760px);
}

/* Scrollbarer Innenbereich + Umbruch-Logik */
.viewer-scroll {
  display: flex;
  flex-wrap: wrap;             /* Text rutscht unter das Medium, wenn der Platz fehlt */
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 3rem 2rem 2rem;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}

/* Medienbereich (Bild oder Video) */
.viewer-media {
  flex: 1 1 420px;             /* ← Mindestbreite, bevor der Text umbricht */
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

/* Textbereich */
.viewer-text {
  flex: 1 1 240px;             /* ← Mindestbreite des Textes */
  min-width: 0;
}

/* Textbereich ausblenden, wenn keine Unterschrift da ist */
.viewer-text:has(p:empty) {
  display: none;
}

.viewer-text p {
  margin: 0;
  color: rgb(0, 0, 0);
  font-size: 1.05rem;
  line-height: 1.7;
  white-space: pre-line;
}

/* ── Schließen-Kreuz (oben rechts im Panel) ───────────────── */
.close-btn,
.lightbox-close {
  position: absolute;
  top: 0.6rem;
  right: 1.1rem;
  z-index: 20;
  color: rgb(0, 0, 0);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close-btn:hover,
.lightbox-close:hover {
  color: rgb(180, 80, 180);
}

/* ── Bild ─────────────────────────────────────────────────── */
#lightbox-img {
  width: auto;                 /* überschreibt das globale width: 100% */
  max-width: 100%;
  height: auto;
  max-height: 65vh;
  object-fit: contain;
  border-radius: 10px;
}

/* ── Video (16:9) ─────────────────────────────────────────── */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 10px;
}

.video-container iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Zwei-Klick-Consent-Overlay */
.youtube-consent {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  z-index: 10;
}

.youtube-consent button {
  margin-top: 1rem;
  padding: 0.8rem 1.5rem;
  border: none;
  background: rgb(180, 80, 180);
  color: white;
  cursor: pointer;
  border-radius: 6px;
}

/* ── Vor/Zurück-Navigation (nur bei Mehrbild-Galerien) ────── */
#lightbox-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

#lb-prev, #lb-next {
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.25);
  color: rgb(0, 0, 0);
  font-size: 1.3rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lb-prev:hover, #lb-next:hover {
  background: rgba(180, 80, 180, 0.15);
  border-color: rgb(180, 80, 180);
  color: rgb(140, 50, 140);
}

#lb-counter {
  color: rgba(0, 0, 0, 0.6);
  font-size: 0.9rem;
  min-width: 60px;
  text-align: center;
}



/* ── Öffnen-Animation (kurz & dezent) ─────────────────────── */
@keyframes viewerBackdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes viewerPanelIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal,
#image-lightbox {
  animation: viewerBackdropIn 0.2s ease-out;
}

.viewer-panel {
  animation: viewerPanelIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Wer Animationen im System reduziert hat, bekommt keine */
@media (prefers-reduced-motion: reduce) {
  .modal,
  #image-lightbox,
  .viewer-panel {
    animation: none;
  }
}