/* =========================================================================
   Mein Zuhause Massivhaus – gemeinsame Lightbox / Galerie
   -------------------------------------------------------------------------
   Herkunft: war bis 09/2026 inline in referenzen/referenzen.html. Für die
   Aktionshaus- und Vermarktungsseiten hierher ausgelagert, damit alle drei
   Seiten dieselbe Galerie nutzen. Optik unverändert übernommen.

   Einbinden:
     <link rel="stylesheet" href="[..]shared/lightbox.css">
     <script src="[..]shared/lightbox.js"></script>
   Das Overlay-Markup erzeugt das Script selbst – keine HTML-Duplikate.
   ========================================================================= */

.lightbox {
  /* Muss ÜBER dem gemeinsamen Header (z-index 1000/1001) und der
     WhatsApp-Bubble (1002) liegen – sonst überlagert die Navbar den
     X-Button und fängt dessen Klicks ab. */
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15, 23, 42, .92); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; visibility: hidden;
  transition: opacity .3s cubic-bezier(.22, 1, .36, 1), visibility .3s cubic-bezier(.22, 1, .36, 1);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.lightbox *, .lightbox *::before, .lightbox *::after { box-sizing: border-box; }
.lightbox.is-open { opacity: 1; visibility: visible; }

.lightbox__figure {
  margin: 0; max-width: 1000px; width: 100%;
  display: flex; flex-direction: column; align-items: center;
  transform: scale(.97); transition: transform .35s cubic-bezier(.22, 1, .36, 1);
  /* Leere Bereiche der figure fangen KEINE Klicks ab, damit ein Klick neben
     das Bild den Backdrop-Schließen-Handler erreicht und der X-Button nie
     verdeckt wird. Bild und Bildunterschrift bleiben klickbar. */
  pointer-events: none;
}
.lightbox.is-open .lightbox__figure { transform: scale(1); }

.lightbox__figure img {
  max-width: 100%; max-height: 76vh; width: auto; border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  pointer-events: auto;
}

.lightbox__caption { pointer-events: auto; color: #fff; text-align: center; margin-top: 20px; }
.lightbox__caption h3 { font-size: 1.2rem; }
.lightbox__caption p  { color: rgba(255,255,255,.75); font-size: .92rem; margin-top: 6px; }
.lightbox__counter    { display: block; margin-top: 10px; font-size: .8rem; color: rgba(255,255,255,.6); letter-spacing: .05em; }

.lightbox__close {
  position: absolute; top: 22px; right: 24px; z-index: 120;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .25s cubic-bezier(.22,1,.36,1); cursor: pointer;
  border: 0;
}
.lightbox__close:hover { background: rgba(255,255,255,.25); }
.lightbox__close svg   { width: 22px; height: 22px; pointer-events: none; }

.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 120;
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .25s cubic-bezier(.22,1,.36,1); cursor: pointer;
  border: 0;
}
.lightbox__nav:hover      { background: rgba(255,255,255,.25); }
.lightbox__nav svg        { width: 26px; height: 26px; pointer-events: none; }
.lightbox__nav--prev      { left: 22px; }
.lightbox__nav--next      { right: 22px; }
.lightbox__nav[hidden]    { display: none; }

/* ---- Zoom-Modus (opt-in, für Grundrisse) --------------------------------
   Grundrisse haben kleine Raumbeschriftungen. Im Zoom-Modus wird das Bild
   auf natürliche Größe gezeigt und ist scroll-/ziehbar. */
.lightbox--zoomable .lightbox__figure img { cursor: zoom-in; }

.lightbox.is-zoomed .lightbox__figure {
  max-width: none; width: 100%; height: 100%;
  pointer-events: auto;
  overflow: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  align-items: flex-start;
}
.lightbox.is-zoomed .lightbox__figure img {
  max-width: none; max-height: none; width: auto; border-radius: 0;
  cursor: zoom-out; margin: auto;
}
.lightbox.is-zoomed .lightbox__caption,
.lightbox.is-zoomed .lightbox__nav { display: none; }

.lightbox__hint {
  display: block; pointer-events: none;
  margin-top: 8px; font-size: .78rem; color: rgba(255,255,255,.55);
  letter-spacing: .04em;
}
.lightbox:not(.lightbox--zoomable) .lightbox__hint { display: none; }
.lightbox.is-zoomed .lightbox__hint { display: none; }

@media (max-width: 700px) {
  .lightbox { padding: 12px; }
  .lightbox__close { top: 12px; right: 12px; width: 40px; height: 40px; }
  .lightbox__nav   { width: 42px; height: 42px; }
  .lightbox__nav--prev { left: 8px; }
  .lightbox__nav--next { right: 8px; }
  .lightbox__figure img { max-height: 62vh; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox, .lightbox__figure { transition: none; }
}
