:root{
  --brand: rgb(10, 99, 101);
  --bg: #f2f2f2;
  --thumb-w: 92px;
  --thumb-h: 68px;
  --thumb-gap: 8px;
}
html.gallery-lock,
body.gallery-lock {
  overflow: hidden !important;
  overscroll-behavior: none;
}
/* overlay plein écran */
.gallery-overlay{
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  overflow: hidden;
}

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

/* bouton fermeture */
.gallery-close{
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
  color: #111;
}

/* conteneur central */
.gallery-content{
  height: 100vh; /* ✅ */
  box-sizing: border-box;

  max-width: 1100px;
  margin: 0 auto;

  padding: 80px 16px 24px;

  display: flex;
  flex-direction: column;
  justify-content: center; /* ✅ centre verticalement */
  align-items: center;
}

/* ===== IMAGE PRINCIPALE + FLECHES ===== */

.gallery-stage{
  position: relative;
  width: 100%;
  display: grid;
  place-items: center;
}

.gallery-main{
  height: 525px;
  width: min(100%, 1100px);
  object-fit: cover;
  border-radius: 10px;
  max-height: calc(100vh - 220px);
  display: block;
   height: auto;
  opacity: 1;
  transition: opacity .45s ease;
    touch-action: pan-y; /* autorise scroll vertical, mais garde swipe horizontal */
  user-select: none;
  -webkit-user-drag: none;
}

.gallery-main.is-fading{
  opacity: 0;
}

/* flèches */

.gallery-arrow{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 0;
  background: var(--bg);
  color: #111;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 10;
}


/* position à 50px du bord écran */

.gallery-arrow--prev{
  left: calc(-180px);
}

.gallery-arrow--next{
  right: calc(-180px);
}

/* ===== BANDES ===== */

.gallery-band{
  width: 100%;
  height: 72px;
  display: grid;
  align-items: center;
}

.gallery-band--counter{
  justify-items: center;
}

.gallery-counter{
  font-size: 14px;
  color: #111;
}

/* ===== MINIATURES ===== */

.gallery-band--thumbs{
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
}

.thumb-viewport{
    overflow: hidden;
  height: 72px;
  width: calc(11 * var(--thumb-w) + 10 * var(--thumb-gap));
  max-width: 100%;
  margin: 0 auto;
}

.thumb-strip{
  display: flex;
  gap: var(--thumb-gap);
  align-items: center;
  transition: transform .25s ease;
  will-change: transform;
}

/* miniature */

.thumb{
  position: relative;
  width: var(--thumb-w);
  height: var(--thumb-h);
  border-radius: 4px;
  border: 2px solid var(--brand);
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  flex: 0 0 auto;
  padding: 0;
}

.thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* overlay sombre miniature inactive */

.thumb::after{
  content:"";
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.35);
  transition:opacity .2s ease;
}

.thumb:hover::after{
  opacity:.15;
}

.thumb.is-active::after{
  opacity:0;
}

.thumb.is-active{
  border-color: var(--brand);
}

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

@media (max-width: 640px){

  /* overlay : plus compact */
  .gallery-content{
    max-width: 100%;
    padding: 72px 12px 16px; /* moins haut */
  }

  /* image principale */
  .gallery-main{
    height: 320px;     /* adapte si tu veux */
    width: 100%;
    border-radius: 10px;
  }

  /* flèches : sur l'image (sinon ça déborde) */
  .gallery-arrow{
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,.45);
    color: #fff;
  }

  .gallery-arrow--prev{
    left: 10px;        /* ✅ plus de -180px */
  }

  .gallery-arrow--next{
    right: 10px;       /* ✅ plus de -180px */
  }

  /* bandes : un peu moins hautes */
  .gallery-band{
    height: 56px;
  }

  /* miniatures : on réduit la taille */
  :root{
    --thumb-w: 72px;
    --thumb-h: 54px;
    --thumb-gap: 8px;
  }

  /* viewport : on ne force plus 11 miniatures,
     on prend la largeur de l'écran */
  .thumb-viewport{
    width: 100%;
    max-width: 100%;
    height: 56px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;   /* optionnel mais super agréable */
  }

  .thumb-strip{
    transform: none !important;      /* on ne translate plus en mobile */
    width: max-content;              /* le strip prend la largeur de toutes les miniatures */
    scroll-snap-align: start;        /* optionnel */
  }

  .thumb{
    scroll-snap-align: start;        /* optionnel */
  }

  /* cacher la scrollbar (optionnel) */
  .thumb-viewport::-webkit-scrollbar{ display:none; }
  .thumb-viewport{ scrollbar-width: none; }
}
@media (min-width: 641px) and (max-width: 1500px){
  .gallery-content{
    padding-top: 110px;
  }
  /* flèches : sur l'image (sinon ça déborde) */
  .gallery-arrow{
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,.45);
    color: #fff;
  }
  .gallery-arrow--prev{ left: 20px; }
  .gallery-arrow--next{ right: 20px; }

  .thumb-viewport{
    width: 100%;
    max-width: 100%;
  }
}