.cpt,
#event_post_results {
    position: relative;
    text-align: center;

    &:not([data-color="#00355f"]) {
        .container {
            &:not(.thematique):not(.offre-daccompagnemen) {
                .teaser__item {
                    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
                }
            }

            &.thematique,
            &.offre-daccompagnemen {
                .teaser__item {
                    &:hover {

                        .icon_thematique,
                        .icon_offre_accompagnement {
                            background-color: var(--red) !important;

                            &:after {
                                border: 2px solid var(--red) !important;
                            }
                        }
                    }
                }
            }
        }
    }

    &[data-color="#00355f"] {
        .container {
            &.appel-a-projets {
                .perimetres_name {
                    h4 {
                        color: var(--white) !important;
                    }
                }
            }

            .video__title {
                margin-top: 15px;
                color: var(--white) !important;
            }

            &.thematique,
            &.offre-daccompagnemen {
                .teaser__item {
                    &:hover {

                        .icon_thematique,
                        .icon_offre_accompagnement {
                            background-color: var(--red) !important;

                            img {
                                filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(20%) hue-rotate(326deg) brightness(104%) contrast(108%);
                            }

                            &:after {
                                border: 2px solid var(--red) !important;
                            }
                        }
                    }

                    &:not(:hover) {

                        .icon_thematique,
                        .icon_offre_accompagnement {
                            background-color: var(--white) !important;
                        }
                    }

                    .teaser__link {
                        * {
                            color: var(--white) !important;
                        }

                        .icon_thematique,
                        .icon_offre_accompagnement {
                            &:after {
                                border: 2px solid var(--white) !important;
                            }
                        }
                    }
                }
            }
        }
    }

    .container {
        position: relative;

        &:not(.thematique, .video, .offre-daccompagnemen) {
            .teaser__item {
                background: var(--white);
            }
        }

        &.offre-daccompagnemen {
            .teaser__item {
                .teaser__link {
                    display: flex;
                    flex-direction: column;
                    text-align: center;
                    align-items: center;
                    gap: 25px;
                    overflow: visible;
                    margin-top: 30px !important;

                    .icon_offre_accompagnement {
                        background-color: var(--dark-blue);
                        border-radius: 100px;
                        position: relative;
                        width: 80px;
                        height: 80px;
                        padding: 20px;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        transition: var(--transition);

                        img {
                            object-fit: contain;
                            width: 100%;
                            height: 100%;
                            filter: brightness(100);
                        }

                        &:after {
                            content: '';
                            border: 2px solid var(--dark-blue);
                            position: absolute;
                            top: 50%;
                            left: 50%;
                            width: 130%;
                            height: 130%;
                            transform: translate(-50%, -50%);
                            border-radius: 100px;
                            transition: var(--transition);
                        }
                    }
                }
            }
        }

        &.thematique {
            .type_thematique {
                place-items: center;
                align-items: stretch;

                .teaser__item {
                    transform: translateY(0px);
                    transition: var(--transition);

                    &:hover {
                        transform: translateY(-2px);
                    }

                    .teaser__link {
                        display: flex;
                        flex-direction: column;
                        text-align: center;
                        align-items: center;
                        gap: 25px;
                        overflow: visible;

                        .icon_thematique {
                            background-color: var(--dark-blue);
                            border-radius: 100px;
                            position: relative;
                            width: 80px;
                            height: 80px;
                            padding: 20px;
                            display: flex;
                            align-items: center;
                            justify-content: center;
                            transition: var(--transition);

                            img {
                                object-fit: contain;
                                width: 100%;
                                height: 100%;
                            }

                            &:after {
                                content: '';
                                border: 2px solid var(--dark-blue);
                                position: absolute;
                                top: 50%;
                                left: 50%;
                                width: 130%;
                                height: 130%;
                                transform: translate(-50%, -50%);
                                border-radius: 100px;
                                transition: var(--transition);
                            }
                        }
                    }
                }
            }
        }

        &.appel-a-projets {
            .perimetres_name {
                display: flex;
                justify-content: center;
                gap: 20px;
                margin-bottom: 60px;
                flex-wrap: wrap;

                &>* {
                    padding-bottom: 5px;
                }
            }

            .teaser__item {
                .teaser__text {
                    &>p {
                        &:has(+.teaser__infos) {
                            margin-bottom: 15px;
                        }
                    }
                }
            }
        }

        &.evenement {
            .teaser__text {
                &>p {
                    margin-top: 15px;
                }

                .teaser__title {
                    color: #00355F !important;
                }

                .teaser__infos {
                    .wrapper_infos {
                        display: grid;
                        grid-template-columns: 1fr 1fr;
                        gap: 10px;

                        .info_item {
                            display: flex;
                            gap: 10px;
                            align-items: center;
                            padding-bottom: 15px;

                            img {
                                width: 25px;
                                height: 25px;
                                object-fit: contain;
                            }

                            .info_infos {
                                display: flex;
                                flex-direction: column;
                                gap: 0;

                                * {
                                    font-size: 13px !important;
                                }

                                span {
                                    font-weight: var(--bold);
                                }
                            }

                            /* p {
                                font-size: 12px;
                            } */
                        }
                    }
                }
            }

            /* .initial_events {
                .container.evenement {
                    &[data-target="togo"] {
                        .teaser__item {
                            opacity: 0.3;
                        }
                    }

                    &[data-target="past"] {
                        .teaser__item {
                            opacity: 0.3;
                        }
                    }
                }
            } */
        }

        .teaser {
            &.type_video {
                .teaser__item {
                    background: transparent !important;
                    border-radius: 0px !important;
                    box-shadow: none !important;
                }
            }

            &.slider_cpt {
                position: relative;
                overflow-y: visible !important;

                .splide__track {
                    overflow-y: visible !important;

                    .splide__list {
                        overflow-y: visible !important;
                    }
                }

                .teaser__item {
                    background: var(--white);
                    position: relative;
                    width: calc((100% - (var(--splide-per-page) - 1) * 1em) / var(--splide-per-page)) !important;
                    overflow-y: visible !important;

                    /* &:not(.is-visible) {
                        opacity: 0;
                        transition: var(--transition);
                        pointer-events: none;
                    }

                    &.is-next+&.teaser__item:not(.is-visible),
                    &:not(.is-visible):has(+&.is-prev) {
                        opacity: 0.3 !important;
                        transition: var(--transition);
                    }

                    @media (max-width: 991px) {
                        &.is-next {
                            opacity: 0.3 !important;
                            transition: var(--transition);
                        }
                    } */
                }

                /* .splide__track {
                    overflow: visible !important;
                } */
            }

            .teaser__link {
                color: var(--dark);

                &:hover {
                    .teaser__text {

                        &>.teaser__title,
                        &>p {
                            color: var(--red) !important;
                        }
                    }
                }

                .teaser__text {
                    padding: 10px;

                    &:not(:has(.teaser__infos)) {
                        .teaser__cta {
                            margin-top: auto !important;
                        }
                    }

                    .teaser__title {
                        padding: 15px 15px 0 15px;
                    }

                    &>p {
                        padding: 0 15px;
                    }

                    .teaser__cta {
                        margin-top: 10px;
                    }
                }

                .teaser__image {
                    margin: 5px 5px 0 5px;
                    overflow: hidden;
                    border-top-left-radius: var(--border-radius);
                    border-top-right-radius: var(--border-radius);

                    img {
                        border-top-left-radius: var(--border-radius);
                        border-top-right-radius: var(--border-radius);
                    }
                }
            }
        }

        .bouton {
            margin: 30px auto 0 auto;
        }

        .teaser__item {
            position: relative;
            text-align: left;
            z-index: 2;
            transition: var(--transition);
            border-radius: 12px;
            width: 100%;
            max-width: 100%;
            margin: 0;

            &.nopostsfound {
                justify-self: center;
                text-align: center;
                width: 100%;
            }
        }

        .teaser__link {
            display: -webkit-box;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-orient: vertical;
            -webkit-box-direction: normal;
            -ms-flex-direction: column;
            flex-direction: column;
            height: 100%;
            overflow: hidden;
            position: relative;

            &:hover {
                .teaser__image img {
                    -webkit-transform: scale(1.1);
                    transform: scale(1.1);
                }

                .teaser__cta>span {
                    background-color: var(--red) !important;
                    border: 0px !important;

                    &:after {
                        right: -3px;
                    }
                }
            }
        }

        .teaser__image {
            overflow: hidden;

            img {
                aspect-ratio: 300 / 125;
                display: block;
                -o-object-fit: cover;
                object-fit: cover;
                -webkit-transition: all 0.3s;
                transition: all 0.3s;
                width: 100%;
            }
        }

        .teaser__text {
            display: -webkit-box;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-flex: 1;
            -ms-flex: 1;
            flex: 1;
            -webkit-box-orient: vertical;
            -webkit-box-direction: normal;
            -ms-flex-direction: column;
            flex-direction: column;
            padding: 12px 0;

            .teaser__infos {
                background: var(--grey);
                padding: 10px;
                display: flex;
                flex-direction: column;
                margin-top: auto;
                gap: 15px;
                border-radius: 8px;

                @media (min-width: 992px) {
                    padding: 15px;
                }

                .deadline {
                    display: flex;
                    gap: 10px;
                    align-items: center;
                    border-bottom: 1px solid var(--dark-grey);
                    padding-bottom: 15px;

                    img {
                        width: 25px;
                        height: 25px;
                        object-fit: contain;
                    }

                    .deadline__content {
                        display: flex;
                        flex-direction: column;

                        &>* {
                            font-size: 14px !important;
                        }

                        &>p {
                            text-transform: uppercase;
                            letter-spacing: 2px;
                        }
                    }
                }

                .thematiques {
                    display: flex;
                    flex-direction: column;
                    gap: 15px;

                    &>span {
                        text-transform: uppercase;
                        font-weight: var(--bold);
                    }

                    .thematiques__list {
                        display: grid;
                        grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
                        gap: 20px 10px;

                        .thematique {
                            max-width: 100px;
                            display: flex;
                            flex-direction: column;
                            text-align: center;
                            align-items: center;

                            &>span {
                                font-size: 12px;
                                margin-top: 10px;
                                line-height: 16px;
                                display: flex;
                                font-weight: var(--medium);
                            }

                            .icon_thematique {
                                background-color: var(--dark-blue);
                                border-radius: 100px;
                                position: relative;
                                width: 40px;
                                height: 40px;
                                padding: 8px;
                                display: flex;
                                align-items: center;
                                justify-content: center;

                                img {
                                    object-fit: contain;
                                    width: 100%;
                                    height: 100%;
                                    filter: brightness(100) grayscale(1) contrast(100);
                                }

                                &:after {
                                    content: '';
                                    border: 2px solid var(--dark-blue);
                                    position: absolute;
                                    top: 50%;
                                    left: 50%;
                                    width: 130%;
                                    height: 130%;
                                    transform: translate(-50%, -50%);
                                    border-radius: 100px;
                                }
                            }
                        }
                    }
                }
            }

            .teaser__cta {
                text-align: end;
                padding-bottom: 5px;

                &>span {
                    border: 0px !important;

                    &:after {
                        background-image: url(../img/chevron_down.svg) !important;
                        width: 9px !important;
                        height: 9px !important;
                        transform: rotate(-90deg);
                    }
                }
            }

            p {
                margin-bottom: 0px;
                -webkit-transition: all 0.3s;
                transition: all 0.3s;
            }

            .teaser__title {
                margin-top: 0;
                margin-bottom: 12px;
                -webkit-transition: all 0.3s;
                transition: all 0.3s;
            }
        }
    }

    .notfound {
        text-align: center;
    }
}

/* === Vidéos YouTube === */
.video__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.video__thumbnail {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 16/9;
    background: #1a1a2e;
}

.video__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video__link:hover .video__thumbnail img {
    transform: scale(1.05);
}

.video__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    transition: background 0.3s ease;
}

.video__link:hover .video__play {
    background: #e6007e;
}

.video__title {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Onglets de filtrage Zone géographique (slider AAP) ───────────────────── */
.aap-zone-tabs {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin: 0 auto 32px;
    flex-wrap: wrap;
}

.aap-zone-tab {
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    padding: 8px 4px;
    font-size: 18px;
    font-weight: var(--bold, 700);
    color: var(--white, #fff);
    cursor: pointer;
    transition: border-color 0.2s ease, opacity 0.2s ease;
    opacity: 0.6;
    font-family: inherit;
}

.aap-zone-tab:hover {
    opacity: 1;
}

.aap-zone-tab.is-active {
    opacity: 1;
}

.aap-zone-tab[data-zone="reg"].is-active {
    border-bottom-color: #00b7ce;
}

.aap-zone-tab[data-zone="nat"].is-active {
    border-bottom-color: #cd0823;
}

.aap-zone-tab[data-zone="eur"].is-active {
    border-bottom-color: #a18a3e;
}

/* ── Sur fond clair, force la couleur de texte adaptée ── */
section[data-color="#ffffff"] .aap-zone-tab,
section:not([data-color]) .aap-zone-tab {
    color: var(--dark, #000);
}

/* ── Message "Aucun appel à projets" affiché quand le filtre ne renvoie rien ── */
.aap-zone-empty {
    text-align: center;
    font-style: italic;
    padding: 40px 16px;
    color: var(--dark, #000);
}

section[data-color="#00355f"] .aap-zone-empty,
section[data-color="#00355F"] .aap-zone-empty {
    color: var(--white, #fff);
}

/* ── Force largeur des slides AAP (sécurité après destroy/re-mount Splide) ── */
.aap-zone-filter .splide__slide {
    flex: 0 0 calc((100% - 2em) / 3) !important;
    width: calc((100% - 2em) / 3) !important;
    max-width: calc((100% - 2em) / 3) !important;
}

@media (max-width: 1199px) and (min-width: 992px) {
    .aap-zone-filter .splide__slide {
        flex-basis: calc((100% - 1em) / 2) !important;
        width: calc((100% - 1em) / 2) !important;
        max-width: calc((100% - 1em) / 2) !important;
    }
}

@media (max-width: 991px) {
    .aap-zone-filter .splide__slide {
        flex-basis: 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ── Filtrage des cartes selon les onglets actifs (multi-zone via JS) ── */
.aap-zone-filter .splide__slide.is-hidden-by-zone,
.aap-zone-filter>.teaser>.teaser__item.is-hidden-by-zone {
    display: none !important;
}

.event .cpt .initial_events,
.event .cpt #event_post_results {
    min-width: 100%;
}
/* Loader AJAX pour le filtre des actualites / evenements */
#kn-filter-loader {
    position: absolute;
    inset: 0;
    background: #00355f;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 40px;
    min-height: 160px;
    z-index: 50;
    pointer-events: none;
}
#kn-filter-loader.is-active { display: flex !important; }
.kn-filter-loader__spinner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: kn-filter-spin 0.9s linear infinite;
}
@keyframes kn-filter-spin { to { transform: rotate(360deg); } }
