let slides = document.querySelectorAll(".slide");
let indicators = document.querySelectorAll(".indicators span");
let index = 0;

function showSlide(i){
    slides.forEach(slide => slide.classList.remove("active"));
    indicators.forEach(dot => dot.classList.remove("active"));

    slides[i].classList.add("active");
    indicators[i].classList.add("active");
}

function nextSlide(){
    index++;
    if(index >= slides.length){
        index = 0;
    }
    showSlide(index);
}

setInterval(nextSlide, 5000);

indicators.forEach((dot, i)=>{
    dot.addEventListener("click", ()=>{
        index = i;
        showSlide(index);
    });
});
// Scroll Animation for Feature Section

const featureItems = document.querySelectorAll(".feature-item");

function revealFeatures(){
    const triggerBottom = window.innerHeight * 0.85;

    featureItems.forEach(item=>{
        const boxTop = item.getBoundingClientRect().top;

        if(boxTop < triggerBottom){
            item.classList.add("show");
        }
    });
}

window.addEventListener("scroll", revealFeatures);
revealFeatures();