/* =====================================================================
   CE Widget — Widget « Slider bannières responsive »
   Mise en page 100 % CSS : la 1re bannière s'affiche sans JS, sa hauteur
   est réservée par width/height des <source>/<img> (CLS nul).
   Animation : transform (glissement) ou opacity (fondu) uniquement.
   Les classes cew-bs-fx-*, cew-bs-arrows-*, cew-bs-dots-*, cew-bs-dotpos-*
   sont posées par CE sur le wrapper du widget (prefix_class).
   Valeurs par défaut = maquette Doze.
   ===================================================================== */

.cew-bs {
  --cew-bs-speed: 550ms;
  --cew-bs-ease: cubic-bezier(.2, .8, .2, 1);
  /* Flèches */
  --cew-bs-a-size: 44px;
  --cew-bs-a-icon: 16px;
  --cew-bs-a-bg: #fff;
  --cew-bs-a-color: #111;
  --cew-bs-a-bg-h: #b1d1ba;
  --cew-bs-a-color-h: #111;
  --cew-bs-a-bw: 2.5px;
  --cew-bs-a-bc: #111;
  --cew-bs-a-radius: 999px;
  --cew-bs-a-sx: 3px;
  --cew-bs-a-sy: 3px;
  --cew-bs-a-sc: #111;
  --cew-bs-a-gap: 8px;
  --cew-bs-a-x: 48px;
  --cew-bs-a-y: 14px;
  /* Points */
  --cew-bs-d-size: 12px;
  --cew-bs-d-active-w: 30px;
  --cew-bs-d-bar-w: 28px;
  --cew-bs-d-gap: 8px;
  --cew-bs-d-bg: #fff;
  --cew-bs-d-bg-a: #111;
  --cew-bs-d-bw: 2px;
  --cew-bs-d-bc: #111;
  --cew-bs-d-y: 16px;
  --cew-bs-d-x: 24px;

  position: relative;
}

/* ───────────────────────────── Piste / bannières ───────────────────── */

.cew-bs__viewport {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.cew-bs__track {
  display: flex;
  transform: translate3d(0, 0, 0);
  transition: transform var(--cew-bs-speed) var(--cew-bs-ease);
}

.cew-bs__slide {
  flex: 0 0 100%;
  min-width: 0;
}

.cew-bs__link,
.cew-bs__pic {
  display: block;
}

.cew-bs__link { -webkit-tap-highlight-color: transparent; }

/* Bannières ni actives ni voisines : image non rendue => non téléchargée.
   bslider.js ajoute .is-near aux voisines après le chargement de la page. */
.cew-bs__slide:not(.is-active):not(.is-near) .cew-bs__pic { display: none; }

.cew-bs__img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  -webkit-user-drag: none;
}

/* Glissement en cours (doigt) : la piste suit sans transition. */
.cew-bs.is-dragging .cew-bs__track { transition: none; }

/* Fondu : bannières superposées dans la même cellule de grille. */
.cew-bs-fx-fade .cew-bs__track {
  display: grid;
  transform: none !important;
  transition: none;
}
.cew-bs-fx-fade .cew-bs__slide {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--cew-bs-speed) var(--cew-bs-ease), visibility 0s linear var(--cew-bs-speed);
}
.cew-bs-fx-fade .cew-bs__slide.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
  transition: opacity var(--cew-bs-speed) var(--cew-bs-ease), visibility 0s;
}

/* ─────────────────────────────────── Flèches ───────────────────────── */

.cew-bs__arrows {
  position: absolute;
  z-index: 3;
  display: flex;
  gap: var(--cew-bs-a-gap);
  right: var(--cew-bs-a-x);
  bottom: var(--cew-bs-a-y);
}

.cew-bs-arrows-bl .cew-bs__arrows { right: auto; left: var(--cew-bs-a-x); }

.cew-bs-arrows-sides .cew-bs__arrows {
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--cew-bs-a-x);
  pointer-events: none;
}
.cew-bs-arrows-sides .cew-bs__arrow { pointer-events: auto; }

.cew-bs__arrow {
  display: inline-grid;
  place-items: center;
  width: var(--cew-bs-a-size);
  height: var(--cew-bs-a-size);
  margin: 0;
  padding: 0;
  border: var(--cew-bs-a-bw) solid var(--cew-bs-a-bc);
  border-radius: var(--cew-bs-a-radius);
  background: var(--cew-bs-a-bg);
  color: var(--cew-bs-a-color);
  box-shadow: var(--cew-bs-a-sx) var(--cew-bs-a-sy) 0 var(--cew-bs-a-sc);
  font-family: 'Archivo Black', inherit;
  font-size: var(--cew-bs-a-icon);
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.cew-bs__arrow svg { width: var(--cew-bs-a-icon); height: var(--cew-bs-a-icon); display: block; }
.cew-bs__arrow:hover,
.cew-bs__arrow:focus-visible {
  background: var(--cew-bs-a-bg-h);
  color: var(--cew-bs-a-color-h);
}
/* Effet « bouton pressé » : le bouton rejoint son ombre. */
.cew-bs__arrow:active {
  transform: translate(var(--cew-bs-a-sx), var(--cew-bs-a-sy));
  box-shadow: 0 0 0 var(--cew-bs-a-sc);
}
.cew-bs__arrow:focus-visible { outline: 2px solid var(--cew-bs-a-bc); outline-offset: 3px; }

/* ─────────────────────────────────── Points ────────────────────────── */

.cew-bs__dots {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: var(--cew-bs-d-y);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--cew-bs-d-gap);
  pointer-events: none;
}
.cew-bs-dotpos-left .cew-bs__dots { justify-content: flex-start; padding-left: var(--cew-bs-d-x); }
.cew-bs-dotpos-right .cew-bs__dots { justify-content: flex-end; padding-right: var(--cew-bs-d-x); }
.cew-bs-dotpos-below .cew-bs__dots { position: static; margin-top: var(--cew-bs-d-y); }

.cew-bs__dot {
  position: relative;
  flex: none;
  width: var(--cew-bs-d-size);
  height: var(--cew-bs-d-size);
  margin: 0;
  padding: 0;
  border: var(--cew-bs-d-bw) solid var(--cew-bs-d-bc);
  border-radius: 999px;
  background: var(--cew-bs-d-bg);
  box-sizing: border-box;
  cursor: pointer;
  pointer-events: auto;
  transition: width .3s ease, background-color .3s ease;
}
/* Zone de clic agrandie (cible tactile ≥ 24 px, critère PageSpeed). */
.cew-bs__dot::before {
  content: '';
  position: absolute;
  inset: -8px -3px;
}
.cew-bs__dot.is-active { background: var(--cew-bs-d-bg-a); }
.cew-bs-dots-pill .cew-bs__dot.is-active { width: var(--cew-bs-d-active-w); }
.cew-bs-dots-bar .cew-bs__dot {
  width: var(--cew-bs-d-bar-w);
  height: calc(var(--cew-bs-d-size) / 2);
  border-radius: 2px;
}
.cew-bs__dot:focus-visible { outline: 2px solid var(--cew-bs-d-bc); outline-offset: 3px; }

/* Une seule bannière : rien à piloter. */
.cew-bs.is-single .cew-bs__arrows,
.cew-bs.is-single .cew-bs__dots { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .cew-bs__track,
  .cew-bs-fx-fade .cew-bs__slide,
  .cew-bs__dot,
  .cew-bs__arrow { transition: none !important; }
}
