/*
 * Photo gallery: Swiper main slider + thumbnail rail + full-screen lightbox.
 * The block was born on single-attraction.php (which still carries its own copy
 * in single-attraction.css); single-post-day-trip.php loads this file to reuse
 * it under the featured image. Class names stay .attraction-* on purpose so the
 * markup and gallery.js are interchangeable between the two templates.
 */

/* ══════════════════════════════════════════════════
   GALLERY
   ══════════════════════════════════════════════════ */
.attraction-gallery-section {
  background: var(--p);
  padding-block: 0;
  padding-bottom: clamp(48px, 7vw, 88px);
}

.attraction-gallery {
  position: relative;
  width: 100%;
  background: var(--ink);
  border-radius: var(--r2);
  overflow: hidden;
}

/* Main/Hero Swiper */
.attraction-swiper-main {
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 600px;
}

.attraction-swiper-main .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
}

.attraction-swiper-main .swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--ink);
}

/* Thumbnail Swiper */
.attraction-swiper-thumbs {
  width: 100%;
  height: auto;
  padding: 0;
  margin: 0;
  background: var(--ink);
}

.attraction-swiper-thumbs .swiper-wrapper {
  display: flex;
  gap: 0;
}

.attraction-swiper-thumbs .swiper-slide {
  width: 20%;
  height: auto;
  aspect-ratio: 16/9;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--t);
  border: 0;
  margin: 0;
  background: var(--ink2);
}

.attraction-swiper-thumbs .swiper-slide:hover {
  opacity: 0.8;
}

.attraction-swiper-thumbs .swiper-slide-thumb-active {
  opacity: 1;
}

.attraction-swiper-thumbs .swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Mobile: full-width with cover */
@media (max-width: 1024px) {
  .attraction-gallery-section {
    padding-block: 0;
  }

  .attraction-gallery {
    border-radius: 0;
  }

  .attraction-swiper-main {
    aspect-ratio: 4/3;
  }

  .attraction-swiper-thumbs .swiper-slide {
    aspect-ratio: 4/3;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   GALLERY LIGHTBOX TRIGGER BUTTON
   ═══════════════════════════════════════════════════════════════════════ */
.attraction-swiper-main {
  position: relative;
}

.attraction-gallery-lightbox-btn {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  background: rgba(10, 9, 8, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  cursor: zoom-in;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.attraction-gallery-lightbox-btn:hover {
  background: var(--r);
  border-color: var(--r);
  transform: scale(1.08);
}

/* ═══════════════════════════════════════════════════════════════════════
   GALLERY LIGHTBOX OVERLAY
   ═══════════════════════════════════════════════════════════════════════ */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox[hidden] {
  display: none;
}

.gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 9, 8, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: zoom-out;
}

.gallery-lightbox__stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: min(90vw, 1200px);
  max-height: 90vh;
  padding: 0 4rem;
}

.gallery-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 3rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: lb-fade-in 0.2s ease forwards;
}

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

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.gallery-lightbox__counter {
  font-family: var(--cond);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.gallery-lightbox__close,
.gallery-lightbox__prev,
.gallery-lightbox__next {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.gallery-lightbox__close:hover,
.gallery-lightbox__prev:hover,
.gallery-lightbox__next:hover {
  background: var(--r);
  border-color: var(--r);
  transform: scale(1.08);
}

.gallery-lightbox__close {
  top: 1.25rem;
  right: 1.25rem;
}

.gallery-lightbox__prev {
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.gallery-lightbox__next {
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.gallery-lightbox__prev:hover,
.gallery-lightbox__next:hover {
  transform: translateY(-50%) scale(1.08);
}

@media (max-width: 640px) {
  .gallery-lightbox__stage {
    padding: 0 3rem;
  }

  .gallery-lightbox__prev {
    left: 0.25rem;
  }

  .gallery-lightbox__next {
    right: 0.25rem;
  }
}

/* Pre-init guard: thumbs rail shows 3/4/5-up before Swiper boots (main swiper
   uses the vendor default width:100%, which already matches slidesPerView 1). */
.attraction-swiper-thumbs:not(.swiper-initialized) .swiper-slide {
  width: 33.3333%;
}

@media (min-width: 640px) {
  .attraction-swiper-thumbs:not(.swiper-initialized) .swiper-slide {
    width: 25%;
  }
}

@media (min-width: 768px) {
  .attraction-swiper-thumbs:not(.swiper-initialized) .swiper-slide {
    width: 20%;
  }
}
