.gallery-item {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  overflow: hidden;
  border-radius: var(--radius);
  position: relative;
}

.gallery-item:focus-visible {
  outline: 2px solid var(--sea);
  outline-offset: 2px;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .45s cubic-bezier(.2,.7,.2,1);
}

.gallery-item:hover img {
  transform: scale(1.03);
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 29, 42, .94);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}

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

.gallery-lightbox[hidden] {
  display: grid;
}

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

.gallery-lightbox__figure {
  margin: 0;
  width: min(92vw, 1200px);
  max-height: 86vh;
  display: grid;
  gap: 14px;
  justify-items: center;
}

.gallery-lightbox__image {
  max-width: 100%;
  max-height: calc(86vh - 64px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
  user-select: none;
  -webkit-user-drag: none;
}

.gallery-lightbox__caption {
  color: var(--paper);
  font-size: .95rem;
  text-align: center;
  max-width: 60ch;
  line-height: 1.5;
}

.gallery-lightbox__caption:empty {
  display: none;
}

.gallery-lightbox__counter {
  color: rgba(247, 244, 238, .72);
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.gallery-lightbox__close,
.gallery-lightbox__nav {
  position: absolute;
  border: 0;
  background: rgba(247, 244, 238, .1);
  color: var(--paper);
  cursor: pointer;
  border-radius: 999px;
  transition: background .2s ease, transform .2s ease;
}

.gallery-lightbox__close:hover,
.gallery-lightbox__nav:hover {
  background: rgba(247, 244, 238, .18);
}

.gallery-lightbox__close {
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  font-size: 1.6rem;
  line-height: 1;
}

.gallery-lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  font-size: 1.8rem;
  line-height: 1;
}

.gallery-lightbox__nav--prev { left: 20px; }
.gallery-lightbox__nav--next { right: 20px; }

.gallery-lightbox__nav:disabled {
  opacity: .25;
  cursor: default;
}

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

  .gallery-lightbox__nav {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .gallery-lightbox__nav--prev { left: 10px; }
  .gallery-lightbox__nav--next { right: 10px; }
  .gallery-lightbox__close { top: 12px; right: 12px; }
}
