/* ============================================================ ZS RECYCLING — Process Steps Scroll Animations ============================================================ */ (function () { 'use strict'; if (!('IntersectionObserver' in window)) { // Fallback: show all steps immediately document.querySelectorAll('.process-step, .process-step-card').forEach(function (el) { el.classList.add('visible'); }); return; } // ---- Timeline steps (vertical single-column) ---- var stepEls = document.querySelectorAll('.process-step'); if (stepEls.length > 0) { var stepObserver = new IntersectionObserver(function (entries) { entries.forEach(function (entry) { if (entry.isIntersecting) { entry.target.classList.add('visible'); stepObserver.unobserve(entry.target); } }); }, { threshold: 0.2, rootMargin: '0px 0px -60px 0px' }); stepEls.forEach(function (el) { stepObserver.observe(el); }); } // ---- Step cards (2-column grid) ---- var cardEls = document.querySelectorAll('.process-step-card'); if (cardEls.length > 0) { var cardObserver = new IntersectionObserver(function (entries) { entries.forEach(function (entry) { if (entry.isIntersecting) { entry.target.classList.add('visible'); cardObserver.unobserve(entry.target); } }); }, { threshold: 0.15, rootMargin: '0px 0px -40px 0px' }); cardEls.forEach(function (el, i) { el.style.transitionDelay = (i * 0.12) + 's'; cardObserver.observe(el); }); } })();