/* Lightbox — the full-screen photograph viewer.
 *
 * Its own file because three different pages open one: the portfolio and the
 * client galleries through styles.css, and the studio through studio.css,
 * which is a separate stylesheet with a smaller set of tokens. The four
 * spacing and type tokens the studio does not define carry fallbacks here, so
 * this file stands up under either one rather than needing both to agree.
 *
 * Behaviour lives in /lightbox.js.
 */

/* -------------------------------------------------------------- lightbox */

.lb {
  border: 0; padding: 0; margin: auto;
  width: 100vw; height: 100svh;
  max-width: 100vw; max-height: 100svh;
  background: oklch(8% 0 0 / 0.96);
  color: var(--ink);
  overflow: hidden;
}
.lb::backdrop { background: oklch(8% 0 0 / 0.9); }
.lb figure {
  margin: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: clamp(0.75rem, 3vh, 2.5rem);
  gap: var(--s2, 0.5rem);
}
.lb .lb-img-wrap {
  flex: 1; min-height: 0; min-width: 0; width: 100%;
  display: flex; align-items: center; justify-content: center;
  /* Medium breathing room on every side, so a frame never touches the edge. */
  padding: clamp(0.5rem, 2.5vmin, 2rem);
}
/* The canvas: one box of the photograph's own shape, which is what gives
   max-height something definite to resolve against. The <img> then fills it
   and object-fit does the scaling — the arrangement the event viewer arrived
   at after a tall frame ran clean off the bottom of a phone screen. */
.lb .lb-frame {
  position: relative;
  max-width: 100%; max-height: 100%;
  min-width: 0; min-height: 0;
  overflow: hidden;
  background-color: var(--bg-raise);
  box-shadow: 0 10px 60px oklch(0% 0 0 / 0.6);
  touch-action: none;          /* pinch, pan and swipe are handled in script */
}
.lb .lb-frame.is-zoomed { cursor: grab; }
/* <picture> is an inline box with no definite height, so every max-height
   below it resolved against "auto" and did nothing. display: contents takes it
   out of the box tree so the img really is the child these rules assume. */
.lb picture { display: contents; }

.lb img {
  width: 100%; height: 100%;
  object-fit: contain; display: block;
  transform-origin: center center;
  background-size: cover; background-position: center;
  -webkit-user-select: none; user-select: none;
}
.lb figcaption {
  flex: none;
  display: flex; gap: var(--s3, 0.75rem); align-items: baseline;
  font-size: var(--t-fine, 0.8125rem); color: var(--ink-soft);
  max-width: var(--measure, 68ch); text-align: center;
}
.lb .lb-count { color: var(--ink-mute); white-space: nowrap; letter-spacing: 0.1em; }

.lb-btn {
  position: absolute;
  background: oklch(20% 0 0 / 0.75);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  width: 2.75rem; height: 2.75rem;
  font-size: 1.3rem; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.lb-btn:hover { border-color: var(--brass); color: var(--brass); }
.lb-close { top: clamp(0.5rem, 2vh, 1.5rem); right: clamp(0.5rem, 2vw, 1.5rem); }
.lb-prev { left: clamp(0.4rem, 2vw, 1.5rem); top: 50%; transform: translateY(-50%); }
.lb-next { right: clamp(0.4rem, 2vw, 1.5rem); top: 50%; transform: translateY(-50%); }
@media (max-width: 719px) {
  .lb-prev, .lb-next { top: auto; bottom: 4.5rem; transform: none; }
  /* At phone width the arrows sit over the picture rather than taking a
     column out of it, and a swipe is the real control anyway. */
  .lb .lb-img-wrap { padding: 0; }
}
/* Nothing scrolls behind a full-screen photograph. */
body.lb-locked { overflow: hidden; }
.lb { overscroll-behavior: contain; }
