/**
 * Labomaison Article Lightbox – PhotoSwipe v5
 * VERSION STABLE – IMAGE + THUMBNAILS EN BAS
 * =========================================================
 * Objectifs :
 * - Image centrée, jamais écrasée
 * - Bande de miniatures toujours visible
 * - Zéro overlap / zéro CLS
 * - Mobile & desktop
 */

/* =========================================================
   ROOT OVERLAY
   ========================================================= */

.pswp.lmal-pswp {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(10, 12, 20, 0.96);
  color: #f5f7fb;
}

/* =========================================================
     SCROLL WRAP – réserve l’espace pour les thumbs
     ========================================================= */

.pswp.lmal-pswp .pswp__scroll-wrap {
  box-sizing: border-box;
  padding-bottom: 120px;
  /* espace réservé aux thumbnails */
}

/* =========================================================
     SLIDES / IMAGES
     ========================================================= */

.pswp.lmal-pswp .pswp__item {
  width: 100%;
  height: 100%;
}

.pswp.lmal-pswp .pswp__zoom-wrap {
  width: 100%;
  height: 100%;
}

/* IMAGE : règle clé */
.pswp.lmal-pswp .pswp__img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 160px);
  /* laisse place aux thumbs */
  object-fit: contain;
  image-rendering: auto;
  height: auto;
  width: auto;
}

/* =========================================================
     TOP BAR
     ========================================================= */

.pswp.lmal-pswp .pswp__top-bar {
  height: 48px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to bottom,
      rgba(5, 6, 12, 0.9) 0%,
      rgba(5, 6, 12, 0.4) 70%,
      rgba(5, 6, 12, 0) 100%);
}

.pswp.lmal-pswp .pswp__counter {
  font-size: 14px;
  color: #c3c8d6;
}

/* =========================================================
     BUTTONS
     ========================================================= */

.pswp.lmal-pswp .pswp__button {
  width: 40px;
  height: 40px;
  margin: 4px;
  border-radius: 6px;
  background: none;
  border: 0;
  color: #e5e8f2;
  cursor: pointer;
}

.pswp.lmal-pswp .pswp__button:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* =========================================================
     ARROWS
     ========================================================= */

.pswp.lmal-pswp .pswp__button--arrow {
  position: absolute;
  top: 50%;
  width: 52px;
  height: 52px;
  margin-top: -26px;
  border-radius: 50%;
  background: rgba(7, 9, 15, 0.7);
}

.pswp.lmal-pswp .pswp__button--arrow--prev {
  left: 12px;
}

.pswp.lmal-pswp .pswp__button--arrow--next {
  right: 12px;
}

/* =========================================================
     CAPTION
     ========================================================= */

.pswp.lmal-pswp .pswp__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 120px;
  /* AU-DESSUS DES THUMBS */
  padding: 10px 16px;
  font-size: 14px;
  text-align: center;
  background: linear-gradient(to top,
      rgba(5, 6, 12, 0.8) 0%,
      rgba(5, 6, 12, 0) 100%);
}

.pswp.lmal-pswp .pswp__caption:empty {
  display: none;
}

/* =========================================================
     THUMBNAILS STRIP – LE POINT CLÉ
     ========================================================= */

.pswp.lmal-pswp .lmal-thumbs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;

  height: 120px;
  padding: 10px 16px;

  display: flex;
  align-items: center;
  /* pas de centrage forcé, on laisse le snap faire le travail */
  gap: 10px;

  background: rgba(8, 10, 18, 0.85);
  backdrop-filter: blur(6px);

  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  /* centering visuel via snap */
  touch-action: pan-x;

  scrollbar-width: none;
  z-index: 1000;
}

.pswp.lmal-pswp .lmal-thumbs.is-centered {
  justify-content: center;
}

.pswp.lmal-pswp .lmal-thumbs::-webkit-scrollbar {
  display: none;
}

/* petite bordure et ombre douce sur les thumbs */
.pswp.lmal-pswp .lmal-thumb {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

/* Thumbnails */
.pswp.lmal-pswp .lmal-thumb {
  width: 88px;
  height: 66px;
  flex: 0 0 auto;

  object-fit: cover;
  border-radius: 6px;

  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
  scroll-snap-align: center;
  /* centré via snap */
}

.pswp.lmal-pswp .lmal-thumb:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.pswp.lmal-pswp .lmal-thumb.is-active {
  opacity: 1;
  outline: 2px solid #ffffff;
}

/* Désactivation du bouton zoom pour stabilité layout */
.pswp.lmal-pswp .pswp__button--zoom {
  display: none !important;
}

/* =========================================================
     MOBILE
     ========================================================= */

@media (max-width: 600px) {
  .pswp.lmal-pswp .pswp__img {
    max-height: calc(100vh - 140px);
  }

  .pswp.lmal-pswp .lmal-thumbs {
    height: 96px;
    padding: 8px 12px;
    gap: 8px;
    mask-image: linear-gradient(to right, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
  }

  .pswp.lmal-pswp .lmal-thumb {
    width: 70px;
    height: 52px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  }

  .pswp.lmal-pswp .pswp__caption {
    bottom: 100px;
  }
}
