.gallery {
  position: relative;
  margin: 1.5rem 0;
}

.gallery-empty {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  color: var(--color-text-muted);
  border-radius: var(--radius-lg);
}

.gallery-count {
  position: absolute;
  bottom: 0.9rem;
  right: 0.9rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  padding: 0.4em 0.8em;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.gallery-counter {
  position: absolute;
  bottom: 0.9rem;
  right: 0.9rem;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3em 0.75em;
  border-radius: 999px;
}

/* Mobile (< 720px): ein Foto pro Bildschirmbreite, horizontal swipebar mit
   Scroll-Snap — wie in der Airbnb-App, statt gestapelter Einzelbilder. */
.gallery-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.gallery-track img {
  flex: 0 0 100%;
  scroll-snap-align: start;
  width: 100%;
  height: 70vw;
  max-height: 320px;
  object-fit: cover;
  background: var(--color-surface);
  cursor: pointer;
}

/* Vollbild-Foto-Slider (Lightbox), von gallery.js an document.body gehängt. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.92);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  width: 2.6rem;
  height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-close {
  top: 1rem;
  right: 1rem;
}

.lightbox-prev {
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-counter {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.3em 0.9em;
  border-radius: 999px;
}

.gallery-count {
  display: none;
}

/* Edge-to-edge auf Mobile: sprengt bewusst das Container-Padding der Seite. */
@media (max-width: 719px) {
  .gallery {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
  }
}

/* Desktop (≥ 720px): festes Rasterlayout wie zuvor, kein Swipen nötig. */
@media (min-width: 720px) {
  .gallery {
    border-radius: var(--radius-lg);
    overflow: hidden;
  }

  .gallery-track {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 140px);
    gap: 4px;
    overflow: visible;
  }

  .gallery-track img {
    height: 100%;
    max-height: none;
    scroll-snap-align: none;
  }

  .gallery-track img:first-child {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
  }

  .gallery-track img:nth-child(n + 6) {
    display: none;
  }

  .gallery-counter {
    display: none;
  }

  .gallery-count {
    display: inline-block;
  }
}
