html.photo-viewer-open { overflow: hidden; }
[data-photo-viewer] { cursor: zoom-in; }
.photo-viewer {
  box-sizing: border-box;
  --viewer-gutter: clamp(8px, 2vmin, 28px);
  --viewer-height: calc(100vh - 2 * var(--viewer-gutter));
  --viewer-width: calc(100vw - 2 * var(--viewer-gutter));
  --image-height: max(1px, calc(var(--viewer-height) - 58px));
  min-width: min(var(--viewer-width), 216px);
  width: var(--viewer-width);
  width: min(var(--viewer-width), calc(var(--image-height) * var(--photo-ratio, 1.777778) + 2px));
  max-width: var(--viewer-width);
  max-height: var(--viewer-height);
  margin: auto;
  padding: 0;
  overflow: auto;
  color: #181815;
  background: #fafaf6;
  border: 1px solid #d9d9ce;
  border-radius: 14px;
  box-shadow: 0 16px 60px #0006;
}
@supports (height: 100dvh) {
  .photo-viewer { --viewer-height: calc(100dvh - 2 * var(--viewer-gutter)); }
}
.photo-viewer::backdrop { background: rgb(15 15 12 / 76%); }
.photo-viewer-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; }
.photo-viewer-bar p { margin: 0; flex: 1 1 auto; min-width: 0; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-viewer-bar button {
  flex: 0 0 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid #ccccc2; border-radius: 8px; cursor: pointer;
  background: #fff; color: #181815; font: 28px/1 system-ui, sans-serif;
}
.photo-viewer-bar button:focus-visible { outline: 2px solid #222; outline-offset: 2px; }
.photo-viewer-controls { display: flex; flex: 0 0 auto; gap: 4px; }
.photo-viewer-controls button { flex-basis: 36px; width: 36px; font-size: 22px; }
.photo-viewer-controls button:disabled { cursor: default; opacity: .43; }
.photo-viewer-controls .photo-viewer-reset { flex-basis: 61px; width: 61px; font: 650 13px system-ui, sans-serif; }
.photo-viewer-stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--photo-ratio, 1.777778);
  max-height: var(--image-height);
  overflow: auto;
  scrollbar-width: none;
  overscroll-behavior: contain;
}
.photo-viewer-stage:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.photo-viewer-stage.is-zoomed { cursor: grab; }
.photo-viewer-stage.is-panning { cursor: grabbing; user-select: none; }
.photo-viewer-stage img { display: block; width: calc(100% * var(--photo-zoom, 1)); max-width: none; height: auto; user-select: none; }
.photo-viewer-stage:not(.is-zoomed) img { max-height: 100%; object-fit: contain; }

