/* PhotoSwipe + Masonry – PumpTrack Bärau */

.gallery-masonry.is-masonry {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  min-height: 200px;
  padding: 0;
}

@media (min-width: 701px) {
  .gallery-masonry.is-masonry {
    gap: 12px;
  }
}

.gallery-masonry.is-masonry.is-masonry-ready {
  display: block;
}

.gallery-masonry .dia {
  display: block;
  position: relative;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  background: transparent;
}

.gallery-masonry.is-masonry-ready .dia {
  position: absolute;
  top: 0;
  left: 0;
}

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

.gallery-masonry .dia a.gallery-item {
  display: block;
  position: relative;
  line-height: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.gallery-masonry .dia:hover a.gallery-item {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 87, 34, 0.45);
}

.gallery-masonry .dia:hover {
  z-index: 2;
}

.gallery-masonry .dia img,
.gallery-masonry .dia video {
  width: 100%;
  height: auto !important;
  display: block;
  vertical-align: top;
  object-fit: contain;
  object-position: center;
}

.gallery-masonry .dia__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 2rem 0.65rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #fff;
  text-align: left;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

@media (hover: hover) and (pointer: fine) {
  .gallery-masonry .dia__caption {
    opacity: 0;
  }

  .gallery-masonry .dia:hover .dia__caption {
    opacity: 1;
  }
}

.gallery-block {
  margin-bottom: 3.5rem;
}

.page-bilder-videos .page-hero h1 {
  hyphens: manual;
  -webkit-hyphens: manual;
}

.page-hero__keep {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .page-bilder-videos .page-hero__keep {
    display: block;
  }
}

.gallery-block__title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 1rem;
}

.gallery-block__sub {
  color: var(--muted);
  margin: -0.35rem 0 1.25rem;
}

.gallery-block--videos {
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.gallery-item__thumb--video {
  position: relative;
  display: block;
  background: #111;
}

.gallery-item__thumb--video video,
.gallery-item__thumb--video img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
  height: auto !important;
  pointer-events: none;
}

.gallery-item__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.22);
}

.gallery-item__play::after {
  content: "";
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 87, 34, 0.92);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  clip-path: polygon(38% 28%, 38% 72%, 72% 50%);
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 0 0 1.75rem;
}

.gallery-filters button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: #fff;
  background: transparent;
  box-sizing: border-box;
  white-space: normal;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.gallery-filters button.is-active,
.gallery-filters button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (max-width: 640px) {
  .gallery-filters {
    flex-wrap: nowrap;
    gap: 0.3rem;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    padding-inline: 0.625rem;
  }

  .gallery-filters button {
    flex: 0 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.48rem 0.5rem;
    font-size: clamp(0.58rem, 2.55vw, 0.72rem);
    letter-spacing: 0.025em;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: manual;
    -webkit-hyphens: manual;
  }
}

@media (max-width: 360px) {
  .gallery-filters button {
    white-space: normal;
  }
}

.gallery-empty {
  color: var(--muted);
  max-width: 40rem;
}

.gallery-empty code {
  color: var(--accent-2);
  font-size: 0.9em;
}

/* ---- 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;
}

.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 {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none !important;
}

.pswp__button--close,
.pswp__button--zoom {
  position: fixed;
  z-index: 100020;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  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;
  transition: opacity 0.15s ease, background 0.15s ease, visibility 0.15s ease;
}

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

.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--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--close:hover,
.pswp__button--zoom:hover {
  background: rgba(40, 40, 40, 0.9) !important;
}

.pswp__button--zoom.pswp__button--zoom-disabled,
.pswp__button--zoom:disabled,
.pswp.pswp--zoom-unavailable .pswp__button--zoom,
.pswp.pswp--video-slide .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.pswp--video-slide .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.pswp--video-slide .pswp__button--zoom::after {
  background: #6a6a6a !important;
}

.pswp__img {
  border: 0 !important;
  border-radius: 4px;
  box-sizing: content-box;
  background: transparent;
  cursor: pointer;
  box-shadow: none;
}

/* Rahmen erst wenn UI bereit – verhindert Schatten-Sprung beim ersten Öffnen */
.pswp.pswp--ui-ready .pswp__img:not(.pswp__img--placeholder):not(.pswp__img--placeholder--blank) {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
}

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

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

/*
 * Rahmen als box-shadow (nicht border):
 * border + border-box verzerrt PhotoSwipe-Berechnung → Sprung + weisser Rand.
 */

.pswp__video-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  box-shadow: none;
  overflow: hidden;
  background: #000;
}

.pswp.pswp--ui-ready .pswp__video-wrap {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.pswp__video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
  background: #000;
}

.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));
}

.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 {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden;
}

.pswp__counter {
  position: fixed;
  z-index: 100015;
  margin: 0 !important;
  padding: 0;
  color: #eaeaea;
  font: 11px/18px "DM Sans", sans-serif;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
  opacity: 1;
}

.pswp__custom-caption {
  position: fixed;
  z-index: 100015;
  margin: 0;
  padding: 0;
  text-align: left;
  color: #eaeaea;
  font: 11px/18px "DM Sans", sans-serif;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  box-sizing: border-box;
}

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

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

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

@media screen and (max-width: 700px) {
  .pswp__button--close,
  .pswp__button--zoom {
    width: 38px;
    height: 38px;
  }

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

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

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