// Load HTML fragment from /includes/nav.html into elements with data-include="nav"
(function () {
    'use strict';
    async function loadNav() {
        try {
            const resp = await fetch('includes/nav.html', { cache: 'no-cache' });
            if (!resp.ok) return;
            const html = await resp.text();
            document.querySelectorAll('[data-include="nav"]').forEach(el => {
                el.innerHTML = html;
            });
        } catch (err) {
            console.error('Failed to load nav include', err);
        }
    }
    if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', loadNav);
    else loadNav();
})();
