let index = 0;
const slides = document.querySelectorAll(".carousel img");

function showSlide() {
    slides.forEach(img => img.classList.remove("active"));
    slides[index].classList.add("active");
    index = (index + 1) % slides.length;
}

setInterval(showSlide, 2000);

/* Reveal on scroll untuk section member info */
const revealSection = document.getElementById('reveal-section');

function handleScrollReveal() {
    if (!revealSection) return;
    const { top, height } = revealSection.getBoundingClientRect();
    const windowHeight = window.innerHeight;

    if (top < windowHeight - 100 && top + height > 100) {
        revealSection.classList.add('active');
        window.removeEventListener('scroll', handleScrollReveal);
    }
}

window.addEventListener('scroll', handleScrollReveal);
window.addEventListener('load', () => {
    handleScrollReveal();
});