/**
 * Scroll reveal utility for PrimeBridge frontend sections.
 * Adds .visible class to elements when they enter viewport.
 * Usage: data-reveal on any element to trigger fade-in-up.
 */

document.addEventListener('DOMContentLoaded', function () {
    const revealElements = document.querySelectorAll('[data-reveal]');

    if (!revealElements.length) return;

    const observer = new IntersectionObserver(
        (entries) => {
            entries.forEach((entry) => {
                if (entry.isIntersecting) {
                    entry.target.classList.add('visible');
                    observer.unobserve(entry.target);
                }
            });
        },
        {
            threshold: 0.15,
            rootMargin: '0px 0px -60px 0px',
        }
    );

    revealElements.forEach((el) => observer.observe(el));
});
