/**
 * Cartes blog de la page d'accueil -- visuel "cartes plates" (11/2026).
 *
 * 4 colonnes separees par un filet vertical, visuel 3/2 avec badge categorie
 * + date en haut a gauche, pastille fleche en haut a droite, titre seul
 * (pas d'extrait ni de bouton).
 * Valeurs reprises de la maquette repiauto-hp-bloc-blog-articles.html.
 *
 * Le sur-titre, le titre de section et le lien "Le Blog" ne sont PAS ici :
 * ils restent geres dans Creative Elements.
 */

.rp-cards {
    --rp-navy: #0b1e3d;
    --rp-red: #d71f1f;
    --rp-line: #e3e6ee;
    --rp-img-bg: #e8ecf2;
    --rp-col-gap: 48px;
    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. L'espacement vertical est regle dans Creative Elements. */
    background: #fff;
}

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

/* --- Grille --- */

.rp-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 28px var(--rp-col-gap);
}

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

/* --- Carte --- */

.rp-pc {
    position: relative;
    margin: 0;
    padding: 0 0 4px;
}

/* Filet vertical entre deux cartes, centre dans la goutiere. */
.rp-pc + .rp-pc::before {
    content: "";
    position: absolute;
    left: calc(var(--rp-col-gap) / -2);
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--rp-line);
}

/* En 2 colonnes, pas de filet devant la premiere carte de chaque ligne. */
@media (max-width: 1000px) {
    .rp-pc:nth-child(odd)::before {
        display: none;
    }
}

.rp-cards a.rp-pc__link {
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--rp-navy) !important;
    text-decoration: none !important;
}

.rp-cards a.rp-pc__link:focus-visible {
    outline: 2px solid var(--rp-red);
    outline-offset: 4px;
    border-radius: 6px;
}

/* --- Visuel --- */

.rp-pc__img {
    position: relative;
    display: block;
    aspect-ratio: 3 / 2;
    border-radius: 6px;
    overflow: hidden;
    background: var(--rp-img-bg);
}

/* Fallback ratio 3/2 pour Safari < 15 : 2/3 = 66.667%. */
@supports not (aspect-ratio: 3 / 2) {
    .rp-pc__img {
        height: 0;
        padding-top: 66.667%;
    }

    .rp-pc__img img {
        position: absolute;
        top: 0;
        left: 0;
    }
}

/* Image cassee : le texte alt ne doit ni deborder ni recouvrir les badges. */
.rp-pc__img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    color: transparent;
    font-size: 0;
    transition: transform .5s ease;
}

.rp-pc__link:hover .rp-pc__img img {
    transform: scale(1.04);
}

/* --- Badge categorie + date --- */

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

.rp-pc__badge {
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.4;
    text-transform: uppercase;
    color: #fff;
    background: var(--rp-navy);
    padding: 4px 9px;
    border-radius: 20px;
    white-space: nowrap;
}

/* Seules les actualites ont un badge rouge. */
.rp-pc__badge[data-cat="actus"] {
    background: var(--rp-red);
}

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

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

/* --- Pastille fleche (haut droite du visuel) --- */

.rp-pc__go {
    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(--rp-navy);
    pointer-events: none;
    transition: background-color .2s ease, color .2s ease;
}

.rp-pc__link:hover .rp-pc__go {
    background: var(--rp-red);
    color: #fff;
}

/* --- Titre --- */

.rp-cards .rp-pc__t {
    margin: 0;
    padding: 0;
    border: 0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    text-transform: none;
    color: var(--rp-navy);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .2s ease;
}

.rp-pc__link:hover .rp-pc__t {
    color: var(--rp-red);
}

@media (prefers-reduced-motion: reduce) {
    .rp-pc__img img,
    .rp-cards .rp-pc__t {
        transition: none;
    }

    .rp-pc__link:hover .rp-pc__img img {
        transform: none;
    }
}

/* ---------------------------------------------------------------------
 * Lien "Le Blog" de l'en-tete : <a class="rp-section-cta rp-section-cta--link">.
 *
 * La classe --link limite la surcharge a CE lien : rp-section-cta peut servir
 * aux boutons d'autres sections, qui doivent garder leur pastille.
 *
 * Ce lien et son style d'origine (pastille navy) sont dans un widget HTML
 * Creative Elements, stocke en base. Son <style> est imprime dans le corps de
 * la page, donc APRES ce fichier : a specificite egale il gagnerait. D'ou le
 * prefixe "html body" et les !important sur les proprietes qu'il definit.
 *
 * Rendu : texte souligne, fleche non soulignee a droite, sans fond.
 * ------------------------------------------------------------------ */

html body a.rp-section-cta.rp-section-cta--link,
html body a.rp-section-cta.rp-section-cta--link:visited {
    display: inline-flex !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #0b1e3d !important;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    /* Le texte est un noeud nu (pas de span) : on souligne le lien entier
       et on retire le soulignement de la fleche ci-dessous. */
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 4px !important;
    transform: none !important;
    transition: color .2s ease !important;
}

/* inline-block : un descendant en ligne atomique n'herite pas du soulignement. */
html body a.rp-section-cta.rp-section-cta--link svg {
    display: inline-block !important;
    flex-shrink: 0;
    transition: transform .2s ease !important;
}

html body a.rp-section-cta.rp-section-cta--link:hover,
html body a.rp-section-cta.rp-section-cta--link:focus {
    background: transparent !important;
    color: #d71f1f !important;
    box-shadow: none !important;
    transform: none !important;
}

html body a.rp-section-cta.rp-section-cta--link:hover svg {
    transform: translateX(3px) !important;
}

html body a.rp-section-cta.rp-section-cta--link:focus-visible {
    outline: 2px solid #d71f1f;
    outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
    html body a.rp-section-cta.rp-section-cta--link svg {
        transition: none !important;
    }

    html body a.rp-section-cta.rp-section-cta--link:hover svg {
        transform: none !important;
    }
}
