document.addEventListener('DOMContentLoaded', function() {
    const slideshow = document.getElementById('heroSlideshow');
    const slides = slideshow.querySelectorAll('img');
    let currentSlide = 0;
    
    slides.forEach((s) => s.style.opacity = '0');

    setTimeout(() => {
        slides[0].style.opacity = '1';
    }, 100);
    
    function nextSlide() {
        slides[currentSlide].style.opacity = 0;
        setTimeout(() => {
            currentSlide = (currentSlide + 1) % slides.length;
            slides[currentSlide].style.opacity = 1;
        }, 500);
    }
    
    setInterval(nextSlide, 4000);

    // Fade project cards
    const cards = document.querySelectorAll('.project-card');
    cards.forEach((card, index) => {
        card.style.opacity = '0';
        setTimeout(() => {
            card.style.transition = 'opacity 0.5s ease';
            card.style.opacity = '1';
        }, 100 * index);
    });
});
