(function () {
  const toggle = document.querySelector('[data-mobile-toggle]');
  const links = document.querySelector('[data-nav-links]');
  if (toggle && links) {
    toggle.addEventListener('click', () => {
      links.classList.toggle('open');
    });
  }

  document.querySelectorAll('[data-nav-links] a').forEach((link) => {
    link.addEventListener('click', () => links?.classList.remove('open'));
  });
})();
