/*
 * cx-motion-float-pulse.css — the six ambient animations of the canvas
 * (MKT-WP-REPLICA-MOTION-FLOAT-PULSE). Marketing switches one on from Elementor,
 * Advanced > CSS Classes:
 *
 *   cx-float        one 4.8 s pass, rises 12 px and comes back  [canvas l.517/524 .cv-coins cvFloat, 8 s loop]
 *   cx-float-sm     one 4.8 s pass, rises 8 px and comes back   [canvas l.454/463 .cv-chip floatY, 6 s loop]
 *   cx-nudge-x      3 x 1.6 s, -3 px <-> 4 px                    [canvas l.237/238 .cs-arrow nudge, loop]
 *   cx-pulse-ring   3 x 1.4 s ring that grows and fades          [canvas l.404/438 .hww-n::after hwRing, loop]
 *   cx-pulse-dot    2 x 2 s halo around a dot                     [canvas l.81/83, l.165/166 pulse, dkp, loop]
 *   cx-sway         one 3.2 s pass, rocks +-5 deg                 [canvas l.594/595 .cb-launch img cbsway, loop]
 *
 * Owner 2026-11-09, «Quitar y parar solas» (MKT-WP-MOTION-NO-AUTOPLAY-NO-PAUSE-BUTTONS): the
 * canvas loops them; here each one plays ONCE, 5 s at most, from the moment its element is
 * on screen (cx-motion-float-pulse.js writes `cx-fp-in` then), and rests on its final frame,
 * which is the element in its own place (the ring and the halo faded out). Nothing to
 * pause, no pause control. scripts/check_motion_no_autoplay.py keeps every count finite and
 * every pass under 5 s.
 *
 * Everything lives under `html.cx-motion` and inside `prefers-reduced-motion:
 * no-preference` (docs/knowledge/motion-module.md §3), so with no JS, or with reduced
 * motion, the element simply sits still in its final place. The movement is written
 * with the independent `translate` / `rotate` properties, not `transform`, so it
 * adds to a Transform set in the widget's Advanced tab instead of replacing it.
 * Scope sits inside :where() (0 specificity): what the widget's Style tab sets wins.
 *
 * Tokens only (--cx-* from style.css). Keyframe names start with `cx-`.
 */

@media (prefers-reduced-motion: no-preference) {
  /* ---- float: the element rises and comes back ---- */
  :where(html.cx-motion .cx-float.cx-fp-in) {
    animation: cx-float-12 4.8s ease-in-out 1;
  }

  :where(html.cx-motion .cx-float-sm.cx-fp-in) {
    animation: cx-float-8 4.8s ease-in-out 1;
  }

  @keyframes cx-float-12 {
    0%,
    100% {
      translate: 0 0;
    }

    50% {
      translate: 0 -12px;
    }
  }

  @keyframes cx-float-8 {
    0%,
    100% {
      translate: 0 0;
    }

    50% {
      translate: 0 -8px;
    }
  }

  /* ---- nudge: a small left-right push on an arrow; rests where it starts ---- */
  :where(html.cx-motion .cx-nudge-x.cx-fp-in) {
    animation: cx-nudge-x 1.6s ease-in-out 3;
  }

  @keyframes cx-nudge-x {
    0%,
    100% {
      translate: 0 0;
    }

    25% {
      translate: -3px 0;
    }

    75% {
      translate: 4px 0;
    }
  }

  /* ---- pulse ring: a 2 px ring that grows to 1.7x and fades (circular hosts); at rest it
   * is faded out, so the element is seen as it is ---- */
  :where(html.cx-motion .cx-pulse-ring) {
    position: relative;
  }

  :where(html.cx-motion .cx-pulse-ring)::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid hsl(var(--cx-primary-hsl));
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
  }

  :where(html.cx-motion .cx-pulse-ring.cx-fp-in)::after {
    animation: cx-pulse-ring 1.4s ease-out 3;
  }

  @keyframes cx-pulse-ring {
    from {
      transform: scale(1);
      opacity: 0.9;
    }

    to {
      transform: scale(1.7);
      opacity: 0;
    }
  }

  /* ---- pulse dot: a green halo that spreads and fades around a small dot ---- */
  :where(html.cx-motion .cx-pulse-dot.cx-fp-in) {
    animation: cx-pulse-dot 2s ease-out 2;
  }

  @keyframes cx-pulse-dot {
    0% {
      box-shadow: 0 0 0 0 hsl(var(--cx-success-hsl) / 0.55);
    }

    100% {
      box-shadow: 0 0 0 9px hsl(var(--cx-success-hsl) / 0);
    }
  }

  /* ---- sway: a mascot rocking from its feet, once ---- */
  :where(html.cx-motion .cx-sway) {
    transform-origin: 50% 90%;
  }

  :where(html.cx-motion .cx-sway.cx-fp-in) {
    animation: cx-sway 3.2s ease-in-out 1;
  }

  @keyframes cx-sway {
    0%,
    100% {
      rotate: 0deg;
    }

    20% {
      rotate: -5deg;
    }

    40% {
      rotate: 3deg;
    }

    60% {
      rotate: -3deg;
    }

    80% {
      rotate: 0deg;
    }
  }
}
