/* Scoped to: ss-tourism-template-travel_partner */
(function() {
  'use strict';
  var componentRoots = document.querySelectorAll('[data-component-slug="ss-tourism-template-travel_partner"]');
  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-tourism-template-travel_partner"] ~ ' + 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 cards = document.querySelectorAll(".feature-card"); const images = document.querySelectorAll(".feature-image"); cards.forEach(card => { card.addEventListener("click", () => { const index = card.dataset.index; cards.forEach(c => { c.classList.remove("bg-[#193A3F]", "text-white"); c.classList.add("border", "border-[#C7D2D1]", "text-[#193A3F]"); const title = c.querySelector(".feature-title"); if (title) { title.classList.remove("text-white"); title.classList.add("text-[#193A3F]"); } const icon = c.querySelector("img"); if (icon?.dataset.default) { icon.src = icon.dataset.default; } }); card.classList.add("bg-[#193A3F]", "text-white"); card.classList.remove("border", "border-[#C7D2D1]"); const activeTitle = card.querySelector(".feature-title"); if (activeTitle) { activeTitle.classList.remove("text-[#193A3F]"); activeTitle.classList.add("text-white"); } const activeIcon = card.querySelector("img"); if (activeIcon?.dataset.active) { activeIcon.src = activeIcon.dataset.active; } images.forEach(img => { img.classList.toggle("hidden", img.dataset.index !== index); if ( img.dataset.index === index && (!img.src || img.src === "") ) { img.src = img.dataset.nodeDefault; } }); }); });
  });
})();