/* ============================================================
   GALLERY LIGHTBOX  — lightbox.css v1
   Full-screen image gallery with prev/next navigation,
   dot indicators, image counter, and loading state.
   ============================================================ */

/* Overlay */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.gallery-lightbox.open {
  opacity: 1;
  visibility: visible;
}

/* Close button */
.gallery-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, transform .2s;
  z-index: 10;
}
.gallery-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

/* Image container */
.gallery-img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 82vh;
}

.gallery-img {
  max-width: 90vw;
  max-height: 82vh;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  object-fit: contain;
  transition: opacity .2s ease;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: pan-y; /* allow vertical scroll, JS handles horizontal swipe */
}
.gallery-img.loading {
  opacity: 0.3;
}

/* Loading spinner (inside lightbox) */
.gallery-spinner {
  position: absolute;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: gallerySpin 0.7s linear infinite;
  pointer-events: none;
  z-index: 5;
}
.gallery-spinner.hidden {
  display: none;
}
@keyframes gallerySpin {
  to { transform: rotate(360deg); }
}

/* Navigation Arrows */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, transform .2s;
  z-index: 10;
  opacity: 0;
}
@media (hover: hover) {
  .gallery-lightbox:hover .gallery-nav,
  .gallery-nav:focus-visible {
    opacity: 1;
  }
}
/* Touch devices: always show nav arrows */
@media (hover: none) {
  .gallery-nav { opacity: 0.7; }
}
.gallery-nav:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-50%) scale(1.08);
}
.gallery-nav:active {
  transform: translateY(-50%) scale(0.95);
}
.gallery-prev {
  left: 16px;
}
.gallery-next {
  right: 16px;
}
.gallery-nav svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
}

/* Hide arrows if only 1 image */
.gallery-lightbox[data-count="1"] .gallery-nav,
.gallery-lightbox[data-count="0"] .gallery-nav {
  display: none;
}

/* Image counter  "2 / 5" */
.gallery-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
  padding: 5px 16px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  pointer-events: none;
  z-index: 10;
  backdrop-filter: blur(4px);
}

/* Dot indicators */
.gallery-dots {
  position: absolute;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
  pointer-events: none;
}
.gallery-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transition: background .2s, transform .2s;
}
.gallery-dot.active {
  background: #fff;
  transform: scale(1.25);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

/* Hide dots if only 1 image */
.gallery-lightbox[data-count="1"] .gallery-dots,
.gallery-lightbox[data-count="0"] .gallery-dots,
.gallery-lightbox[data-count="1"] .gallery-counter,
.gallery-lightbox[data-count="0"] .gallery-counter {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .gallery-nav {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  .gallery-prev { left: 8px; }
  .gallery-next { right: 8px; }
  .gallery-close { top: 10px; right: 12px; width: 38px; height: 38px; }
  .gallery-img {
    max-width: 96vw;
    max-height: 75vh;
    border-radius: 8px;
  }
  .gallery-lightbox:hover .gallery-nav {
    opacity: 1;
  }
  .gallery-nav { opacity: 0.7; }
}
