/* Renaflow : comparateur avant / après. Une goutte glisse sur la photo et révèle l'après. */

.ba {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}

.ba__intro {
  display: grid;
  gap: 1.2rem;
  justify-items: start;
}

/* Les exemples : des pastilles, une seule active */
.ba__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.ba__tab {
  display: grid;
  gap: 0.15rem;
  padding: 0.7rem 1.2rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font: 600 0.98rem/1.1 var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s, transform 0.35s var(--ease);
}

.ba__tab small {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.ba__tab:hover {
  border-color: var(--prune);
}

.ba__tab[aria-selected="true"] {
  background: var(--prune);
  border-color: var(--prune);
  color: var(--bg);
}

.ba__tab[aria-selected="true"] small {
  color: var(--block-soft);
}

.ba__note {
  max-width: 40ch;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* La scène : deux photos superposées, l'après est révélé par un masque */
.ba__stage {
  display: grid;
  gap: 0.9rem;
}

.ba__frame {
  --pos: 50%;
  position: relative;
  aspect-ratio: 10 / 9;
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
  touch-action: pan-y;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
}

.ba__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
  pointer-events: none;
  -webkit-user-drag: none;
}

.ba__img--after {
  clip-path: inset(0 0 0 var(--pos));
}

/* Étiquettes : posées dans les coins, elles s'effacent quand la goutte s'en approche */
.ba__tag {
  position: absolute;
  top: 1rem;
  padding: 0.45rem 0.95rem;
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--prune);
  font: 700 0.8rem/1 var(--font-body);
  letter-spacing: 0.04em;
  pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.ba__tag--before {
  left: 1rem;
}

.ba__tag--after {
  right: 1rem;
  background: var(--prune);
  color: var(--bg);
}

.ba__frame[data-edge="left"] .ba__tag--before,
.ba__frame[data-edge="right"] .ba__tag--after {
  opacity: 0;
  transform: translateY(-6px);
}

/* La barre : un trait fin et une goutte à saisir */
.ba__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 56px;
  margin-left: -28px;
  display: grid;
  place-items: center;
  touch-action: none;
  outline: none;
}

.ba__line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(67, 4, 44, 0.18), 6px 0 14px -8px rgba(67, 4, 44, 0.45);
}

.ba__grip {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--prune);
  border: 3px solid var(--bg);
  box-shadow: 0 14px 26px -10px rgba(67, 4, 44, 0.6);
  color: var(--bg);
  transition: transform 0.35s var(--ease);
}

.ba__grip svg {
  display: block;
}

.ba__grip::before,
.ba__grip::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 2px solid var(--apricot, var(--petal));
  border-right: 2px solid var(--apricot, var(--petal));
  margin-top: -3.5px;
}

.ba__grip::before {
  left: 9px;
  transform: rotate(-135deg);
}

.ba__grip::after {
  right: 9px;
  transform: rotate(45deg);
}

.ba__frame:hover .ba__grip,
.ba__frame.is-dragging .ba__grip {
  transform: scale(1.08);
}

.ba__handle:focus-visible .ba__grip {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

/* Invitation à glisser, retirée dès la première interaction */
.ba__hint {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  translate: -50% 0;
  padding: 0.5rem 1rem;
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--prune);
  font: 600 0.82rem/1 var(--font-body);
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
}

.ba__frame.is-touched .ba__hint {
  opacity: 0;
}

.ba__caption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.ba__caption strong {
  color: var(--ink);
}

@media (max-width: 900px) {
  .ba {
    grid-template-columns: minmax(0, 1fr);
  }

  .ba__frame {
    aspect-ratio: 1 / 1;
    border-radius: 22px;
  }

  .ba__note {
    max-width: none;
  }
}

/* Changement d'exemple : la photo se fond doucement */
@media (prefers-reduced-motion: no-preference) {
  .ba__frame.is-swapping .ba__img {
    animation: ba-fade 0.6s var(--ease) both;
  }

  @keyframes ba-fade {
    from {
      opacity: 0.2;
      filter: blur(6px);
    }
  }
}
