/* =========================================================
   FOOTER — responsive
   Ne modifie volontairement pas les boutons / overlays burger.

   Organisation :
     - > 1024px : desktop (tel que tu l'as conçu)
     - <= 1024px : même organisation que mobile (tout en colonne)
     - <= 781px  : mobile "confortable"
     - <= 480px  : petit mobile

   Le padding left/right est appliqué·² au groupe interne,
   pas au footer lui-meme, pour ne pas decaler le separateur.
   ========================================================= */

footer.wp-block-template-part {
    box-sizing: border-box;
}

/* =========================================================
   TABLETTE & MOBILE (max-width: 1024px)
   Même organisation que mobile : tout en colonne.
   ========================================================= */

@media (max-width: 1024px) {
    /* On ne touche pas au padding horizontal du footer,
     pour ne pas decaler le separateur. */
    footer.wp-block-template-part {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        padding-bottom: 0 !important;
        overflow: hidden;
    }

    /* C'est ce groupe interne qui porte le padding horizontal. */
    footer.wp-block-template-part>.wp-block-group {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        width: 100% !important;
        max-width: 100% !important;
        gap: 0;
        padding: 2rem 3rem 0 !important;
        /* top | right/left | bottom */
        margin: 0 !important;
        box-sizing: border-box;
    }

    footer.wp-block-template-part>.wp-block-group>.wp-block-columns {
        display: flex !important;
        flex-direction: column;
        flex-wrap: nowrap !important;
        width: 100%;
        max-width: 100% !important;
        gap: 2.5rem;
        margin: 0 !important;
    }

    footer.wp-block-template-part>.wp-block-group>.wp-block-columns>.wp-block-column {
        flex: 0 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
        margin: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Logo + reseaux alignes a gauche */
    footer.wp-block-template-part .wp-block-group.is-content-justification-space-between {
        justify-content: flex-start;
    }

    footer.wp-block-template-part .wp-block-site-logo {
        width: min(100%, 357px) !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    footer.wp-block-template-part .wp-block-site-logo img {
        display: block !important;
        width: 100% !important;
        height: auto !important;
    }

    footer.wp-block-template-part .wp-block-social-links {
        display: flex !important;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-start;
        width: auto !important;
        margin: 0 !important;
    }

    /* Contacts */
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:first-child>.wp-block-column:first-child>.wp-block-group:nth-child(2) {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        width: 100% !important;
        gap: 1.25rem;
        margin: 0 !important;
    }

    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:first-child>.wp-block-column:first-child>.wp-block-group:nth-child(2)>.wp-block-group {
        display: flex !important;
        flex-direction: row;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        min-width: 0 !important;
        gap: 0.75rem;
        margin: 0 !important;
        padding: 0 !important;
    }

    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:first-child>.wp-block-column:first-child>.wp-block-group:nth-child(2)>.wp-block-group>.wp-block-outermost-icon-block {
        flex: 0 0 30px !important;
        width: 30px !important;
        min-width: 30px !important;
        margin: 0 !important;
    }

    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:first-child>.wp-block-column:first-child>.wp-block-group:nth-child(2)>.wp-block-group>p {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        margin: 0 !important;
        line-height: 1.5 !important;
        overflow-wrap: anywhere;
    }

    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:first-child>.wp-block-column:first-child>.wp-block-group:nth-child(2)>.wp-block-group:last-child>.wp-block-outermost-icon-block {
        flex-basis: 20px !important;
        width: 20px !important;
        min-width: 20px !important;
    }

    /* Badges */
    footer.wp-block-template-part .wp-block-image,
    footer.wp-block-template-part figure.wp-block-image,
    footer.wp-block-template-part .wp-container-content-1387b69e {
        flex-basis: auto;
        flex-grow: 0;
        flex-shrink: 0;
        width: 150px !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        line-height: 0 !important;
    }

    footer.wp-block-template-part .wp-block-image img,
    footer.wp-block-template-part figure.wp-block-image img,
    footer.wp-block-template-part .wp-container-content-1387b69e img {
        display: block !important;
        width: 150px !important;
        height: auto !important;
        margin: 0 !important;
    }

    /* Trois navigations */
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) {
        margin-top: 2.5rem !important;
        gap: 2.5rem;
    }

    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2)>.wp-block-column {
        display: block !important;
        height: auto;
        min-height: 0;
    }

    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) h5 {
        min-height: 0;
        margin: 0 0 0.75rem !important;
        line-height: 1.3;
    }

    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) nav {
        width: 100%;
        margin: 0 !important;
    }

    /* Override explicite du "color: initial !important" de WordPress
     sur .wp-block-navigation__container * en mobile. */
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) .wp-block-navigation .wp-block-navigation__container,
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) .wp-block-navigation .wp-block-navigation__container *,
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) .wp-block-navigation .wp-block-navigation-item__content,
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) .wp-block-navigation__container a {
        color: var(--bacchus-color-grey) !important;
        /* custom-classic-grey en dur */
    }

    /* Made with */
    footer.wp-block-template-part>.wp-block-group>p:last-child {
        display: block !important;
        width: 100% !important;
        margin: 3rem 0 0 !important;
        text-align: center !important;
        line-height: 1.5 !important;
    }
}

/* =========================================================
   MOBILE "CONFORTABLE" (max-width: 781px)
   Même orga, mais un peu plus compact.
   ========================================================= */

@media (max-width: 781px) {
    footer.wp-block-template-part {
        padding-bottom: 0 !important;
    }

    /* Padding horizontal uniquement sur le groupe interne. */
    footer.wp-block-template-part>.wp-block-group {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }

    footer.wp-block-template-part>.wp-block-group>.wp-block-columns {
        gap: 2rem;
    }

    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:first-child>.wp-block-column:first-child>.wp-block-group:nth-child(2) {
        gap: 1rem;
    }

    footer.wp-block-template-part .wp-block-site-logo {
        width: min(100%, 320px) !important;
    }

    /* On re-preserVe la couleur des liens de nav en mobile (781 px). */
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) .wp-block-navigation .wp-block-navigation__container,
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) .wp-block-navigation .wp-block-navigation__container *,
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) .wp-block-navigation .wp-block-navigation-item__content,
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) .wp-block-navigation__container a {
        color: var(--bacchus-color-grey) !important;
    }
}

/* =========================================================
   PETIT MOBILE (max-width: 480px)
   On compacte encore un peu.
   ========================================================= */

@media (max-width: 480px) {
    footer.wp-block-template-part {
        padding-bottom: 0 !important;
    }

    footer.wp-block-template-part>.wp-block-group {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }

    footer.wp-block-template-part .wp-block-site-logo {
        width: min(100%, 260px) !important;
    }

    /* On re-preserVe la couleur des liens de nav en mobile 480. */
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) .wp-block-navigation .wp-block-navigation__container,
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) .wp-block-navigation .wp-block-navigation__container *,
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) .wp-block-navigation .wp-block-navigation-item__content,
    footer.wp-block-template-part>.wp-block-group>.wp-block-columns:nth-child(2) .wp-block-navigation__container a {
        color: var(--bacchus-color-grey) !important;
    }
}
