/* ============================================================
   Bildergalerie-Komponente (Mosaik / Peek / Lightbox)
   ============================================================ */

.gallery {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.gallery__viewport {
  flex: 1 1 auto;
  min-width: 0;
}

/* ---- Mosaik (Desktop / Tablet) ---- */
.gallery__viewport--mosaic {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), 1fr);
  gap: 0.85rem;
}

.mosaic__tile {
  position: relative;
  margin: 0;
  padding: 0;
  border: none;
  background: #111118;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  perspective: 1100px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.mosaic__card {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.mosaic__card.is-flipped {
  transform: rotateY(180deg);
}

.mosaic__face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.mosaic__face--back {
  transform: rotateY(180deg);
}

.mosaic__face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mosaic__tile::after {
  /* dezenter Rahmen/Glanz für mehr Tiefe */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  pointer-events: none;
  z-index: 2;
}

.mosaic__tile:hover {
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
}

.mosaic__tile:focus-visible {
  outline: 3px solid #f6e7d0;
  outline-offset: 2px;
}

/* ---- Einzelbild-Slider (Mobile) ---- */
.gallery--peek {
  position: relative;
  gap: 0;
}

.gallery__viewport--peek {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.5rem 0;
}

.gallery__viewport--peek::-webkit-scrollbar {
  display: none;
}

.peek__tile {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: center;
  margin: 0;
  padding: 0;
  border: none;
  background: #111118;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}

.peek__tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Navigationspfeile über das Bild legen, damit es die volle Breite nutzt */
.gallery--peek .gallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
}

.gallery--peek .gallery__nav:hover {
  transform: translateY(-50%) scale(1.08);
}

.gallery--peek .gallery__nav--prev {
  left: 0.6rem;
}

.gallery--peek .gallery__nav--next {
  right: 0.6rem;
}

/* ---- Navigation / Bildunterschrift ---- */
.gallery__nav {
  flex: 0 0 auto;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  color: #f6e7d0;
  font-size: 1.7rem;
  line-height: 1;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 2;
}

.gallery__nav[hidden] {
  display: none;
}

.gallery__nav:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.08);
}

.gallery__nav:focus-visible {
  outline: 2px solid #f6e7d0;
}

.gallery__caption {
  text-align: center;
  margin: 1.1rem 0 0;
  color: #c9b89c;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(8, 6, 4, 0.93);
  backdrop-filter: blur(4px);
}

.lightbox[hidden] {
  display: none;
}

.lightbox__img {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
}

.lightbox__close {
  position: absolute;
  top: 1.1rem;
  right: 1.4rem;
  background: none;
  border: none;
  color: #f6e7d0;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.45);
  border: none;
  color: #f6e7d0;
  font-size: 2.2rem;
  line-height: 1;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lightbox__nav:hover {
  background: rgba(0, 0, 0, 0.75);
}

.lightbox__nav--prev {
  left: 1.2rem;
}

.lightbox__nav--next {
  right: 1.2rem;
}

.lightbox__close:focus-visible,
.lightbox__nav:focus-visible {
  outline: 2px solid #f6e7d0;
}

.lightbox__counter {
  position: absolute;
  bottom: 1.1rem;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: #c9b89c;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
}

@media (prefers-reduced-motion: reduce) {
  .mosaic__card {
    transition: none;
  }
}
