class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
feather.replace();
// Mobile menu toggle functionality
const btn = this.shadowRoot.querySelector('.nav-toggle');
const nav = this.shadowRoot.getElementById('primary-nav');
const headerHeight = 64; // Fixed header height for mobile
if (btn && nav) {
btn.addEventListener('click', function () {
const expanded = btn.getAttribute('aria-expanded') === 'true';
btn.setAttribute('aria-expanded', String(!expanded));
nav.classList.toggle('open');
document.body.classList.toggle('menu-open', !expanded);
});
}
// Set fixed header height and padding
document.documentElement.style.setProperty('--header-h', `${headerHeight}px`);
document.body.style.paddingTop = `${headerHeight}px`;
}
}
customElements.define('custom-navbar', CustomNavbar);