/* ════════════════════════════════════════════════════════════════════
   _shared/css/motion.css — Animations & micro-interactions
   ════════════════════════════════════════════════════════════════════
   "De la vie dans les parcours" : entrées en scène fluides, hover
   responsifs, breathing sur les éléments emblématiques, transitions
   douces entre étapes. Tout respecte prefers-reduced-motion (cf tokens.css).
   ════════════════════════════════════════════════════════════════════ */

/* ─── Keyframes ───────────────────────────────────────────── */
@keyframes mcw-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes mcw-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes mcw-rise-soft {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes mcw-slide-in-left {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes mcw-pop {
  0%   { transform: scale(.92); opacity: 0; }
  60%  { transform: scale(1.02); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes mcw-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-3px) scale(1.012); }
}
@keyframes mcw-float {
  0%   { transform: translateY(0) rotate(-1deg); }
  50%  { transform: translateY(-6px) rotate(1deg); }
  100% { transform: translateY(0) rotate(-1deg); }
}
@keyframes mcw-pulse-ring {
  0%   { transform: scale(.95); box-shadow: 0 0 0 0 rgba(199,165,85, .5); }
  70%  { transform: scale(1);   box-shadow: 0 0 0 14px rgba(199,165,85, 0); }
  100% { transform: scale(.95); box-shadow: 0 0 0 0 rgba(199,165,85, 0); }
}
@keyframes mcw-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes mcw-progress-grow {
  from { width: 0; }
}

/* ─── Classes utilitaires (à appliquer manuellement) ─────── */
.mcw-anim-fade   { animation: mcw-fade-in var(--mcw-t-page) var(--mcw-ease-out) both; }
.mcw-anim-rise   { animation: mcw-rise var(--mcw-t-page) var(--mcw-ease-out) both; }
.mcw-anim-pop    { animation: mcw-pop  var(--mcw-t-slow) var(--mcw-ease-back) both; }
.mcw-anim-slide  { animation: mcw-slide-in-left var(--mcw-t-slow) var(--mcw-ease-out) both; }

.mcw-breathe { animation: mcw-breathe 4s var(--mcw-ease-in-out) infinite; }
.mcw-float   { animation: mcw-float 5s var(--mcw-ease-in-out) infinite; }

/* Délais en cascade (pour révéler une grille progressivement) */
.mcw-cascade > * { animation: mcw-rise var(--mcw-t-page) var(--mcw-ease-out) both; }
.mcw-cascade > :nth-child(1) { animation-delay: 0ms; }
.mcw-cascade > :nth-child(2) { animation-delay: 60ms; }
.mcw-cascade > :nth-child(3) { animation-delay: 120ms; }
.mcw-cascade > :nth-child(4) { animation-delay: 180ms; }
.mcw-cascade > :nth-child(5) { animation-delay: 240ms; }
.mcw-cascade > :nth-child(6) { animation-delay: 300ms; }
.mcw-cascade > :nth-child(7) { animation-delay: 360ms; }
.mcw-cascade > :nth-child(8) { animation-delay: 420ms; }

/* ─── Bouton "appel à l'action" attiré (pulse ring discret) */
.mcw-btn--pulse {
  animation: mcw-pulse-ring 2.4s var(--mcw-ease-in-out) infinite;
  border-radius: var(--mcw-r-sm);
}

/* ─── Skeleton loader ─────────────────────────────────────── */
.mcw-skeleton {
  background: linear-gradient(
    90deg,
    var(--mcw-bg-2) 0%,
    var(--mcw-bg-3) 50%,
    var(--mcw-bg-2) 100%
  );
  background-size: 200% 100%;
  animation: mcw-shimmer 1.4s linear infinite;
  border-radius: var(--mcw-r-sm);
  color: transparent !important;
  user-select: none;
}

/* ─── Progress bar avec animation à l'entrée ─────────────── */
.mcw-progress {
  height: 6px;
  background: var(--mcw-bg-3);
  border-radius: var(--mcw-r-pill);
  overflow: hidden;
}
.mcw-progress > .mcw-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mcw-accent-deep), var(--mcw-accent));
  border-radius: var(--mcw-r-pill);
  animation: mcw-progress-grow 800ms var(--mcw-ease-out) both;
  transition: width var(--mcw-t-slow) var(--mcw-ease-out);
}

/* ─── Reveal au scroll ────────────────────────────────────── */
.mcw-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 600ms var(--mcw-ease-out), transform 600ms var(--mcw-ease-out);
}
.mcw-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Hover lift (à appliquer sur cards/lien actionnables) ─ */
.mcw-lift {
  transition: transform var(--mcw-t-base) var(--mcw-ease-out),
              box-shadow var(--mcw-t-base) var(--mcw-ease-out);
  will-change: transform;
}
.mcw-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--mcw-shadow-md);
}

/* ─── Underline animé (liens) ─────────────────────────────── */
.mcw-link-fancy {
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
}
.mcw-link-fancy::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform var(--mcw-t-base) var(--mcw-ease-out);
}
.mcw-link-fancy:hover::after {
  transform: scaleX(1);
  transform-origin: left center;
}

/* ─── Transition de page (fade-in du body) ───────────────── */
body { animation: mcw-fade-in var(--mcw-t-page) var(--mcw-ease-out) both; }

/* ─── Pour rendre les emojis/illustrations vivantes ──────── */
.mcw-illustration {
  display: inline-block;
  animation: mcw-float 6s var(--mcw-ease-in-out) infinite;
  transform-origin: center;
}
.mcw-illustration--delay-1 { animation-delay: 0.6s; }
.mcw-illustration--delay-2 { animation-delay: 1.2s; }
.mcw-illustration--delay-3 { animation-delay: 1.8s; }
