/* ===================================================
   Lightbox Gallery Styles
   Add these to your existing stylesheet.
   =================================================== */

/* --- Thumbnail grid changes (replaces <a> with <button>) --- */

.popup__gallery-item {
  position: relative;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  overflow: hidden;
  border-radius: 8px;
  line-height: 0;
}

.popup__gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.popup__gallery-item:hover img,
.popup__gallery-item:focus-visible img {
  transform: scale(1.05);
}

.popup__gallery-zoom {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.25s ease;
  color: #fff;
  pointer-events: none;
}

.popup__gallery-item:hover .popup__gallery-zoom,
.popup__gallery-item:focus-visible .popup__gallery-zoom {
  opacity: 1;
}

/* --- Lightbox overlay --- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lightbox-fade-in 0.2s ease;
}

@keyframes lightbox-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Close */
.lightbox__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Counter badge */
.lightbox__counter {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

/* Prev / Next arrows */
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox__nav--prev {
  left: 12px;
}

.lightbox__nav--next {
  right: 12px;
}

/* Image stage */
.lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 60px 72px 100px;
  box-sizing: border-box;
}

.lightbox__image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  cursor: zoom-in;
  transition: transform 0.3s ease;
  user-select: none;
}

.lightbox__image--zoomed {
  transform: scale(1.8);
  cursor: zoom-out;
}

/* Thumbnail strip */
.lightbox__thumbs {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  max-width: 90vw;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}

.lightbox__thumbs::-webkit-scrollbar {
  display: none;
}

.lightbox__thumb {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: none;
  opacity: 0.5;
  transition: opacity 0.2s, border-color 0.2s;
}

.lightbox__thumb:hover {
  opacity: 0.85;
}

.lightbox__thumb--active {
  opacity: 1;
  border-color: #fff;
}

.lightbox__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Mobile adjustments --- */

@media (max-width: 640px) {
  .lightbox__stage {
    padding: 56px 16px 90px;
  }

  .lightbox__nav {
    width: 36px;
    height: 36px;
  }

  .lightbox__nav--prev {
    left: 4px;
  }

  .lightbox__nav--next {
    right: 4px;
  }

  .lightbox__thumb {
    width: 40px;
    height: 40px;
  }
}