/* ============================================================
   ANIMATIONS SYSTEM — Drupal Theme
   Moderne, fluide, maintenable
   ============================================================ */

/* ── Valeurs cubic-bezier réutilisables (custom properties) ── */
:root {
  --ease-out-expo:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart:   cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-back:    cubic-bezier(0.34, 1.56, 0.64, 1);   /* légère surimpulsion */
  --ease-in-out-sine: cubic-bezier(0.37, 0, 0.63, 1);
  --ease-spring:      cubic-bezier(0.175, 0.885, 0.32, 1.275); /* spring */

  --duration-fast:    500ms;
  --duration-base:    800ms;
  --duration-slow:    1100ms;
  --duration-xslow:   1500ms;
}


/* ============================================================
   BASE — tout élément animable est invisible au départ
   ============================================================ */
[data-animate] {
  opacity: 0;
  will-change: opacity, transform;
}

/* Quand visible → l'animation prend le relais */
[data-animate].is-visible {
  animation-fill-mode: both;
  animation-timing-function: var(--ease-out-expo);
  animation-duration: var(--duration-base);
}


/* ============================================================
   1. FADES — apparitions simples
   ============================================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-40px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeLeft {
  from { opacity: 0; transform: translateX(-50px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeRight {
  from { opacity: 0; transform: translateX(50px); }
  to   { opacity: 1; transform: translateX(0); }
}

[data-animate="fade"].is-visible       { animation-name: fadeIn;    animation-timing-function: var(--ease-out-quart); }
[data-animate="fade-up"].is-visible    { animation-name: fadeUp;    animation-timing-function: var(--ease-out-expo); }
[data-animate="fade-down"].is-visible  { animation-name: fadeDown;  animation-timing-function: var(--ease-out-expo); }
[data-animate="fade-left"].is-visible  { animation-name: fadeLeft;  animation-timing-function: var(--ease-out-expo); }
[data-animate="fade-right"].is-visible { animation-name: fadeRight; animation-timing-function: var(--ease-out-expo); }

/* ============================================================
   2. REVEAL CLIP — le texte/bloc se dévoile (masque qui glisse)
   ============================================================ */

@keyframes clipRevealUp {
  from { clip-path: inset(100% 0 0 0); opacity: 1; transform: translateY(10px); }
  to   { clip-path: inset(0% 0 0 0);   opacity: 1; transform: translateY(0); }
}

@keyframes clipRevealLeft {
  from { clip-path: inset(0 100% 0 0); opacity: 1; }
  to   { clip-path: inset(0 0% 0 0);   opacity: 1; }
}

[data-animate="reveal-up"].is-visible   {
  opacity: 1; /* override — le clip gère la visibilité */
  animation-name: clipRevealUp;
  animation-timing-function: var(--ease-out-expo);
  animation-duration: var(--duration-slow);
}

[data-animate="reveal-left"].is-visible {
  opacity: 1;
  animation-name: clipRevealLeft;
  animation-timing-function: var(--ease-out-expo);
  animation-duration: var(--duration-xslow);
}




/* ============================================================
   3. ACCESSIBILITÉ — respect prefers-reduced-motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  [data-animate],
  [data-animate].is-visible,
  .hover-lift,
  .hover-scale,
  .hover-underline::after,
  [data-parallax] {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
  }
}
