document.addEventListener('DOMContentLoaded', function() { const preloader = document.getElementById('preloader'); const lottiePlayer = document.querySelector('lottie-player'); if (lottiePlayer) { lottiePlayer.addEventListener('ready', function() { setTimeout(function() { preloader.classList.add('hidden'); setTimeout(function() { preloader.style.display = 'none'; }, 600); }, 1000); // Reduced to 1 second for faster mobile experience }); // Fallback: Hide preloader if animation fails to load within 4 seconds setTimeout(function() { if (!preloader.classList.contains('hidden')) { preloader.classList.add('hidden'); setTimeout(function() { preloader.style.display = 'none'; }, 600); } }, 4000); // Reduced to 4 seconds } else { // If lottie-player is not found, hide preloader immediately preloader.classList.add('hidden'); setTimeout(function() { preloader.style.display = 'none'; }, 600); } });