/* Scoped to: ss-interior-flooring-template-header */
(function() {
  'use strict';
  var componentRoots = document.querySelectorAll('[data-component-slug="ss-interior-flooring-template-header"]');
  componentRoots.forEach(function(componentRoot) {
    // Helper to query within component, with fallback to document for sibling elements
    var $ = function(sel) { 
      return componentRoot.querySelector(sel) || document.querySelector('[data-component-slug="ss-interior-flooring-template-header"] ~ ' + sel) || document.querySelector(sel);
    };
    var $$ = function(sel) { 
      var results = componentRoot.querySelectorAll(sel);
      return results.length ? results : document.querySelectorAll(sel);
    };
    // Original component JS runs in this scope
    const flooringMenuBtn = document.getElementById("flooring-menu-btn"); const flooringCloseBtn = document.getElementById("flooring-close-btn"); const flooringMobileMenu = document.getElementById("flooring-mobile-menu"); const flooringOverlay = document.getElementById("flooring-overlay"); function toggleFlooringMenu() { flooringMobileMenu.classList.toggle("-translate-x-full"); if (flooringOverlay) flooringOverlay.classList.toggle("hidden"); } if (flooringMenuBtn) flooringMenuBtn.addEventListener("click", toggleFlooringMenu); if (flooringCloseBtn) flooringCloseBtn.addEventListener("click", toggleFlooringMenu); if (flooringOverlay) flooringOverlay.addEventListener("click", toggleFlooringMenu); (function () { var path = window.location.pathname; if (path.charAt(0) === "/") path = path.substring(1); if (path.charAt(path.length - 1) === "/") path = path.slice(0, -1); if (path.indexOf("page/") === 0) path = path.substring(5); var currentPath = path.toLowerCase(); if (!currentPath) currentPath = "home"; var desktopLinks = document.querySelectorAll('header nav ul a[data-node^="nav_link_"]'); desktopLinks.forEach(function (link) { var href = link.getAttribute("href") || ""; var linkPath = href.replace(/^\/|\/$/g, "").toLowerCase(); if (linkPath === currentPath || (currentPath === "home" && (linkPath === "" || linkPath === "home"))) { link.classList.remove("text-gray-500", "font-medium"); link.classList.add("text-gray-900", "font-semibold"); } else { link.classList.remove("text-gray-900", "font-semibold"); link.classList.add("text-gray-500", "font-medium"); } }); var mobileLinks = document.querySelectorAll('#flooring-mobile-menu a[data-node^="m_nav_"]'); mobileLinks.forEach(function (link) { var href = link.getAttribute("href") || ""; var linkPath = href.replace(/^\/|\/$/g, "").toLowerCase(); if (linkPath === currentPath || (currentPath === "home" && (linkPath === "" || linkPath === "home"))) { link.classList.add("text-[#965C00]", "font-semibold"); } else { link.classList.remove("text-[#965C00]", "font-semibold"); } }); })();
  });
})();