html:has(.photo-lightbox[open]) { overflow: hidden; }
.photo-lightbox {
  position: fixed;
  inset: 0;
  margin: 0;
  border: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
           max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: transparent;
  color: #fff;
}
.photo-lightbox::backdrop { background: rgb(8 8 8 / .95); }
.photo-lightbox[open] {
  display: grid;
  grid-template: "close close close" 44px "prev photo next" minmax(0, 1fr) "count count count" 34px
                 / 44px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
  justify-items: center;
}
.lightbox-frame {
  grid-area: photo;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  min-width: 0;
  min-height: 0;
  touch-action: pan-y pinch-zoom;
}
.lightbox-image {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / .3);
  background: #1d1d1d;
  color: #fff;
  cursor: pointer;
}
.lightbox-button:hover { border-color: #efc765; color: #efc765; }
.lightbox-button:focus-visible { outline: 2px solid #efc765; outline-offset: 3px; }
.lightbox-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lightbox-close { grid-area: close; justify-self: end; }
.lightbox-prev { grid-area: prev; }
.lightbox-next { grid-area: next; }
.lightbox-counter { grid-area: count; margin: 0; font-size: .9rem; font-variant-numeric: tabular-nums; }
.photo-lightbox [hidden] { display: none; }
@media (max-width: 640px) {
  .photo-lightbox[open] {
    grid-template: "close close close" 44px "photo photo photo" minmax(0, 1fr) "prev count next" 50px
                   / 44px minmax(0, 1fr) 44px;
  }
}
