/* Comparateur avant/après — remplace le widget Elfsight, sans dépendance ni abonnement.
   Valeurs calées sur le relevé du widget d'origine (_extraction/data/_widget_mesures.json). */

.rmb-aa {
  --rmb-aa-encre: #2D2727;
  --rmb-aa-etiquette-fond: #111111;
  --rmb-aa-etiquette-texte: #FFFFFF;
  --rmb-aa-poignee: #FFFFFF;
  --rmb-aa-ratio: 4 / 3;        /* zone image d'origine : 1280 × 960 */
  --rmb-aa-position: 50%;        /* position de la poignée, pilotée par le JS */

  max-width: 100%;
  font-family: "Wix Madefor Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* --- Carrousel --- */

.rmb-aa__piste {
  overflow: hidden;
}

.rmb-aa__rail {
  display: flex;
  transition: transform .45s cubic-bezier(.4, 0, .2, 1);
}

@media (prefers-reduced-motion: reduce) {
  .rmb-aa__rail { transition: none; }
}

.rmb-aa__slide {
  flex: 0 0 100%;
  min-width: 0;
}

/* --- Zone de comparaison --- */

.rmb-aa__cadre {
  position: relative;
  aspect-ratio: var(--rmb-aa-ratio);
  overflow: hidden;
  touch-action: pan-y;          /* le glissement horizontal nous revient, le scroll vertical reste au navigateur */
  user-select: none;
  cursor: ew-resize;
  background: #EEE;
}

.rmb-aa__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* l'image « avant » est découpée à la position de la poignée ; « après » reste en fond */
.rmb-aa__image--avant {
  clip-path: inset(0 calc(100% - var(--rmb-aa-position)) 0 0);
}

/* --- Étiquettes Avant / Après --- */

.rmb-aa__etiquette {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--rmb-aa-etiquette-fond);
  color: var(--rmb-aa-etiquette-texte);
  font-size: 18px;
  line-height: 1.5;
  pointer-events: none;
}

.rmb-aa__etiquette--avant { left: 12px; }
.rmb-aa__etiquette--apres { right: 12px; }

/* --- Poignée --- */

.rmb-aa__poignee {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--rmb-aa-position);
  z-index: 3;
  width: 29px;
  margin-left: -14.5px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: ew-resize;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* trait vertical */
.rmb-aa__poignee::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--rmb-aa-poignee);
  box-shadow: 0 0 4px rgba(0, 0, 0, .35);
}

/* les deux chevrons */
.rmb-aa__poignee svg {
  position: relative;
  z-index: 1;
  width: 29px;
  height: 20px;
  fill: var(--rmb-aa-poignee);
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, .45));
}

.rmb-aa__poignee:focus-visible {
  outline: 3px solid var(--rmb-aa-encre);
  outline-offset: 3px;
}

/* --- Pied : légende, compteur, navigation --- */

.rmb-aa__legende {
  margin: 16px 0 0;
  text-align: center;
  font-size: 20px;
  line-height: 1.38;
  color: var(--rmb-aa-encre);
}

.rmb-aa__barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.rmb-aa__compteur {
  font-size: 16px;
  color: var(--rmb-aa-etiquette-fond);
  font-variant-numeric: tabular-nums;
}

.rmb-aa__nav {
  display: flex;
  gap: 8px;
}

.rmb-aa__fleche {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--rmb-aa-encre);
  cursor: pointer;
  border-radius: 50%;
  transition: background-color .2s ease-in-out;
}

.rmb-aa__fleche:hover { background: rgba(45, 39, 39, .08); }
.rmb-aa__fleche:focus-visible { outline: 3px solid var(--rmb-aa-encre); outline-offset: 2px; }
.rmb-aa__fleche[disabled] { opacity: .3; cursor: default; }
.rmb-aa__fleche[disabled]:hover { background: transparent; }

.rmb-aa__fleche svg { width: 14px; height: 20px; fill: currentColor; }

/* --- Mobile --- */

@media (max-width: 834px) {
  .rmb-aa__etiquette { font-size: 15px; padding: 5px 8px; }
  .rmb-aa__legende { font-size: 16px; margin-top: 12px; }
}
