/* ════════════════════════════════════════════
   gallery.css — Parifiane Tours
   Import on every page that uses gallery.js
════════════════════════════════════════════ */

.pf-gallery {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-2);
  margin-bottom: 44px;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Main slide area ── */
.pf-gallery-main {
  position: relative;
  width: 100%;
  height: 400px;
  overflow: hidden;
  cursor: pointer;
}

/* ── Slides ──
   z-index is controlled ONLY by gallery.js, not here.
   JS sets:  active slide  → z-index 2  (on top, fades in)
             previous slide → z-index 1  (visible during fade-out)
             all others     → z-index 0  (hidden underneath)
   This is the fix for "wrong image on mobile" — without explicit
   z-index the last appended child paints on top regardless of opacity,
   so the last photo in the array always bleeds through on some browsers. */
.pf-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .42s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
  display: block;
  will-change: opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.pf-slide.active {
  opacity: 1;
  pointer-events: auto;
}

/* Bottom gradient */
.pf-gallery-main::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 90px;
  background: linear-gradient(to top, rgba(0,0,0,.52) 0%, transparent 100%);
  pointer-events: none;
  z-index: 3;   /* above slides (max z-index 2) */
}

/* ── Counter ── */
.pf-counter {
  position: absolute;
  top: 14px; left: 14px; z-index: 4;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  font-size: 11px; padding: 4px 10px; border-radius: 2px;
  font-family: 'Outfit', sans-serif;
  letter-spacing: .08em;
}

/* ── Caption ── */
.pf-caption {
  position: absolute;
  bottom: 14px; left: 16px; right: 16px; z-index: 4;
  font-size: 12px; color: rgba(255,255,255,.88);
  font-family: 'Outfit', sans-serif; font-weight: 300;
  letter-spacing: .03em;
  text-shadow: 0 1px 4px rgba(0,0,0,.7);
  line-height: 1.5;
  min-height: 18px;
}

/* ── Dots ── */
.pf-dots {
  position: absolute;
  bottom: 44px; left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; gap: 7px; align-items: center;
}
.pf-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.4);
  border: none; cursor: pointer; padding: 0;
  transition: background .2s, transform .2s;
  flex-shrink: 0;
}
.pf-dot.active { background: #fff; transform: scale(1.4); }

/* ── Nav arrows ── */
.pf-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%); z-index: 5;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.22);
  transition: background .2s, transform .2s, box-shadow .2s;
  font-size: 18px; color: #111; line-height: 1;
  font-family: system-ui, sans-serif;
}
.pf-nav:hover { background: #fff; transform: translateY(-50%) scale(1.1); box-shadow: 0 4px 20px rgba(0,0,0,.28); }
.pf-nav.prev { left: 12px; }
.pf-nav.next { right: 12px; }

/* ── Thumbnails ── */
.pf-thumbs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-md) transparent;
  -webkit-overflow-scrolling: touch;
}
.pf-thumbs::-webkit-scrollbar { height: 3px; }
.pf-thumbs::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 2px; }

.pf-thumb {
  flex-shrink: 0;
  width: 68px; height: 50px;
  border-radius: 3px; overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: .55;
  transition: opacity .2s, border-color .2s;
}
.pf-thumb:hover  { opacity: .82; }
.pf-thumb.active { border-color: var(--gold); opacity: 1; }
.pf-thumb img    { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ════════════════════════════════════════════
   LIGHTBOX
════════════════════════════════════════════ */
.pf-lightbox {
  position: fixed;
  inset: 0; z-index: 9999;
  background: rgba(0,0,0,.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .28s;
}
.pf-lightbox.open { opacity: 1; pointer-events: all; }

.pf-lb-inner {
  position: relative;
  max-width: min(1100px, 95vw);
  display: flex; flex-direction: column; align-items: center;
}
.pf-lb-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 3px;
  display: block;
  cursor: zoom-in;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  transform-origin: center center;
}
.pf-lb-img.zoomed { transform: scale(2); cursor: zoom-out; }

.pf-lb-caption {
  margin-top: 14px;
  font-size: 13px; color: rgba(255,255,255,.65);
  font-family: 'Outfit', sans-serif;
  text-align: center; letter-spacing: .04em;
  max-width: 600px;
}
.pf-lb-dots {
  display: flex; gap: 8px; margin-top: 14px; justify-content: center;
}
.pf-lb-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,.28);
  border: none; cursor: pointer; padding: 0;
  transition: background .2s, transform .2s;
}
.pf-lb-dot.active { background: #fff; transform: scale(1.3); }

.pf-lb-nav {
  position: fixed;
  top: 50%; transform: translateY(-50%); z-index: 10001;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff; font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .2s;
  font-family: system-ui, sans-serif;
}
.pf-lb-nav:hover { background: rgba(255,255,255,.22); transform: translateY(-50%) scale(1.1); }
.pf-lb-nav.prev { left: 18px; }
.pf-lb-nav.next { right: 18px; }

.pf-lb-close {
  position: fixed;
  top: 16px; right: 16px; z-index: 10001;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff; font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .2s;
  font-family: system-ui, sans-serif;
}
.pf-lb-close:hover { background: rgba(255,255,255,.25); transform: scale(1.1); }

.pf-lb-hint {
  position: fixed;
  bottom: 20px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: rgba(255,255,255,.32);
  font-family: 'Outfit', sans-serif;
  letter-spacing: .1em; text-transform: uppercase;
  white-space: nowrap; pointer-events: none;
}

/* ── Mobile ── */
@media (max-width: 640px) {
  .pf-gallery-main { height: 250px; }
  .pf-thumb { width: 54px; height: 38px; }
  .pf-lb-nav { width: 40px; height: 40px; font-size: 18px; }
  .pf-lb-nav.prev { left: 6px; }
  .pf-lb-nav.next { right: 6px; }
  .pf-lb-hint { display: none; }
}