.gallery figure > a {
  display: block;
  border-radius: .35rem;
  cursor: zoom-in;
}

.gallery-lightbox {
  width: max-content;
  max-width: calc(100% - 1rem);
  max-height: calc(100% - 1rem);
  padding: .25rem;
  border: 0;
  overflow: visible;
  background: transparent;
  color: #fff;
}

.gallery-lightbox:not([open]) { display: none; }

.gallery-lightbox::backdrop { background: rgb(18 12 24 / .94); }

html:has(.gallery-lightbox[open]) { overflow: hidden; }

.gallery-lightbox-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: .35rem;
}

.gallery-lightbox-body {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, auto) 2.75rem;
  align-items: center;
  gap: clamp(.35rem, 2vw, 1rem);
}

.gallery-lightbox-image > img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 5rem);
  max-height: calc(100dvh - 5rem);
  margin-inline: auto;
  border-radius: .35rem;
  object-fit: contain;
  touch-action: pan-y pinch-zoom;
  user-select: none;
}

.gallery-lightbox-button {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid rgb(255 255 255 / .65);
  border-radius: 50%;
  background: #251832;
  color: #fff;
  cursor: pointer;
}

.gallery-lightbox-button:hover { background: #643895; }

.gallery-lightbox-button:focus-visible { outline-color: #fff; }

.gallery-lightbox-button .icon { width: 1.25rem; height: 1.25rem; }

@media (max-width: 46rem) {
  .gallery-lightbox-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-lightbox-image { grid-area: 1 / 1 / 2 / -1; }
  .gallery-lightbox-image > img {
    max-height: calc(100vh - 8rem);
    max-height: calc(100dvh - 8rem);
  }
  .gallery-lightbox-button[data-photo-step="-1"] { justify-self: end; }
  .gallery-lightbox-button[data-photo-step="1"] { justify-self: start; }
}
