.gallery {
  position: relative;
  margin: 1.5rem 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

/* Erstes Foto oben groß, die restlichen (die "es noch gibt") als Raster
   darunter — auf allen Breiten dasselbe Prinzip, nur mit unterschiedlicher
   Spaltenzahl/Zeilenhöhe per Breakpoint (siehe unten). Ersetzt das frühere
   Swipe-Karussell: dessen Edge-to-edge-Bleed ließ keine sichtbaren abgerundeten
   Ecken zu, ein Raster zeigt zudem alle Fotos auf einen Blick statt nur eins. */
.gallery-track {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.gallery-track img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--color-surface);
  cursor: pointer;
}

.gallery-track img:first-child {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 10;
}

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

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

/* Desktop (≥ 720px): breiteres Raster (4 Spalten statt 2), Hauptfoto spannt
   2×2 statt volle Breite, feste Zeilenhöhe statt Seitenverhältnis. */
@media (min-width: 720px) {
  .gallery-track {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 140px);
  }

  .gallery-track img {
    aspect-ratio: auto;
  }

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