/* ALSI Nettoyage – v6 : « Avant. Après. », les photos réelles des chantiers.
   Un cadre de comparaison : la ligne de lumière passe sur la photo comme un coup de raclette,
   l'avant à gauche, l'après à droite. Se charge après v5.css. */

.ba { overflow: hidden; }
.ba .lead { color: #b9c6d3; }
.ba .accent { background: var(--grad); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: reflet-texte 6s ease-in-out infinite; }

/* halos de fond, dans la continuité de l'ouverture */
.ba-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ba-glow { position: absolute; border-radius: 50%; opacity: .5; }
.ba-glow.g1 { width: 52rem; height: 52rem; left: -14rem; top: 18%; background: radial-gradient(closest-side, rgba(41, 168, 224, .28), transparent); }
.ba-glow.g2 { width: 40rem; height: 40rem; right: -10rem; bottom: -8rem; background: radial-gradient(closest-side, rgba(127, 211, 247, .2), transparent); }
.ba > .wrap { position: relative; }

/* ---------- La scène : hauteur fixe, la photo s'y pose (paysage ou portrait) sans faire sauter la page ---------- */
.ba-show { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: clamp(2rem, 4vw, 3.5rem); align-items: center; }
.ba-stage {
  --h: min(74vh, 40rem);
  position: relative; display: grid; place-items: center; height: var(--h);
  border-radius: calc(var(--r-l) + 6px); overflow: hidden; isolation: isolate;
  background: rgba(255, 255, 255, .03); box-shadow: inset 0 0 0 1px rgba(127, 211, 247, .12);
}
.ba-bg { position: absolute; inset: -10%; z-index: -1; width: 120%; height: 120%; max-width: none; object-fit: cover; filter: blur(34px) saturate(1.2); opacity: .38; transition: opacity .6s var(--ease); }
.ba-stage::after { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(80% 70% at 50% 50%, transparent 40%, rgba(11, 22, 34, .7)); }

.ba-frame {
  --pos: 50%;
  position: relative; width: min(100%, calc(var(--h) * var(--ar))); aspect-ratio: var(--ar);
  border-radius: var(--r-l); overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: ew-resize;
  background: #0e1d2c;
  box-shadow: 0 0 0 1px rgba(127, 211, 247, .28), 0 30px 80px rgba(0, 0, 0, .5), 0 0 90px rgba(41, 168, 224, .16);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.ba-frame.swap { opacity: 0; transform: scale(.985); }
.ba-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
/* l'avant est découpé à gauche de la ligne */
.ba-clip { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); -webkit-clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.ba-avant { filter: saturate(.9); }
/* l'après reçoit un reflet de lumière quand la ligne vient de le révéler */
.ba-frame::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .28) 50%, transparent 70%) no-repeat -160% 0 / 45% 100%; mix-blend-mode: soft-light; opacity: 0; }
.ba-frame.shine::after { animation: ba-shine 1.3s cubic-bezier(.45, 0, .2, 1) both; }
@keyframes ba-shine { 0% { opacity: 1; background-position: -160% 0; } 100% { opacity: 1; background-position: 260% 0; } }

/* la ligne de lumière */
.ba-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 0; pointer-events: none; }
.ba-line::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: linear-gradient(180deg, rgba(255, 255, 255, .2), #fff 20%, #fff 80%, rgba(255, 255, 255, .2)); box-shadow: 0 0 12px rgba(127, 211, 247, .9), 0 0 32px rgba(41, 168, 224, .6); }
.ba-line::after { content: ""; position: absolute; top: 0; bottom: 0; left: -42px; width: 84px; background: linear-gradient(90deg, transparent, rgba(127, 211, 247, .16), transparent); }
.ba-knob {
  position: absolute; top: 50%; left: 0; display: grid; place-items: center; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  color: #fff; background: rgba(11, 22, 34, .55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 0 0 2px #fff, 0 0 24px rgba(127, 211, 247, .8), 0 10px 26px rgba(0, 0, 0, .35);
  transition: transform .3s var(--ease);
}
.ba-frame:hover .ba-knob, .ba-frame.drag .ba-knob { transform: scale(1.08); }
.ba-frame.hint .ba-knob { animation: ba-hint 2.4s var(--ease) infinite; }
@keyframes ba-hint { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

/* étiquettes */
.ba-tag { position: absolute; top: 1rem; z-index: 2; padding: .38rem .8rem; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #fff; background: rgba(11, 22, 34, .55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); pointer-events: none; transition: opacity .3s var(--ease); }
.ba-tag-avant { left: 1rem; opacity: var(--o-av, 1); }
.ba-tag-apres { right: 1rem; opacity: var(--o-ap, 1); background: rgba(22, 121, 171, .75); box-shadow: inset 0 0 0 1px rgba(127, 211, 247, .5), 0 0 18px rgba(41, 168, 224, .45); }

/* étincelles laissées par la ligne */
.ba-sparks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* le curseur réel, invisible : il sert au clavier et aux lecteurs d'écran ; la souris et le doigt passent par le cadre (js) */
.ba-range { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; margin: 0; opacity: 0; -webkit-appearance: none; appearance: none; background: transparent; pointer-events: none; }
.ba-frame.kb { outline: 2px solid var(--blue-l); outline-offset: 4px; }

/* ---------- Le texte à côté ---------- */
.ba-info { color: #b9c6d3; }
.ba-count { display: flex; align-items: baseline; gap: .5rem; margin-bottom: 1.25rem; font-family: var(--f-title); }
.ba-count b { font-size: clamp(3.5rem, 6vw, 5rem); font-weight: 700; line-height: .9; letter-spacing: -.04em; background: var(--grad); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.ba-count span { font-size: 1rem; font-weight: 600; color: #6f8499; }
.ba-cat { display: inline-block; margin-bottom: .85rem; padding: .3rem .75rem; border-radius: 999px; font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--blue-l); background: rgba(41, 168, 224, .1); box-shadow: inset 0 0 0 1px rgba(127, 211, 247, .22); }
.ba-info h3 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); line-height: 1.15; letter-spacing: -.02em; }
.ba-text { margin-top: .9rem; font-size: 1.05rem; line-height: 1.6; min-height: 5em; }
.ba-info [data-ba-num], .ba-info [data-ba-cat], .ba-info h3, .ba-text { transition: opacity .3s var(--ease), transform .3s var(--ease); }
.ba-info.out [data-ba-num], .ba-info.out [data-ba-cat], .ba-info.out h3, .ba-info.out .ba-text { opacity: 0; transform: translateY(8px); }
.ba-ctrl { display: flex; align-items: center; gap: .6rem; margin: 1.75rem 0 2rem; }
.ba-arrow { display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(127, 211, 247, .25); cursor: pointer; transition: background-color .25s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease); }
.ba-arrow:hover { background: rgba(41, 168, 224, .22); box-shadow: inset 0 0 0 1px rgba(127, 211, 247, .6), 0 0 22px rgba(41, 168, 224, .35); }
.ba-arrow:active { transform: scale(.94); }
.ba-bar { position: relative; flex: 1; height: 2px; margin-left: .6rem; border-radius: 2px; background: rgba(127, 211, 247, .15); overflow: hidden; }
.ba-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 12.5%; border-radius: inherit; background: linear-gradient(90deg, #29a8e0, #7fd3f7); box-shadow: 0 0 10px rgba(127, 211, 247, .8); transition: width .5s var(--ease); }

/* ---------- Les vignettes ---------- */
.ba-thumbs { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .75rem; margin-top: clamp(2rem, 4vw, 3rem); }
.ba-thumbs button { position: relative; display: block; padding: 0; border: 0; border-radius: var(--r); overflow: hidden; background: #0e1d2c; cursor: pointer; aspect-ratio: 9 / 7; box-shadow: inset 0 0 0 1px rgba(127, 211, 247, .14); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.ba-thumbs img { width: 100%; height: 100%; object-fit: cover; opacity: .55; filter: saturate(.7); transition: opacity .35s var(--ease), filter .35s var(--ease), transform .6s var(--ease); }
.ba-thumbs span { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.4rem .6rem .5rem; font-size: .78rem; font-weight: 600; color: #fff; text-align: left; background: linear-gradient(180deg, transparent, rgba(11, 22, 34, .85)); }
.ba-thumbs button:hover { transform: translateY(-3px); }
.ba-thumbs button:hover img { opacity: .85; filter: none; transform: scale(1.05); }
.ba-thumbs button.on { box-shadow: 0 0 0 2px var(--blue), 0 0 26px rgba(41, 168, 224, .45); }
.ba-thumbs button.on img { opacity: 1; filter: none; }

/* ---------- Tablette ---------- */
@media (max-width: 1080px) {
  .ba-show { grid-template-columns: minmax(0, 1fr) 17rem; }
  .ba-thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Téléphone : la photo d'abord, le texte dessous, les vignettes défilent d'un geste ---------- */
@media (max-width: 900px) {
  .ba-show { grid-template-columns: 1fr; gap: 1.25rem; }
  .ba-stage { --h: min(calc(100vw - 2.5rem), 64svh); border-radius: var(--r-l); }
  .ba-frame { border-radius: var(--r); }
  .ba-knob { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
  .ba-tag { top: .7rem; padding: .3rem .65rem; font-size: .68rem; }
  .ba-tag-avant { left: .7rem; }
  .ba-tag-apres { right: .7rem; }
  .ba-info { display: grid; grid-template-columns: auto 1fr; column-gap: 1rem; align-items: start; }
  .ba-count { grid-row: span 2; margin: 0; }
  .ba-count b { font-size: 3rem; }
  .ba-count span { display: none; }
  .ba-cat { justify-self: start; margin: .2rem 0 .4rem; font-size: .68rem; }
  .ba-info h3 { font-size: 1.35rem; }
  .ba-text, .ba-ctrl, .ba-info .btn { grid-column: 1 / -1; }
  .ba-text { margin-top: .75rem; font-size: .95rem; min-height: 0; }
  .ba-ctrl { margin: 1rem 0 1.25rem; }
  .ba-info .btn { width: 100%; }
  .ba-thumbs { display: flex; gap: .6rem; overflow-x: auto; scroll-snap-type: x mandatory; margin: 1.5rem -1.25rem 0; padding: .3rem 1.25rem .5rem; scrollbar-width: none; }
  .ba-thumbs::-webkit-scrollbar { display: none; }
  .ba-thumbs button { flex: 0 0 7.25rem; scroll-snap-align: start; }
  .ba-thumbs button:hover { transform: none; }
  .js .ba-thumbs.rv { opacity: 1; transform: none; }
  .ba-glow.g1 { width: 30rem; height: 30rem; }
  /* sur téléphone : flou fixe et léger, aucun flou animé (Safari) */
  .ba-bg { filter: blur(20px); opacity: .3; transition: none; }
  .ba-knob { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(11, 22, 34, .7); }
  .ba-tag { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ba .accent { animation: none; }
  .ba-frame.shine::after, .ba-frame.hint .ba-knob { animation: none; }
  .ba-frame, .ba-info [data-ba-num], .ba-info h3, .ba-text, .ba-bar i { transition: none; }
}
