.gallery-lightbox-open {
  overflow: hidden;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
  background: rgb(17 25 24 / 88%);
  opacity: 0;
  transition: opacity 180ms ease;
}

.gallery-lightbox.is-visible {
  opacity: 1;
}

.gallery-lightbox__dialog {
  position: relative;
  display: grid;
  max-width: min(1100px, 100%);
  max-height: 100%;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 12px;
  background: #f7f3e9;
  box-shadow: 0 24px 80px rgb(0 0 0 / 45%);
}

.gallery-lightbox__image {
  display: block;
  width: auto;
  max-width: min(100%, 1000px);
  max-height: calc(100vh - 170px);
  margin: auto;
  object-fit: contain;
}

.gallery-lightbox__caption {
  min-height: 1.5em;
  color: #303738;
  font: 500 0.95rem/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  text-align: center;
}

.gallery-lightbox__button {
  position: absolute;
  top: 50%;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgb(20 41 40 / 88%);
  color: #fff;
  font: 400 1.7rem/1 system-ui, sans-serif;
  cursor: pointer;
  transform: translateY(-50%);
}

.gallery-lightbox__button:hover,
.gallery-lightbox__button:focus-visible {
  background: #165f61;
}

.gallery-lightbox__button--close {
  top: 20px;
  right: 20px;
  transform: none;
}

.gallery-lightbox__button--previous {
  left: 20px;
}

.gallery-lightbox__button--next {
  right: 20px;
}

@media (max-width: 600px) {
  .gallery-lightbox {
    padding: 12px;
  }

  .gallery-lightbox__dialog {
    width: 100%;
    padding: 8px;
  }

  .gallery-lightbox__image {
    max-height: calc(100vh - 155px);
  }

  .gallery-lightbox__button {
    top: auto;
    bottom: 18px;
    transform: none;
  }

  .gallery-lightbox__button--close {
    right: 18px;
  }

  .gallery-lightbox__button--previous {
    left: 18px;
  }

  .gallery-lightbox__button--next {
    right: 70px;
  }
}

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