/* MTP DHF Tutor Bridge: injected header and footer wrappers.
 *
 * Deliberately thin. The sticky and fixed offset compensation lives in
 * mtp-dhf-tutor.js, because Tutor's own offsets are hardcoded pixel values
 * that differ per layout and per breakpoint, and copying those constants into
 * a stylesheet would mean they rot on Tutor's next release. The script reads
 * each base value live and adds the measured offset to it.
 *
 * Every rule is rooted on body.mtp-dhf-tutor, which outranks Tutor's own
 * single-class selectors on specificity alone. No !important anywhere: the
 * css.important bound is a burn-down and this module does not spend from it.
 *
 * --mtp-tutor-chrome is published by the script for anything downstream that
 * wants it. It starts at 0 so a script failure leaves Tutor's layout exactly
 * as shipped rather than pushed off its hinges.
 */

body.mtp-dhf-tutor {
	--mtp-tutor-chrome: 0px;
	--mtp-tutor-adminbar: 0px;
}

/* The injected header sits above Tutor's own chrome in the stacking order.
   Tutor's learning header and dashboard header both carry its z-header token;
   without this the fixed learning header draws over the site header. */
body.mtp-dhf-tutor .mtp-dhf-tutor-header {
	position: relative;
	z-index: 9999;
	width: 100%;
}

body.mtp-dhf-tutor .mtp-dhf-tutor-footer {
	position: relative;
	z-index: 1;
	width: 100%;
}

/* Tutor sizes the lesson body from the viewport and pins a fixed footer bar to
   the bottom on phones. The injected footer must not land underneath it. */
@media (max-width: 600px) {
	body.mtp-dhf-tutor .mtp-dhf-tutor-footer {
		padding-bottom: 80px;
	}
}

/* PINNED MODE (default). The site header becomes the page's real header: it
 * welds under the admin bar and Tutor's whole layout sits beneath it.
 *
 * This is both a preference and a robustness win. Left in normal flow, the
 * header scrolls off while Elementor's own sticky can keep a nav row welded,
 * so the offset has to chase a moving target every frame. Pinned, the offset
 * is a constant and nothing chases anything.
 *
 * Body padding replaces the flow space the header gave up. It reads the value
 * the script measures, so it tracks the real rendered height rather than a
 * number guessed here.
 */
body.mtp-dhf-tutor-pinned .mtp-dhf-tutor-header {
	position: fixed;
	top: var(--mtp-tutor-adminbar);
	inset-inline: 0;
	z-index: 9999;
}

body.mtp-dhf-tutor-pinned {
	padding-top: var(--mtp-tutor-chrome);
}
