/* ==================================================================
   Sticky footer - logged-in (after-login) pages only.

   Short page -> #footer_area sits flush with the bottom of the viewport.
   Tall page  -> #footer_area follows the content and scrolls away.
   No JS, no position:fixed, no position:sticky.

   No wrapper element is needed: #header_area, .inner-center and
   #footer_area are all direct children of <body>, so <body> is it.
   (.inner-center opens on the last line of header-afterlogin.php and
   closes on line 1 of the parent's footer-afterlogin.php, before
   <footer id="footer_area"> opens.)

   Loaded only by header-afterlogin.php, which always pairs with
   get_footer('afterlogin'). The public footer is unaffected.
   ================================================================== */

@media screen {

/* .has-sticky-footer is added via body_class() in header-afterlogin.php */
.has-sticky-footer {
	display: flex;
	flex-direction: column;

	min-height: 100vh;  /* fallback; older browsers drop the next line */
	min-height: 100dvh; /* visible viewport: on iOS Safari / Chrome Android
	                       100vh is the URL-bar-HIDDEN height, ~60-115px
	                       taller than the screen, which would produce
	                       exactly the scrollbar this change removes */
}

/* margin-top:auto absorbs leftover space above the footer on a short page.
   On a tall page there is no free space, so it resolves to 0 and the footer
   scrolls normally. Changes no element's used width or height.

   order:1 keeps the footer last even if a plugin prints an in-flow element
   at wp_footer(), which runs AFTER </footer>. Default order is 0. */
.has-sticky-footer > #footer_area {
	margin-top: auto;
	order: 1;
}

/* Insurance only, not load-bearing: min-height (not height) means free space
   is never negative, and flex items default to min-height:auto. Guards
   against someone later "tidying" min-height into height. Deliberately not
   applied to .inner-center - if a shrink situation ever arose, the growable
   content area should absorb it, not the chrome. */
.has-sticky-footer > #header_area,
.has-sticky-footer > #footer_area {
	flex-shrink: 0;
}

}
