// LOADER.js
// Manages the page loader

let loaderHidden = false;

// Hide the page loader after x seconds once DOM is loaded
document.addEventListener('DOMContentLoaded', function () {
     const pageLoader = document.getElementById('pageLoader');

     setTimeout(function () {
          pageLoader.classList.add('hidden');
          loaderHidden = true;
     }, 2800);
});

// Maximum timeout of 8 seconds - redirect to error page if loader still showing
setTimeout(function () {
     if (!loaderHidden) {
          window.location.href = '../error.html'; // Change to your error page path
     }
}, 8000);
