/* Finitions : compare (avant / après)
   Chargé après main.css : tout ce qui suit reprend la main sur .ba__*      */

/* -------------------------------------------------------------------------- */
/* Cadre                                                                       */
/* -------------------------------------------------------------------------- */

.ba__stage {
  background: var(--ink);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
}
.ba__stage.is-dragging { cursor: grabbing; }
.ba__stage:focus { outline: none; }
.ba__stage:focus-visible { outline: 2px solid var(--ardoise); outline-offset: 6px; }

/* La poignée est le seul repère : pas de curseur maison par-dessus */
@media (hover: hover) and (pointer: fine) {
  body:has(.ba__stage:hover) .cursor__dot,
  body:has(.ba__stage:hover) .cursor__ring,
  body:has(.ba__stage:hover) .cursor__label,
  body:has(.ba__stage.is-dragging) .cursor__dot,
  body:has(.ba__stage.is-dragging) .cursor__ring,
  body:has(.ba__stage.is-dragging) .cursor__label { opacity: 0; }
}

/* -------------------------------------------------------------------------- */
/* Calques : même photo, même cadrage, au pixel                                */
/* -------------------------------------------------------------------------- */

.ba__layers { position: absolute; inset: 0; }
/* Le zoom d'entrée se joue à l'intérieur de chaque calque : la découpe du
   volet, elle, ne bouge pas et reste exactement sous le filet. */
.ba__zoom { position: absolute; inset: 0; }
.ba__layer img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }

.ba__before { will-change: clip-path; }
/* Fichier brut : tons éteints, dominante chaude, et une légère fuite des
   verticales. Le pivot est sur le bord haut : rien ne se décale en haut ni sur
   l'axe central, l'image ne fait que grandir vers le bas, le calque la rogne. */
.ba__before img {
  filter: saturate(0.6) contrast(0.8) brightness(0.88) sepia(0.2) hue-rotate(-8deg);
  transform-origin: 50% 0;
  transform: perspective(1800px) rotateX(1deg);
  backface-visibility: hidden;
}
.ba__before::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(214, 170, 110, 0.1);
  mix-blend-mode: multiply;
  pointer-events: none;
}
.ba__vignette { pointer-events: none; background: radial-gradient(ellipse at center, transparent 48%, rgba(35, 30, 20, 0.4) 100%); }

/* Voile haut et bas : les légendes restent lisibles sur une photo claire */
.ba__scrim {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(rgba(20, 26, 30, 0.4), rgba(20, 26, 30, 0) 22%, rgba(20, 26, 30, 0) 76%, rgba(20, 26, 30, 0.42));
  pointer-events: none;
}

/* -------------------------------------------------------------------------- */
/* Légendes : s'effacent quand le volet les traverse (--o piloté par le JS)    */
/* -------------------------------------------------------------------------- */

.ba__tag {
  top: 24px;
  padding: 0;
  background: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  white-space: nowrap;
  color: #fff;
  text-shadow: 0 1px 14px rgba(20, 26, 30, 0.5);
  pointer-events: none;
  opacity: var(--o, 1);
  transform: translate3d(0, calc((1 - var(--o, 1)) * -6px), 0);
  transition: opacity 0.35s var(--ease-out), transform 0.5s var(--ease-out);
}
.ba__tag::before {
  content: '';
  display: inline-block; vertical-align: middle;
  width: 24px; height: 1px; margin: -2px 12px 0 0;
  background: currentColor; opacity: 0.75;
}
.ba__tag em { font-style: normal; opacity: 0.72; }
.ba__tag--after { left: 24px; }
.ba__tag--before { right: 24px; }

/* -------------------------------------------------------------------------- */
/* Volet et poignée                                                            */
/* -------------------------------------------------------------------------- */

.ba__handle {
  left: 0;
  pointer-events: none;
  will-change: transform;
  transition: opacity 0.9s var(--ease-out);
}
.ba__handle::before {
  background: linear-gradient(rgba(255, 255, 255, 0.5), #fff 12%, #fff 88%, rgba(255, 255, 255, 0.5));
  box-shadow: 0 0 14px rgba(20, 26, 30, 0.28);
}
/* Halo le long du volet pendant le geste */
.ba__handle::after {
  content: '';
  position: absolute; top: 0; bottom: 0; left: -48px; width: 96px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0));
  opacity: 0;
  transition: opacity 0.5s var(--ease-out);
  pointer-events: none;
}
.ba__stage.is-dragging .ba__handle::after { opacity: 1; }

.ba__grip { position: absolute; top: 50%; left: 0; width: 0; height: 0; }

.ba__knob {
  top: 0; left: 0;
  width: 60px; height: 60px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 36px rgba(20, 26, 30, 0.24), 0 1px 2px rgba(20, 26, 30, 0.2);
  transition: transform 0.6s var(--ease-expo), box-shadow 0.6s var(--ease-expo), opacity 0.5s var(--ease-out);
}
.ba__knob::after {
  content: '';
  position: absolute; inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.6);
  opacity: 0.55;
  transition: transform 0.7s var(--ease-expo), opacity 0.4s var(--ease-out);
  pointer-events: none;
}
.ba__knob svg { width: 22px; height: 22px; overflow: visible; }
.ba__chev { transition: transform 0.5s var(--ease-expo); }

@media (hover: hover) and (pointer: fine) {
  .ba__stage:hover .ba__knob { transform: translate(-50%, -50%) scale(1.07); }
  .ba__stage:hover .ba__knob::after { transform: scale(1.08); opacity: 0.85; }
  .ba__stage:hover .ba__chev--l { transform: translateX(-1.2px); }
  .ba__stage:hover .ba__chev--r { transform: translateX(1.2px); }
}
.ba__stage.is-dragging .ba__knob {
  transform: translate(-50%, -50%) scale(0.9);
  box-shadow: 0 4px 14px rgba(20, 26, 30, 0.26), 0 1px 2px rgba(20, 26, 30, 0.2);
}
.ba__stage.is-dragging .ba__knob::after { transform: scale(1.3); opacity: 1; }
.ba__stage.is-dragging .ba__chev--l { transform: translateX(-2.6px); }
.ba__stage.is-dragging .ba__chev--r { transform: translateX(2.6px); }
.ba__stage:focus-visible .ba__knob::after { transform: scale(1.12); opacity: 1; border-color: #fff; box-shadow: 0 0 0 1px var(--ardoise); }

/* Invitation, une seule fois : les flèches respirent, « Glisser » sous la poignée */
.ba__hint {
  position: absolute; top: 46px; left: 0;
  padding: 6px 11px 6px 13px;
  border-radius: 999px;
  background: rgba(35, 43, 48, 0.62);
  color: #fff;
  font-size: 0.64rem; font-weight: 500; line-height: 1;
  letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap;
  opacity: 0;
  transform: translate3d(-50%, 8px, 0);
  transition: opacity 0.5s var(--ease-out), transform 0.8s var(--ease-expo);
  pointer-events: none;
}
.ba__stage.is-hint:not(.is-touched) .ba__hint { opacity: 1; transform: translate3d(-50%, 0, 0); transition-delay: 0.2s; }
.ba__stage.is-hint:not(.is-touched):not(:hover) .ba__chev--l { animation: ba-nudge-l 2.6s var(--ease-in-out) 0.6s infinite; }
.ba__stage.is-hint:not(.is-touched):not(:hover) .ba__chev--r { animation: ba-nudge-r 2.6s var(--ease-in-out) 0.6s infinite; }
@keyframes ba-nudge-l { 0%, 60%, 100% { transform: translateX(0); } 30% { transform: translateX(-2.4px); } }
@keyframes ba-nudge-r { 0%, 60%, 100% { transform: translateX(0); } 30% { transform: translateX(2.4px); } }

/* -------------------------------------------------------------------------- */
/* Corrections : écrites par le passage du volet                               */
/* -------------------------------------------------------------------------- */

.ba__notes { clip-path: inset(0 50% 0 0); will-change: clip-path; }
.ba__notes li {
  left: var(--x); right: var(--r, auto);
  padding: 7px 15px 7px 7px;
  border-radius: 999px;
  background: rgba(240, 241, 241, 0.94);
  box-shadow: 0 8px 26px rgba(20, 26, 30, 0.16);
  font-size: 0.74rem; letter-spacing: 0.01em;
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  transition: opacity 0.4s var(--ease-out), transform 0.9s var(--ease-expo);
}
.ba__notes li.is-on { opacity: 1; transform: translate3d(0, 0, 0); }
.ba__notes li i { transform: scale(0); transition: transform 0.4s var(--ease-out); }
.ba__notes li.is-on i { transform: scale(1); transition: transform 0.8s var(--ease-expo) 0.08s; }
.ba__notes li span { display: inline-block; opacity: 0; transform: translate3d(-8px, 0, 0); transition: opacity 0.3s var(--ease-out), transform 0.4s var(--ease-out); }
.ba__notes li.is-on span { opacity: 1; transform: translate3d(0, 0, 0); transition: opacity 0.6s var(--ease-out) 0.12s, transform 0.9s var(--ease-expo) 0.12s; }

/* -------------------------------------------------------------------------- */
/* Compteur et filet de progression                                            */
/* -------------------------------------------------------------------------- */

.ba__count {
  position: absolute; left: 24px; bottom: 22px; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 1.4rem; line-height: 1;
  color: #fff;
  text-shadow: 0 1px 14px rgba(20, 26, 30, 0.5);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  transition: opacity 0.9s var(--ease-out);
}
.ba__count-n { display: inline-block; overflow: hidden; padding: 0.1em 0; }
.ba__count-n b { display: block; font-weight: 400; }
.ba__count i { width: 22px; height: 1px; background: currentColor; opacity: 0.6; }
.ba__count > span:last-child { font-size: 1rem; opacity: 0.66; }

.ba__bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
  pointer-events: none;
  transition: opacity 0.9s var(--ease-out);
}
.ba__bar i { display: block; height: 100%; background: rgba(255, 255, 255, 0.9); transform-origin: 0 50%; transform: scaleX(0.5); will-change: transform; }

/* -------------------------------------------------------------------------- */
/* Avant l'entrée : le cadre est nu, les repères arrivent avec le volet        */
/* -------------------------------------------------------------------------- */

.ba__stage:not(.is-live) .ba__handle,
.ba__stage:not(.is-live) .ba__tag,
.ba__stage:not(.is-live) .ba__count,
.ba__stage:not(.is-live) .ba__bar { opacity: 0; }
.ba__stage:not(.is-live) .ba__knob { transform: translate(-50%, -50%) scale(0.55); }

/* -------------------------------------------------------------------------- */
/* Exemples                                                                    */
/* -------------------------------------------------------------------------- */

.ba__pairs { margin-top: 26px; align-items: center; }

/* -------------------------------------------------------------------------- */
/* Petit écran                                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 700px) {
  .ba__tag { top: 18px; font-size: 0.62rem; }
  .ba__tag::before { width: 16px; margin-right: 9px; }
  .ba__tag em { display: none; }
  .ba__tag--after { left: 16px; }
  .ba__tag--before { right: 16px; }
  .ba__knob { width: 52px; height: 52px; }
  .ba__knob::after { inset: -6px; }
  .ba__hint { top: 40px; }
  .ba__count { left: 16px; bottom: 16px; font-size: 1.2rem; }
  .ba__stage .ba__notes li { font-size: 0.66rem; padding: 6px 12px 6px 6px; gap: 8px; }
  .ba__stage .ba__notes li:nth-child(1) { left: 5%; right: auto; top: 16%; }
  .ba__stage .ba__notes li:nth-child(2) { left: 20%; right: auto; top: 66%; }
  .ba__stage .ba__notes li:nth-child(3) { left: 30%; right: auto; top: 29%; }
  .ba__stage .ba__notes li:nth-child(4) { left: auto; right: 5%; top: 79%; }
}

/* -------------------------------------------------------------------------- */
/* Animations réduites (html.is-reduced, réglage du site)                      */
/* -------------------------------------------------------------------------- */

html.is-reduced .ba__stage,
html.is-reduced .ba__stage *,
html.is-reduced .ba__stage *::before,
html.is-reduced .ba__stage *::after {
  transition-duration: 0.01s !important;
  transition-delay: 0s !important;
  animation: none !important;
}
