.photo-viewer-link {
  display: grid;
  place-items: center;
  position: relative;
  border-radius: inherit;
  cursor: zoom-in;
  touch-action: manipulation;
}
.photo-viewer-link:focus-visible { outline: 3px solid #d5f3ad; outline-offset: -4px; }
.photo-viewer-link__label {
  position: absolute;
  inset: auto 8px 8px auto;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 5px 11px;
  color: #fff;
  background: #10291feb;
  border: 1px solid #cfecda94;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 750;
  line-height: 1.15;
}
.photo-viewer-link:hover .photo-viewer-link__label,
.photo-viewer-link:focus-visible .photo-viewer-link__label { color: #183728; background: #d5f3ad; }
.photo-viewer svg, .photo-viewer-link svg { flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

body:has(.photo-viewer[open]) { overflow: hidden; }
.photo-viewer {
  inset: 0;
  inline-size: min(calc(100vw - 32px), 1280px);
  block-size: min(calc(100vh - 32px), 1000px);
  block-size: min(calc(100dvh - 32px), 1000px);
  max-inline-size: 100%;
  max-block-size: 100%;
  padding: 0;
  border: 1px solid #536e60;
  border-radius: 16px;
  background: #11291f;
  color: #eef7ee;
  overflow: hidden;
}
.photo-viewer::backdrop { background: #07160fe6; }
.photo-viewer [hidden] { display: none; }
.photo-viewer__frame {
  display: grid;
  grid-template-rows: auto minmax(120px, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  block-size: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}
.photo-viewer__top, .photo-viewer__bottom { padding: 10px clamp(10px, 2.4vw, 22px); }
.photo-viewer__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.photo-viewer__top h2 { margin: 0; color: inherit; font-size: clamp(1.05rem,3vw,1.5rem); overflow-wrap: anywhere; }
.photo-viewer__stage {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-inline-size: 0;
  background: #081911;
  overflow: hidden;
  cursor: zoom-in;
  touch-action: none;
  user-select: none;
}
.photo-viewer__stage[data-pannable] { cursor: grab; }
.photo-viewer__stage[data-dragging] { cursor: grabbing; }
.photo-viewer__stage p { max-inline-size: 32ch; margin: 8px; text-align: center; }
.photo-viewer__image {
  position: absolute;
  top: 50%;
  left: 50%;
  inline-size: var(--photo-width, 0px);
  block-size: var(--photo-height, 0px);
  max-inline-size: none;
  object-fit: contain;
  transform: translate(-50%, -50%) translate(var(--photo-x, 0px), var(--photo-y, 0px)) scale(var(--photo-scale, 1));
  pointer-events: none;
}
.photo-viewer__bottom { display: grid; gap: 8px; }
.photo-viewer__actions, .photo-viewer__zoom, .photo-viewer__sequence { display: flex; gap: 6px; align-items: center; }
.photo-viewer__actions { flex-wrap: wrap; justify-content: center; }
.photo-viewer__zoom output, .photo-viewer__sequence span { min-inline-size: 52px; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.photo-viewer__button {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  min-inline-size: 44px;
  min-block-size: 44px;
  padding: 6px;
  color: #f0f8ee;
  background: #204534;
  border: 1px solid #607c6f;
  border-radius: 9px;
  cursor: pointer;
  touch-action: manipulation;
}
.photo-viewer__button:hover { color: #142b1e; background: #d5f3ad; }
.photo-viewer__button[aria-disabled="true"] { opacity: .58; cursor: default; }
.photo-viewer__button[aria-disabled="true"]:hover { color: #f0f8ee; background: #204534; }
.photo-viewer :focus-visible { outline: 3px solid #d5f3ad; outline-offset: -3px; }
.photo-viewer__credit { justify-self: center; max-inline-size: 85ch; text-align: center; overflow-wrap: anywhere; font-size: .875rem; }
.photo-viewer__credit a, .photo-viewer__stage p a { color: #d5f3ad; text-decoration: underline; }

@media (max-width: 450px) {
  .photo-viewer { inline-size: 100%; block-size: 100vh; block-size: 100dvh; border: 0; border-radius: 0; }
  .photo-viewer__top { padding-top: max(8px, env(safe-area-inset-top)); }
  .photo-viewer__bottom { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}
