/* Lightbox — NOT FROM THE HANDOFF.
 *
 * Uses the design's own tokens so an enlarged image sits in the same visual
 * system as the page behind it: charcoal ground, --radius-core plate, the
 * spring easing the rest of the site animates with.
 */

.is-zoomable { cursor: zoom-in; }
.is-zoomable:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* Stop the page behind scrolling while the dialog is up. */
.lbox-open { overflow: hidden; }

.lbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: rgb(20 20 19 / 0.92);
  animation: lbox-in var(--dur-base) var(--ease-out);
}
.lbox[hidden] { display: none; }

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

.lbox__figure {
  margin: 0;
  grid-column: 2;
  display: grid;
  justify-items: center;
  gap: var(--space-sm);
  /* The figure is also a backdrop hit area, so it must fill its cell. */
  width: 100%;
  height: 100%;
  align-content: center;
}

.lbox__img {
  max-width: 100%;
  /* Leaves room for the caption without the image ever forcing a scroll. */
  max-height: calc(100vh - var(--space-lg) * 2 - 4rem);
  width: auto;
  height: auto;
  border-radius: var(--radius-core);
  box-shadow: var(--shadow-md);
  background: var(--color-surface);
}

.lbox__cap {
  color: rgb(255 255 255 / 0.85);
  font-size: var(--step--1);
  text-align: center;
  max-width: 60ch;
}
.lbox__cap[hidden] { display: none; }

.lbox__close,
.lbox__nav {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 0.10);
  color: var(--color-text-inv);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.lbox__close:hover,
.lbox__nav:hover { background: rgb(255 255 255 / 0.22); }
.lbox__close:focus-visible,
.lbox__nav:focus-visible {
  outline: 2px solid var(--color-text-inv);
  outline-offset: 2px;
}
.lbox__close svg,
.lbox__nav svg { width: 20px; height: 20px; }

.lbox__close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
}
.lbox__nav--prev { grid-column: 1; }
.lbox__nav--next { grid-column: 3; }
.lbox__nav[hidden] { visibility: hidden; display: grid; }

@media (max-width: 768px) {
  .lbox { padding: var(--space-sm); gap: var(--space-2xs); }
  .lbox__close,
  .lbox__nav { width: 40px; height: 40px; }
}
