const hamburger = document.querySelector('.hamburger');
const mobileMenu = document.querySelector('.mobile-menu');

const yearSpan = document.getElementById('year');
const currentYear = new Date().getFullYear();
yearSpan.textContent = currentYear;

hamburger.addEventListener('click', () => {
    mobileMenu.classList.toggle('active');
});


window.addEventListener('resize', () => {
    if (window.innerWidth > 1300) {
        mobileMenu.classList.remove('active');
    }
});

// ---------------- del carrusel ----------------
let index = 0;

function showSlide(n) {
    const slides = document.querySelectorAll('.slide');
    if (n >= slides.length) index = 0;
    if (n < 0) index = slides.length - 1;

    const newTransformValue = -index * 100 + '%';
    document.querySelector('.slider-container').style.transform = `translateX(${newTransformValue})`;
}

function moveSlide(step) {
    showSlide(index += step);
}

showSlide(index);
setInterval(() => moveSlide(1), 8000);
