/* Homepage editoriale: il layout arriva già completo dal server. */
body.rcd-home .rcd-featured-editorial .acn-carousel-controls,
body.rcd-home .rcd-featured-editorial .acn-carousel-dots {
    display: none !important;
}

body.rcd-home .rcd-featured-footer {
    justify-content: flex-end;
    margin-top: 1.25rem;
}

body.rcd-home .rcd-featured-footer .acn-view-all {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    width: auto;
    text-decoration: none;
}

body.rcd-home .acn-card-img {
    overflow: hidden;
    background: #e9eef3;
}

body.rcd-home .acn-card-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Le sezioni sotto la prima schermata vengono renderizzate solo quando si
 * avvicinano al viewport. Lo spazio stimato evita salti durante lo scroll. */
@supports (content-visibility: auto) {
    body.rcd-home .rcd-home-deferred-section {
        content-visibility: auto;
        contain-intrinsic-size: auto 720px;
    }
}

@media (min-width: 992px) {
    body.rcd-home .rcd-featured-editorial .acn-carousel {
        overflow: visible !important;
    }

    body.rcd-home .rcd-featured-editorial .acn-carousel-track {
        display: grid !important;
        grid-template-columns: minmax(0, 1.45fr) repeat(2, minmax(0, .775fr));
        grid-template-rows: repeat(2, minmax(210px, 1fr));
        gap: 1rem;
        width: 100% !important;
        transform: none !important;
        transition: none !important;
    }

    body.rcd-home .rcd-featured-editorial .acn-carousel-card {
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        height: 100%;
        margin: 0 !important;
    }

    body.rcd-home .rcd-featured-editorial .acn-carousel-card:nth-child(1) {
        grid-column: 1;
        grid-row: 1 / 3;
    }

    body.rcd-home .rcd-featured-editorial .acn-carousel-card:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }

    body.rcd-home .rcd-featured-editorial .acn-carousel-card:nth-child(3) {
        grid-column: 3;
        grid-row: 1;
    }

    body.rcd-home .rcd-featured-editorial .acn-carousel-card:nth-child(4) {
        grid-column: 2;
        grid-row: 2;
    }

    body.rcd-home .rcd-featured-editorial .acn-carousel-card:nth-child(5) {
        grid-column: 3;
        grid-row: 2;
    }

    body.rcd-home .rcd-featured-editorial .acn-carousel-card:nth-child(n + 6) {
        display: none !important;
    }

    body.rcd-home .rcd-featured-editorial .acn-card-link {
        height: 100%;
        overflow: hidden;
        border-radius: .55rem;
        background: #fff;
        text-decoration: none;
    }

    body.rcd-home .rcd-featured-editorial .rcd-featured-secondary .acn-card-img {
        aspect-ratio: 16 / 9;
        height: auto;
        min-height: 0;
    }

    body.rcd-home .rcd-featured-editorial .rcd-featured-secondary .acn-card-body {
        padding: 1rem;
    }

    body.rcd-home .rcd-featured-editorial .rcd-featured-secondary .acn-card-title {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        font-size: 1.1rem;
        line-height: 1.18;
    }
}

@media (max-width: 767.98px) {
    body.rcd-home .rcd-mobile-snap-carousel {
        overflow-x: auto !important;
        overflow-y: hidden !important;
        margin-right: -1rem;
        padding-right: 1rem;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: 0;
        overscroll-behavior-inline: contain;
        scrollbar-width: none;
        touch-action: pan-x;
        -webkit-overflow-scrolling: touch;
    }

    body.rcd-home .rcd-mobile-snap-carousel::-webkit-scrollbar {
        display: none;
    }

    body.rcd-home .rcd-mobile-snap-carousel .acn-carousel-track {
        display: flex !important;
        gap: 1rem;
        width: max-content !important;
        padding-bottom: .35rem;
        transform: none !important;
        transition: none !important;
    }

    body.rcd-home .rcd-mobile-snap-carousel .acn-carousel-card {
        display: block !important;
        flex: 0 0 calc(100vw - 3.75rem) !important;
        width: calc(100vw - 3.75rem) !important;
        max-width: 430px !important;
        margin: 0 !important;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    body.rcd-home .rcd-mobile-snap-carousel .acn-card-img {
        aspect-ratio: 16 / 9;
        height: auto;
    }

    body.rcd-home .acn-carousel-controls,
    body.rcd-home .acn-carousel-dots {
        display: none !important;
    }

    body.rcd-home .rcd-featured-footer {
        justify-content: flex-start;
    }
}

:root[data-theme="dark"] body.rcd-home .acn-card-img {
    background: #21262d;
}

@media (prefers-reduced-motion: reduce) {
    body.rcd-home .rcd-featured-editorial img {
        transition: none !important;
        transform: none !important;
    }
}
