/* ============================================================
   gallery.css — responsive photo grid + placeholder tiles
   ============================================================ */

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

.gallery-item {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 0;
  padding: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--c-aqua-soft);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: block;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease);
}
.gallery-item:hover img,
.gallery-item:focus-visible img { transform: scale(1.06); }
.gallery-item:focus-visible {
  outline: 3px solid var(--c-aqua);
  outline-offset: 3px;
}

/* Placeholder tile shown when the image is missing/fails to load */
.gallery-item.is-placeholder {
  display: grid;
  place-items: center;
  color: var(--c-ocean);
  background:
    repeating-linear-gradient(
      45deg,
      var(--c-aqua-soft),
      var(--c-aqua-soft) 12px,
      #cdeff3 12px,
      #cdeff3 24px
    );
}
.gallery-item.is-placeholder::after {
  content: "🐟";
  font-size: 2rem;
  opacity: 0.55;
}

/* ============================================================
   Lightbox — full-screen viewer opened from a grid tile
   ============================================================ */
body.has-lightbox { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}
.lightbox[hidden] { display: none; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 58, 70, 0.9);
  backdrop-filter: blur(2px);
  animation: lb-fade var(--dur) var(--ease);
}

.lightbox-stage {
  position: relative;
  z-index: 1;
  width: min(96vw, 1100px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
}

.lightbox-figure {
  margin: 0;
  min-width: 0;
  text-align: center;
  animation: lb-pop var(--dur) var(--ease);
}
.lightbox-img {
  display: block;
  margin-inline: auto;
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  background: var(--c-deep);
}
.lightbox-caption {
  margin-top: 0.9rem;
  color: var(--c-white);
  font-size: var(--fs-sm);
  opacity: 0.9;
}

.lightbox-btn {
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
  color: var(--c-white);
  background: rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-pill);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.lightbox-btn:hover { background: rgba(255, 255, 255, 0.28); }
.lightbox-btn:focus-visible {
  outline: 3px solid var(--c-aqua);
  outline-offset: 2px;
}
.lightbox-prev,
.lightbox-next {
  width: 48px;
  height: 48px;
  font-size: 1.8rem;
  line-height: 1;
}
.lightbox-prev:hover { transform: translateX(-2px); }
.lightbox-next:hover { transform: translateX(2px); }

.lightbox-close {
  position: absolute;
  top: -3.4rem;
  right: 0;
  width: 44px;
  height: 44px;
  font-size: 1.8rem;
  line-height: 1;
}

@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lb-pop {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox-backdrop,
  .lightbox-figure { animation: none; }
  .lightbox-btn { transition: none; }
}

/* On phones: arrows overlay the image bottom corners, close top-right */
@media (max-width: 560px) {
  .lightbox-stage {
    grid-template-columns: 1fr;
    width: 94vw;
  }
  .lightbox-prev,
  .lightbox-next {
    position: absolute;
    bottom: 3.2rem;
    z-index: 2;
  }
  .lightbox-prev { left: 0.4rem; }
  .lightbox-next { right: 0.4rem; }
  .lightbox-close { top: -3rem; }
}
