/* NorthMart: sticky header (theme fork 1.0.9) */

/* overflow-x:hidden on html/body turns body into a scroll container and kills position:sticky; clip does not. */
html, body { overflow-x: clip; }

body .wp-site-blocks > header.wp-block-template-part:first-child {
	position: sticky;
	top: 0;
	z-index: 99;
	background-color: var(--wp--preset--color--background, #f7f6f3);
}
body.admin-bar .wp-site-blocks > header.wp-block-template-part:first-child { top: 32px; }
@media (max-width: 782px) {
	body.admin-bar .wp-site-blocks > header.wp-block-template-part:first-child { top: 46px; }
}

/* NOTE: no scroll-padding-top here on purpose: core focuses the submenu toggle inside the sticky header on click,
   and any scroll-padding makes the browser scroll the page to satisfy it. */

/* Compact state while scrolled (desktop only): menu only, smaller logo. Class toggled by js/northmart-nav.js */
@media (min-width: 783px) {
	body .wp-site-blocks > header.wp-block-template-part:first-child > .wp-block-group {
		transition: padding-bottom .2s ease;
	}
	#header-wrapper { transition: min-height .2s ease; }
	#header-wrapper .logo-background { transition: width .2s ease, padding .2s ease; }

	body.nm-header-compact .wp-site-blocks > header.wp-block-template-part:first-child > .wp-block-group {
		padding-bottom: 8px;
	}
	body.nm-header-compact #header-wrapper {
		min-height: 60px;
		align-items: center;
	}
	body.nm-header-compact #header-wrapper > .wp-block-group.is-vertical > .is-responsive {
		display: none;
	}
	body.nm-header-compact #header-wrapper .logo-background {
		width: clamp(110px, 11vw, 136px);
		padding: 14px 12px 12px;
	}
}

/* Mobile menu: submenus open on click/tap only (no hover, no focus-within). Open state = toggle button aria-expanded. */
@media (hover: none), (max-width: 782px) {
	.intro-menu-mobile .wp-block-navigation .has-child:hover > .wp-block-navigation__submenu-container,
	.intro-menu-mobile .wp-block-navigation .has-child:focus-within > .wp-block-navigation__submenu-container {
		visibility: hidden !important;
		opacity: 0 !important;
		height: 0 !important;
		overflow: hidden !important;
	}
	.intro-menu-mobile .wp-block-navigation .has-child > .wp-block-navigation-submenu__toggle[aria-expanded="true"] ~ .wp-block-navigation__submenu-container {
		visibility: visible !important;
		opacity: 1 !important;
		height: auto !important;
		overflow: visible !important;
	}
}
