/* CARDS GRID (grille de cartes avec pictos) */
.cards-grid .cards-grid--container {
    padding: 32px 16px;
}

@media screen and (min-width: 768px) {
    .cards-grid .cards-grid--container {
        padding: 48px 16px;
    }
}

@media screen and (min-width: 1281px) {
    .cards-grid .cards-grid--container {
        padding: 48px 112px;
    }
}

.cards-grid .cards-grid--intro {
    max-width: 792px;
    margin-bottom: 32px;
}

.cards-grid .cards-grid--intro > * + * {
    margin-top: 16px;
}

.cards-grid .cards-grid--list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media screen and (min-width: 600px) {
    .cards-grid .cards-grid--list {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media screen and (min-width: 1025px) {
    .cards-grid .cards-grid--list.cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .cards-grid .cards-grid--list.cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Carte */
.cards-grid .cards-grid--item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    background-color: var(--customgrey);
    -webkit-clip-path: polygon(100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 0);
    clip-path: polygon(100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 0);
    transition: background-color 0.2s ease;
}

@media screen and (min-width: 768px) {
    .cards-grid .cards-grid--item {
        padding: 32px;
    }
}

/* Picto */
.cards-grid .cards-grid--picto {
    display: block;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
}

@media screen and (min-width: 768px) {
    .cards-grid .cards-grid--picto {
        width: 64px;
        height: 64px;
    }
}

.cards-grid .cards-grid--picto img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cards-grid .cards-grid--picto.is-mask {
    background-color: var(--customdark);
    -webkit-mask: var(--picto) no-repeat center / contain;
    mask: var(--picto) no-repeat center / contain;
}

/* Contenu */
.cards-grid .cards-grid--content {
    flex-grow: 1;
    font-size: 0.875rem;
    line-height: 150%;
}

.cards-grid .cards-grid--content > * + * {
    margin-top: 12px;
}

.cards-grid .cards-grid--content h3 {
    margin-bottom: 4px;
}

.cards-grid .cards-grid--content p,
.cards-grid .cards-grid--content li {
    font-size: 0.875rem !important;
    line-height: 150% !important;
}

/* Listes plus compactes que le style global (gap 16px, retrait 32px) */
main .cards-grid .cards-grid--content ul {
    gap: 6px !important;
}

main .cards-grid .cards-grid--content ul li {
    padding-left: 20px !important;
}

main .cards-grid .cards-grid--content ul li::before {
    top: 8px !important;
    transform: none !important;
}

.cards-grid .cards-grid--content b,
.cards-grid .cards-grid--content strong {
    font-weight: 700;
}

/* Carte cliquable : toute la surface renvoie vers le lien */
.cards-grid .cards-grid--link {
    position: static;
}

.cards-grid .cards-grid--link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.cards-grid .cards-grid--item.has-link:hover {
    background-color: #e3f6eb;
}

.cards-grid .cards-grid--item.has-link:hover .cards-grid--link .btn-picto::before {
    background-color: #e3f6eb;
}

.cards-grid .cards-grid--item.has-link:hover .cards-grid--link .btn-picto::after {
    background-color: var(--customdark);
}

/* Carte unique : pleine largeur, picto à gauche du texte */
@media screen and (min-width: 768px) {
    .cards-grid .cards-grid--item:only-child {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: flex-start;
        gap: 32px;
    }

    .cards-grid .cards-grid--item:only-child .cards-grid--content {
        max-width: 792px;
    }
}

/* Éditeur Gutenberg : liens inactifs pour pouvoir sélectionner et éditer le bloc */
.cards-grid.is-preview .cards-grid--link {
    pointer-events: none;
}

.cards-grid.is-preview .cards-grid--link::after {
    display: none;
}
