/* ============================================================
   CATEGORIES – Version stable PiloteCSE (2025)
   ============================================================ */


/* -----------------------------------------------------------
   1) LARGEUR GLOBALE DES PAGES CATÉGORIES
----------------------------------------------------------- */

.archive.category main {
    max-width: 1600px !important;
    margin: 0 auto !important;
    padding: 0 30px !important;
    width: 100%;
}

.archive.category > .wp-block-group {
    max-width: 1600px !important;
    margin: 0 auto !important;
    width: 100%;
}


/* -----------------------------------------------------------
   2) GRILLE DES ARTICLES
----------------------------------------------------------- */

.archive.category .wp-block-post-template {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    max-width: 1600px !important;
    margin: 40px auto !important;
    padding: 0 20px !important;
}

@media (max-width: 1300px) {
    .archive.category .wp-block-post-template {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 900px) {
    .archive.category .wp-block-post-template {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 600px) {
    .archive.category .wp-block-post-template {
        grid-template-columns: 1fr;
    }
}


/* -----------------------------------------------------------
   3) CARTE — CADRE AUTOUR DE L’ARTICLE
----------------------------------------------------------- */

.archive.category .wp-block-post > .wp-block-group {
    background: #ffffff !important;
    border-radius: 14px !important;
    border: 1px solid #e5e5e5 !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06) !important;
    overflow: hidden !important;
    padding: 12px 0 0 0 !important;  /* espace au-dessus de l’image */
    position: relative;
    z-index: 2;
}

.archive.category .wp-block-post:hover > .wp-block-group {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.12);
}

.archive.category .wp-block-post * {
    position: relative;
    z-index: 10;
}


/* -----------------------------------------------------------
   4) IMAGE — ESPACE EN HAUT SANS DÉCALER LA GRILLE
----------------------------------------------------------- */

.archive.category .wp-block-post-featured-image {
    margin-top: -12px !important; /* compense le padding-top du card */
}

.archive.category .wp-block-post-featured-image img {
    width: 100%;
    height: 230px;
    object-fit: cover;
    border-radius: 12px 12px 0 0 !important;
    transition: transform 0.25s ease;
}

.archive.category .wp-block-post:hover .wp-block-post-featured-image img {
    transform: scale(1.03);
}


/* -----------------------------------------------------------
   5) TITRE + EXCERPT
----------------------------------------------------------- */

.archive.category .wp-block-post-title {
    font-size: 1.15rem !important;
    font-weight: 800;
    margin: 16px 20px 10px !important;
    line-height: 1.32 !important;
    color: #004c79;
}

.archive.category .wp-block-post-excerpt {
    font-size: 0.95rem;
    line-height: 1.48;
    color: #333;
    text-align: justify;
    margin: 0 20px 18px;
}


/* -----------------------------------------------------------
   6) DATE + LOGO — SANS CADRE
----------------------------------------------------------- */

.card-date-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px 20px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Date */
.card-date-line .card-date {
    font-size: 0.95rem;
    color: #444;
    margin: 0 !important;
}

/* LOGO AGRANDI (WordPress force width:42px → on écrase) */
.archive.category figure.wp-block-image img {
    width: 90px !important;
    height: auto !important;
    max-width: none !important;
    aspect-ratio: auto !important;
}

/* supprime la marge autour du <figure> */
.archive.category .card-date-line figure {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* élimine tout style WP résiduel */
.archive.category .wp-block-post-date,
.archive.category .wp-block-post-date::after {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}


/* -----------------------------------------------------------
   7) PADDING TEXTE — DESKTOP
----------------------------------------------------------- */

@media (min-width: 601px) {
    .archive.category .wp-block-post-title,
    .archive.category .wp-block-post-excerpt {
        margin-left: 20px !important;
        margin-right: 20px !important;
    }

    .card-date-line {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
}


/* -----------------------------------------------------------
   8) VERSION MOBILE — AIR + LISIBILITÉ
----------------------------------------------------------- */

@media (max-width: 600px) {
    .archive.category .wp-block-post > .wp-block-group {
        padding-left: 14px !important;
        padding-right: 14px !important;
        padding-bottom: 22px !important;
    }

    .archive.category .wp-block-post-excerpt {
        margin-bottom: 24px !important;
    }

    .archive.category figure.wp-block-image img {
        width: 60px !important; /* réduit légèrement */
    }
}


/* -----------------------------------------------------------
   9) SAVIEZ-VOUS ?
----------------------------------------------------------- */

.le-savais-vous-encart .lsv-icon {
    transition: color 0.25s ease, transform 0.25s ease;
}
.le-savais-vous-encart:hover .lsv-icon {
    color: #ffb400;
    transform: scale(1.15);
}
.le-savais-vous-encart a {
    text-decoration: none !important;
}
/* -----------------------------------------------------------
   PADDING SUR L’IMAGE
----------------------------------------------------------- */

/* Ajoute un padding autour de l’image */
.archive.category .wp-block-post-featured-image {
    padding: 12px 20px 12px 20px !important;  /* haut = 12px, côtés = 20px */
}

/* Force l’image à respecter l’arrondi + supprimer débordement */
.archive.category .wp-block-post-featured-image img {
    border-radius: 12px !important;
    width: 100% !important;
    height: 230px !important;
    object-fit: cover;
}

/* ============================================================================
   ALIGNEMENT PARFAIT DE LA DATE + TAILLE LOGO + HAUTEUR IDENTIQUE (FINAL)
   ============================================================================ */

/* 1) La date – alignée avec le texte */
.archive.category .wp-block-post-date {
    margin: 0 !important;
    padding: 0 !important;         /* pas de décalage */
    display: block !important;
}

/* 2) Le conteneur DATE + LOGO */
.archive.category .wp-block-group.carte-date {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;

    padding: 0 20px 20px 20px !important;

    min-height: 55px !important;   /* hauteur uniforme */
    height: 55px !important;
}

/* 3) Le logo – OVERRIDE du width="42" imposé par WP */
.archive.category .wp-block-group.carte-date img {
    width: 80px !important;
    height: auto !important;
    object-fit: contain !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 4) Empêcher WordPress d’ajouter un padding caché */
.archive.category figure.wp-block-image {
    margin: 0 !important;
    padding: 0 !important;
}

/* 5) Extrait – limitation à 4 lignes + hauteur identique */
.archive.category .wp-block-post-excerpt {
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden !important;

    margin-left: 20px !important;
    margin-right: 20px !important;

    min-height: 100px !important;  /* hauteur corrigée */
}

.archive.category .wp-block-post-excerpt p {
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden !important;

    min-height: 5.6em !important;
}
/* Uniformiser la hauteur du titre dans les cartes */
.archive.category .wp-block-post-title {
    display: -webkit-box;
    -webkit-line-clamp: 2; /* titre sur 2 lignes max */
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.2em; /* hauteur correspondant à 2 lignes */
}
/* Hauteur fixe et identique pour les extraits */
.archive.category .wp-block-post-excerpt {
    min-height: 6.2em !important;   /* hauteur standardisée */
    max-height: 6.2em !important;   /* empêche l'allongement */
    overflow: hidden !important;
    margin-left: 20px !important;
    margin-right: 20px !important;
}
/* ===========================================
   UNIFORMISATION DE LA HAUTEUR DES CARTES
   =========================================== */

/* 1️⃣ TITRE – On limite à 2 lignes */
.archive.category .wp-block-post-title {
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; 
    overflow: hidden !important;
    min-height: 3.4em !important; /* correspond à 2 lignes */
    padding: 0 20px !important;
}

/* 2️⃣ EXTRAIT – Même hauteur pour toutes les cartes */
.archive.category .wp-block-post-excerpt {
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4; 
    overflow: hidden !important;
    min-height: 6.4em !important; /* uniforme sur toutes les cartes */
    padding: 0 20px !important;
}

/* 3️⃣ DATE + LOGO – même ligne, parfaitement alignés */
.archive.category .carte-date {
    padding: 0 20px 20px 20px !important;
}

.archive.category .wp-block-post-date {
    margin: 0 !important;
    padding: 0 !important;
}

/* ============================================================
   CARTES CATÉGORIE — VERSION AUTO, FLUIDE & NATURELLE
   ============================================================ */

/* 1) Titre : hauteur automatique, pas de limitation */
.archive.category .wp-block-post-title {
    display: block !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
    overflow: visible !important;
    min-height: auto !important;
    padding: 0 20px !important;
    margin-bottom: 12px !important;
}

/* 2) Extrait : hauteur automatique */
.archive.category .wp-block-post-excerpt {
    display: block !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
    overflow: visible !important;
    min-height: auto !important;
    padding: 0 20px 0 20px !important;
    margin-bottom: 18px !important;
}

/* 3) Date + logo */
.archive.category .carte-date {
    padding: 0 20px 20px 20px !important;
}
/* Hauteur UNIFORME du bloc texte (titre + début extrait) */
.archive.category .wp-block-post {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Bloc qui contient titre + extrait */
.archive.category .wp-block-post > div {
    min-height: 230px; /* 👉 ajustable selon ton design */
}
/* ============================================================
   ALIGNEMENT NATUREL DES CARTES (titre + extrait équilibrés)
   ============================================================ */

.archive.category li.wp-block-post {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.archive.category li.wp-block-post > .wp-block-group:nth-child(2) {
    flex-grow: 1;
    min-height: 240px; /* 👉 AJUSTE ICI SI NÉCESSAIRE */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

