/* ── Referenz-Galerie: Lightbox ─────────────────────── */
/* Vanilla, kein Framework. Card-Media wird zum Trigger,  */
/* Klick öffnet ein Vollbild-Overlay mit allen Bildern    */
/* des Objekts (Pfeile, Swipe, Tastatur, ESC).            */
/* Scharfe Kanten durchgehend (kein border-radius).       */

/* ── Media als klickbarer Button ────────────────────── */
button.reference-card-media {
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
button.reference-card-media:focus-visible {
  outline: 2px solid var(--primary-300);
  outline-offset: 3px;
}

/* ── Foto-Zähler oben rechts (nur bei > 1 Bild) ─────── */
.reference-card-count {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  color: var(--white);
  background: rgba(13, 46, 68, 0.78);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.reference-card-count svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* Scroll-Lock, solange die Lightbox offen ist */
.is-lightbox-open { overflow: hidden; }

/* ── Overlay ────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox[hidden] { display: none; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 28, 41, 0.94);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity .3s ease;
}
.lightbox.is-open .lightbox-backdrop { opacity: 1; }

.lightbox-stage {
  position: relative;
  z-index: 1;
  max-width: min(1400px, 92vw);
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(.98);
  transition:
    transform .3s cubic-bezier(0.22, 0.61, 0.36, 1),
    opacity .3s ease;
}
.lightbox.is-open .lightbox-stage { opacity: 1; transform: scale(1); }

.lightbox-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lightbox-img {
  display: block;
  max-width: 92vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  background: var(--primary-900);
  box-shadow: 0 24px 70px -20px rgba(0, 0, 0, 0.7);
}
.lightbox-caption {
  margin-top: var(--space-4);
  max-width: 60ch;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: var(--primary-200);
}

/* ── Bedienelemente ─────────────────────────────────── */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
  transition: background .25s ease, transform .25s ease;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255, 255, 255, 0.18); }
.lightbox-close:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
  outline: 2px solid var(--primary-300);
  outline-offset: 2px;
}

.lightbox-close {
  top: 18px;
  right: 18px;
  width: 48px;
  height: 48px;
  font-size: 30px;
  line-height: 1;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  width: 56px;
  height: 72px;
  font-size: 40px;
  line-height: 1;
  transform: translateY(-50%);
}
.lightbox-prev { left: 18px; }
.lightbox-next { right: 18px; }
.lightbox-prev:hover { transform: translateY(-50%) scale(1.04); }
.lightbox-next:hover { transform: translateY(-50%) scale(1.04); }

.lightbox-counter {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--white);
  background: rgba(255, 255, 255, 0.10);
}

/* Einzelbild: Pfeile + Zähler ausblenden */
.lightbox.is-single .lightbox-prev,
.lightbox.is-single .lightbox-next,
.lightbox.is-single .lightbox-counter { display: none; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 600px) {
  .lightbox-prev,
  .lightbox-next { width: 44px; height: 60px; font-size: 32px; }
  .lightbox-prev { left: 6px; }
  .lightbox-next { right: 6px; }
  .lightbox-close { top: 10px; right: 10px; width: 44px; height: 44px; }
  .lightbox-img { max-height: 74vh; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox-backdrop,
  .lightbox-stage,
  .lightbox-close,
  .lightbox-prev,
  .lightbox-next { transition: none; }
}
