(function() { const toggleBtn = document.getElementById('dark-mode-toggle-btn'); const body = document.body; const storageKey = 'twentytwentyfive-dark-mode'; // Check for saved preference or default to enabled if (localStorage.getItem(storageKey) === 'enabled' || localStorage.getItem(storageKey) === null) { body.classList.add('is-dark-theme'); } if (toggleBtn) { toggleBtn.addEventListener('click', function() { body.classList.toggle('is-dark-theme'); if (body.classList.contains('is-dark-theme')) { localStorage.setItem(storageKey, 'enabled'); } else { localStorage.setItem(storageKey, 'disabled'); } }); } })();