html.picture-open { overflow: hidden; }
a.opens-picture:has(img) { cursor: zoom-in; }
.picture-viewer:not([open]) { display: none; }
.picture-viewer[open] {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  z-index: 100;
  width: min(96vw, 1600px);
  height: min(94vh, 1200px);
  height: min(94dvh, 1200px);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid #55514e;
  border-radius: 6px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  color: #fbf8ee;
  background: #171719;
  box-shadow: 0 16px 80px #0007;
  text-align: left;
  font: 500 14px/1.35 system-ui, sans-serif;
}
.picture-viewer::backdrop { background: #0e0d0fe8; }
.picture-bar, .picture-foot { display: flex; align-items: center; gap: 7px; padding: 9px 12px; }
.picture-bar { border-bottom: 1px solid #3a3638; }
.picture-foot { justify-content: space-between; border-top: 1px solid #3a3638; gap: 18px; }
.picture-count { margin-right: auto; white-space: nowrap; color: #d8d3c8; font-variant-numeric: tabular-nums; }
.picture-bar button {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: .35em;
  min-height: 40px; min-width: 40px; margin: 0; padding: 5px 11px;
  color: #fffcf3; background: #292829; border: 1px solid #646064; border-radius: 3px;
  font: inherit; line-height: 1; cursor: pointer;
}
.picture-bar button:is(:hover, :focus-visible), .picture-save:focus-visible { outline: 2px solid #e9c6dc; outline-offset: 1px; }
.picture-bar button:disabled { opacity: .3; cursor: default; }
.picture-bar [data-zoom] { min-width: 79px; }
.picture-stage {
  overflow: auto; overscroll-behavior: contain; display: grid; place-items: center;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  min-width: 0; min-height: 0; margin: 0; padding: 0;
}
.picture-stage img {
  display: block; position: static; width: auto; height: auto; max-width: 100%; max-height: 100%;
  margin: 0; object-fit: contain; cursor: zoom-in;
}
.picture-zoomed .picture-stage { display: block; }
.picture-zoomed .picture-stage img { max-width: none; max-height: none; height: auto; margin: 0 auto; cursor: zoom-out; }
.picture-caption { min-width: 0; }
a.picture-save { display: inline-block; flex: none; padding: 6px 0; color: #f0d5e5; text-underline-offset: 3px; font: inherit; }
@media (max-width: 600px) {
  .picture-viewer[open] { width: 100vw; height: 100vh; height: 100dvh; border: 0; border-radius: 0; }
  .picture-bar, .picture-foot { gap: 5px; padding: 7px 9px; }
  .picture-bar button { min-height: 44px; min-width: 39px; padding: 5px 9px; }
  .picture-bar [data-zoom] { min-width: 69px; }
  .picture-foot { padding-bottom: max(10px, env(safe-area-inset-bottom)); font-size: 12px; }
  .picture-caption { max-height: 18dvh; overflow: auto; }
}
.picture-viewer [hidden] { display: none !important; }
.picture-save-hint { flex: none; color: #bcb8b4; font-size: .8em; }
@media (max-width: 480px) { .picture-save-hint { max-width: 7.2em; } }
