.gallery {
  position: relative;
  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);
}

/* Zwei mögliche Badges (siehe gallery.js) — mobil sind nur 3 Fotos sichtbar,
   ab 720px 5, die "+N weitere"-Zahl ist also je Breakpoint unterschiedlich.
   Nur die passende Variante wird gezeigt. */
.gallery-count.is-desktop-only {
  display: none;
}

@media (min-width: 720px) {
  .gallery-count.is-mobile-only {
    display: none;
  }

  .gallery-count.is-desktop-only {
    display: block;
  }
}

/* Mobil: drei Fotos in einer Reihe, groß genug für einen echten Header-
   Eindruck (Zeilenhöhe an der Viewport-Höhe orientiert). Ab 720px die
   ursprüngliche Aufteilung zurück — 1 großes Foto (2×2) + 4 kleinere
   daneben — nur mit größeren Zeilen und weniger Rand als vorher (siehe
   .listing-gallery in style.css). */
.gallery-track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(220px, 40vh);
  gap: 4px;
}

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

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

@media (min-width: 720px) {
  .gallery-track {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: unset;
    grid-template-rows: repeat(2, 220px);
  }

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

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

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

