/* Gallery grid thumbs + lightbox (P17 / 17.7) */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.75rem;
}

.gallery-item {
  margin: 0;
  cursor: pointer;
  overflow: hidden;
  border-radius: 0.65rem;
  background: rgba(0, 0, 0, 0.12);
}

.gallery-item img,
.gallery-item video {
  display: block;
  width: 100%;
  height: 8.5rem;
  object-fit: cover;
}

.gallery-item figcaption {
  font-size: 0.9rem;
  padding: 0.4rem 0.5rem 0.55rem;
}

.gallery-lightbox-open {
  overflow: hidden;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 12, 18, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.gallery-lightbox__stage {
  position: relative;
  max-width: min(96vw, 56rem);
  max-height: 92vh;
  width: 100%;
}

.gallery-lightbox__media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
}

.gallery-lightbox__media img,
.gallery-lightbox__media video {
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.4rem;
}

.gallery-lightbox__caption {
  color: #fff;
  text-align: center;
  margin: 0.75rem 0 0;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.gallery-lightbox__close,
.gallery-lightbox__nav {
  position: absolute;
  z-index: 2;
  min-width: 2.75rem;
  min-height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-lightbox__close {
  top: 0;
  right: 0;
}

.gallery-lightbox__nav--prev {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.gallery-lightbox__nav--next {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}
