/* ==========================================================================
   Lightbox  (.pf-lightbox)
   A click-to-enlarge image viewer built on the native <dialog> element, so the
   focus trap, Escape-to-close, and inertness of the rest of the page come from
   the platform (dialog.showModal()) rather than hand-rolled JS. Driven by
   assets/lightbox.js. One <dialog> per page; the trigger buttons carry the src +
   caption. Colours are tokens → dark mode flips for free.
   ========================================================================== */

.pf-lightbox {
  /* Center in the viewport. The native modal centering relies on `margin: auto`, which
     the DS reset zeroes globally, so restore it here (with inset:0 so both axes center). */
  margin: auto;
  inset: 0;
  border: none;
  padding: var(--pf-space-3);
  max-width: min(92vw, 1100px);
  max-height: 92vh;
  background: var(--pf-surface);
  color: var(--pf-ink);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.5);
}
.pf-lightbox::backdrop {
  background: var(--pf-scrim);
}

.pf-lightbox__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--pf-space-2);
}
.pf-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  margin-inline: auto;
  background: var(--pf-surface-sunken);
}
.pf-lightbox__caption {
  font-family: var(--pf-font-body);
  font-size: var(--pf-text-small);
  line-height: 1.5;
  color: var(--pf-ink-secondary);
  text-align: center;
  max-width: var(--pf-measure);
  margin-inline: auto;
}
/* Empty caption: collapse it so there is no stray gap. */
.pf-lightbox__caption:empty { display: none; }

.pf-lightbox__close {
  position: absolute;
  top: var(--pf-space-1);
  right: var(--pf-space-1);
  width: 44px;                 /* WCAG 2.2 target size */
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--pf-ink);
  font-family: var(--pf-font-body);
  font-size: var(--pf-text-h3);
  line-height: 1;
  cursor: pointer;
}
.pf-lightbox__close:hover { color: var(--pf-ink); }
