html:has(.work-image-viewer[open]) { overflow: hidden }

.work-image-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  overscroll-behavior: contain;
}
.work-image-viewer[open] {
  display: grid;
  grid-template-rows: auto 1fr;
}
.work-image-viewer form {
  justify-self: end;
  padding: max(.4rem, env(safe-area-inset-top)) max(var(--edge), env(safe-area-inset-right)) 0;
}
.work-image-viewer button {
  min-height: 44px;
  min-width: 44px;
  padding: .5rem;
  font: inherit;
  color: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .15em;
}
.work-image-viewer figure {
  place-self: center;
  width: min(100%, calc((100dvh - 8rem) * var(--image-ratio)));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}
.work-image-viewer figcaption {
  max-width: none;
  margin: .4rem 0 0;
  padding-inline: .5rem;
  font-size: .95rem;
  text-align: left;
}
