/* PhotoSwipe gallery skin + Masonry-Vorschau */

/*
 * Masonry per JS (kürzeste Spalte) in gallery.js –
 * oben links→rechts, unten dicht ohne leere End-Spalten.
 */
.div-hg-bilder.is-masonry {
  position: relative;
  display: block;
  background-color: #222;
  padding: 40px 25px;
  clear: both;
  width: 100%;
  box-sizing: border-box;
  min-height: 200px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.div-hg-bilder.is-masonry.is-masonry-ready {
  opacity: 1;
}

.div-hg-bilder.is-masonry .dia {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  aspect-ratio: auto;
  height: auto;
  background-color: transparent;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #bbb;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: box-shadow 0.3s ease, opacity 0.25s ease;
}

.div-hg-bilder.is-masonry .dia.is-hidden {
  display: none !important;
  position: static !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.div-hg-bilder.is-masonry .dia:hover {
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.65);
  z-index: 2;
}

.div-hg-bilder.is-masonry .dia a {
  display: block;
  line-height: 0;
}

.div-hg-bilder.is-masonry .dia img {
  width: 100%;
  height: auto !important;
  object-fit: unset !important;
  display: block;
  vertical-align: top;
}

@media screen and (max-width: 700px) {
  .div-hg-bilder.is-masonry {
    padding: 1.25rem 0.75rem;
  }
}

/* Unsichtbarer Auslöser: lädt die nächste Charge, sobald er ins Blickfeld kommt */
.gallery-scroll-sentinel {
  height: 1px;
  width: 100%;
  pointer-events: none;
  background: #222;
}

.gallery-js-hint {
  color: #aaa;
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
}

/* ---- PhotoSwipe ---- */
.pswp {
  --pswp-bg: rgba(0, 0, 0, 0.88);
  --pswp-placeholder-bg: #111;
  --pswp-icon-color: #eaeaea;
  --pswp-icon-color-secondary: rgba(234, 234, 234, 0.75);
  z-index: 100000;
}

.pswp__bg {
  background: var(--pswp-bg);
}

.pswp__top-bar {
  background: transparent !important;
}

/* UI erst einblenden, wenn Bildgrösse stabil ist (kein Caption-Sprung) */
.pswp:not(.pswp--ui-ready) .pswp__button--close,
.pswp:not(.pswp--ui-ready) .pswp__button--zoom,
.pswp:not(.pswp--ui-ready) .pswp__counter,
.pswp:not(.pswp--ui-ready) .pswp__custom-caption,
.pswp:not(.pswp--ui-ready) .pswp__download-btn {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none !important;
}

/* Schliessen: Kreis auf der oberen rechten Bildecke (Position per JS) */
.pswp button.pswp__button--close,
.pswp button.pswp__button--zoom {
  position: fixed;
  z-index: 100020;
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  margin: 0;
  padding: 0 !important;
  border-radius: 50% !important;
  box-sizing: border-box !important;
  aspect-ratio: 1 / 1;
  background: rgba(20, 20, 20, 0.72) !important;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  opacity: 1;
  overflow: hidden;
  transition: opacity 0.15s ease, background 0.15s ease, visibility 0.15s ease;
}

.pswp__button--close .pswp__icn {
  display: none;
}

.pswp__button--close::before,
.pswp__button--close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 2.5px;
  background: #eaeaea;
  border-radius: 1px;
}

.pswp__button--close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.pswp__button--close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.pswp__button--close:hover,
.pswp__button--zoom:hover {
  background: rgba(40, 40, 40, 0.9) !important;
}

.pswp__button--close:hover::before,
.pswp__button--close:hover::after {
  background: #fff;
}

/* Lupe: nur Rahmen + Stiel (kein gefüllter Kreis) */
.pswp__button--zoom {
  display: block !important;
}

.pswp__button--zoom .pswp__icn {
  display: none !important;
}

.pswp__button--zoom::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -11px 0 0 -12px;
  border: 2.5px solid #eaeaea;
  border-radius: 50%;
  box-sizing: border-box;
  background: transparent;
}

.pswp__button--zoom::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 2.5px;
  margin: 6px 0 0 4px;
  background: #eaeaea;
  border-radius: 1px;
  transform: rotate(45deg);
  transform-origin: left center;
}

.pswp__button--zoom:hover::before {
  border-color: #fff;
}

.pswp__button--zoom:hover::after {
  background: #fff;
}

.pswp__button--zoom.pswp__button--zoom-disabled,
.pswp__button--zoom:disabled,
.pswp.pswp--zoom-unavailable .pswp__button--zoom,
.pswp:not(.pswp--zoom-allowed) .pswp__button--zoom {
  opacity: 1 !important;
  cursor: default !important;
  pointer-events: none !important;
}

.pswp__button--zoom.pswp__button--zoom-disabled::before,
.pswp__button--zoom:disabled::before,
.pswp.pswp--zoom-unavailable .pswp__button--zoom::before,
.pswp:not(.pswp--zoom-allowed) .pswp__button--zoom::before {
  border-color: #6a6a6a !important;
}

.pswp__button--zoom.pswp__button--zoom-disabled::after,
.pswp__button--zoom:disabled::after,
.pswp.pswp--zoom-unavailable .pswp__button--zoom::after,
.pswp:not(.pswp--zoom-allowed) .pswp__button--zoom::after {
  background: #6a6a6a !important;
}

.pswp__button--zoom.pswp__button--zoom-disabled:hover,
.pswp__button--zoom:disabled:hover,
.pswp.pswp--zoom-unavailable .pswp__button--zoom:hover,
.pswp:not(.pswp--zoom-allowed) .pswp__button--zoom:hover {
  background: rgba(20, 20, 20, 0.72) !important;
}

.pswp__button--zoom.pswp__button--zoom-disabled:hover::before,
.pswp__button--zoom:disabled:hover::before,
.pswp.pswp--zoom-unavailable .pswp__button--zoom:hover::before,
.pswp:not(.pswp--zoom-allowed) .pswp__button--zoom:hover::before {
  border-color: #6a6a6a !important;
}

.pswp__button--zoom.pswp__button--zoom-disabled:hover::after,
.pswp__button--zoom:disabled:hover::after,
.pswp.pswp--zoom-unavailable .pswp__button--zoom:hover::after,
.pswp:not(.pswp--zoom-allowed) .pswp__button--zoom:hover::after {
  background: #6a6a6a !important;
}

.pswp--zoom-unavailable .pswp__img {
  cursor: default;
}

/*
 * Rahmen als box-shadow (nicht border):
 * border + border-box verzerrt PhotoSwipe-Berechnung → Sprung + weisser Rand.
 */
.pswp__img {
  border: 0 !important;
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
  box-sizing: content-box;
  background: transparent;
  cursor: pointer;
}

.pswp__img--placeholder,
.pswp__img--placeholder--blank {
  border-radius: 4px;
  background: #111 !important;
  box-shadow: none;
}

.pswp__button--arrow--prev,
.pswp__button--arrow--next {
  width: 56px;
  height: 72px;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.pswp__button--arrow--prev.pswp__button--hidden-edge,
.pswp__button--arrow--next.pswp__button--hidden-edge {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.pswp__button--arrow .pswp__icn {
  width: 36px;
  height: 36px;
  fill: #eaeaea;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

/* Smartphone: X und Lupe etwas kleiner */
@media screen and (max-width: 700px) {
  .pswp button.pswp__button--close,
  .pswp button.pswp__button--zoom {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
  }

  .pswp__button--close::before,
  .pswp__button--close::after {
    width: 18px;
    height: 2.5px;
  }

  .pswp__button--zoom::before {
    width: 14px;
    height: 14px;
    margin: -9px 0 0 -10px;
    border-width: 2px;
  }

  .pswp__button--zoom::after {
    width: 7px;
    height: 2px;
    margin: 4px 0 0 3px;
  }

  .pswp__button--arrow--prev,
  .pswp__button--arrow--next {
    width: 44px;
    height: 56px;
  }

  .pswp__button--arrow .pswp__icn {
    width: 28px;
    height: 28px;
  }
}

/* Beim Zoomen: Chrome inkl. Caption aus */
.pswp--zoomed-in .pswp__button--arrow--prev,
.pswp--zoomed-in .pswp__button--arrow--next,
.pswp--zoomed-in .pswp__button--close,
.pswp--zoomed-in .pswp__button--zoom,
.pswp--zoomed-in .pswp__counter,
.pswp--zoomed-in .pswp__custom-caption,
.pswp--zoomed-in .pswp__download-btn {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden;
}

.pswp__download-btn {
  position: fixed;
  z-index: 1000100;
  display: inline-block;
  margin: 0;
  padding: 0.45rem 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 0;
  background: rgba(20, 20, 20, 0.72);
  color: #eaeaea;
  font: 700 0.8rem/1.2 "Lato-Bold", sans-serif;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.pswp__download-btn:hover {
  background: #f35110;
  border-color: #f35110;
  color: #fff;
}

.pswp__download-btn[hidden] {
  display: none !important;
}

.pswp__counter {
  position: fixed;
  z-index: 100015;
  margin: 0 !important;
  padding: 0;
  color: #eaeaea;
  font: 11px/18px "Lucida Sans", "Lucida Sans Unicode", "Lucida Grande", Tahoma, Arial, sans-serif;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
  opacity: 1;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.pswp__custom-caption {
  position: fixed;
  z-index: 100015;
  margin: 0;
  padding: 0;
  text-align: left;
  color: #eaeaea;
  font: 11px/18px "Lucida Sans", "Lucida Sans Unicode", "Lucida Grande", Tahoma, Arial, sans-serif;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  box-sizing: border-box;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.pswp__custom-caption-title {
  display: block;
  font-weight: bold;
  margin: 0 0 0.15rem;
}

.pswp__custom-caption-text {
  display: block;
  font-weight: normal;
  opacity: 0.92;
}

.pswp__custom-caption:empty {
  display: none;
}
