html:has(.photo-viewer[open]) { overflow: hidden; }
.gallery figure > a, .spa-strip figure > a, .mosaic figure > a {
  display: block;
  height: 100%;
}
:is(.album-grid, .gallery, .spa-strip, .mosaic) a { cursor: zoom-in; }
:is(.album-grid, .gallery, .spa-strip, .mosaic) a:focus-visible {
  outline: 3px solid var(--clay);
  outline-offset: -3px;
}
.photo-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  box-sizing: border-box;
  margin: 0;
  padding: clamp(12px, 2vw, 28px);
  border: 0;
  background: #fff;
  color: #282828;
}
.photo-viewer::backdrop { background: rgb(16 16 16 / 65%); }
.photo-viewer[open] {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  grid-template-rows: 44px minmax(0, 1fr) 44px;
  gap: .75rem;
  align-items: center;
  justify-items: center;
}
.photo-viewer .viewer-image {
  grid-area: 2 / 2;
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
}
.viewer-count { grid-area: 1 / 1 / 2 / -2; justify-self: start; font: 500 .9rem/1 var(--site-font); font-variant-numeric: tabular-nums; }
.photo-viewer:has(.viewer-caption:not([hidden])) { grid-template-rows: 44px minmax(0,1fr) auto; }
.viewer-caption { grid-area: 3 / 2; text-align: center; font: 400 1rem/1.45 var(--site-font); padding-block: 6px; }
.photo-viewer button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.photo-viewer button[hidden] { display: none; }
.photo-viewer button:hover { background: #f3f2f0; }
.photo-viewer button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.viewer-close { grid-area: 1 / 3; }
.viewer-close::before, .viewer-close::after {
  content: ''; grid-area: 1 / 1; width: 31px; border-top: 1.5px solid; transform: rotate(45deg);
}
.viewer-close::after { transform: rotate(-45deg); }
.viewer-prev { grid-area: 2 / 1; }
.viewer-next { grid-area: 2 / 3; }
.viewer-prev::after, .viewer-next::after {
  content: ''; width: 14px; height: 14px; border: solid currentColor; border-width: 0 1.5px 1.5px 0;
}
.viewer-prev::after { transform: translateX(2px) rotate(135deg); }
.viewer-next::after { transform: translateX(-2px) rotate(-45deg); }
@media (max-width: 650px) {
  .photo-viewer .viewer-image { grid-column: 1 / -1; }
  .viewer-prev, .viewer-next { grid-row: 3; }
}
