html.photo-viewer-open { overflow: hidden; }
.photo-viewer {
  --viewer-top: max(12px, env(safe-area-inset-top));
  --viewer-bottom: max(12px, env(safe-area-inset-bottom));
  box-sizing: border-box; position: fixed; inset: 0; margin: 0;
  width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none;
  border: 0; background: transparent; color: white;
  padding: var(--viewer-top) max(12px, env(safe-area-inset-right)) var(--viewer-bottom) max(12px, env(safe-area-inset-left));
  overflow: hidden; overscroll-behavior: contain;
}
.photo-viewer[open] { display: flex; align-items: center; justify-content: center; }
.photo-viewer::backdrop { background: rgb(0 0 0 / 90%); }
.photo-viewer-frame { position: relative; max-width: 100%; max-height: 100%; }
.photo-viewer .photo-viewer-close {
  position: absolute; top: 0; right: 0; width: 48px; height: 48px; min-height: 48px; margin: 0;
  padding: 0; border: 2px solid white; border-radius: 0 0 0 8px;
  background: #183f45; color: white; font: 700 32px/1 system-ui; cursor: pointer;
}
.photo-viewer-close:focus-visible { outline: 3px solid #ffda72; outline-offset: -5px; }
.photo-viewer-image { cursor: pointer; }
.photo-viewer .photo-viewer-image img {
  display: block; width: auto; height: auto; max-width: 100%;
  max-height: calc(100vh - var(--viewer-top) - var(--viewer-bottom));
  max-height: calc(100dvh - var(--viewer-top) - var(--viewer-bottom));
  object-fit: contain; border-radius: 0;
}
@media print { .photo-viewer { display: none !important; } }
/* No animation: opening and closing also respect reduced-motion preferences. */
