.gallery-section {
  padding-top: 20px;
}
.gallery-block {
  margin-top: clamp(60px, 8vw, 110px);
}
.gallery-block .gallery-title-row {
  margin-bottom: 22px;
}
.gallery-block h2 {
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  margin: 0;
}
.masonry-gallery {
  columns: 5 240px;
  column-gap: 10px;
}
.gallery-item {
  display: block;
  break-inside: avoid;
  margin: 0 0 14px;
  overflow: hidden;
  background: #eee;
  position: relative;
}
.gallery-item img {
  width: 100%;
  transition:
    transform 0.4s ease,
    filter 0.4s ease;
}
.gallery-item:hover img {
  transform: scale(1.015);
  filter: brightness(0.96);
}

.video-gallery-empty {
  margin-top: 35px;
  padding: 28px;
  background: #f6f6f5;
  color: #777;
}
.video-gallery-empty p {
  margin: 0;
}
.video-gallery-empty code {
  font: inherit;
  color: #555;
}
.video-gallery-item {
  color: #fff;
}
.video-gallery-item::after {
  content: "";
  position: absolute;
  inset: 42% 0 0;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.72));
  pointer-events: none;
}
.video-gallery-item img {
  min-height: 180px;
  object-fit: cover;
}
.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 62px;
  height: 62px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  display: grid;
  place-items: center;
  backdrop-filter: blur(2px);
  transition:
    transform 0.25s ease,
    background 0.25s ease;
}
.video-play span {
  display: block;
  margin-left: 5px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid #fff;
}
.video-gallery-item:hover .video-play {
  transform: translate(-50%, -50%) scale(1.06);
  background: rgba(0, 0, 0, 0.35);
}
.video-card-copy {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 18px;
  z-index: 2;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.38);
}
.video-card-copy strong {
  display: block;
  font-size: clamp(1.05rem, 1.5vw, 1.35rem);
  font-weight: 500;
  line-height: 1.15;
}
.video-card-copy small {
  display: block;
  margin-top: 5px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  opacity: 0.9;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 3000;
  display: grid;
  grid-template-columns: minmax(54px, 1fr) minmax(0, 1800px) minmax(54px, 1fr);
  align-items: center;
  padding: 30px;
}
.lightbox-stage {
  grid-column: 2;
  margin: 0;
  display: grid;
  place-items: center;
  position: relative;
  max-width: 100%;
  max-height: 92vh;
}
.lightbox img {
  display: block;
  max-width: 100%;
  max-height: 88vh;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  right: 20px;
  top: 14px;
  z-index: 3;
  border: 0;
  background: none;
  color: #fff;
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 8px;
}
.lightbox-nav {
  position: relative;
  z-index: 2;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  font-size: 2.6rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}
.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.8);
  transform: scale(1.04);
}
.lightbox-prev {
  grid-column: 1;
  justify-self: start;
}
.lightbox-next {
  grid-column: 3;
  justify-self: end;
}
.lightbox-counter {
  position: absolute;
  left: 50%;
  bottom: -25px;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}
.lightbox [hidden] {
  display: none !important;
}

.video-lightbox-stage {
  width: min(100%, 1500px);
  max-height: none;
  align-content: center;
  justify-self: center;
  margin-inline: auto;
}
.video-lightbox video {
  display: block;
  width: 100%;
  max-height: 80vh;
  background: #000;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}
.video-lightbox-caption {
  position: relative;
  width: 100%;
  min-height: 54px;
  padding-top: 14px;
  color: #fff;
}
.video-lightbox-text {
  display: block;
  padding-right: 100px;
}
.video-lightbox-text strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 500;
}
.video-lightbox-text small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.82rem;
}
.video-lightbox .lightbox-counter {
  left: auto;
  right: 0;
  bottom: auto;
  top: 17px;
  transform: none;
}

@media (max-width: 700px) {
  .masonry-gallery {
    columns: 2 150px;
    column-gap: 8px;
  }
  .gallery-item {
    margin-bottom: 8px;
  }
  .video-play {
    width: 46px;
    height: 46px;
  }
  .video-play span {
    border-top-width: 7px;
    border-bottom-width: 7px;
    border-left-width: 11px;
  }
  .video-card-copy {
    left: 12px;
    right: 12px;
    bottom: 11px;
  }
  .video-card-copy small {
    font-size: 0.68rem;
  }
  .lightbox {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    padding: 18px 10px;
  }
  .lightbox-nav {
    width: 38px;
    height: 38px;
    font-size: 2rem;
    background: rgba(0, 0, 0, 0.35);
  }
  .lightbox-close {
    right: 8px;
    top: 6px;
    font-size: 2rem;
  }
  .lightbox img {
    max-height: 82vh;
  }
  .lightbox-counter {
    bottom: -22px;
  }
  .video-lightbox video {
    max-height: 72vh;
  }
  .video-lightbox-caption {
    min-height: 70px;
  }
  .video-lightbox-text {
    padding-right: 0;
  }
  .video-lightbox .lightbox-counter {
    top: auto;
    right: auto;
    left: 0;
    bottom: -3px;
    transform: none;
  }
}

/* ===== Eigene Videosteuerung der Video-Lightbox ===== */
.video-player {
  position: relative;
  width: 100%;
  background: #000;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}
.video-lightbox .video-player video {
  display: block;
  width: 100%;
  max-height: 80vh;
  background: #000;
  box-shadow: none;
  cursor: pointer;
}
.video-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: auto auto minmax(80px, 1fr) auto auto minmax(
      70px,
      110px
    );
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.86),
    rgba(0, 0, 0, 0.58) 68%,
    transparent
  );
  color: #fff;
  transition: opacity 0.2s ease;
}
.video-control-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}
.video-control-button:hover,
.video-control-button:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.04);
  outline: none;
}
.video-toggle span {
  font-size: 1rem;
  margin-left: 2px;
}
.video-player.is-playing .video-toggle span {
  font-size: 0.82rem;
  margin-left: 0;
  letter-spacing: -2px;
}
.video-mute span {
  font-size: 1rem;
}
.video-time {
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.86);
  white-space: nowrap;
}
.video-seek,
.video-volume {
  --video-progress: 0%;
  width: 100%;
  height: 18px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}
.video-seek::-webkit-slider-runnable-track,
.video-volume::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #fff 0 var(--video-progress),
    rgba(255, 255, 255, 0.35) var(--video-progress) 100%
  );
}
.video-volume::-webkit-slider-runnable-track {
  background: rgba(255, 255, 255, 0.35);
}
.video-seek::-moz-range-track,
.video-volume::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}
.video-seek::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: #fff;
}
.video-volume::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: #fff;
}
.video-seek::-webkit-slider-thumb,
.video-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}
.video-seek::-moz-range-thumb,
.video-volume::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}
.video-seek:focus-visible,
.video-volume:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 3px;
  border-radius: 999px;
}

@media (max-width: 700px) {
  .video-lightbox .video-player video {
    max-height: 72vh;
  }
  .video-controls {
    grid-template-columns: auto auto minmax(55px, 1fr) auto auto;
    gap: 7px;
    padding: 12px 10px 10px;
  }
  .video-control-button {
    width: 34px;
    height: 34px;
  }
  .video-volume {
    display: none;
  }
  .video-time {
    font-size: 0.68rem;
  }
}

/* Galerie-Anker: Abstand zum Sticky-Header (82px, mobil 72px). */
.gallery-block[id] {
  scroll-margin-top: 102px;
}
@media (max-width: 520px) {
  .gallery-block[id] {
    scroll-margin-top: 92px;
  }
}
/* HTML-Abmessungen reservieren den Platz auch vor dem Laden. */
.masonry-gallery .gallery-item img {
  display: block;
  height: auto;
}
