/* THEME HANDLING */
export function initTheme() {
    const themeBtn = document.getElementById('themeToggle');
    const html = document.documentElement;

    if (localStorage.getItem('theme') === 'light') {
        html.setAttribute('data-theme', 'light');
    }

    if (themeBtn) {
        themeBtn.addEventListener('click', () => {
            const current = html.getAttribute('data-theme');
            let next = 'light';
            if (current === 'light') next = 'dark';

            html.setAttribute('data-theme', next);
            localStorage.setItem('theme', next);
        });
    }
}
