/* Phase 1 shell: header [mf_header] and footer [mf_footer]. Colours from tokens.css only; logical properties; rem.
   Layout states on .mf-header: data-layout="narrow|wide" (set by the boot script and shell.js), data-js (script ran),
   data-cart (cart cookie), data-menu-open. The Elementor <header> wrapper carries sticky and hide-on-scroll.
   Nothing that wraps the drawer may get transform, filter, backdrop-filter or containment while the menu is open:
   any of them would trap the fixed drawer inside the header. */

/* On the root: the Elementor header wrapper reads them too, and it is not a .mf-shell element (2 Dec e2e: an
   undefined var made its z-index invalid, and the page painted over the open drawer). */
:where(:root) {
	--mf-z-header: 100;
	--mf-z-backdrop: 2147483000; /* below the morin-a11y toolbar (2147483601+, INVENTORY) */
	--mf-z-drawer: 2147483001;
}
.mf-shell {
	--mf-drawer-progress: 0;
	box-sizing: border-box;
	font-family: var(--mf-font-body);
	font-weight: var(--mf-font-body-weight);
	font-size-adjust: from-font; /* visually-stable-font-fallbacks: Arial and Rubik measure alike, so the layout holds */
	color: var(--mf-color-text);
	-webkit-tap-highlight-color: transparent;
}
.mf-shell *,
.mf-shell *::before,
.mf-shell *::after { box-sizing: inherit; }
.mf-shell ul { list-style: none; margin: 0; padding: 0; }
.mf-shell [hidden] { display: none !important; }
.mf-icon { inline-size: 1.375rem; block-size: 1.375rem; flex: none; }

/* ---------- Kit guard ----------
   Elementor kit 121 styles every link (`.elementor-kit-121 a`: colour, font-size 17px; 0,1,1), every button (0,1,1:
   peach fill, border, 100px radius, kit font; :hover/:focus 0,2,1) and every text input (0,3,1). The shell outranks
   them here, once, and each component sets only custom properties, which the kit never touches (2 Dec e2e). */
.mf-shell a[href] { /* 0,2,1 */
	color: var(--mf-link-fg, inherit);
	font-size: var(--mf-link-text, inherit);
}
.mf-shell :is(button, a):is(.mf-header__menu-btn, .mf-header__icon, .mf-drawer__util, .mf-drawer__close, .mf-btn) { /* 0,2,1 */
	display: var(--mf-c-display, inline-flex);
	align-items: center;
	justify-content: var(--mf-c-justify, center);
	gap: var(--mf-c-gap, var(--mf-space-2));
	inline-size: var(--mf-c-inline, auto);
	min-inline-size: var(--mf-c-min-inline, 0);
	min-block-size: var(--mf-touch);
	margin-block: var(--mf-c-margin-block, 0);
	margin-inline: 0;
	padding-block: var(--mf-c-pad-block, 0);
	padding-inline: var(--mf-c-pad, 0);
	border: 0;
	border-radius: var(--mf-c-radius, 0);
	background: var(--mf-c-bg, transparent);
	color: var(--mf-c-fg, inherit);
	font-family: var(--mf-font-body);
	font-size: var(--mf-c-text, var(--mf-text-body));
	font-weight: var(--mf-c-weight, var(--mf-weight-regular));
	line-height: 1.2;
	letter-spacing: normal;
	text-align: var(--mf-c-align, start);
	text-decoration: none;
	text-transform: none;
	white-space: var(--mf-c-wrap, nowrap);
	transition: none;
	user-select: auto;
	cursor: pointer;
}
.mf-shell :is(button, a):is(.mf-header__menu-btn, .mf-header__icon, .mf-drawer__util, .mf-drawer__close, .mf-btn):is(:hover, :focus, :active) { /* 0,3,1 */
	border: 0;
	background: var(--mf-c-bg-hover, var(--mf-c-bg, transparent));
	color: var(--mf-c-fg, inherit);
}
.mf-shell #mf-search-field { /* 1,1,0: outranks the kit's input rules (0,3,1 and 0,4,1 on focus) */
	flex: 1;
	min-inline-size: 0;
	min-block-size: var(--mf-touch);
	margin: 0;
	padding-block: 0;
	padding-inline: var(--mf-space-4);
	border: 1px solid var(--mf-color-control-border);
	border-radius: var(--mf-radius-pill);
	background: var(--mf-color-card);
	color: var(--mf-color-text);
	font-family: var(--mf-font-body);
	font-size: max(1rem, var(--mf-text-body)); /* 16px or more: iOS does not zoom the page on focus */
	font-weight: var(--mf-weight-regular);
	line-height: 1.2;
}

/* Two-tone focus ring (R12). */
.mf-shell :is(a, button, input):focus-visible {
	outline: var(--mf-focus-width) solid var(--mf-focus-color);
	outline-offset: var(--mf-focus-offset);
	box-shadow: 0 0 0 calc(var(--mf-focus-offset) + var(--mf-focus-width)) var(--mf-focus-inner);
}

/* ---------- Sticky header and hide on scroll (content-first-noise-reduction) ---------- */
/* --mf-bar-h is the measured header height (shell.js): the bar grows when it wraps at large text (WCAG 2.4.11). */
html:has(.mf-header) { scroll-padding-block-start: var(--mf-bar-h, var(--mf-top-bar)); }
html:has(.mf-header) main.mf-main { scroll-margin-block-start: 0; } /* the new bar replaces Phase 1a's 68px offset */
.elementor-location-header:has(.mf-header) {
	position: sticky;
	inset-block-start: 0;
	z-index: var(--mf-z-header);
}
@media (prefers-reduced-motion: no-preference) {
	.elementor-location-header:has(.mf-header) { transition: translate var(--mf-motion-base) var(--mf-motion-ease); }
}
/* While the menu is open: the wrapper's stacking context rises to the drawer's layer (still below the a11y toolbar),
   and translate snaps to none so the wrapper never becomes the fixed drawer's containing block mid-transition. */
.elementor-location-header:has(.mf-header):has([data-menu-open]) {
	z-index: var(--mf-z-drawer);
	translate: none !important;
	transition: none;
}
/* JavaScript fallback (shell.js) where scroll-state queries are not supported.
   Keyboard focus keeps the bar in view; a tapped or clicked button inside it does not (it kept the bar pinned, 2 Dec e2e). */
.elementor-location-header[data-mf-hidden]:not(:has(:focus-visible)):not(:has([data-menu-open])) { translate: 0 -100%; }
/* No script: never sticky (the static panel would cover the screen) and never hidden. */
.elementor-location-header:has(.mf-header:not([data-js])) { position: static; translate: none !important; }
@supports (container-type: scroll-state) {
	html:has(.mf-header) { container: mf-page / scroll-state; } /* state-aware-sticky-headers: always name it */
	@container mf-page scroll-state((scrolled: bottom) and (scrollable: top)) {
		.elementor-location-header:has(.mf-header):not(:has(:focus-visible)):not(:has([data-menu-open])) { translate: 0 -100%; }
	}
}
@media (max-height: 30rem) { /* landscape phones: no sticky bar at all */
	.elementor-location-header:has(.mf-header) { position: static; translate: none !important; }
}

/* ---------- Bar ---------- */
.mf-header { position: relative; }
.mf-header::before { /* the frosted background lives on a pseudo-element, never on an ancestor of the drawer */
	content: "";
	position: absolute;
	inset: 0;
	background: color-mix(in srgb, var(--mf-color-paper) 92%, transparent);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	box-shadow: 0 1px 0 var(--mf-color-wash);
}
.mf-header__bar {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--mf-space-2);
	min-block-size: var(--mf-top-bar);
	padding-inline: var(--mf-space-3);
	max-inline-size: var(--mf-content-max);
	margin-inline: auto;
}
/* flex-basis 0: the logo takes the space the controls leave and shrinks first, so the row wraps only when the
   controls alone no longer fit. With its natural width as the basis, 115% Android text wrapped the hidden cart
   slot onto an empty second row (owner's phone, 6 Dec). */
.mf-header__logo { display: flex; align-items: center; margin-inline-end: auto; min-block-size: var(--mf-touch); min-inline-size: 0; }
/* ...but never below 4.5rem (it fell to 4px at 200%, 6 Dec), so at very large text it moves to its own row instead.
   An empty cart slot takes no room on phones (it only appears with the cart), so it never holds a row open. */
.mf-header:not([data-layout="wide"]) .mf-header__logo { flex: 1 1 0; min-inline-size: 4.5rem; }
.mf-header[data-js]:not([data-layout="wide"]):not([data-cart]) .mf-header__cart { display: none; }
.mf-header__logo img { display: block; block-size: 2.25rem; inline-size: auto; max-inline-size: 100%; object-fit: contain; }
/* respect-os-text-scale: at large text the narrow row wraps instead of scrolling sideways. */
.mf-header:not([data-layout="wide"]) .mf-header__bar { flex-wrap: wrap; }

.mf-header__menu-btn {
	--mf-c-pad: var(--mf-space-3) var(--mf-space-4);
	--mf-c-radius: var(--mf-radius-pill);
	--mf-c-bg: var(--mf-color-wash);
	--mf-c-bg-hover: var(--mf-color-wash-hover);
	--mf-c-fg: var(--mf-color-brand);
	--mf-c-text: var(--mf-text-label);
	--mf-c-weight: var(--mf-weight-semibold);
}
.mf-header__icon {
	--mf-c-inline: var(--mf-touch);
	--mf-c-min-inline: var(--mf-touch);
	--mf-c-radius: 50%;
	--mf-c-bg-hover: var(--mf-color-wash);
	--mf-c-fg: var(--mf-color-text);
}
.mf-header__cart { visibility: hidden; position: relative; }
/* Item count (owner, 7 Dec), on the icon's top inline-end corner; numbers in a pill, tabular. */
.mf-header__cart-count {
	position: absolute;
	inset-block-start: 0.125rem;
	inset-inline-end: 0.125rem;
	min-inline-size: 1.125rem;
	block-size: 1.125rem;
	padding-inline: 0.25rem;
	border-radius: var(--mf-radius-pill);
	background: var(--mf-color-brand);
	color: var(--mf-color-card);
	font-size: 0.6875rem;
	font-weight: var(--mf-weight-bold);
	font-variant-numeric: tabular-nums;
	line-height: 1.125rem;
	text-align: center;
	pointer-events: none;
	box-shadow: 0 0 0 2px var(--mf-color-paper); /* keeps the pill apart from the cart glyph (design review, 7 Dec) */
	unicode-bidi: plaintext; /* "99+" lays out left to right without flipping the badge's corner (direction: ltr did) */
}
/* Wider counts grow outward, away from the glyph. */
.mf-header__cart-count:not(:empty) { inset-inline-end: auto; inset-inline-start: calc(50% + 0.125rem); }
.mf-header__cart:is(:hover, :focus, :active) .mf-header__cart-count { box-shadow: 0 0 0 2px var(--mf-color-wash); } /* same triggers as the icon's wash */
.mf-header__cart-count[hidden] { display: none; }
.mf-header[data-cart] .mf-header__cart,
.mf-header:not([data-js]) .mf-header__cart { visibility: visible; } /* without script the cookie cannot be read: always show */
.mf-header__intro {
	--mf-link-fg: var(--mf-color-brand);
	display: inline-flex;
	align-items: center;
	min-block-size: var(--mf-touch);
	padding-inline: var(--mf-space-3);
	border-radius: var(--mf-radius-pill);
	font-weight: var(--mf-weight-semibold);
	text-decoration: underline;
	text-underline-offset: 0.25em;
	white-space: nowrap;
}
.mf-header__intro:hover { background: var(--mf-color-wash); } /* same hover as the nav links (owner, 3 Dec) */

/* One copy of each control per layout. Without script the layout stays narrow. */
.mf-header:not([data-layout="wide"]) .mf-wide-only,
.mf-header[data-layout="wide"] .mf-narrow-only,
.mf-shell.mf-header[data-layout="wide"] .mf-header__menu-btn,
.mf-shell.mf-header:not([data-js]) [data-mf-menu-close] { display: none; } /* the last two outrank the kit guard's display */

/* ---------- Search disclosure ---------- */
.mf-search {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--mf-space-2);
	max-inline-size: var(--mf-content-max);
	margin-inline: auto;
	padding: var(--mf-space-2) var(--mf-space-3) var(--mf-space-3);
}
/* With script the disclosure overlays the page under the bar instead of pushing content down. */
.mf-header[data-js] .mf-search {
	position: absolute;
	inset-inline: 0;
	inset-block-start: 100%;
	max-inline-size: none;
	background: var(--mf-color-paper);
	box-shadow: var(--mf-shadow-soft);
}
.mf-search form { display: contents; } /* <search> wraps the form (forms guide); the flex layout is on <search> */
.mf-search label { flex-basis: 100%; font-size: var(--mf-text-label); color: var(--mf-color-text-2); }

.mf-btn {
	--mf-c-pad: var(--mf-space-5);
	--mf-c-radius: var(--mf-radius-card-lg); /* half of --mf-touch: a pill on one line, rounded corners when the label wraps */
	--mf-c-bg: var(--mf-color-brand);
	--mf-c-bg-hover: var(--mf-color-brand-hover);
	--mf-c-fg: var(--mf-color-card);
	--mf-c-text: var(--mf-text-button);
	--mf-c-weight: var(--mf-weight-semibold);
	--mf-c-wrap: normal; /* at 200% text the label wraps inside the sheet instead of running past the pill (G1 packet, 3 Dec) */
	--mf-c-align: center;
	--mf-c-pad-block: var(--mf-space-2);
}
.mf-btn svg { flex-shrink: 0; }

/* ---------- Nav: inline in the wide layout ---------- */
.mf-nav { --mf-link-text: 1.3125rem; }
.mf-header[data-layout="wide"] .mf-nav { --mf-link-text: var(--mf-text-body); margin-inline-end: auto; }
.mf-header[data-layout="wide"] :is(.mf-drawer, .mf-drawer__sheet) { display: contents; }
.mf-header[data-layout="wide"] .mf-nav ul { display: flex; gap: var(--mf-space-1); }
.mf-header[data-layout="wide"] .mf-nav a {
	display: inline-flex;
	min-block-size: var(--mf-touch);
	padding-inline: var(--mf-space-3);
	border: 0;
	border-radius: var(--mf-radius-pill);
	white-space: nowrap;
}
.mf-header[data-layout="wide"] .mf-nav a:hover { background: var(--mf-color-wash); }
.mf-nav a[aria-current="page"] { --mf-link-fg: var(--mf-color-brand); }
.mf-header[data-layout="wide"] .mf-nav a[aria-current="page"] { /* more than colour (navbar guide): a 3px underline */
	text-decoration: underline 3px;
	text-underline-offset: 0.45em;
}
/* Keep the measured row at its natural width. */
.mf-header[data-layout="wide"] .mf-header__bar > *,
.mf-header[data-layout="wide"] .mf-nav li { flex-shrink: 0; }

/* ---------- Panel contents (narrow layout and no script) ---------- */
.mf-drawer__sheet { display: flex; flex-direction: column; gap: var(--mf-space-1); }
.mf-drawer__sheet > * { flex-shrink: 0; } /* the fixed-height sheet scrolls; its items never get squeezed (200% text) */
.mf-nav a {
	display: flex;
	align-items: center;
	min-block-size: 3.5rem;
	font-weight: var(--mf-weight-semibold);
	line-height: 1.2;
	text-decoration: none;
	border-block-end: 1px solid var(--mf-color-wash);
}
.mf-header:not([data-layout="wide"]) .mf-nav a[aria-current="page"] { /* a bar at the inline start, not colour alone */
	border-inline-start: 0.1875rem solid var(--mf-color-brand);
	padding-inline-start: var(--mf-space-3);
}
.mf-drawer__util {
	--mf-c-display: flex;
	--mf-c-justify: flex-start;
	--mf-c-gap: var(--mf-space-3);
	--mf-c-inline: 100%;
	--mf-c-fg: var(--mf-color-text-2);
}
.mf-drawer__social a {
	--mf-link-fg: var(--mf-color-text-2);
	--mf-link-text: var(--mf-text-body);
	display: flex;
	align-items: center;
	gap: var(--mf-space-3);
	min-block-size: var(--mf-touch);
	text-decoration: none;
}
/* .mf-shell prefix: outranks `.mf-shell ul { margin: 0; padding: 0 }` (0,1,1), which had dropped these spacings */
.mf-shell .mf-drawer__utils { margin-block-start: var(--mf-space-3); }
.mf-shell .mf-drawer__social { display: flex; gap: var(--mf-space-5); padding-block: var(--mf-space-3) var(--mf-space-5); }
/* Last in the panel, pushed to its bottom edge and full width: within thumb reach (owner, 3 Dec). With 200% text the
   panel scrolls and the auto margin is 0, so the social row's bottom padding keeps it apart. */
.mf-drawer__intro { --mf-c-margin-block: auto 0; align-self: stretch; }
.mf-drawer__close {
	--mf-c-inline: var(--mf-touch);
	--mf-c-min-inline: var(--mf-touch);
	--mf-c-radius: 50%;
	--mf-c-bg: var(--mf-color-wash);
	--mf-c-bg-hover: var(--mf-color-wash-hover);
	--mf-c-fg: var(--mf-color-brand);
	align-self: flex-end;
	margin-block: var(--mf-space-1);
}

/* No script: the panel is a plain list under the bar. */
.mf-header:not([data-js]) .mf-drawer { position: relative; padding: var(--mf-space-3); }

/* ---------- Drawer (narrow layout with script): navigation-drawer guide, fallback variant ----------
   No popover (its top layer would cover the a11y toolbar): position fixed below the toolbar, class/attribute toggle.
   A full-viewport horizontal scroller with two snap stops (open, closed) gives native swipe-to-close.
   The sheet leaves the a11y trigger's column (--mf-a11y-reserve at the inline end) uncovered. */
.mf-header[data-js]:not([data-layout="wide"]) .mf-drawer {
	--mf-drawer-size: min(84%, 100% - var(--mf-a11y-reserve) - env(safe-area-inset-left), 24rem);
	position: fixed;
	inset: 0;
	z-index: var(--mf-z-drawer);
	display: grid;
	grid-template-columns: var(--mf-drawer-size) 100%;
	overflow-x: scroll;
	overflow-y: hidden;
	overscroll-behavior: none;
	scrollbar-width: none;
	scroll-snap-type: x mandatory;
	visibility: hidden;
}
.mf-header[data-js]:not([data-layout="wide"]) .mf-drawer::-webkit-scrollbar { display: none; }
.mf-header[data-js]:not([data-layout="wide"]) .mf-drawer::after { content: ""; scroll-snap-align: end; }
.mf-header[data-js]:not([data-layout="wide"]) .mf-drawer[data-open] { visibility: visible; }
.mf-header[data-js]:not([data-layout="wide"]) .mf-drawer__sheet {
	block-size: 100svh;
	padding: var(--mf-space-2) var(--mf-space-5) calc(var(--mf-space-6) + env(safe-area-inset-bottom));
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--mf-color-paper);
	box-shadow: var(--mf-shadow-lift);
	scroll-snap-align: start;
}
@media (prefers-reduced-motion: no-preference) {
	.mf-header[data-js] .mf-drawer { scroll-behavior: smooth; }
}
.mf-drawer-backdrop {
	position: fixed;
	inset: 0;
	z-index: var(--mf-z-backdrop);
	background: var(--mf-color-deep);
	opacity: calc(var(--mf-drawer-progress) * 0.45);
	pointer-events: none;
}

/* ---------- Footer ---------- */
.mf-footer {
	display: grid;
	gap: var(--mf-space-1);
	padding: var(--mf-space-4) var(--mf-gutter) calc(var(--mf-space-5) + env(safe-area-inset-bottom));
	padding-inline-end: max(var(--mf-gutter), var(--mf-a11y-reserve)); /* R9: the a11y trigger's column stays free */
	background: var(--mf-color-deep);
	color: var(--mf-color-footer-text);
	font-size: var(--mf-text-small);
}
.mf-footer__links { display: flex; flex-wrap: wrap; gap: 0 var(--mf-space-5); }
.mf-footer__links a {
	--mf-link-fg: var(--mf-color-card);
	display: inline-flex;
	align-items: center;
	min-block-size: 2rem;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}
@media (pointer: coarse) {
	.mf-footer__links a { min-block-size: var(--mf-touch); }
}
.mf-footer__copy { margin: 0; opacity: 0.85; }
.mf-shell.mf-footer :focus-visible { /* (0,3,0): must beat the shared (0,2,1) ring rule, or the ring is green on green */
	outline-color: var(--mf-color-card);
	box-shadow: 0 0 0 calc(var(--mf-focus-offset) + var(--mf-focus-width)) var(--mf-color-deep);
}

/* ---------- Forced colours ---------- */
@media (forced-colors: active) {
	.mf-header__cart-count { outline: 1px solid CanvasText; outline-offset: -1px; }
	.mf-nav a[aria-current="page"] { text-decoration: underline 3px; }
	.mf-shell :is(button, a):is(.mf-header__menu-btn, .mf-drawer__close, .mf-btn) { border: 1px solid ButtonText; }
	.mf-header[data-js]:not([data-layout="wide"]) .mf-drawer__sheet { border-inline-end: 1px solid CanvasText; }
}
