#gallery {
  padding: 2rem;
  text-align: center;
  background-color: var(--accent-warm);
}

#gallery h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

.gallery-grid {
  column-count: 4;         /* Adjust for desktop; try 2 on tablet, 1 on mobile */
  column-gap: 1rem;
  padding: 0 1rem;
}

.gallery-grid img {
  width: 100%;
  display: block;
  margin-bottom: 1rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.gallery-grid img:hover {
  transform: scale(1.03);
}

@media (max-width: 900px) {
  .gallery-grid {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  .gallery-grid {
    column-count: 1;
  }
}

/* Lightbox base */
/* Overlay: darker + subtle blur so the page is still visible behind */
.lightbox {
  position: fixed; inset: 0;
  display: none; align-items: center; justify-content: center;
  background: rgba(10,10,12,.78);
  backdrop-filter: blur(3px) saturate(.9);
  z-index: 10000;
}
.lightbox.open { display: flex; }

/* Centered stage with tall image */
.lb-stage {
  position: relative;
  max-width: min(80vw, 1100px);
  max-height: 90vh;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
}

/* Make the image tall and contained, like your screenshot */
#lb-img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  user-select: none; -webkit-user-drag: none;
  transform: translate3d(0,0,0) scale(1);
  transition: transform .18s ease;
  cursor: zoom-in;
}

/* Zoomed state (drag-to-pan) */
.lightbox.zoomed #lb-img { cursor: grab; }
.lightbox.zoomed #lb-img:active { cursor: grabbing; }

/* Minimal, edge-hugging chevrons */
.lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  border: none; color: #fff;
  width: 40px; height: 40px; border-radius: 9999px;
  background: rgba(255,255,255,.12);
  display: grid; place-items: center;
  font-size: 28px; line-height: 1;
  backdrop-filter: blur(4px);
}
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
.lb-close {
  top: 14px; right: 14px; transform: none;
  font-size: 26px; width: 36px; height: 36px;
}

.lb-btn:hover { background: rgba(255,255,255,.2); cursor: pointer; }

/* Hide caption for the ultra-clean look */
.lb-caption { display: none; }

/* On very small screens, tuck arrows away */
@media (max-width: 520px) {
  .lb-prev, .lb-next { display: none; }
}

/* fly-in animation helpers */
.fly-overlay {
  position: fixed; inset: 0;
  background: rgba(10,10,12,.78);
  backdrop-filter: blur(3px) saturate(.9);
  opacity: 0; transition: opacity .25s ease;
  z-index: 9998;
}

.fly-clone {
  position: fixed; margin: 0; z-index: 9999;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  border-radius: 12px; overflow: hidden;
  will-change: top, left, width, height, transform, opacity;
  transition: top .28s cubic-bezier(.2,.7,.25,1),
              left .28s cubic-bezier(.2,.7,.25,1),
              width .28s cubic-bezier(.2,.7,.25,1),
              height .28s cubic-bezier(.2,.7,.25,1),
              opacity .2s ease;
  pointer-events: none; /* don’t block clicks */
}

/* Optional: fade the real lightbox in slightly */
.lightbox { opacity: 0; visibility: hidden; transition: opacity .18s ease; }
.lightbox.open { opacity: 1; visibility: visible; display: flex; }

/* fly-in/out pieces (keep if you already added) */
.fly-overlay {
  position: fixed; inset: 0;
  background: rgba(10,10,12,.78);
  backdrop-filter: blur(3px) saturate(.9);
  opacity: 0; transition: opacity .25s ease;
  z-index: 9998;
}
.fly-clone {
  position: fixed; margin: 0; z-index: 9999;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  border-radius: 12px; overflow: hidden;
  will-change: top, left, width, height, transform, opacity;
  transition: top .28s cubic-bezier(.2,.7,.25,1),
              left .28s cubic-bezier(.2,.7,.25,1),
              width .28s cubic-bezier(.2,.7,.25,1),
              height .28s cubic-bezier(.2,.7,.25,1),
              opacity .2s ease;
  pointer-events: none;
}

/* Lightbox fades (so it can crossfade with the clone) */
.lightbox { opacity: 0; visibility: hidden; transition: opacity .18s ease; }
.lightbox.open { opacity: 1; visibility: visible; display: flex; }

/* Respect user motion prefs */
@media (prefers-reduced-motion: reduce) {
  .fly-clone, .fly-overlay, .lightbox { transition: none !important; }
}
