/* Performance Fix for High CPU Usage from Infinite Animations */

/* Disable animations when page is fully loaded and not actively loading */
body:not(.is-loading) .loading-spinner-hammer,
body:not(.is-loading) .loading-spinner-gear,
body:not(.is-loading) .skeleton-loading,
body:not(.is-loading) .audio-loading {
    animation: none !important;
    display: none !important;
}

/* Pause carousel animations when not hovered */
.carousel-item:not(:hover) .pulse-animation {
    animation-play-state: paused;
}

/* Performance optimizations */
.loading-container {
    contain: layout style paint;
    will-change: auto;
}

/* Respect user's reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Vertical mode specific optimizations */
@media (orientation: portrait) {
    /* Reduce animation complexity in portrait mode */
    .loading-spinner-hammer {
        animation: simple-spin 2s linear infinite;
    }

    @keyframes simple-spin {
        from { transform: rotate(0deg); }
        to { transform: rotate(360deg); }
    }
}

/* Hide loading states after reasonable timeout */
body.page-loaded .loading-state,
body.page-loaded .loading-container {
    display: none !important;
}