/*
 * Crush Image Motion Optimizer
 * Lightweight CSS-only movement for article images and equipment accents.
 */

.crush-motion-picture {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    vertical-align: middle;
}

.crush-motion-image,
article img.crush-motion-image,
.entry-content img.crush-motion-image,
.post img.crush-motion-image,
.site-main img.crush-motion-image,
#content img.crush-motion-image {
    opacity: 0 !important;
    transform: translateY(14px) scale(1.01) !important;
    transition:
        opacity 700ms ease,
        filter 900ms ease;
    will-change: opacity, transform;
}

.crush-motion-image.crush-motion-visible,
article img.crush-motion-image.crush-motion-visible,
.entry-content img.crush-motion-image.crush-motion-visible,
.post img.crush-motion-image.crush-motion-visible,
.site-main img.crush-motion-image.crush-motion-visible,
#content img.crush-motion-image.crush-motion-visible {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    animation: crush-soft-kenburns 7s ease-in-out infinite alternate;
    transform-origin: center center;
}

.crush-motion-image.crush-motion-visible:hover,
article img.crush-motion-image.crush-motion-visible:hover,
.entry-content img.crush-motion-image.crush-motion-visible:hover,
.post img.crush-motion-image.crush-motion-visible:hover,
.site-main img.crush-motion-image.crush-motion-visible:hover,
#content img.crush-motion-image.crush-motion-visible:hover {
    transform: translateY(-3px) scale(1.045) !important;
    filter: saturate(1.03) contrast(1.02);
}

.single-post .entry-content .crush-motion-image:first-of-type,
.single-post .wp-block-post-content .crush-motion-image:first-of-type {
    animation: crush-soft-kenburns 14s ease-in-out infinite alternate;
    transform-origin: center center;
}

@keyframes crush-soft-kenburns {
    0% {
        transform: translateY(0) scale(1);
    }
    100% {
        transform: translateY(-4px) scale(1.045);
    }
}

.crush-equipment-motion-stage {
    position: fixed;
    right: 0;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 0;
    z-index: 8;
    height: clamp(70px, 10vw, 118px);
    overflow: hidden;
    pointer-events: none;
    contain: layout paint;
}

.crush-equipment-motion-vehicle {
    position: absolute;
    bottom: 0;
    left: 0;
    width: clamp(112px, 14vw, 190px);
    height: auto;
    transform: translate3d(-240px, 0, 0);
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.22));
    animation: crush-equipment-drive 18s linear infinite;
    will-change: transform;
}

.crush-equipment-body {
    transform-origin: center bottom;
    animation: crush-equipment-idle 760ms ease-in-out infinite alternate;
}

.crush-equipment-wheel {
    transform-box: fill-box;
    transform-origin: center;
    animation: crush-equipment-wheel-spin 720ms linear infinite;
}

.crush-equipment-loader-arm {
    transform-box: fill-box;
    transform-origin: 8% 82%;
    animation: crush-equipment-arm-lift 2.9s ease-in-out infinite alternate;
}

.crush-equipment-bucket {
    transform-box: fill-box;
    transform-origin: 18% 72%;
    animation: crush-equipment-bucket-tilt 2.9s ease-in-out infinite alternate;
}

@keyframes crush-equipment-drive {
    0%,
    8% {
        opacity: 0;
        transform: translate3d(-240px, 0, 0);
    }

    12% {
        opacity: 0.96;
    }

    67% {
        opacity: 0.96;
        transform: translate3d(calc(100vw + 90px), 0, 0);
    }

    72%,
    100% {
        opacity: 0;
        transform: translate3d(calc(100vw + 90px), 0, 0);
    }
}

@keyframes crush-equipment-idle {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-1.5px);
    }
}

@keyframes crush-equipment-wheel-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes crush-equipment-arm-lift {
    0%,
    35% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(-4deg);
    }
}

@keyframes crush-equipment-bucket-tilt {
    0%,
    35% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(6deg);
    }
}

@media (max-width: 680px) {
    .crush-equipment-motion-stage {
        bottom: max(10px, env(safe-area-inset-bottom));
        height: 74px;
    }

    .crush-equipment-motion-vehicle {
        width: 116px;
        animation-duration: 16s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .crush-motion-image,
    .crush-motion-image.crush-motion-visible,
    .crush-motion-image.crush-motion-visible:hover,
    .single-post .entry-content .crush-motion-image:first-of-type,
    .single-post .wp-block-post-content .crush-motion-image:first-of-type,
    .crush-equipment-motion-stage,
    .crush-equipment-motion-vehicle,
    .crush-equipment-body,
    .crush-equipment-wheel,
    .crush-equipment-loader-arm,
    .crush-equipment-bucket {
        animation: none;
        opacity: 1;
        transform: none;
        transition: none;
        filter: none;
    }

    .crush-equipment-motion-stage {
        display: none;
    }
}
