/* Each part can define its own gesture. Plain icons keep the default lift. */
@keyframes hib-product-icon-lift {
    0%, 100% { translate: 0 0; rotate: 0deg; }
    43% { translate: 0 -.24rem; rotate: -1.25deg; }
}

@keyframes hib-icon-door-swing {
    0%, 100% { transform: scaleX(1); }
    48%, 57% { transform: scaleX(.63); }
}

@keyframes hib-icon-door-light {
    0%, 100% { opacity: 0; }
    48%, 57% { opacity: .9; }
}

@keyframes hib-icon-tiles-settle {
    0%, 100% { transform: translate(0, 0); }
    42% { transform: translate(var(--tile-x), var(--tile-y)); }
}

@keyframes hib-icon-runpace-sweep {
    0%, 100% { transform: rotate(0deg); }
    34% { transform: rotate(-68deg); }
    69% { transform: rotate(25deg); }
}

[data-product-icon] { --hib-icon-gesture: none; }
[data-icon-part='runpace-needle'] {
    transform-box: view-box;
    transform-origin: 128px 163px;
    --hib-icon-gesture: hib-icon-runpace-sweep 900ms ease-in-out;
}
[data-icon-part='door'] {
    transform-box: view-box;
    transform-origin: 170px 139px;
    --hib-icon-gesture: hib-icon-door-swing 650ms ease-in-out;
}
[data-icon-part='door-light'] {
    opacity: 0;
    --hib-icon-gesture: hib-icon-door-light 650ms ease-in-out;
}
:is([data-icon-part='tile-top'], [data-icon-part='tile-left'], [data-icon-part='tile-right']) {
    --hib-icon-gesture: hib-icon-tiles-settle 250ms ease-out;
}
[data-icon-part='tile-top'] { --tile-x: 0px; --tile-y: -8px; }
[data-icon-part='tile-left'] { --tile-x: -5px; --tile-y: 6px; }
[data-icon-part='tile-right'] { --tile-x: 5px; --tile-y: 6px; }

.shop-product-heading > svg[data-product-icon='visual-login'] {
    flex: 0 0 auto;
    width: clamp(3.15rem, 7.4vw, 4.5rem);
    height: auto;
}

@media (prefers-reduced-motion: no-preference) {
    :is(.shop-product:has(:focus-visible), .sgp-hero:has(:focus-visible), .home-shop-feature:focus-visible)
        :is(.shop-product-icon, .shop-product-heading > :is(img, svg), .home-shop-icon > :is(img, svg), [data-icon-part]) {
        animation: var(--hib-icon-gesture, hib-product-icon-lift 380ms ease-in-out);
    }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    :is(.shop-product, .sgp-hero, .home-shop-feature):hover
        :is(.shop-product-icon, .shop-product-heading > :is(img, svg), .home-shop-icon > :is(img, svg), [data-icon-part]) {
        animation: var(--hib-icon-gesture, hib-product-icon-lift 380ms ease-in-out);
    }
}
