/* ====================================================================
   THE LOCAL ROOT — Photo gallery + lightbox
   Used on tour pages (scuba, snorkeling, mainland). Scoped to .gallery
   and .glb so it never collides with the rest of the site.
   ==================================================================== */

/* --- Thumbnail grid -------------------------------------------------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}
.gallery__item {
  position: relative;
  display: block;
  margin: 0; padding: 0; border: 0;
  cursor: pointer;
  overflow: hidden;
  border-radius: 10px;
  background: var(--sand);
  aspect-ratio: 1 / 1;
  box-shadow: 0 6px 18px rgba(31,61,46,0.08);
}
.gallery__item img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform 0.55s cubic-bezier(.2,.6,.25,1);
}
.gallery__item::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(31,61,46,0) 55%, rgba(31,61,46,0.28) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.gallery__item:hover img,
.gallery__item:focus-visible img { transform: scale(1.07); }
.gallery__item:hover::after,
.gallery__item:focus-visible::after { opacity: 1; }
.gallery__item:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }

@media (max-width: 900px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .gallery { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; } }

/* --- Lightbox -------------------------------------------------------- */
.glb {
  position: fixed; inset: 0;
  z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(22,36,28,0.93);
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.glb.is-open { opacity: 1; visibility: visible; }
.glb__figure {
  margin: 0;
  max-width: 92vw; max-height: 88vh;
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
}
.glb__img {
  max-width: 92vw; max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.45);
  background: rgba(255,255,255,0.04);
}
.glb__counter {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(250,247,242,0.75);
}
.glb__btn {
  position: absolute;
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  border: none; border-radius: 50%;
  background: rgba(250,247,242,0.12);
  color: var(--ivory);
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}
.glb__btn:hover { background: var(--coral); }
.glb__btn svg { width: 22px; height: 22px; }
.glb__close { top: 1.25rem; right: 1.25rem; }
.glb__nav { top: 50%; transform: translateY(-50%); }
.glb__prev { left: 1.25rem; }
.glb__next { right: 1.25rem; }
.glb__nav:hover { transform: translateY(-50%) scale(1.08); }

@media (max-width: 560px) {
  .glb__btn { width: 42px; height: 42px; }
  .glb__prev { left: 0.5rem; }
  .glb__next { right: 0.5rem; }
  .glb__close { top: 0.75rem; right: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery__item img, .glb, .glb__btn { transition: none; }
}
