/* Animate only UI-icon paths: SVG-level RTL flips and menu rotations stay intact. */
body .ic {
  --icon-motion-name: icon-motion-pop;
}

body .ic > path {
  transform-box: fill-box;
  transform-origin: center;
}

/* Directional motion follows each icon's existing SVG orientation. */
body .ic:is(.ic-arrow, .ic-chevron) {
  --icon-motion-name: icon-motion-nudge;
}

body .ic.ic-external {
  --icon-motion-name: icon-motion-external;
}

body .ic.ic-up {
  --icon-motion-name: icon-motion-up;
}

body .ic.ic-search {
  --icon-motion-name: icon-motion-search;
}

body .ic.ic-globe {
  --icon-motion-name: icon-motion-globe;
}

body .ic.ic-pin {
  --icon-motion-name: icon-motion-pin;
}

/* One brief response per hover; no touch hover or resting animation. */
@media (hover: hover) and (pointer: fine) {
  body .ic:hover > path,
  body :is(a, button):hover .ic > path {
    animation: var(--icon-motion-name, icon-motion-pop) .58s cubic-bezier(.22, .7, .3, 1) 1;
  }
}

/* Keyboard feedback remains available independently of pointer capabilities. */
body .ic:focus-visible > path,
body :is(a, button):focus-visible .ic > path {
  animation: var(--icon-motion-name, icon-motion-pop) .58s cubic-bezier(.22, .7, .3, 1) 1;
}

/* Touch responds only while pressing, never via a sticky synthetic hover. */
@media (hover: none), (pointer: coarse) {
  body :is(a, button):active .ic > path {
    animation: var(--icon-motion-name, icon-motion-pop) .28s ease-out 1;
  }
}

@keyframes icon-motion-pop {
  0%, 100% { transform: none; }
  32% { transform: rotate(-9deg) scale(1.14); }
  64% { transform: rotate(4deg) scale(1.04); }
}

@keyframes icon-motion-nudge {
  0%, 100% { transform: none; }
  34% { transform: translateX(2.4px) scale(1.08); }
  66% { transform: translateX(-.7px) scale(1.02); }
}

@keyframes icon-motion-external {
  0%, 100% { transform: none; }
  34% { transform: translate(1.7px, -1.7px) scale(1.08); }
  66% { transform: translate(-.5px, .5px); }
}

@keyframes icon-motion-up {
  0%, 100% { transform: none; }
  32% { transform: translateY(-2.5px) scale(1.08); }
  64% { transform: translateY(.7px) scale(1.02); }
}

@keyframes icon-motion-search {
  0%, 100% { transform: none; }
  32% { transform: rotate(-14deg) scale(1.15); }
  64% { transform: rotate(5deg) scale(1.04); }
}

@keyframes icon-motion-globe {
  0%, 100% { transform: none; }
  34% { transform: rotate(18deg) scale(1.08); }
  68% { transform: rotate(-6deg) scale(1.02); }
}

@keyframes icon-motion-pin {
  0%, 100% { transform: none; }
  34% { transform: translateY(-1.8px) scale(1.1); }
  66% { transform: translateY(.5px) scale(1.02); }
}

html.ui-motion-paused body .ic > path { animation-play-state: paused !important; }

/* Never override the SVG's resting transform when motion is disabled. */
@media (prefers-reduced-motion: reduce) {
  body .ic,
  body .ic > path {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  body .ic,
  body .ic > path {
    animation: none !important;
    transition: none !important;
  }
}
