/* ============================================================
   AFEBAS — 03-overflow-fixes.css
   Anti "marge fantôme", anti overflow horizontal, Owl Carousel
   IMPORTANT : ce fichier regroupe TOUS les patches overflow.
   Ne pas modifier l'ordre des règles.
   ============================================================ */

/* ───────────────────────────────────────────────────────────
   1) Racine : verrou viewport
   ─────────────────────────────────────────────────────────── */
html,body{
  width:100%;
  max-width:100vw;
  min-width:0;
  margin:0; padding:0;
  overflow-x:clip;
}
@supports not (overflow-x:clip){
  html,body{ overflow-x:hidden !important; }
}

/* Si un script JS colle une width inline sur html/body */
html[style*="width"],body[style*="width"]{
  width:100% !important;
  max-width:100vw !important;
}

/* ───────────────────────────────────────────────────────────
   2) Wrappers WP / thème parent
   ─────────────────────────────────────────────────────────── */
#page,.site,.site-content,.content-area,.site-main,
#content,#primary,#content-wrapper,.wrap,.container,
.afb-container,.afb-content-area,.afb-layout,
.wp-site-blocks{
  width:100% !important;
  max-width:100vw !important;
  min-width:0 !important;
}

/* Pare-feu : si un script colle une width inline */
#page[style*="width"],.site[style*="width"],.site-content[style*="width"],
#content-wrapper[style*="width"],.wrap[style*="width"],.container[style*="width"],
.afb-container[style*="width"],.afb-content-area[style*="width"],.afb-layout[style*="width"]{
  width:100% !important;
  max-width:100vw !important;
}

/* Suppression centrages / largeurs fixes / positionnements latéraux */
body,#page,#content-wrapper,.site,.site-content,
.content-area,.site-main,.wrap,.container{
  margin-left:0 !important;
  margin-right:0 !important;
  left:auto !important;
  right:auto !important;
  float:none !important;
}
#page,#content-wrapper,.site,.site-content{
  left:auto !important; right:auto !important;
  transform:none !important;
}

/* ───────────────────────────────────────────────────────────
   3) Conteneurs internes AFEBAS : clip + min-width:0
   ─────────────────────────────────────────────────────────── */
#content-wrapper,
.afb-container,
.afb-content-area,
.afb-layout,
.afb-main,
.afb-sidebar,
.afb-static-content,
.afb-section,
.afb-section-head,
.af-section,
.af-card,
figure.wp-block-table,
.wp-block-table{
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  overflow-x:clip;
}
@supports not (overflow-x:clip){
  #content-wrapper,
  .afb-container,
  .afb-content-area,
  .afb-layout,
  .afb-main,
  .afb-sidebar,
  .afb-static-content,
  .afb-section,
  .afb-section-head,
  .af-section,
  .af-card,
  figure.wp-block-table,
  .wp-block-table{ overflow-x:hidden !important; }
}

/* ───────────────────────────────────────────────────────────
   4) Gutenberg alignfull / alignwide
   ─────────────────────────────────────────────────────────── */
.alignfull,
.wp-block[data-align="full"],
.wp-site-blocks > .alignfull{
  width:100% !important;
  max-width:100% !important;
  margin-left:0 !important;
  margin-right:0 !important;
}
.alignwide,
.wp-block[data-align="wide"]{ max-width:100% !important; }

/* Inline style "100vw" (plugins/builders) */
*[style*="100vw"]{ width:100% !important; max-width:100% !important; }

/* ───────────────────────────────────────────────────────────
   5) OWL CAROUSEL / SlideAnything
   ─────────────────────────────────────────────────────────── */
.owl-carousel,
.sa-owl-carousel,
#sample_slider{
  width:100% !important;
  max-width:100% !important;
  overflow:hidden !important;
  contain:layout paint !important;
}

.owl-carousel .owl-stage-outer,
.sa-owl-carousel .owl-stage-outer,
#sample_slider .owl-stage-outer{
  width:100% !important;
  max-width:100% !important;
  overflow:hidden !important;
  touch-action:pan-y;
  overflow-x:clip;
}
@supports not (overflow-x:clip){
  .owl-carousel .owl-stage-outer,
  .sa-owl-carousel .owl-stage-outer,
  #sample_slider .owl-stage-outer{ overflow-x:hidden !important; }
}

/* Stage : display:block (flex cassait la largeur sur desktop) */
.owl-carousel .owl-stage,
.sa-owl-carousel .owl-stage,
#sample_slider .owl-stage{
  display:block !important;
  position:relative !important;
  left:0 !important;
  max-width:none !important;
}

.owl-carousel .owl-item,
.sa-owl-carousel .owl-item,
#sample_slider .owl-item{
  float:left !important;
  max-width:100% !important;
}
.owl-carousel .owl-item img{ width:100% !important; height:auto !important; }

/* ───────────────────────────────────────────────────────────
   6) Embeds / iframes
   ─────────────────────────────────────────────────────────── */
iframe,embed,object,video{ max-width:100% !important; }
.wp-block-embed,.wp-block-embed__wrapper{
  max-width:100% !important; overflow:hidden !important;
}

/* ───────────────────────────────────────────────────────────
   7) Sécurité : largeurs inline délirantes posées par JS
   ─────────────────────────────────────────────────────────── */
[style*="width: 2"],[style*="width:2"],
[style*="width: 3"],[style*="width:3"]{
  max-width:100% !important;
}

/* ───────────────────────────────────────────────────────────
   8) overflow-x sur wrappers Gutenberg / contenu
   ─────────────────────────────────────────────────────────── */
.wp-block-group,
.wp-block-columns,
.entry-content,
.site-content{
  overflow-x:clip;
}
@supports not (overflow-x:clip){
  .wp-block-group,
  .wp-block-columns,
  .entry-content,
  .site-content{ overflow-x:hidden !important; }
}

/* ───────────────────────────────────────────────────────────
   9) MOBILE uniquement (≤ 820px)
   ─────────────────────────────────────────────────────────── */
@media (max-width:820px){

  html,body{
    width:100% !important;
    max-width:100% !important;
    overflow-x:hidden !important;
    position:relative !important;
  }

  /* Wrappers racine en 100vw */
  #page,.site,.site-content,#content-wrapper,.wp-site-blocks{
    width:100vw !important;
    max-width:100vw !important;
    min-width:100vw !important;
    margin-left:0 !important; margin-right:0 !important;
    display:block !important; float:none !important;
  }

  /* Contenu interne : 100% */
  .content-area,.site-main,.entry-content,.post-content,
  .afb-container,.afb-content-area,.afebas-page-content{
    max-width:none !important;
    width:100% !important;
    min-width:0 !important;
  }

  /* Padding mobile AFEBAS */
  .afb-container{
    padding-left:12px !important;
    padding-right:12px !important;
  }

  /* Blocs */
  .afb-section,.af-section,.af-card,.afb-article{
    width:100% !important; max-width:none !important;
  }

  section.afb-section,.afb-static-content,.entry-content,figure.wp-block-table{
    max-width:100% !important; overflow-x:clip !important;
  }

  /* Gutenberg */
  .alignfull,.wp-block[data-align="full"],
  .alignwide,.wp-block[data-align="wide"]{
    width:100% !important; max-width:100% !important;
    margin-left:0 !important; margin-right:0 !important;
  }

  /* Owl */
  .owl-carousel,.sa-owl-carousel,#sample_slider{
    max-width:100% !important; width:100% !important; overflow:hidden !important;
  }
  .owl-carousel .owl-stage-outer,
  .sa-owl-carousel .owl-stage-outer,
  #sample_slider .owl-stage-outer{
    width:100% !important; max-width:100% !important; overflow:hidden !important;
  }
  .owl-carousel .owl-stage,
  .sa-owl-carousel .owl-stage,
  #sample_slider .owl-stage{
    display:block !important; max-width:none !important;
  }
  .owl-carousel .owl-item{ float:left !important; }
  .owl-carousel .owl-item img{ width:100% !important; height:auto !important; }

  /* Embeds */
  iframe,embed,object,video{ max-width:100% !important; }
  .wp-block-embed,.wp-block-embed__wrapper{
    max-width:100% !important; overflow:hidden !important;
  }
}
