/**
 * Shared footer layout — fixes overlap / horizontal scroll on tablet & mobile.
 * Inline grid styles on pages are overridden here at breakpoints (!important).
 */
footer.site-footer {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: clip;
}

footer.site-footer > div {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
}

/* Main 4-column grid wrapper (first row block before <hr>) */
footer.site-footer > div > div:first-child {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

footer.site-footer > div > div:first-child > div {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

footer.site-footer input[type="email"],
footer.site-footer button#subscribe-btn,
footer.site-footer #subscribe-email {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

footer.site-footer #social-media-links {
    flex-wrap: wrap !important;
}

footer.site-footer hr {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Bottom bar: allow links row to shrink / wrap without forcing page width */
footer.site-footer > div > div:last-child {
    flex-wrap: wrap !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

footer.site-footer > div > div:last-child > div:last-child {
    min-width: 0 !important;
    flex-wrap: wrap !important;
}

/* Large tablet / small laptop: 2×2 grid */
@media (max-width: 1100px) {
    footer.site-footer > div > div:first-child {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 32px 28px !important;
        margin-bottom: 48px !important;
    }

    footer.site-footer > div > div:last-child {
        gap: 20px !important;
        justify-content: flex-start !important;
    }
}

/* Narrow tablet */
@media (max-width: 820px) {
    footer.site-footer > div > div:first-child {
        gap: 28px 20px !important;
    }

    footer.site-footer {
        padding-top: 56px !important;
        padding-bottom: 32px !important;
    }
}

/* Phone */
@media (max-width: 600px) {
    footer.site-footer {
        padding-left: max(16px, env(safe-area-inset-left)) !important;
        padding-right: max(16px, env(safe-area-inset-right)) !important;
        padding-top: 48px !important;
        padding-bottom: 28px !important;
        margin-top: 48px !important;
    }

    footer.site-footer > div > div:first-child {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 32px !important;
        margin-bottom: 36px !important;
    }

    /* Bottom bar: stack copyright + legal links */
    footer.site-footer > div > div:last-child {
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        gap: 16px !important;
    }

    footer.site-footer > div > div:last-child > div:last-child {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    /* Hide pipe separators between legal links */
    footer.site-footer > div > div:last-child > div:last-child > span {
        display: none !important;
    }
}
