/* Anti-flash: cacher les galeries natives avant le JS */
html:not(.ft-gal-ready) .entry-content .wp-block-gallery,
html:not(.ft-gal-ready) .entry-content .blocks-gallery-grid,
html:not(.ft-gal-ready) .entry-content .gallery{
  visibility:hidden; height:0; margin:0; padding:0; overflow:hidden;
}
/* Masquage durable appliqué par JS */
.ft-hidden-original{ display:none !important; }

/* Grille virtuelle 6×90 centrée */
.ft-gallery-virtual{
  display:grid !important;
  grid-template-columns:repeat(6,90px) !important;
  gap:10px !important;
  justify-content:center !important;
  align-content:start !important;
  width:fit-content; max-width:100%;
  margin:0 auto;
}
.ft-gallery-virtual > figure{ width:90px; height:90px; overflow:hidden; margin:0; }
.ft-gallery-virtual img{ display:block; width:100%; height:100%; object-fit:cover; }

/* Pagination au-dessus, centrée */
.ft-gallery-pagination{
  display:flex; justify-content:center; gap:6px;
  width:fit-content; margin:12px auto 10px; line-height:1;
}
.ft-gallery-pagination .ft-pill{
  display:inline-block; padding:6px 10px; border:1px solid #000;
  border-radius:999px; text-decoration:none; color:#000; background:#fff;
}
.ft-gallery-pagination .ft-pill.is-active,
.ft-gallery-pagination .ft-pill[aria-current="page"],
.ft-gallery-pagination .ft-pill:not(.is-active):hover{ background:#000; color:#fff; }

@media (max-width:640px){
  .ft-gallery-virtual{ grid-template-columns:repeat(3,90px) !important; }
}

/* ===== FooBox : affichage propre, non déformé (overlay uniquement) ===== */
.foobox-overlay .foobox-content{
  display:flex; align-items:center; justify-content:center;
}
.foobox-overlay .foobox-content img{
  max-width:calc(100vw - 40px);
  max-height:calc(100vh - 80px);
  width:auto !important;
  height:auto !important;
  object-fit:contain !important;
}
/* S’assure que les flèches ne s’affichent QUE dans l’overlay */
.foobox-overlay .fbx-prev,
.foobox-overlay .fbx-next{ opacity:1; visibility:visible; }
