.gallery-image { display: block; border-radius: 10px; cursor: zoom-in; }
.gallery-image:focus-visible { outline: 3px solid #286648; outline-offset: 3px; }

.photo-dialog {
  box-sizing: border-box;
  width: min(96vw, 1440px);
  height: 92vh;
  height: 92dvh;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  padding: 12px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: #192f26;
}
.photo-dialog:not([open]), .photo-dialog [hidden] { display: none; }
.photo-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.photo-dialog::backdrop { background: rgb(12 21 18 / 82%); }
html:has(.photo-dialog[open]) { overflow: hidden; }
.photo-toolbar, .photo-navigation { display: flex; align-items: center; gap: 12px; }
.photo-toolbar [data-position] { margin-inline-end: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.photo-toolbar a { text-decoration: underline; text-underline-offset: 3px; padding-block: 10px; }
.photo-dialog button {
  min-width: 48px;
  min-height: 48px;
  border: 1px solid #cfdad2;
  border-radius: 8px;
  background: #fff;
  color: #192f26;
  cursor: pointer;
}
.studio .photo-dialog button { font-size: 1.4rem; }
.photo-navigation { justify-content: center; padding-top: 8px; }
.photo-stage { min-height: 0; }
.photo-dialog .photo-stage img {
  display: block; width: 100%; height: 100%; object-fit: contain;
  border: 0; border-radius: 0; padding: 0; aspect-ratio: auto;
}
@media (max-width: 680px) {
  .photo-dialog {
    width: 100%; height: 100vh; height: 100dvh; border-radius: 0;
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
             max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
}

/* Signed uploads are served to image elements within the current site. */
.signed-gallery-photo .photo-return { display: none; }
.signed-gallery-photo:target {
  position: fixed; inset: 0; z-index: 6000; background: #fff;
  display: grid; grid-template-rows: minmax(0, 1fr) auto;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}
.signed-gallery-photo:target img {
  width: 100%; height: 100%; object-fit: contain; border: 0; padding: 0;
}
.signed-gallery-photo:target .gallery-image { min-height: 0; cursor: default; }
.signed-gallery-photo:target .photo-return {
  display: grid; place-items: center; justify-self: center;
  min-width: 64px; min-height: 48px; text-decoration: underline;
}
