/* ==========================================================================
   Galleries
   Built for a small, strong set rather than a large archive: images are shown
   big, in a masonry-ish column flow, with the frame doing none of the talking.
   ========================================================================== */

.photo-grid {
  columns: 3 20rem;
  column-gap: var(--sp-4);
}

@media (max-width: 46rem) {
  .photo-grid { columns: 1; }
}

.photo-item {
  break-inside: avoid;
  margin-bottom: var(--sp-4);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface-sunk);
  border: 1px solid var(--hairline);
  display: block;
  position: relative;
  cursor: zoom-in;
}

.photo-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 620ms var(--ease);
}

.photo-item:hover img { transform: scale(1.02); }

.photo-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: var(--sp-5) var(--sp-4) var(--sp-3);
  color: #fff;
  font-size: var(--step--1);
  font-weight: 600;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.photo-item:hover .photo-caption,
.photo-item:focus-visible .photo-caption { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .photo-item img { transition: none; }
  .photo-caption { opacity: 1; }
}

.gallery-empty { display: flex; flex-direction: column; justify-content: center; }
.gallery-empty h3 { margin: var(--sp-2) 0 var(--sp-3); }

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */
/* Scope the layout to [open]. A bare `display: grid` beats the UA stylesheet's
   `display: none` for a closed <dialog>, which leaves the dimmed backdrop
   covering the page from load. */
.lightbox:not([open]) { display: none; }

.lightbox[open] {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: rgba(0, 0, 0, 0.92);
  border: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

.lightbox::backdrop { background: rgba(0, 0, 0, 0.92); }

.lightbox img {
  max-width: 100%;
  max-height: 84vh;
  width: auto;
  border-radius: var(--r-md);
}

.lightbox-caption {
  margin-top: var(--sp-4);
  color: rgba(255, 255, 255, 0.82);
  font-size: var(--step--1);
  text-align: center;
  max-width: 60ch;
}

.lightbox-close {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }

.stock-links {
  margin-top: var(--sp-5);
  font-size: var(--step--1);
  color: var(--ink-muted);
}

.stock-links a { color: var(--sea); }
