/* Bilder klickbar machen */
.wp-block-gallery img,
.wp-block-image img,
.gallery img { cursor: pointer; }

#sal-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: none;
  z-index: 999999;
  pointer-events: none; /* wenn geschlossen: nie blocken */
}

#sal-lightbox-overlay.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.sal-lightbox-content {
  position: relative;
  max-width: min(90vw, 1200px);
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden; /* wichtig für Slider & Pan-Bounds */
}

/* Layering */
.sal-topbar {
  position: absolute;
  top: 10px; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; gap: 8px; z-index: 4;
}
.sal-btn, .sal-caption { z-index: 3; }

/* Slider mit 3 Slides */
.sal-slider {
  display: flex;
  width: 300%;
  height: auto;
  will-change: transform;
  z-index: 1;
}
.sal-slide {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Zoom-Layer je Slide */
.sal-zoom-wrap { will-change: transform; }

/* Bild */
.sal-lightbox-img {
  max-width: 100%;
  max-height: 85vh;
  display: block;
  border-radius: 6px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  user-select: none;
  transform-origin: center center;
  will-change: transform;
  touch-action: none; /* für Pinch/Pan */
  cursor: zoom-in;
}

/* sanfte Transitions (Zoom/Slider) */
#sal-lightbox-overlay.sal-animate .sal-lightbox-img,
#sal-lightbox-overlay.sal-animate .sal-zoom-wrap,
#sal-lightbox-overlay.sal-animate .sal-slider {
  transition: transform .24s cubic-bezier(.2,.8,.2,1);
}

#sal-lightbox-overlay.is-zoomed .sal-lightbox-img { cursor: grab; }
#sal-lightbox-overlay.is-panning .sal-lightbox-img { cursor: grabbing; }

/* Caption unten: Dateiname */
.sal-caption {
  position: absolute;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  max-width: min(84vw, 1000px);
  text-align: center;
  color: #fff;
  font-size: 14px;
  line-height: 1.35;
  padding: 6px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.55)) rgba(0,0,0,0.45);
  border-radius: 8px;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buttons */
.sal-btn-top {
  background: rgba(0,0,0,0.55);
  border: none; border-radius: 999px;
  color: #fff; padding: 5px 16px 6px;
  font-size: 13px; font-weight: 500;
  pointer-events: auto; cursor: pointer;
  transition: background .2s, opacity .2s;
  z-index: 5;
}
.sal-btn-top:hover { background: rgba(0,0,0,0.85); }

.sal-btn-icon.sal-close {
  position: absolute; right: 10px; top: 0;
  background: rgba(0,0,0,0.55);
  border: none; width: 36px; height: 36px; border-radius: 999px;
  color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center;
  pointer-events: auto; cursor: pointer; transition: background .2s, opacity .2s;
  z-index: 5;
}
.sal-btn-icon.sal-close:hover { background: rgba(0,0,0,0.85); }

/* Zoom Controls (links oben) */
.sal-zoom-controls {
  position: absolute; left: 10px; top: 0;
  display: flex; gap: 6px; pointer-events: auto; z-index: 5;
}
.sal-btn-icon.sal-zoom-in, .sal-btn-icon.sal-zoom-out {
  background: rgba(0,0,0,0.55);
  border: none; width: 36px; height: 36px; border-radius: 999px;
  color: #fff; font-size: 20px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .2s, opacity .2s;
}
.sal-btn-icon.sal-zoom-in:hover, .sal-btn-icon.sal-zoom-out:hover { background: rgba(0,0,0,0.85); }
.sal-btn-icon:disabled { opacity: 0.45; cursor: not-allowed; }

/* Pfeile */
.sal-btn {
  position: absolute;
  background: rgba(0,0,0,0.6);
  border: none; color: #fff; cursor: pointer;
  font-size: 32px; width: 46px; height: 46px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.sal-btn:hover { background: rgba(0,0,0,0.85); }

.sal-prev, .sal-next { top: 50%; transform: translateY(-50%); z-index: 3; }
.sal-prev { left: 10px; }
.sal-next { right: 10px; }

@media (max-width: 768px) {
  .sal-lightbox-content { max-width: 100vw; }
  .sal-prev, .sal-next { width: 40px; height: 40px; font-size: 26px; }
}
