/* lightbox.css — the image viewer (lightbox.js). Loaded by every page that
   has paintings or photographs to open: home, series pages, offerings. */

/* The painting large on a translucent tint of the page ground — the page and
   its 10% painting still faintly visible behind. A large × top-right, ‹ › at
   the sides, caption and count beneath. Never cropped (C10). */
.is-zoomable { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: var(--u4) calc(var(--u4) * 1.6) var(--u2);
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: hidden;
}
.lightbox[open] {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--u2);
}
.lightbox::backdrop {
  background: color-mix(in srgb, var(--paper) 92%, transparent);
}
.has-lightbox { overflow: hidden; }   /* the page does not scroll behind it */

.lightbox__figure {
  grid-column: 2;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--u1);
  height: 100%;
  min-height: 0;
}
.lightbox__img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - var(--u4) * 2.6);
  max-height: calc(100dvh - var(--u4) * 2.6);
  transition: opacity 120ms ease;
}
.lightbox__img.is-changing { opacity: 0; }
.lightbox__cap {
  max-width: 80ch;
  text-align: center;
  font-size: var(--t-caption);
  line-height: 1.5;
  color: var(--ink-soft);
}
.lightbox__count {
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--track);
  margin-right: var(--u-half);
}

/* Controls: thin line glyphs, large targets, no ground. */
.lightbox__close,
.lightbox__nav {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  opacity: .72;
  transition: opacity var(--fade) ease;
}
.lightbox__close:hover,
.lightbox__nav:hover,
.lightbox__close:focus-visible,
.lightbox__nav:focus-visible { opacity: 1; }
.lightbox__close svg,
.lightbox__nav svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: square;
}
.lightbox__close {
  position: absolute;
  top: var(--u1);
  right: var(--u1);
  width: 64px;
  height: 64px;
}
.lightbox__close svg { width: 40px; height: 40px; }
.lightbox__nav { width: 56px; height: 96px; }
.lightbox__nav svg { width: 40px; height: 40px; }
.lightbox__nav--prev { grid-column: 1; }
.lightbox__nav--next { grid-column: 3; }

@media (max-width: 800px) {
  /* Phone: the image takes the width; ‹ › sit over its edges. */
  .lightbox { padding: calc(var(--u4) * 1.4) var(--u1) var(--u2); }
  .lightbox[open] { grid-template-columns: minmax(0, 1fr); }
  .lightbox__figure { grid-column: 1; }
  .lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 72px;
  }
  .lightbox__nav--prev { left: 0; }
  .lightbox__nav--next { right: 0; }
  .lightbox__nav svg { width: 30px; height: 30px; }
  .lightbox__close { top: var(--u-half); right: var(--u-half); }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox__img { transition: none; }
}
