// Hero carousel
(function () {
    const slides = document.querySelectorAll('.slide');
    const dots = document.querySelectorAll('.dot');
    let current = 0;

    function show(i) {
        slides.forEach(s => s.classList.remove('active'));
        dots.forEach(d => d.classList.remove('active'));
        slides[i].classList.add('active');
        dots[i].classList.add('active');
    }

    dots.forEach((d, i) => d.addEventListener('click', () => {
        current = i;
        show(i);
    }));

    if (slides.length > 0) {
        setInterval(() => {
            current = (current + 1) % slides.length;
            show(current);
        }, 4500);
    }

    // Tabs (Cars/Bikes)
    document.querySelectorAll('.tab').forEach(t => {
        t.addEventListener('click', () => {
            document.querySelectorAll('.tab').forEach(x => x.classList.remove('active'));
            t.classList.add('active');
        });
    });
})();
