html:has(.site-gallery-viewer[open]) { overflow: hidden; }
.site-gallery-viewer {
  --viewer-width: min(1120px, calc(100vw - 24px));
  --photo-height: calc(100dvh - 80px);
  width: max-content; max-width: var(--viewer-width); max-height: calc(100dvh - 24px);
  padding: 0; border: 0; border-radius: 14px; overscroll-behavior: contain;
  color: white; background: #101933; box-shadow: 0 16px 70px #080f2880;
}
.site-gallery-viewer::backdrop { background: #080f28db; }
.site-gallery-viewer [hidden] { display: none; }
.site-gallery-viewer-toolbar { display: flex; align-items: center; justify-content: flex-end; padding: 6px; gap: 8px; }
.site-gallery-viewer-nav { display: flex; align-items: center; gap: clamp(6px, 2vw, 14px); margin-inline-end: auto; }
.site-gallery-viewer-count { min-width: 6ch; text-align: center; font-variant-numeric: tabular-nums; }
.site-gallery-viewer-button {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 8px; background: #ffffff19; color: inherit; font: inherit; cursor: pointer;
}
.site-gallery-viewer-button:hover { background: #ffffff33; }
.site-gallery-viewer-button:focus-visible { outline: 2px solid #8ce2ff; outline-offset: 2px; }
.site-gallery-viewer-button .ph-icon { width: 24px; height: 24px; }
.site-gallery-viewer figure { margin: 0; }
.site-gallery-viewer-photo { display: grid; place-items: center; }
.site-gallery-viewer-photo img {
  display: block; width: auto; height: auto; max-width: var(--viewer-width);
  max-height: var(--photo-height); object-fit: contain;
}
.site-gallery-viewer.has-multiple { width: var(--viewer-width); --photo-height: min(760px, calc(100dvh - 80px)); }
.site-gallery-viewer.has-multiple .site-gallery-viewer-photo { height: var(--photo-height); touch-action: pan-y pinch-zoom; }
.site-gallery-viewer:has(.site-gallery-viewer-caption:not([hidden])) {
  --photo-height: min(760px, max(100px, calc(100dvh - 80px - min(20dvh, 7rem))));
}
.site-gallery-viewer-caption {
  padding: 8px 14px 12px; max-height: min(20dvh, 7rem); overflow: auto;
  color: #e0edff; text-align: center; font-size: .95rem; overflow-wrap: anywhere;
}
