/**
 * Module: Footer Bottom Fix
 * Description: Uses Flexbox to push the footer to the bottom.
 */

/* 
 * 1. Target the main FSE Site Wrapper 
 * In Twenty Twenty-Five, everything is wrapped in .wp-site-blocks
 */
body>.wp-site-blocks {
    /* Ensure the container takes at least the full height of the viewport */
    min-height: 100vh;
    /* Fallback for older browsers */
    min-height: 100dvh;
    /* Dynamic Viewport Height (Mobile friendly) */

    /* Use Flexbox to manage vertical distribution */
    display: flex;
    flex-direction: column;
}

/* 
 * 2. Push the Footer to the bottom
 * We target the footer element specifically.
 * 'margin-top: auto' in a flex column pushes the element as far down as possible.
 */
body>.wp-site-blocks>footer,
body>.wp-site-blocks>.wp-block-template-part:last-child {
    margin-top: auto;
}

/* 
 * 3. Fix for Admin Bar
 * If the admin bar is present, we need to subtract its height 
 * to avoid a vertical scrollbar when not needed.
 */
body.admin-bar>.wp-site-blocks {
    min-height: calc(100vh - 32px);
    min-height: calc(100dvh - 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar>.wp-site-blocks {
        min-height: calc(100vh - 46px);
        min-height: calc(100dvh - 46px);
    }
}