sList.add('light-mode');
    } else {
        body.classList.remove('light-mode');
        body.classList.add('dark-mode');
    }

    // Save the selected theme to localStorage
    localStorage.setItem('theme', isDark ? 'light' : 'dark');
}

// Do not animate theme toggle on page load
document.addEventListener("DOMContentLoaded", () => {
    const themeToggle = document.getElementById('themeToggle');
    const toggleSpan = themeToggle.nextElementSibling; // The <span> element

    // Prevent animation on p