/* ============================================================
   fx.css — finition commune à tous les jeux de La Tournée.
   Principes : rapide (< 300 ms), ease-out marqué, seulement
   transform / opacity, jamais d'animation sur du répétitif.
   Les propriétés individuelles `scale` / `translate` sont
   utilisées exprès : elles ne touchent pas aux `transform`
   déjà écrits dans chaque jeu.
   ============================================================ */
:root{
  --fx-out:cubic-bezier(.23,1,.32,1);
  --fx-in-out:cubic-bezier(.77,0,.175,1);
}

/* 1 · Le bouton « écoute » : léger enfoncement au toucher */
:where(button:not(:disabled), a.game, [role="button"], summary):active{
  scale:.97;
}
:where(button, a.game, [role="button"]){
  -webkit-tap-highlight-color:transparent;
}

/* 2 · Changement d'écran : fondu + petite montée, flou léger
   qui masque le « remplacement » sec d'un écran par l'autre */
@keyframes fxScreen{
  from{ opacity:0; translate:0 10px; filter:blur(3px); }
  to  { opacity:1; translate:none;   filter:none; }
}
.screen.on{ animation:fxScreen 260ms var(--fx-out) backwards; }

/* 3 · Les blocs d'un écran arrivent en cascade (30–40 ms d'écart) */
@keyframes fxItem{
  from{ opacity:0; translate:0 8px; }
  to  { opacity:1; translate:none; }
}
.screen.on > *{ animation:fxItem 300ms var(--fx-out) backwards; }
.screen.on > :nth-child(1){ animation-delay:0ms; }
.screen.on > :nth-child(2){ animation-delay:40ms; }
.screen.on > :nth-child(3){ animation-delay:80ms; }
.screen.on > :nth-child(4){ animation-delay:120ms; }
.screen.on > :nth-child(5){ animation-delay:160ms; }
.screen.on > :nth-child(n+6){ animation-delay:200ms; }

/* 4 · Ouverture d'une page : simple fondu (pas de transform sur
   body, ça casserait les éléments en position fixe) */
@keyframes fxBody{ from{ opacity:0; } to{ opacity:1; } }
body{ animation:fxBody 240ms ease-out backwards; }

/* 5 · Menu : les jeux apparaissent l'un après l'autre */
.game{ animation:fxItem 340ms var(--fx-out) backwards; }
.game:nth-child(1){ animation-delay:40ms; }
.game:nth-child(2){ animation-delay:80ms; }
.game:nth-child(3){ animation-delay:120ms; }
.game:nth-child(4){ animation-delay:160ms; }
.game:nth-child(5){ animation-delay:200ms; }
.game:nth-child(6){ animation-delay:240ms; }
.game:nth-child(7){ animation-delay:280ms; }
.game:nth-child(8){ animation-delay:320ms; }
.game:nth-child(n+9){ animation-delay:360ms; }

/* 6 · Mouvement réduit : on garde le fondu, on retire le déplacement */
@media (prefers-reduced-motion: reduce){
  .screen.on, .screen.on > *, .game{
    animation-name:fxBody; animation-duration:160ms; animation-delay:0ms;
  }
  :where(button:not(:disabled), a.game, [role="button"], summary):active{ scale:1; }
}
