/* AI:DA design system 2.0 — movement.
 *
 * Everything here is behind prefers-reduced-motion: no-preference. With the
 * setting on, nothing moves and nothing is missing: every element is already
 * in its final place without this file.
 *
 * Durations and the curve come from tokens.css. There is no overshoot and no
 * bounce anywhere: --ease settles, it does not spring past the target.
 *
 * The patterns are the ones from Kinetics (kinetics.colorion.co) that fit the
 * system — Stagger Entrance, Underline Draw, Skeleton to Content, Success
 * Check, Tab Pill Glide (as a line), Odometer Count-up (motion.js) — rewritten
 * on these tokens. The springy ones (Toast Overshoot, Elastic Progress) and the
 * whole "Surface & Motion" shelf are left out on purpose.
 */

@media (prefers-reduced-motion: no-preference) {

  /* Rows of a list come in one after another, once, on first render.
     <a class="aida-row aida-enter" style="--i: 3"> — --i is the row index. */
  .aida-enter {
    animation: aida-enter var(--motion-slow) var(--ease) backwards;
    animation-delay: calc(min(var(--i, 0), 8) * var(--stagger));
  }
  @keyframes aida-enter {
    from { opacity: 0; transform: translateY(8px); }
  }

  /* Content replacing a skeleton. */
  .aida-reveal { animation: aida-reveal var(--motion) var(--ease) backwards; }
  @keyframes aida-reveal { from { opacity: 0; } }

  /* A link keeps its 1px underline; on hover a 2px one draws over it from
     the left. Opt in with .aida-link--draw next to .aida-link. */
  .aida-link--draw {
    text-decoration: none;
    background:
      linear-gradient(currentColor, currentColor) 0 100% / 0% 2px no-repeat,
      linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
    padding-bottom: 2px;
    transition: background-size var(--motion) var(--ease);
  }
  .aida-link--draw:hover {
    background-size: 100% 2px, 100% 1px;
  }

  /* The toast rises into place. */
  .aida-toast { animation: aida-toast-in var(--motion) var(--ease) backwards; }
  @keyframes aida-toast-in { from { opacity: 0; transform: translateY(12px); } }

  /* "Пройден": the tick draws itself once.
     <svg class="aida-done" viewBox="0 0 24 24"><path pathLength="1" d="M5 12.5l4.5 4.5L19 7.5"/></svg> */
  .aida-done path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: aida-draw var(--motion-slow) var(--ease) forwards;
  }
  @keyframes aida-draw { to { stroke-dashoffset: 0; } }

  /* The disclosure opens by height where the browser can animate to auto
     (Chromium 129+); elsewhere it simply opens. */
  .aida-disclosure { interpolate-size: allow-keywords; }
  .aida-disclosure::details-content {
    transition: height var(--motion) var(--ease), content-visibility var(--motion) allow-discrete;
    height: 0;
    overflow: clip;
  }
  .aida-disclosure[open]::details-content { height: auto; }

  /* Moving between screens of the same app (View Transitions). */
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: var(--motion);
    animation-timing-function: var(--ease);
  }
}

/* The sliding tab line. motion.js adds .aida-tabs--glide only when motion is
   allowed and it has measured the tabs, so without the script (or with
   reduced motion) the ordinary underline of .aida-tab stays. */
.aida-tabs--glide { position: relative; }
.aida-tabs--glide .aida-tab[aria-selected='true'] { border-bottom-color: transparent; }
.aida-tabs--glide::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: var(--glide-w, 0);
  transform: translateX(var(--glide-x, 0));
  background: var(--sun);
  transition: transform var(--motion) var(--ease), width var(--motion) var(--ease);
}
