/* WIN motion and polish. Loaded only when SM_WIN_WOW=on (the server adds the link, off = today's page byte for byte).
   Rules: opacity and transform only, never width, height or a left/right move, so a phone page never scrolls
   sideways. Fill mode "backwards" only: nothing keeps a transform once its animation ends (a kept transform would
   trap a fixed popup inside it). Short: 90 to 220 ms. Reduced motion turns every piece off. */
@media (prefers-reduced-motion: no-preference) {
  /* new content in the page (a tab, a date range, a refresh): fades in and rises 4px, the first blocks in turn */
  #main > * { animation: win-wow-rise 180ms cubic-bezier(.2, .7, .2, 1) backwards; }
  #main > :nth-child(2) { animation-delay: 40ms; }
  #main > :nth-child(3) { animation-delay: 80ms; }
  #main > :nth-child(n+4) { animation-delay: 120ms; }
  /* a background redraw (Found Money still loading, every 8 s) comes in still: no replayed rise */
  #main.wow-quiet > *, #main.wow-quiet .tiles > * { animation-name: none; }

  /* the number tiles come in one after another */
  .tiles > .tile { animation: win-wow-rise 220ms cubic-bezier(.2, .7, .2, 1) backwards; }
  .tiles > :nth-child(2) { animation-delay: 30ms; }
  .tiles > :nth-child(3) { animation-delay: 60ms; }
  .tiles > :nth-child(4) { animation-delay: 90ms; }
  .tiles > :nth-child(5) { animation-delay: 120ms; }
  .tiles > :nth-child(6) { animation-delay: 150ms; }
  .tiles > :nth-child(n+7) { animation-delay: 180ms; }

  /* a popup: the dark back fades in, the card grows from 98% */
  .backdrop, .osa-back, .au-sc-back { animation: win-wow-fade 140ms ease-out backwards; }
  .modal, .osa-modal { animation: win-wow-pop 180ms cubic-bezier(.2, .7, .2, 1) backwards; }
  .popover { animation: win-wow-pop 140ms cubic-bezier(.2, .7, .2, 1) backwards; }

  /* buttons give a little under a tap */
  .tabs button, .periods button, .btn { transition: transform 90ms ease-out; }
  .tabs button:active, .periods button:active, .btn:active:not(:disabled) { transform: scale(.97); }

  /* Refresh turns while it works (the button is disabled until the numbers are back) */
  .btn.refresh:disabled .refresh-ico { animation: win-wow-spin 800ms linear infinite; }

  @keyframes win-wow-fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes win-wow-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes win-wow-pop { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: scale(1); } }
  @keyframes win-wow-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
}
@media (prefers-reduced-motion: reduce) {
  #main > *, .tiles > *, .backdrop, .osa-back, .au-sc-back, .modal, .osa-modal, .popover, .refresh-ico,
  .tabs button, .periods button, .btn {
    animation: none !important; transition: none !important;
  }
  .tabs button:active, .periods button:active, .btn:active { transform: none !important; }
}
