/* ═══════════════════════════════════════════════════════
   GGGC — photos.css
   Styles for the photo gallery grid, hover overlays,
   image placeholders and lightbox.
   ═══════════════════════════════════════════════════════ */

/* ── PHOTO GRID ─────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

/* ── PHOTO CARD ─────────────────────────────────────── */
.photo-card {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--mist), var(--sky));
  border: 1.5px solid rgba(58,125,68,.15);
  transition: transform .28s cubic-bezier(.4,0,.2,1),
              box-shadow .28s cubic-bezier(.4,0,.2,1);
}
.photo-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 16px 48px rgba(26,51,32,.18);
  z-index: 2;
}

/* ── IMAGE ──────────────────────────────────────────── */
.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s cubic-bezier(.4,0,.2,1);
}
.photo-card:hover img {
  transform: scale(1.06);
}

/* Placeholder shown when image is missing */
.photo-card img[src=""],
.photo-card img:not([src]),
.photo-card img[src$=".jpg"]:not([complete]) {
  min-height: 100%;
}
/* Green placeholder background with slot number */
.photo-card::before {
  content: attr(data-slot);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Mono', monospace;
  font-size: .65rem;
  color: var(--leaf);
  letter-spacing: .1em;
  z-index: 0;
  pointer-events: none;
}

/* ── HOVER OVERLAY ──────────────────────────────────── */
.photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10,30,14,0.92) 0%,
    rgba(10,30,14,0.65) 55%,
    rgba(10,30,14,0.15) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.1rem;
  opacity: 0;
  transition: opacity .3s cubic-bezier(.4,0,.2,1);
}
.photo-card:hover .photo-overlay {
  opacity: 1;
}
.photo-overlay h3 {
  font-family: 'DM Serif Display', serif;
  font-size: .92rem;
  color: var(--white);
  line-height: 1.25;
  margin-bottom: .35rem;
}
.photo-overlay p {
  font-size: .72rem;
  color: rgba(255,255,255,.75);
  line-height: 1.55;
  margin-bottom: .5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.photo-zoom {
  font-family: 'Space Mono', monospace;
  font-size: .6rem;
  letter-spacing: .1em;
  color: var(--accent);
  text-transform: uppercase;
}

/* ── LIGHTBOX ───────────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,.92);
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn .25s ease;
}
.lightbox.open {
  display: flex;
}
.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.lightbox-content img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: .75rem;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  display: block;
}
.lightbox-caption {
  text-align: center;
  max-width: 640px;
}
.lightbox-caption h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  color: var(--white);
  margin-bottom: .35rem;
}
.lightbox-caption p {
  font-size: .85rem;
  color: rgba(255,255,255,.65);
  line-height: 1.65;
}

/* Close button */
.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: var(--white);
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
  z-index: 510;
}
.lightbox-close:hover { background: rgba(255,255,255,.25); }

/* Prev / Next arrows */
.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: var(--white);
  width: 48px; height: 48px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
  z-index: 510;
}
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(143,188,43,.35); }

/* ── STAGGERED GRID ENTRANCE ────────────────────────────────── */
/*
   When .photo-grid gets class .grid-visible (added by photos.js via
   IntersectionObserver), each card animates in sequentially.
   No extra markup needed — works alongside the existing .reveal system.
*/
.photo-card {
  opacity: 0;
  transform: translateY(28px) scale(0.97);
  /* NOTE: the existing hover transitions (transform, box-shadow) are
     preserved — we merge them here so nothing conflicts. */
  transition: opacity .5s cubic-bezier(.4,0,.2,1),
              transform .5s cubic-bezier(.4,0,.2,1),
              box-shadow .28s cubic-bezier(.4,0,.2,1);
}
.photo-grid.grid-visible .photo-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}
/* Per-card stagger delays (up to 20 slots; beyond that share the last) */
.photo-grid.grid-visible .photo-card:nth-child(1)      { transition-delay: .04s; }
.photo-grid.grid-visible .photo-card:nth-child(2)      { transition-delay: .08s; }
.photo-grid.grid-visible .photo-card:nth-child(3)      { transition-delay: .12s; }
.photo-grid.grid-visible .photo-card:nth-child(4)      { transition-delay: .16s; }
.photo-grid.grid-visible .photo-card:nth-child(5)      { transition-delay: .20s; }
.photo-grid.grid-visible .photo-card:nth-child(6)      { transition-delay: .24s; }
.photo-grid.grid-visible .photo-card:nth-child(7)      { transition-delay: .28s; }
.photo-grid.grid-visible .photo-card:nth-child(8)      { transition-delay: .32s; }
.photo-grid.grid-visible .photo-card:nth-child(9)      { transition-delay: .36s; }
.photo-grid.grid-visible .photo-card:nth-child(10)     { transition-delay: .40s; }
.photo-grid.grid-visible .photo-card:nth-child(11)     { transition-delay: .44s; }
.photo-grid.grid-visible .photo-card:nth-child(12)     { transition-delay: .48s; }
.photo-grid.grid-visible .photo-card:nth-child(13)     { transition-delay: .52s; }
.photo-grid.grid-visible .photo-card:nth-child(14)     { transition-delay: .56s; }
.photo-grid.grid-visible .photo-card:nth-child(15)     { transition-delay: .60s; }
.photo-grid.grid-visible .photo-card:nth-child(16)     { transition-delay: .64s; }
.photo-grid.grid-visible .photo-card:nth-child(17)     { transition-delay: .68s; }
.photo-grid.grid-visible .photo-card:nth-child(18)     { transition-delay: .72s; }
.photo-grid.grid-visible .photo-card:nth-child(19)     { transition-delay: .76s; }
.photo-grid.grid-visible .photo-card:nth-child(n+20)   { transition-delay: .80s; }

/* Preserve hover lift once cards are visible */
.photo-grid.grid-visible .photo-card:hover {
  transform: translateY(-4px) scale(1.02);
}

/* ── LAZY-LOAD FADE-IN ───────────────────────────────────────── */
/*
   Add loading="lazy" to every <img> inside .photo-card.
   photos.js listens for the 'load' event and adds .img-loaded,
   which fades the image in. The card's gradient placeholder stays
   visible underneath until the image is ready.
*/
.photo-card img {
  opacity: 0;
  transition: opacity .55s cubic-bezier(.4,0,.2,1),
              transform .4s cubic-bezier(.4,0,.2,1); /* existing zoom */
}
.photo-card img.img-loaded {
  opacity: 1;
}

/* ── RIPPLE ON CARD CLICK ────────────────────────────────────── */
/*
   .ripple spans are created by photos.js on mousedown.
   They expand from the exact click point. overflow:hidden on
   .photo-card already clips them so no extra wrapper is needed.
*/
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(143, 188, 43, 0.38); /* --lime at low opacity */
  width: 10px; height: 10px;
  transform: scale(0);
  animation: rippleExpand .58s cubic-bezier(.4,0,.2,1) forwards;
  pointer-events: none;
  z-index: 5;
}
@keyframes rippleExpand {
  to { transform: scale(40); opacity: 0; }
}

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 1100px) {
  .photo-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 800px) {
  .photo-grid { grid-template-columns: repeat(3, 1fr); gap: .75rem; }
}
@media (max-width: 560px) {
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .photo-overlay h3 { font-size: .82rem; }
  .lightbox-prev { left: .25rem; }
  .lightbox-next { right: .25rem; }
}

/* ── REDUCED MOTION — gallery overrides ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .photo-card,
  .photo-card img { transition-duration: .01ms !important; }
  .photo-card { opacity: 1; transform: none; }
  .photo-card img { opacity: 1; }
  .ripple { display: none; }
}
