/* =========================================================
   FREIRAUM LIGHTBOX – Grundstil
   ========================================================= */

/* Hintergrund mit Blur */
.elementor-lightbox {
  background: rgba(38, 41, 51, 0.90) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* Bild */
.elementor-lightbox .elementor-lightbox-image {
  border-radius: 8px;
  box-shadow: none !important;
}

/* Originale Vor/Zurück-Pfeile ausblenden
   (werden über die kleinen Pfeile beim Zähler ausgelöst) */
.elementor-lightbox .elementor-swiper-button {
  display: none !important;
}

/* Header (Kopfzeile) dauerhaft sichtbar */
.elementor-lightbox .elementor-slideshow__header {
  opacity: 1 !important;
  visibility: visible !important;
  display: flex !important;
  pointer-events: auto !important;
  transition: none !important;
}

/* Schließen-Icon: Standard-Icon ausblenden, eigenes SVG per Maske in Weiß
   (Position: siehe Abschnitt "Kopfzeile") */
.elementor-lightbox .dialog-lightbox-close-button svg,
.elementor-lightbox .dialog-lightbox-close-button i {
  display: none !important;
}

.elementor-lightbox .dialog-lightbox-close-button {
  background-color: #ffffff;
  -webkit-mask-image: url("https://freiraum-stubai.com/wp-content/uploads/2024/01/freiraum-close.svg");
  mask-image: url("https://freiraum-stubai.com/wp-content/uploads/2024/01/freiraum-close.svg");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  width: 20px;
  height: 20px;
}

/* =========================================================
   FREIRAUM LIGHTBOX – Bild- und Textpositionierung
   Bild immer mittig, Textblock (Titel, Beschreibung) zentriert
   zwischen Bildunterkante und Bildschirmrand.
   Werte per Script (assets/js/lightbox.js):
   --fr-img-max-h, --fr-text-h, --fr-img-bottom
   ========================================================= */

/* Stellschrauben */
.elementor-lightbox {
  --fr-lb-gap-min: 50px;                 /* Mindestabstand Desktop + Tablet quer */
  --fr-lb-img-max-w: min(90vw, 2000px);  /* Bildbreite Desktop, max. 2000px */
  --fr-lb-text-w: 650px;                 /* Textbreite Desktop */
  --fr-lb-text-gap: 6px;                 /* Abstand Titel → Beschreibung */
}

@media (max-width: 1024px) {
  .elementor-lightbox {
    --fr-lb-text-w: 550px;               /* Textbreite Tablet */
  }
}

/* Tablet hochkant: kleinerer Mindestabstand */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  .elementor-lightbox {
    --fr-lb-gap-min: 24px;
  }
}

@media (max-width: 767px) {
  .elementor-lightbox {
    --fr-lb-gap-min: 16px;
    --fr-lb-img-max-w: 100vw;
    --fr-lb-text-w: 100%;                /* Smartphone: volle Breite */
  }
}

/* Slide: Elementors vertikales Padding entfernen, Bild bleibt mittig */
.elementor-lightbox .elementor-lightbox-item {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* Bild: immer mittig, max. Höhe berechnet das Script (--fr-img-max-h):
   unten Text + 2 Mindestabstände, oben Kopfzeile + Mindestabstand */
.elementor-lightbox .elementor-lightbox-image {
  max-width: var(--fr-lb-img-max-w) !important;
  max-height: var(--fr-img-max-h, 70dvh) !important;
  object-fit: contain;
}

/* Footer: von Bildunterkante bis Bildschirmrand, Textblock darin zentriert */
.elementor-lightbox .elementor-slideshow__footer {
  position: fixed !important;
  top: var(--fr-img-bottom, auto) !important;
  bottom: 0 !important;
  left: 0;
  right: 0;
  width: auto !important;
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 20px !important;
  box-sizing: border-box;
  pointer-events: none;                  /* Klick in leeren Bereich schließt weiterhin */
}

/* Footer mit Titel + Beschreibung dauerhaft sichtbar
   (Elementor blendet ihn nach Inaktivität per .elementor-slideshow--ui-hidden aus) */
.elementor-lightbox .elementor-slideshow__footer,
.elementor-lightbox .elementor-slideshow--ui-hidden .elementor-slideshow__footer,
.elementor-lightbox .elementor-slideshow--ui-hidden .elementor-slideshow__title,
.elementor-lightbox .elementor-slideshow--ui-hidden .elementor-slideshow__description {
  opacity: 1 !important;
  visibility: visible !important;
  transition: none !important;
}

/* Titel: Abstand zur Beschreibung */
.elementor-lightbox .elementor-slideshow__title {
  margin-bottom: var(--fr-lb-text-gap) !important;
}

/* Titel + Beschreibung: einheitliche Breite je Endgerät */
.elementor-lightbox .elementor-slideshow__title,
.elementor-lightbox .elementor-slideshow__description {
  width: 100%;
  max-width: var(--fr-lb-text-w);
  pointer-events: auto;
}

/* =========================================================
   FREIRAUM LIGHTBOX – Navigation in der Kopfzeile: ‹ 2 / 8 ›
   Zeile wird per Script aufgebaut (.fr-lb-nav).
   Pfeile lösen die originalen Elementor-Pfeile aus.
   ========================================================= */

/* Stellschrauben */
.elementor-lightbox {
  --fr-lb-nav-size: 10px;                /* Schriftgröße Zähler = Pfeilgröße */
  --fr-lb-nav-gap: 14px;                 /* Abstand Pfeil ↔ Zähler */
  --fr-lb-nav-close-gap: 30px;           /* ← Desktop/Tablet: Abstand Navigation → Schließen-Icon */
  --fr-lb-nav-hit: 14px;                 /* unsichtbare Klickfläche rund um den Pfeil */
}

/* Zeile: Pfeil – Zähler – Pfeil, in der Kopfzeile auf der Mittellinie
   Desktop/Tablet: rechtsbündig vor dem Schließen-Icon (Icon 20px breit) */
.elementor-lightbox .fr-lb-nav {
  position: fixed;
  top: calc(var(--fr-lb-bar-top) + var(--fr-lb-bar-h) / 2);
  right: calc(var(--fr-lb-bar-x) + 20px + var(--fr-lb-nav-close-gap));
  left: auto;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: var(--fr-lb-nav-gap);
  z-index: 10;
  pointer-events: none;                  /* nur Pfeile + Zähler reagieren */
}

/* Smartphone: mittig zwischen Logo-Ende und Schließen-Icon
   Logo-Ende = Rand + Logobreite, X-Anfang = 100vw − Rand − 20px
   → Mittelpunkt = (Logobreite + 100vw − 20px) / 2 */
@media (max-width: 767px) {
  .elementor-lightbox .fr-lb-nav {
    right: auto;
    left: calc((var(--fr-lb-logo-w) + 100vw - 20px) / 2);
    transform: translate(-50%, -50%);
  }
}

/* Bildzähler */
.elementor-lightbox .fr-lb-nav .elementor-slideshow__counter,
.elementor-lightbox .fr-lb-nav .elementor-lightbox-counter {
  color: #ffffff;
  font-size: var(--fr-lb-nav-size) !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  margin: 0 !important;
  padding: 0 !important;
  white-space: nowrap;
  pointer-events: auto;
}

/* Pfeile: Button = unsichtbare Klickfläche, Theme-Button-Stile neutralisiert
   (Padding vergrößert die Klickfläche, negativer Margin hält die Optik gleich) */
.elementor-lightbox .fr-lb-nav__btn,
.elementor-lightbox .fr-lb-nav__btn:hover,
.elementor-lightbox .fr-lb-nav__btn:focus,
.elementor-lightbox .fr-lb-nav__btn:focus-visible,
.elementor-lightbox .fr-lb-nav__btn:active {
  position: relative;
  box-sizing: content-box;
  width: var(--fr-lb-nav-size);
  height: var(--fr-lb-nav-size);
  padding: var(--fr-lb-nav-hit) !important;
  margin: calc(-1 * var(--fr-lb-nav-hit)) !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
  cursor: pointer;
}

/* Pfeil-Icon: weißes Chevron per Maske – immer weiß, kein Hover */
.elementor-lightbox .fr-lb-nav__btn::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15 4 7 12l8 8' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15 4 7 12l8 8' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Weiter-Pfeil: Chevron gespiegelt */
.elementor-lightbox .fr-lb-nav__btn--next::before {
  transform: scaleX(-1);
}

/* Kein Weiterblättern möglich (Anfang/Ende): Pfeil blass */
.elementor-lightbox .fr-lb-nav__btn.is-disabled {
  cursor: default;
}

.elementor-lightbox .fr-lb-nav__btn.is-disabled::before {
  opacity: 0.3;
}

/* =========================================================
   FREIRAUM LIGHTBOX – Kopfzeile: Logo links | Navigation | Schließen rechts
   Alle auf einer gemeinsamen Mittellinie
   ========================================================= */

/* Stellschrauben */
.elementor-lightbox {
  --fr-lb-bar-h: 20px;                   /* Zeilenhöhe = Höhe Schließen-Icon */
  --fr-lb-bar-top: 32px;                 /* ← Desktop/Tablet: Abstand von oben */
  --fr-lb-bar-x: 55px;                   /* ← Desktop/Tablet: Abstand links/rechts */
  --fr-lb-logo-w: 235px;                 /* ← Logobreite Desktop/Tablet */
  --fr-lb-logo-h: 50px;                  /* max. Logohöhe – SVG hat Leerraum oben/unten, Breite bestimmt die Größe */
}

@media (max-width: 767px) {
  .elementor-lightbox {
    --fr-lb-bar-top: 25px;               /* ← Smartphone: Abstand von oben */
    --fr-lb-bar-x: 30px;                 /* ← Smartphone: Abstand links/rechts */
    --fr-lb-logo-w: 45vw;                /* ← Logobreite Smartphone */
  }
}

/* Kopfzeile: nach unten versetzt, Höhe = Icon-Höhe */
.elementor-lightbox .elementor-slideshow__header {
  top: var(--fr-lb-bar-top) !important;
  height: var(--fr-lb-bar-h);
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  align-items: center;
  box-sizing: border-box;
}

/* Logo: linksbündig, vertikal mittig zur Kopfzeile */
.elementor-lightbox .elementor-slideshow__header::after {
  content: "";
  position: absolute;
  left: var(--fr-lb-bar-x);
  top: 50%;
  transform: translateY(-50%);
  width: var(--fr-lb-logo-w);
  height: var(--fr-lb-logo-h);
  background: url("https://freiraum-stubai.com/wp-content/uploads/2024/01/logomobilelight.svg")
    left center / contain no-repeat;
  pointer-events: none;
}

/* Schließen-Icon: rechts, auf der Mittellinie der Kopfzeile (Icon 20px hoch) */
.elementor-lightbox .dialog-lightbox-close-button {
  top: calc(var(--fr-lb-bar-top) + (var(--fr-lb-bar-h) - 20px) / 2) !important;
  right: var(--fr-lb-bar-x) !important;
  margin: 0 !important;
  padding: 0 !important;
}