/* Scoped to: ss-agriculture-template-faq */
(function() {
  'use strict';
  var componentRoots = document.querySelectorAll('[data-component-slug="ss-agriculture-template-faq"]');
  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-agriculture-template-faq"] ~ ' + 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 faqToggles = document.querySelectorAll(".faq-toggle"); faqToggles.forEach(function (toggle) { toggle.addEventListener("click", function () { const faqItem = this.closest(".faq-item"); const content = faqItem.querySelector(".faq-content"); const icon = this.querySelector(".faq-icon"); const isExpanded = this.getAttribute("aria-expanded") === "true"; faqToggles.forEach(function (otherToggle) { if (otherToggle !== toggle) { const otherItem = otherToggle.closest(".faq-item"); const otherContent = otherItem.querySelector(".faq-content"); const otherIcon = otherToggle.querySelector(".faq-icon"); otherContent.classList.add("hidden"); otherIcon.style.transform = "rotate(0deg)"; otherToggle.setAttribute("aria-expanded", "false"); otherItem.classList.remove("bg-gray-50"); } }); if (isExpanded) { content.classList.add("hidden"); icon.style.transform = "rotate(0deg)"; this.setAttribute("aria-expanded", "false"); faqItem.classList.remove("bg-gray-50"); } else { content.classList.remove("hidden"); icon.style.transform = "rotate(180deg)"; this.setAttribute("aria-expanded", "true"); faqItem.classList.add("bg-gray-50"); } }); });
  });
})();