/* =========================================================
   COLLÈGE PRIVÉ STANI ZALIOHOUAN
   CARROUSEL GALERIE ACCUEIL — VERSION 2
   Grandes images + défilement automatique fiable
   ========================================================= */

.home-top-gallery {
    padding: 22px 0 27px;
    background:
        radial-gradient(
            circle at 88% 5%,
            rgba(255,255,255,.045),
            transparent 25%
        ),
        linear-gradient(
            120deg,
            #2a160f 0%,
            #402217 58%,
            #56301f 100%
        );
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.home-top-gallery .container {
    width: min(1460px, calc(100% - 38px));
}

.home-top-gallery-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 17px;
}

.home-top-gallery-head > div:first-child {
    display: grid;
    gap: 3px;
}

.home-top-gallery-kicker {
    color: #ff9b7f;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .15em;
}

.home-top-gallery-head strong {
    color: #fff;
    font-size: 1rem;
    line-height: 1.25;
}

.home-top-gallery-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.home-gallery-control {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255,255,255,.26);
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    color: #fff;
    font: inherit;
    font-size: 1.3rem;
    font-weight: 900;
    cursor: pointer;
    transition:
        background .18s ease,
        color .18s ease,
        transform .18s ease;
}

.home-gallery-control:hover {
    background: #fff;
    color: #3b2418;
    transform: translateY(-1px);
}

.home-top-gallery-link {
    margin-left: 7px;
    color: #ffc1ae;
    font-size: .80rem;
    font-weight: 850;
    white-space: nowrap;
}

.home-top-gallery-link:hover {
    color: #fff;
}

/* Le viewport est maintenant le vrai conteneur que JS fait défiler. */
.home-top-gallery-viewport {
    position: relative;
    width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    border-radius: 22px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.home-top-gallery-viewport::-webkit-scrollbar {
    display: none;
}

/* width:max-content est la correction essentielle :
   la piste devient réellement plus large que la fenêtre. */
.home-top-gallery-track {
    display: flex;
    align-items: stretch;
    gap: 18px;
    width: max-content;
    min-width: 100%;
    overflow: visible;
}

/* Environ trois grandes images visibles sur un écran de bureau. */
.home-top-gallery-slide {
    position: relative;
    display: block;
    flex: 0 0 clamp(365px, 29vw, 445px);
    width: clamp(365px, 29vw, 445px);
    height: 255px;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,.12);
    background: #2e1a12;
    box-shadow:
        0 15px 34px rgba(0,0,0,.24),
        inset 0 0 0 1px rgba(255,255,255,.03);
    text-decoration: none;
}

.home-top-gallery-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition:
        transform .6s ease,
        filter .6s ease;
}

.home-top-gallery-slide:hover img {
    transform: scale(1.045);
    filter: brightness(1.03);
}

.home-top-gallery-slide::after {
    content: "";
    position: absolute;
    inset: 30% 0 0;
    background:
        linear-gradient(
            to bottom,
            transparent 0%,
            rgba(28,13,7,.18) 25%,
            rgba(28,13,7,.88) 100%
        );
    pointer-events: none;
}

.home-top-gallery-caption {
    position: absolute;
    z-index: 2;
    left: 17px;
    right: 17px;
    bottom: 15px;
    color: #fff;
}

.home-top-gallery-caption strong,
.home-top-gallery-caption small {
    display: block;
}

.home-top-gallery-caption strong {
    overflow: hidden;
    font-size: .92rem;
    line-height: 1.25;
    font-weight: 900;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.home-top-gallery-caption small {
    margin-top: 4px;
    color: rgba(255,255,255,.77);
    font-size: .75rem;
}

.home-top-gallery-viewport::before,
.home-top-gallery-viewport::after {
    content: "";
    position: absolute;
    z-index: 4;
    top: 0;
    bottom: 0;
    width: 26px;
    pointer-events: none;
}

.home-top-gallery-viewport::before {
    left: 0;
    background:
        linear-gradient(
            to right,
            rgba(42,22,15,.25),
            transparent
        );
}

.home-top-gallery-viewport::after {
    right: 0;
    background:
        linear-gradient(
            to left,
            rgba(42,22,15,.25),
            transparent
        );
}

@media (max-width: 1250px) {
    .home-top-gallery-slide {
        flex-basis: 370px;
        width: 370px;
        height: 235px;
    }
}

@media (max-width: 900px) {
    .home-top-gallery {
        padding: 18px 0 22px;
    }

    .home-top-gallery-head {
        align-items: center;
    }

    .home-top-gallery-slide {
        flex-basis: 335px;
        width: 335px;
        height: 220px;
    }
}

@media (max-width: 620px) {
    .home-top-gallery .container {
        width: min(100% - 24px, 1460px);
    }

    .home-top-gallery-head {
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 13px;
    }

    .home-top-gallery-kicker {
        font-size: .65rem;
    }

    .home-top-gallery-head strong {
        font-size: .88rem;
    }

    .home-top-gallery-actions {
        gap: 6px;
    }

    .home-gallery-control {
        width: 36px;
        height: 36px;
        font-size: 1.05rem;
    }

    .home-top-gallery-link {
        display: none;
    }

    .home-top-gallery-track {
        gap: 13px;
    }

    .home-top-gallery-slide {
        flex-basis: 86vw;
        width: 86vw;
        max-width: 390px;
        height: 235px;
        border-radius: 18px;
    }

    .home-top-gallery-caption {
        left: 15px;
        right: 15px;
        bottom: 14px;
    }

    .home-top-gallery-caption strong {
        font-size: .88rem;
    }
}

@media (max-width: 390px) {
    .home-top-gallery-slide {
        flex-basis: 88vw;
        width: 88vw;
        height: 215px;
    }
}
