
  document.addEventListener("DOMContentLoaded", function () {
    const menuIcon = document.querySelector(".mobile_menu_icon");
    const drawer = document.getElementById("mobile-drawer");
    const closeBtn = document.getElementById("close-drawer");
    const overlay = document.getElementById("drawer-overlay");

    function openDrawer() {
      drawer.classList.add("open");
      overlay.classList.add("visible");
    }

    function closeDrawer() {
      drawer.classList.remove("open");
      overlay.classList.remove("visible");
    }

    menuIcon.addEventListener("click", openDrawer);
    closeBtn.addEventListener("click", closeDrawer);
    overlay.addEventListener("click", closeDrawer);

    // Dropdown toggle
    document.querySelectorAll("#mobile-drawer .menu-item-has-children > a, #mobile-drawer .page_item_has_children > a").forEach(link => {
      link.addEventListener("click", function (e) {
        e.preventDefault();
        this.parentElement.classList.toggle("submenu-open");
      });
    });
  });

