/**
 * KNOLL Theme - Off-Canvas Scroll Fix
 * 
 * Fixes the issue where Elementor Pro off-canvas widgets leave
 * scroll-blocking classes on the body element after closing.
 * 
 * @package KNOLL_Theme
 * @version 1.0.0
 */

/* 
 * Force scroll restoration when no off-canvas is visible
 * This acts as a safety net when JavaScript cleanup fails
 */
body:not(:has(.e-off-canvas[aria-hidden="false"])).e-off-canvas__no-scroll,
body:not(:has(.e-off-canvas[aria-hidden="false"])).e-off-canvas__no-scroll-animation {
    overflow: auto !important;
}

/* 
 * Alternative approach for browsers that don't support :has()
 * Auto-cleanup animation classes after a reasonable timeout
 */
body.e-off-canvas__no-scroll-animation {
    animation: knoll-cleanup-scroll-lock 3s forwards;
}

@keyframes knoll-cleanup-scroll-lock {
    0% { 
        overflow: hidden; 
    }
    95% { 
        overflow: hidden; 
    }
    100% { 
        overflow: auto !important;
    }
}

/* 
 * Restore scroll on user interaction when no off-canvas is visible
 * This handles cases where users try to scroll but can't
 */
body.e-off-canvas__no-scroll-animation:hover,
body.e-off-canvas__no-scroll-animation:focus-within {
    overflow: auto !important;
}

/* 
 * Mobile-specific fixes - be more aggressive about restoring scroll
 */
@media (max-width: 768px) {
    body.e-off-canvas__no-scroll-animation {
        animation-duration: 2s; /* Faster cleanup on mobile */
    }
    
    /* Force scroll restoration on touch events */
    body.e-off-canvas__no-scroll-animation:active {
        overflow: auto !important;
    }
}

/* 
 * Accessibility improvement - ensure scroll is restored 
 * when users navigate with keyboard
 */
body.e-off-canvas__no-scroll-animation:focus-within {
    overflow: auto !important;
}

