/* ==========================================================================
   152 — Wipe Reveal
   Transition rideau : un panneau accent balaye la zone de gauche à droite
   (entrée nerveuse, 0.42s), les vues sont échangées à couverture totale,
   puis le rideau repart vers la droite en décélérant (sortie 0.55s) et
   révèle la nouvelle vue, dont le contenu arrive en stagger dans son
   sillage. Timing volontairement asymétrique : on couvre vite, on révèle
   avec du souffle.
   Racine : .wipe-reveal — phases pilotées par anim.js (.is-cover, .is-exit
   sur le rideau ; .is-in sur la vue active pour le stagger).
   Démo CONTENUE dans la zone (scène relative, jamais de fixed).
   ========================================================================== */

.wipe-reveal {
  --wr-accent: var(--ml-accent, #7c8cff);
  --wr-accent-2: var(--ml-accent-2, #2dd4bf);

  position: relative;
  display: flex;
  flex-direction: column;
  width: min(320px, 100%);
  height: 236px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--ml-surface, #151a24);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--ml-fg, #e8eaf2);
}

/* --- Scène : vues + rideau ------------------------------------------------- */

.wipe-reveal__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.wipe-reveal__view {
  position: absolute;
  inset: 0;
  padding: 16px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.wipe-reveal__view[hidden] { display: none; }

.wipe-reveal__kicker {
  margin: 0;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wr-accent-2);
}

.wipe-reveal__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: 0.005em;
}

.wipe-reveal__text {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--ml-muted, #8b91a3);
}

.wipe-reveal__chips {
  display: flex;
  gap: 6px;
  margin-top: auto;
}

.wipe-reveal__chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--wr-accent);
  background: color-mix(in srgb, var(--wr-accent) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--wr-accent) 30%, transparent);
}

/* --- Stagger du contenu ------------------------------------------------------
   Chaque élément marqué .wipe-reveal__stag porte un index inline `--wr-i` ;
   la cascade démarre quand la vue reçoit .is-in (posée par le JS pendant que
   le rideau repart), avec un délai de base pour laisser passer le rideau. --- */

.wipe-reveal__stag {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.wipe-reveal__view.is-in .wipe-reveal__stag {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(0.12s + var(--wr-i, 0) * 0.07s);
}

/* --- Le rideau -----------------------------------------------------------------
   scaleX piloté par deux phases : couverture (origine gauche, le bord droit
   file) puis sortie (origine droite, le bord gauche suit) — un seul balayage
   continu gauche → droite. Liseré accent-2 sur le bord de fuite. -------------- */

.wipe-reveal__curtain {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(
    105deg,
    var(--wr-accent),
    color-mix(in srgb, var(--wr-accent) 55%, var(--wr-accent-2))
  );
}

.wipe-reveal__curtain::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 7px;
  background: var(--wr-accent-2);
}

.wipe-reveal__curtain.is-cover {
  transform-origin: left;
  animation: wipe-reveal-cover 0.42s cubic-bezier(0.65, 0, 0.35, 1) both;
}

.wipe-reveal__curtain.is-exit {
  transform-origin: right;
  animation: wipe-reveal-exit 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes wipe-reveal-cover {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes wipe-reveal-exit {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* --- Pied : pagination + bouton ------------------------------------------------ */

.wipe-reveal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.wipe-reveal__dots {
  display: flex;
  gap: 5px;
}

.wipe-reveal__pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.25s ease, transform 0.25s ease;
}

.wipe-reveal__pip.is-on {
  background: var(--wr-accent);
  transform: scale(1.25);
}

.wipe-reveal__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ml-fg, #e8eaf2);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.wipe-reveal__btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.wipe-reveal__btn:active {
  transform: translateY(0) scale(0.97);
}

.wipe-reveal__btn:focus-visible {
  outline: 2px solid var(--wr-accent);
  outline-offset: 2px;
}

.wipe-reveal__btn svg {
  display: block;
  width: 11px;
  height: 11px;
}

/* --- Reduced motion --------------------------------------------------------------
   anim.js bascule en swap instantané (pas de rideau) ; ceci couvre le cas
   CSS seul ou un changement de préférence en cours de route. ------------------- */

@media (prefers-reduced-motion: reduce) {
  .wipe-reveal__pip,
  .wipe-reveal__btn {
    transition: none;
  }

  .wipe-reveal__btn:hover,
  .wipe-reveal__btn:active {
    transform: none;
  }

  .wipe-reveal__curtain.is-cover,
  .wipe-reveal__curtain.is-exit {
    animation-duration: 0.01s;
  }

  .wipe-reveal__view.is-in .wipe-reveal__stag {
    transition-duration: 0.01s;
    transition-delay: 0s;
  }
}
