﻿/* ----------------------- */
/* Carosello               */
/* ----------------------- */
.carousel-container {
    overflow: hidden;
    position: relative;
    width: 100%;
    background: #f8f8f8;
    padding: 1rem 0;
}

.carousel-track {
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: scroll 40s linear infinite;
    will-change: transform; /* migliora performance */
}

    .carousel-track img {
        height: 7.5rem; /* circa 120px */
        aspect-ratio: 16/9; /* mantiene proporzioni */
        object-fit: cover;
        border-radius: 8px;
        pointer-events: none;
        user-select: none;
        box-shadow: 0 2px 6px rgba(0,0,0,0.15);
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

        .carousel-track img:hover {
            transform: scale(1.05);
            box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        }

/* Animazione scroll infinito */
@keyframes scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* ----------------------- */
/* Galleria Responsive     */
/* ----------------------- */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 1rem;
    margin: 2rem;
}

.gallery-item img {
    width: 100%;
    height: 12rem;
    object-fit: cover;
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    cursor: pointer;
}

    .gallery-item img:hover {
        transform: scale(1.07);
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    }

/* ----------------------- */
/* Ottimizzazione mobile   */
/* ----------------------- */
@media (max-width: 768px) {
    .carousel-track img {
        height: 6rem;
    }

    .gallery-item img {
        height: auto;
    }
}

@media (max-width: 480px) {
    .carousel-track img {
        height: 5rem;
    }

    .gallery-item img {
        height: auto;
    }
}

/* ----------------------- */
/* Lightbox Overlay        */
/* ----------------------- */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1050;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    overflow: hidden;
}

/* Immagine centrata */
.lightbox-content {
    max-width: 90%;
    max-height: 80%;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    animation: fadeIn 0.4s ease;
}

/* Animazione ingresso */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Pulsante chiudi */
.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
}

.close:hover {
    color: #ff5252;
    transform: scale(1.2);
}

/* Frecce di navigazione */
.prev, .next {
    text-decoration: none;
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    font-weight: bold;
    color: rgba(255,255,255,0.8);
    padding: 0.6rem 1rem;
    border-radius: 50%;
    background: transparent;
    backdrop-filter: blur(4px); /* effetto vetro */
    transition: background 0.3s, transform 0.2s, color 0.2s;
    user-select: none;
}

.prev:hover, .next:hover {
    color: #fff;
}

.prev {
    left: 30px;
}

.next {
    right: 30px;
}

/* Responsive frecce/lightbox */
@media (max-width: 768px) {
    .prev, .next {
        font-size: 2.2rem;
    }

    .close {
        font-size: 1.5rem;
    }
}
