/* ==========================================================
   ANIMATIONS — keyframes + icon hover animations.
   Each icon animates when its parent .tile is hovered, or — on touch
   screens — when it scrolls into view (.is-play, set by js/touch-play.js).
   ========================================================== */

/* Shared: animate SVG groups around their own centre */
.ico g, .ico path, .ico circle { transform-box: fill-box; transform-origin: center; }

/* Two seats bounce one after another */
.ico--seats .s1, .ico--seats .s2 { transition: transform .4s var(--ease-spring); }
.tile:is(:hover, .is-play) .ico--seats .s1 { transform: translateY(-7px) rotate(-4deg); }
.tile:is(:hover, .is-play) .ico--seats .s2 { transform: translateY(-7px) rotate(4deg); transition-delay: .09s; }

/* Coin drops into the slot, lamp lights up */
.ico--coin .coin { transition: transform .55s cubic-bezier(.55, 0, .8, .2), opacity .2s .5s; }
.tile:is(:hover, .is-play) .ico--coin .coin { transform: translateY(26px); opacity: 0; }
.ico--coin .lamp { fill: transparent; transition: fill .15s; }
.tile:is(:hover, .is-play) .ico--coin .lamp { fill: var(--c-hot); transition-delay: .5s; }

/* Track draws itself while a dot races along it.
   Driven from JS (js/icon-track.js) so line and dot stay in sync
   in every browser. Here: only the resting state. */
.ico--track .trk { stroke-dasharray: 100; stroke-dashoffset: 0; }
.ico--track .dot { opacity: 0; transition: opacity .2s; }
.ico--track.is-running .dot { opacity: 1; }

/* Car drives: wheels spin, body bobs, road scrolls */
.ico--car .road { stroke-dasharray: 8 8; }
.tile:is(:hover, .is-play) .ico--car .wheel { animation: spin .5s linear infinite; }
.tile:is(:hover, .is-play) .ico--car .car   { animation: bob .18s ease-in-out infinite alternate; }
.tile:is(:hover, .is-play) .ico--car .road  { animation: road .3s linear infinite; }

/* Collaboration "×" spins */
.ico--cross .x { transition: transform .6s var(--ease-spring); }
.tile:is(:hover, .is-play) .ico--cross .x { transform: rotate(135deg); }

/* Platform layers spread apart */
.ico--layers .l1, .ico--layers .l3 { transition: transform .4s var(--ease-spring); }
.tile:is(:hover, .is-play) .ico--layers .l1 { transform: translateY(-10px); }
.tile:is(:hover, .is-play) .ico--layers .l3 { transform: translateY(10px); }

/* Misc */
.blink { animation: blink 1.1s steps(1) infinite; }

/* Keyframes */
@keyframes blink    { 50% { opacity: 0; } }
@keyframes marquee  { to { transform: translateX(-50%); } }
@keyframes ping     { 0% { transform: scale(.7); opacity: .9; } 80%, 100% { transform: scale(1.7); opacity: 0; } }
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes bob      { to { transform: translateY(-1.5px); } }
@keyframes road     { to { stroke-dashoffset: 16; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
