/* Scoped to: politician-party-template-quote */
(function() {
  'use strict';
  var componentRoots = document.querySelectorAll('[data-component-slug="politician-party-template-quote"]');
  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="politician-party-template-quote"] ~ ' + 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
    (function () { const textEl = document.querySelector(".final__bottom-text"); const imageWrap = document.querySelector(".quote-image-wrap"); if (!textEl || !imageWrap) return; const fullText = textEl.textContent.trim(); const authorIndex = fullText.lastIndexOf("~"); if (authorIndex === -1) return; const mainText = fullText.slice(0, authorIndex).trim(); const authorText = fullText.slice(authorIndex).trim(); textEl.innerHTML = ""; const chars = []; mainText.split("").forEach(char => { const span = document.createElement("span"); span.textContent = char; span.style.color = "#999999"; textEl.appendChild(span); chars.push(span); }); const authorSpan = document.createElement("span"); authorSpan.className = "quote-author"; authorSpan.textContent = " " + authorText; textEl.appendChild(authorSpan); function onScroll() { const rect = textEl.getBoundingClientRect(); const windowHeight = window.innerHeight; const start = windowHeight * 0.85; const end = windowHeight * 0.3; let progress = (start - rect.top) / (start - end); progress = Math.min(Math.max(progress, 0), 1); const visibleChars = Math.floor(progress * chars.length); chars.forEach((char, i) => { char.style.color = i < visibleChars ? "#000000" : "#999999"; }); if (progress >= 1) { imageWrap.style.opacity = "1"; } else { imageWrap.style.opacity = "0"; } } window.addEventListener("scroll", onScroll); onScroll(); })();
  });
})();