/* Gallery page — responsive photo grid + lightbox. Loaded only on /gallery. */

.gallery {
  padding-block: 56px 80px;
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 40px;
}

.gallery__item {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: zoom-in;
  background: var(--ink-100);
  aspect-ratio: 4 / 3;
  box-shadow: var(--shadow-sm);
}

.gallery__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.gallery__item:hover .gallery__img,
.gallery__item:focus-visible .gallery__img {
  transform: scale(1.05);
}

.gallery__item:focus-visible {
  outline: 3px solid var(--brand-600);
  outline-offset: 3px;
}

.gallery__empty {
  text-align: center;
  color: var(--ink-500);
  margin-top: 40px;
}

/* ── Lightbox ─────────────────────────────────────────────────── */
.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  inset: 0;
  padding: 24px;
  border: 0;
  background: transparent;
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgba(10, 19, 48, 0.9);
  backdrop-filter: blur(4px);
}

.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.lightbox__figure {
  margin: 0;
  max-width: min(1100px, 90vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox__img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.lightbox__caption {
  color: var(--surface);
  text-align: center;
  font-size: var(--fs-small);
  max-width: 60ch;
}

.lightbox__caption:empty {
  display: none;
}

.lightbox__btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-900);
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.lightbox__btn svg {
  width: 24px;
  height: 24px;
  fill: none;
}

.lightbox__btn:focus-visible {
  outline: 3px solid var(--brand-600);
  outline-offset: 3px;
}

.lightbox__btn--close {
  position: absolute;
  top: 16px;
  right: 16px;
}

@media (prefers-reduced-motion: reduce) {
  .gallery__img { transition: none; }
  .gallery__item:hover .gallery__img,
  .gallery__item:focus-visible .gallery__img { transform: none; }
}
