.gallery--grid-lightbox__inner {
  container-type: inline-size;
}

.gallery--grid-lightbox__grid-wrapper {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-m);
}

/*Hide last on mobile */
.gallery--grid-lightbox__grid-wrapper
  > .gallery--grid-lightbox__img-link:nth-last-child(1):nth-child(odd) {
  display: none;
}

@container (min-width: 768px) {
  .gallery--grid-lightbox__grid-wrapper {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery--grid-lightbox__grid-wrapper
    > .gallery--grid-lightbox__img-link:nth-last-child(1):nth-child(odd) {
    display: block;
  }
}

.gallery--grid-lightbox__figure {
  aspect-ratio: 2/3;
  overflow: hidden;
}

.gallery--grid-lightbox img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =========================
   Gallery Lightbox
   ========================= */

.gallery--grid-lightbox__lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;

  width: 100%;
  height: 100svh;
}

.gallery--grid-lightbox__lightbox[hidden] {
  display: none;
}

.gallery--grid-lightbox__lightbox-inner {
  position: relative;
  display: grid;
  margin-inline: auto;
  max-width: 1200px; /*damit prev/next nicht zu weit weg*/
  width: 100%;
  height: 100svh;
}

/* Swiper */
.gallery--grid-lightbox__swiper {
  width: 100%;
  height: 100%;
}

.gallery--grid-lightbox__swiper .swiper-wrapper {
  height: 100%;
}

.gallery--grid-lightbox__swiper .swiper-slide {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery--grid-lightbox__swiper .swiper-slide img {
  max-width: calc(100% - 6rem);
  max-height: 90svh;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Kleine Displays */
@media (max-width: 400px) {
  .gallery--grid-lightbox__swiper .swiper-slide img {
    max-width: calc(100vw - 4.5rem);
    max-height: 80svh;
  }
}

/* =========================
   Navigation Arrows
   ========================= */

.gallery--grid-lightbox__lightbox-prev,
.gallery--grid-lightbox__lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;

  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;

  padding: 0.5rem;
}

.gallery--grid-lightbox__lightbox-prev {
  left: clamp(0.5rem, 1vw, 1.5rem);
}

.gallery--grid-lightbox__lightbox-next {
  right: clamp(0.5rem, 1vw, 1.5rem);
}

.gallery--grid-lightbox__lightbox-prev svg,
.gallery--grid-lightbox__lightbox-next svg {
  width: 32px;
  height: 32px;
  display: block;
  pointer-events: none;
}

.gallery--grid-lightbox__lightbox-prev:hover,
.gallery--grid-lightbox__lightbox-next:hover {
  opacity: 0.7;
}

/* =========================
   Close Button
   ========================= */

.gallery--grid-lightbox__lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 3;

  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;

  padding: 0.5rem;
}

.gallery--grid-lightbox__lightbox-close svg {
  width: 28px;
  height: 28px;
  display: block;
  pointer-events: none;
}

.gallery--grid-lightbox__lightbox-close:hover {
  opacity: 0.7;
}

/* Scroll Lock */
body.is-lightbox-open {
  overflow: hidden;
}
