/* Task 19.1: full screen screenshot viewer. A wrapped screenshot gets a
   zoom-in cursor and an expand icon on hover/focus; the dialog shows the
   largest file with its alt text as the caption. Colours, radii, spacing and
   motion come from the token sheets (base.css; --ds-* tokens with a plain
   fallback because tokens.css is not loaded on public pages). */

/* The wrapped screenshot: keyboard-focusable via the script, zoom cursor. */
.shot-zoomable { position: relative; display: block; }
.shot-zoomable img { cursor: zoom-in; }
.shot-zoomable__icon {
  position: absolute; top: var(--space-sm); right: var(--space-sm);
  display: grid; place-items: center;
  width: var(--control-sm); height: var(--control-sm);
  border-radius: var(--radius-pill);
  background: rgba(20, 19, 15, .72); color: var(--ivory);
  opacity: 0; pointer-events: none;
  transition: opacity var(--ds-motion-duration-short, .15s) var(--ease);
}
.shot-zoomable__icon svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.shot-zoomable:hover .shot-zoomable__icon,
.shot-zoomable:focus-within .shot-zoomable__icon { opacity: 1; }

/* The viewer fills the screen; the page behind it does not scroll. */
html.shot-zoom-lock { overflow: hidden; }
dialog.shot-zoom {
  position: fixed; inset: 0;
  width: 100%; height: 100dvh; max-width: none; max-height: none;
  padding: 0; border: 0; background: transparent;
  color: var(--ivory);
  overscroll-behavior: contain;
}
dialog.shot-zoom::backdrop { background: rgba(14, 13, 11, .93); }
.shot-zoom__stage {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: var(--space-2xl) var(--space-xl);
  touch-action: none;
  overscroll-behavior: contain;
  overflow: hidden;
}
.shot-zoom__stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: var(--radius-md); }
.shot-zoom figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  margin: 0; padding: var(--space-md) var(--space-2xl) calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
  font: 400 var(--step--1)/1.4 var(--sans); text-align: center; text-wrap: pretty;
  color: var(--ivory-2);
}
.shot-zoom__close,
.shot-zoom__nav {
  display: grid; place-items: center;
  min-height: var(--control-sm); min-width: var(--control-sm);
  border: 0; border-radius: var(--radius-pill);
  background: rgba(20, 19, 15, .72); color: var(--ivory);
  font: 600 var(--step--1)/1 var(--sans);
  cursor: pointer;
}
.shot-zoom__close:hover, .shot-zoom__nav:hover { background: rgba(20, 19, 15, .9); }
.shot-zoom__close { position: absolute; top: var(--space-sm); right: var(--space-sm); padding: 0 var(--space-lg); }
.shot-zoom__nav { position: absolute; top: 50%; transform: translateY(-50%); padding: 0; }
.shot-zoom__nav svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.shot-zoom__nav--prev { left: var(--space-sm); }
.shot-zoom__nav--next { right: var(--space-sm); }
/* The outline from base.css stays visible against the dark backdrop. */
.shot-zoom__close:focus-visible,
.shot-zoom__nav:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* The entrance zoom is motion, so it only runs when motion is welcome. */
@media (prefers-reduced-motion: no-preference) {
  .shot-zoom--in { animation: shot-zoom-in var(--ds-motion-duration-modal, .25s) var(--ease-out); }
  @keyframes shot-zoom-in { from { opacity: 0; transform: scale(.985); } }
}
