/* ============================================================
   SP Theme — Lightbox Visionneuse (sp-lightbox.css)
   À inclure APRÈS woocommerce.css et main.css
   ============================================================ */

/* ──────────────────────────────────────────────────────────
   Galerie principale — améliorations responsive
   ────────────────────────────────────────────────────────── */

/* Image principale : ratio adaptatif selon la taille d'écran */
.gallery-main {
  aspect-ratio: 4 / 3;
  cursor: zoom-in;
  background: #f9fafb;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  /* Assure que l'image ne déborde jamais de l'écran */
  max-height: 72vw;           /* mobile : max 72 % de la largeur */
}

@media (min-width: 600px) {
  .gallery-main {
    max-height: 520px;         /* tablette / petit desktop */
  }
}

@media (min-width: 900px) {
  .gallery-main {
    /* Côte à côte avec le panneau achat : 360 px fixe + gap 2 rem */
    max-height: calc(100vw - 360px - 4rem);
    max-height: min(560px, calc(100vw - 440px));
  }
}

.gallery-main img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  transition: transform 0.4s ease;
  display: block;
}
.gallery-main:hover img {
  transform: scale(1.03);
}

/* ── Strip de miniatures ── */
.thumb-strip {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding-bottom: 0.15rem;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #e5e7eb transparent;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}
.thumb-strip::-webkit-scrollbar { height: 4px; }
.thumb-strip::-webkit-scrollbar-track { background: transparent; }
.thumb-strip::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

.thumb {
  cursor: pointer;
  opacity: 0.6;
  border: 2px solid transparent;
  border-radius: 9px;
  flex-shrink: 0;
  width: 70px;
  height: 54px;
  transition: border-color 0.2s, opacity 0.2s, transform 0.15s;
  overflow: hidden;
  scroll-snap-align: start;
}
@media (min-width: 900px) {
  .thumb { width: 80px; height: 62px; }
}
.thumb.active,
.thumb:hover {
  opacity: 1;
  border-color: #10b981;
  transform: translateY(-2px);
}
.thumb img {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

/* Bouton +N */
.thumb-more {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: #0f1923;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  border-radius: 9px;
  flex-shrink: 0;
  width: 70px;
  height: 54px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
@media (min-width: 900px) {
  .thumb-more { width: 80px; height: 62px; }
}
.thumb-more:hover {
  background: #10b981;
  border-color: #059669;
  transform: translateY(-2px);
}

/* Masquage responsive des miniatures */
@media (max-width: 768px) {
  .thumb-mob-hidden  { display: none !important; }
  .thumb-desktop-hidden { display: flex !important; }  /* visible sur mobile si pas mob-hidden */
}
@media (min-width: 769px) {
  .thumb-desktop-hidden { display: none !important; }
}


/* ──────────────────────────────────────────────────────────
   Lightbox / Visionneuse
   ────────────────────────────────────────────────────────── */

#sp-lb {
  display: none;            /* géré en JS */
  position: fixed;
  inset: 0;
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 0;               /* plein écran mobile */
}

/* Fond semi-transparent */
.sp-lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 18, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Boîte centrale */
.sp-lb-box {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;             /* plein écran mobile */
  max-width: 100%;
  background: #0f1923;
  overflow: hidden;
}

@media (min-width: 640px) {
  #sp-lb {
    padding: 1.5rem;
  }
  .sp-lb-box {
    border-radius: 18px;
    max-width: min(1100px, 94vw);
    max-height: 94vh;
    height: auto;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  }
}

/* Animation d'entrée */
#sp-lb { opacity: 0; transition: opacity 0.28s ease; }
#sp-lb.sp-lb-open { opacity: 1; }
.sp-lb-box { transform: scale(0.97); transition: transform 0.28s ease; }
#sp-lb.sp-lb-open .sp-lb-box { transform: scale(1); }

/* ── En-tête : compteur + bouton fermer ── */
.sp-lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  flex-shrink: 0;
  background: rgba(15, 25, 35, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sp-lb-counter {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.sp-lb-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.sp-lb-close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  transform: scale(1.1);
}
.sp-lb-close svg { width: 18px; height: 18px; }

/* ── Zone image principale ── */
.sp-lb-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #0a0e15;
  min-height: 0;           /* permet au flex de réduire */
}

.sp-lb-img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.sp-lb-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.25s;
}

/* ── Boutons de navigation ── */
.sp-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 25, 35, 0.7);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s, transform 0.2s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.sp-lb-nav:hover {
  background: #10b981;
  border-color: #059669;
  transform: translateY(-50%) scale(1.08);
}
.sp-lb-nav svg { width: 20px; height: 20px; }

.sp-lb-prev { left: 0.75rem; }
.sp-lb-next { right: 0.75rem; }

@media (min-width: 900px) {
  .sp-lb-nav { width: 52px; height: 52px; }
  .sp-lb-prev { left: 1.25rem; }
  .sp-lb-next { right: 1.25rem; }
}

/* ── Spinner de chargement ── */
.sp-lb-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sp-lb-spin-ring {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: #10b981;
  border-radius: 50%;
  animation: sp-spin 0.75s linear infinite;
}
@keyframes sp-spin {
  to { transform: rotate(360deg); }
}

/* ── Strip de miniatures dans la lightbox ── */
.sp-lb-strip-wrap {
  flex-shrink: 0;
  padding: 0.6rem 0.75rem;
  background: rgba(15, 25, 35, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.sp-lb-strip {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
  scroll-snap-type: x mandatory;
  padding-bottom: 2px;     /* espace pour la scrollbar thin */
}
.sp-lb-strip::-webkit-scrollbar { height: 3px; }
.sp-lb-strip::-webkit-scrollbar-track { background: transparent; }
.sp-lb-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.sp-lb-thumb {
  flex-shrink: 0;
  width: 56px;
  height: 44px;
  border-radius: 7px;
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, border-color 0.2s, transform 0.15s;
  background: #1a2535;
  scroll-snap-align: start;
  padding: 0;
}
@media (min-width: 640px) {
  .sp-lb-thumb { width: 68px; height: 52px; }
}
.sp-lb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sp-lb-thumb.active,
.sp-lb-thumb:hover {
  opacity: 1;
  border-color: #10b981;
  transform: translateY(-2px);
}
.sp-lb-thumb.active {
  border-color: #10b981;
}

/* ── Accessibilité : focus visible ── */
.sp-lb-nav:focus-visible,
.sp-lb-close:focus-visible,
.sp-lb-thumb:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}
