/* Images that open full size say so with the cursor. */
.post-body img.is-zoomable {
  cursor: zoom-in;
}
.post-body img.is-zoomable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 10px;
}

/* The image over a dimmed page, as large as the screen allows. */
.img-zoom {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* The top strip stays clear so the image never sits under the close
     button. */
  padding: 68px 2vw 3vh;
  background: rgba(10, 16, 24, 0.86);
  cursor: zoom-out;
  outline: none;
  /* The browser's pinch would zoom the page, overlay and all; the image's own
     pinch handler zooms just the image instead. */
  touch-action: none;
  overscroll-behavior: contain;
  animation: img-zoom-in 140ms ease-out;
}

.img-zoom-img {
  transform-origin: 0 0;
  touch-action: none;
  will-change: transform;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

/* Solid, ringed and shadowed, so it shows over any part of any screenshot. */
.img-zoom-close,
.img-zoom-close:hover,
.img-zoom-close:focus {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 0;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  background: #10181f;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.img-zoom-close:hover { background: #24303b; }
.img-zoom-close svg { width: 18px; height: 18px; }

@keyframes img-zoom-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .img-zoom { animation: none; }
}

/* A drawn element shown full size: the copy keeps its own styles and is
   scaled up with zoom, so text and lines are drawn sharp at the new size
   rather than stretched. */
.img-zoom-el {
  width: min(1100px, 92vw);
  zoom: 1.35;
  cursor: auto;
  pointer-events: auto;
}
.img-zoom-el > [data-zoomable] {
  margin: 0 !important;
  cursor: auto;
}
@media (max-width: 40rem) {
  .img-zoom-el { zoom: 1; width: 96vw; }
}

/* Elements that open in the overlay say so with the cursor. */
[data-zoomable] { cursor: zoom-in; }
