/* responsive
   Écrit d'après les fichiers de la branche dev (commit 7f0238d).
   Le logo (1600 x 400, format 4:1) est dans un lien .logoLien dont header.css fixe la largeur à 20 %. */

/* ===== Écrans d'ordinateur qui se réduisent ===== */

@media screen and (max-width: 970px) {
    li > a {
        font-size: 20px;
    }
}

@media screen and (max-width: 900px) {
    li > a {
        font-size: 17px;
        letter-spacing: 1px;
    }
    .header__menu a {
        margin-left: 12px;
    }
    .header__buttons a {
        margin-left: 10px;
        margin-right: 10px;
    }
    .header__buttons a:last-child {
        padding: 8px 14px;
    }
}

/* ===== Téléphones : en-tête sur deux lignes =====
   ligne 1 : logo à gauche, bouton « Faire un don » à droite
   ligne 2 : les trois onglets sur toute la largeur */

@media screen and (max-width: 760px) {
    header {
        flex-wrap: wrap;
        padding: 8px 10px;
        gap: 6px 10px;
    }
    .logoLien {
        width: 130px;
        flex-shrink: 0;      /* sinon le logo se réduit à rien quand l'en-tête est trop étroit */
    }
    .header__buttons {
        order: 2;
    }
    .header__menu {
        order: 3;
        width: 100%;
        justify-content: space-around;
    }
    .header__menu a {
        margin-left: 0;
    }
    li > a {
        font-size: 16px;
    }
    .header__buttons a {
        margin: 0;
        font-size: 12px;
        display: inline-block;
        white-space: nowrap;  /* le cadre du bouton ne doit pas se couper sur deux lignes */
    }
    .header__buttons a:last-child {
        padding: 6px 12px;
    }
}

/* Téléphone tenu en largeur : l'écran est bas, l'en-tête ne reste plus collé en haut */
@media screen and (max-width: 900px) and (max-height: 500px) {
    header {
        position: static;
    }
}

/* ===== Téléphones : 2 dessins dans la largeur ===== */

@media screen and (max-width: 600px) {
    .grid-wrapper {
        margin: 6px;
        grid-gap: 6px;
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 45vw;
    }
    .grid-wrapper > div {
        border-width: 4px;
        border-radius: 8px;
    }
    .grid-wrapper > div > img,
    .grid-wrapper > div > a.lienDessin > img {
        border-radius: 4px;
    }

    /* boutons posés sur les tuiles, plus petits */
    .btnDownload {
        bottom: 6px;
        font-size: 12px;
        padding: 10px 12px;
    }
    .colo-actions {
        bottom: 6px;
        gap: 4px;
    }
    .laby-actions {
        bottom: 6px;
        gap: 4px;
    }
    .btnLaby {
        font-size: 12px;
        padding: 8px;
    }
}

/* Écrans très étroits (le téléphone de Franck affiche environ 270 px de large) */
@media screen and (max-width: 400px) {
    .logoLien {
        width: 90px;
    }
    li > a {
        font-size: 12px;
        letter-spacing: 0.5px;
    }
    .header__buttons a {
        font-size: 11px;
        letter-spacing: 1px;
    }
    .header__buttons a:last-child {
        padding: 6px 8px;
    }
    .btnDownload {
        font-size: 11px;
        padding: 8px 10px;
    }
    .btnLaby {
        font-size: 11px;
        padding: 6px 8px;
    }
    .selectColo > label,
    .selectColo > select {
        font-size: 16px;
    }
}

/* Très petits téléphones : « Télécharger » et « Solution » ne tiennent plus côte à côte */
@media screen and (max-width: 380px) {
    .laby-actions {
        flex-direction: column;
        align-items: center;
    }
    /* « Télécharger » et « Colorier » restent côte à côte : boutons plus serrés */
    .colo-actions {
        gap: 3px;
        width: 98%;
    }
    .colo-actions .btnDownload {
        font-size: 10px;
        padding: 6px 6px;
    }
}
/* Téléphone de Franck (environ 270 px de large) : tuiles d'environ 118 px */
@media screen and (max-width: 330px) {
    .colo-actions .btnDownload {
        font-size: 9px;
        padding: 5px 4px;
    }
}
