/**
 * Cartes blog de la page d'accueil.
 *
 * Les regles .rp-card-* reprennent a l'identique le CSS des anciens widgets HTML
 * Creative Elements ; .rp-cards-grid remplace les 3 colonnes Elementor par une
 * grille autonome.
 *
 * Le titre de section et le bouton vers le blog ne sont PAS ici : ils restent
 * geres dans Creative Elements.
 */

.rp-cards {
    --navy: #0b1e3d;
    --navy-2: #142a52;
    --red: #e81f1f;
    --grey-bg: #f5f6fa;
    --grey-line: #e3e6ee;
    --text-soft: #667085;
    --radius: 10px;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    /* Fond blanc explicite : sans cela la section herite du gris de la page
       Creative Elements, alors que la maquette est sur fond blanc.
       Pas de padding vertical : l'espacement autour du bloc est regle dans
       Creative Elements, avec le titre. */
    background: #fff;
}

.rp-cards * {
    box-sizing: border-box;
}

/* --- Grille --- */

.rp-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    align-items: stretch;
}

@media (max-width: 991px) {
    .rp-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .rp-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Carte (markup d'origine) --- */

/*
 * Pas de max-width ici : dans le markup d'origine chaque carte occupait sa
 * propre colonne Elementor et devait etre bridee a 380px. La grille ci-dessus
 * gere desormais la largeur, la carte remplit donc sa cellule.
 */
.rp-card-single {
    width: 100%;
    display: flex;
}

.rp-card-single button,
.rp-card-single input {
    font-family: inherit;
}

.rp-card {
    background: #fff;
    border: 1px solid var(--grey-line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .25s, transform .25s;
    width: 100%;
}

.rp-card:hover {
    box-shadow: 0 8px 20px -10px rgba(11, 30, 61, .18);
}

.rp-card-media {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    /* Fond neutre visible tant que l'image n'est pas chargee, et derriere une
       image trop petite qui ne couvrirait pas toute la zone. */
    background: var(--grey-bg);
}

/* Fallback ratio 16/10 pour les navigateurs sans aspect-ratio (Safari < 15) :
   padding-top en pourcentage de la largeur = 10/16 = 62.5%. */
@supports not (aspect-ratio: 16/10) {
    .rp-card-media {
        height: 0;
        padding-top: 62.5%;
    }

    .rp-card-media img,
    .rp-card-media > a {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/* Image cassee (fichier absent) : le texte alt ne doit pas deborder de la
   carte ni recouvrir le badge. On le masque et on garde le fond neutre. */
.rp-card-media img {
    color: transparent;
    font-size: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s;
}

.rp-card:hover .rp-card-media img {
    transform: scale(1.03);
}

.rp-card-top {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rp-badge {
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #fff;
    padding: 4px 9px;
    border-radius: 20px;
    pointer-events: none;
}

.rp-badge[data-cat="actus"] {
    background: var(--red);
}

.rp-badge[data-cat="conseils"],
.rp-badge[data-cat="securite"],
.rp-badge[data-cat="saviez"],
.rp-badge[data-cat="diy"] {
    background: var(--navy);
}

.rp-share {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(11, 30, 61, .18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--navy);
    cursor: pointer;
}

.rp-card-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.rp-card-date {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fff;
    color: var(--navy);
    font-size: .6rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.rp-card-date svg {
    flex-shrink: 0;
    opacity: .7;
}

.rp-card-title {
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--grey-line);
    color: var(--navy);
}

.rp-card-excerpt {
    font-size: .85rem;
    color: var(--navy);
    opacity: .65;
    line-height: 1.55;
    margin: 0 0 20px;
    flex: 1;
}

.rp-card-link {
    font-size: .78rem;
    font-weight: 600;
    color: var(--red);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    border: 1.5px solid rgba(232, 31, 31, .35);
    border-radius: 20px;
    padding: 8px 16px;
    align-self: flex-start;
}

.rp-card-link svg {
    transition: transform .2s;
}

.rp-card-link:hover {
    color: var(--red);
}

.rp-card-link:hover svg {
    transform: translateX(3px);
}

.rp-card-media a {
    display: block;
    height: 100%;
}

.rp-card-title a {
    color: inherit;
    text-decoration: none !important;
}

.rp-card-title a:hover {
    color: var(--red);
    text-decoration: none !important;
}
