/* Thème OST — grille, accueil et bandeau de cookies.
   Chargé après style.css et style_mobile.css par functions.php. */
@media (width > 834px) {
    /* Préserve les proportions historiques des cartes sur ordinateur. */
    .grid-container {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .experience-thumb {
        float: none;
        width: calc(50% - 1.354vw);
    }

    .module-thumb {
        float: none;
        width: calc(33.333% - 1.354vw);
    }
}

@media (max-width: 834px) {
    .grid-container {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
        gap: clamp(14px, 3vw, 28px);
        width: 100%;
        margin-inline: 0;
    }

    .grid-container .experience-thumb,
    .grid-container .module-thumb {
        float: none;
        width: auto;
        min-width: 0;
        height: auto;
        margin: 0;
    }

    /* La variante .module-thumb.short fixe aussi la taille de sa vignette dans le thème. */
    .grid-container .experience-image-container,
    .grid-container .module-thumb .module-image-container {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
        margin-bottom: 12px;
    }

    .grid-container .module-thumb .module-image-container {
        aspect-ratio: 1;
    }

    .grid-container .experience-title,
    .grid-container .experience-text {
        width: 100%;
        overflow-wrap: anywhere;
    }

    .grid-container .experience-title {
        min-height: 0;
        margin-bottom: 8px;
    }
}

@media (max-width: 600px) {
    /* L’accueil et la liste utilisent des sections différentes, mais les mêmes cartes. */
    .grid-container:has(> .experience-thumb) {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (width <= 480px) {
    /* Le thème réserve 594 px au visuel. Garder de la place sous l’image
       pour le bandeau, le résumé et le bouton, même sur un écran court. */
    .homepage .post-image-container-home {
        height: clamp(300px, calc(100vh - 250px), 594px);
        height: clamp(300px, calc(100svh - 250px), 594px);
    }
}

@media (max-width: 350px) {
    .grid-container {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Les liens d’action suivent une taille tactile minimale sur téléphone et tablette. */
@media (max-width: 834px) {
    .homepage a.plus {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        height: 44px;
        padding: 0 16px;
        border-radius: 999px;
        font-size: 16px;
        line-height: 1.2;
    }
}

@media (width > 834px) and (height <= 950px) {
    /* Laisser la place au résumé et au lien sur les fenêtres de laptop peu hautes. */
    .homepage .post-image-container-home {
        height: min(54vw, max(320px, calc(100vh - 15vw)));
    }
}

@media (max-width: 600px) {
    /* Compacter la boîte sans modifier le texte, l’ordre des actions ni le consentement. */
    #cookie-law-info-bar {
        box-sizing: border-box;
        width: 100%;
        margin-left: 0;
        padding: 14px 14px max(10px, env(safe-area-inset-bottom));
        font-size: 15px;
        line-height: 1.4;
        max-height: 75vh;
        max-height: 75dvh;
        overflow-y: auto;
    }

    #cookie-law-info-bar .cli_messagebar_head {
        margin: 0 0 8px;
        font-size: 18px;
        line-height: 1.2;
    }

    #cookie-law-info-bar > span {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    #cookie-law-info-bar p {
        grid-column: 1 / -1;
        margin: 0 0 4px;
        text-align: left;
    }

    /* CookieYes applique display en ligne aux liens. Garder le sélecteur dans le bandeau. */
    #cookie-law-info-bar :is(#cookie_action_close_header, #cookie_action_close_header_reject, .cli-plugin-main-link) {
        display: grid !important;
        place-items: center;
        min-height: 44px;
        margin: 0;
        padding: 0 2px;
        font-size: 13px;
        line-height: 1.2;
    }
}

/* Sur un écran paysage peu haut, réserver de la place au résumé et au lien.
   La grille garde « Plus » dans sa propre colonne et laisse le texte revenir à la ligne. */
@media (orientation: landscape) and (480px < width <= 1200px) and (height <= 540px) {
    .homepage .post-image-container-home {
        height: clamp(140px, calc(100vh - 155px), 330px);
        height: clamp(140px, calc(100svh - 155px), 330px);
    }

    .homepage h1.featured-title {
        width: min(70vw, 100%);
        font-size: clamp(2rem, min(6vw, 11vh), 4rem);
        line-height: 1.05;
    }

    .homepage .post-text-container-home {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: start;
        gap: 8px;
        margin-top: 12px;
        padding-bottom: 12px;
    }

    .homepage .featured-excerpt {
        width: auto;
        overflow: visible;
    }

    .homepage .featured-excerpt p {
        margin: 0;
    }

    .homepage .post-text-container-home .plus-container {
        margin: 0;
        padding: 0;
    }

    .homepage .post-text-container-home a.plus {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: 0 16px;
        border-radius: 999px;
        font-size: 16px;
        line-height: 1.2;
    }
}
