/* Gallery page: a grid of photo thumbnails (whole photos, no cropping, in
   columns) and a full-screen viewer (js/gallery.js). */

.gallery-grid {
  columns: 2;
  column-gap: var(--space-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 700px) {
  .gallery-grid { columns: 3; column-gap: var(--space-md); }
}
@media (min-width: 1100px) {
  .gallery-grid { columns: 4; }
}
.gallery-grid__item {
  break-inside: avoid;
  margin-bottom: var(--space-sm);
}
@media (min-width: 700px) {
  .gallery-grid__item { margin-bottom: var(--space-md); }
}
.gallery-grid__link {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: var(--beige-deep);
}
.gallery-grid__link img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 400ms var(--ease-out), filter 400ms var(--ease-out);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .gallery-grid__link:hover img {
    transform: scale(1.04);
    filter: brightness(1.05);
  }
}
.gallery-grid__link:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 3px;
}

.gallery-cta .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}
.gallery-cta h2 {
  margin: 0;
}

/* --- Full-screen viewer -------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 18, 9, 0.94);
  touch-action: pan-y;
  opacity: 0;
  transition: opacity 200ms linear;
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }
.lightbox__figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 64px var(--space-sm) var(--space-sm);
}
.lightbox__img {
  display: block;
  max-width: min(100vw - 2 * var(--space-sm), 1600px);
  max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px);
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox__caption {
  margin-top: var(--space-xs);
  max-width: 60ch;
  color: var(--beige);
  font-size: var(--text-sm);
}
.lightbox__count {
  position: absolute;
  top: 18px;
  left: var(--space-md);
  color: var(--beige);
  font-size: var(--text-sm);
  font-weight: 700;
}
.lightbox__btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(244, 236, 217, 0.14);
  color: var(--beige);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.lightbox__btn:hover { background: rgba(244, 236, 217, 0.26); }
.lightbox__btn:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }
.lightbox__close { top: 8px; right: 8px; }
.lightbox__prev,
.lightbox__next { top: 50%; transform: translateY(-50%); }
.lightbox__prev { left: 8px; }
.lightbox__next { right: 8px; }
@media (max-width: 600px) {
  /* Phones: the arrows sit at the bottom, out of the photo's way; swiping works too. */
  .lightbox__prev,
  .lightbox__next { top: auto; bottom: 12px; transform: none; }
}
@media (max-width: 600px) {
  .lightbox__figure { padding-bottom: 72px; }
  .lightbox__img { max-height: calc(100dvh - 180px); }
}
