/**
 * Mobile header final (≤767px only).
 * Compact sticky single header; centered wordmark; no bottom nav / no cloned bar.
 */

@media (max-width: 767px) {
	:root {
		--nds-mobile-header-h: 3.625rem; /* ~58px */
		--nds-bottom-bar-h: 0px;
		--nds-fixed-bottom-offset: 0px;
		--nds-main-header-h: var(--nds-mobile-header-h);
		/* Measured by storefront.js — 0 unless a visible #wpadminbar exists */
		--nds-admin-bar-offset: 0px;
	}

	/*
	 * Do NOT put overflow-x:clip on body here. Combined with body padding-top it can
	 * make position:fixed resolve against the content box in WebKit → ~50–58px gap
	 * above the header once content scrolls into that band.
	 */
	html {
		overflow-x: clip;
		scroll-padding-top: calc(
			var(--nds-mobile-header-h) + var(--nds-admin-bar-offset, 0px) + env(safe-area-inset-top, 0px)
		);
		scroll-padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
	}

	body.nds-storefront,
	body {
		overflow-x: visible !important;
		/* Clearance moved to .nds-header-sentinel — keep body padding at 0 */
		padding-top: 0 !important;
	}

	/* —— Single real header: fixed to viewport top —— */
	.nds-site-header,
	.nds-site-header--premium {
		position: fixed !important;
		top: 0 !important;
		left: 0 !important;
		right: 0 !important;
		bottom: auto !important;
		z-index: 10050;
		width: 100%;
		margin: 0 !important;
		padding: 0 !important;
		transform: none !important;
		translate: none !important;
		background: #fff;
		border: 0;
		border-top: 0;
		border-bottom: 0;
		box-shadow: none;
		inset-inline: 0;
	}

	/* Logged-out mobile customers: always flush with the viewport top edge */
	body:not(.admin-bar) .nds-site-header,
	body:not(.admin-bar) .nds-site-header--premium {
		top: 0 !important;
	}

	/*
	 * Logged-in WordPress users only.
	 * Offset from --nds-admin-bar-offset (JS measures visible #wpadminbar height).
	 * Hidden/missing toolbar → 0px.
	 */
	body.admin-bar .nds-site-header,
	body.admin-bar .nds-site-header--premium {
		top: var(--nds-admin-bar-offset, 0px) !important;
	}

	/*
	 * In-flow spacer (existing sentinel). Replaces body padding-top so a fixed
	 * containing-block cannot inherit a ~58px content-edge offset.
	 */
	.nds-header-sentinel {
		display: block !important;
		visibility: hidden !important;
		pointer-events: none !important;
		height: var(--nds-mobile-header-h) !important;
		min-height: var(--nds-mobile-header-h) !important;
		max-height: var(--nds-mobile-header-h) !important;
		margin: 0 !important;
		padding: 0 !important;
		border: 0 !important;
		overflow: hidden !important;
		background: transparent !important;
	}

	/* Staging notice (admin-only): never reserve empty space when absent */
	body:not(.admin-bar) .nds-staging-banner,
	body.admin-bar:not(:has(#wpadminbar)) .nds-staging-banner {
		display: none !important;
		height: 0 !important;
		margin: 0 !important;
		padding: 0 !important;
		overflow: hidden !important;
	}

	.nds-site-header--premium .nds-site-header__main,
	.nds-site-header__main {
		background: #fff;
		border: 0;
		box-shadow: none;
	}

	.nds-site-header__inner,
	.nds-site-header--premium .nds-site-header__inner {
		position: relative;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 0.35rem;
		min-height: var(--nds-mobile-header-h);
		height: var(--nds-mobile-header-h);
		padding-block: 0;
		box-sizing: border-box;
	}

	/* LEFT — menu stays in place */
	.nds-menu-toggle--header {
		position: relative;
		z-index: 2;
		flex: 0 0 auto;
	}

	/* CENTER — true viewport/header center */
	.nds-site-header .nds-brand--header,
	.nds-site-header--premium .nds-brand--header {
		position: absolute;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);
		z-index: 1;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 0;
		margin: 0;
		max-width: calc(100% - 12.75rem);
		pointer-events: auto;
	}

	.nds-site-header .nds-brand--header .nds-brand__icon,
	.nds-site-header--premium .nds-brand--header .nds-brand__icon,
	.nds-site-header .nds-brand--header .nds-brand-svg,
	.nds-site-header--premium .nds-brand--header .nds-brand-svg {
		display: none !important;
	}

	.nds-site-header .nds-brand--header .nds-brand__text,
	.nds-site-header--premium .nds-brand--header .nds-brand__text {
		display: flex !important;
		flex-direction: column;
		align-items: center;
		min-width: 0;
	}

	.nds-site-header .nds-brand--header .nds-brand__tagline,
	.nds-site-header--premium .nds-brand--header .nds-brand__tagline {
		display: none !important;
	}

	.nds-site-header .nds-brand--header .nds-brand__name,
	.nds-site-header--premium .nds-brand--header .nds-brand__name {
		display: inline-flex;
		align-items: baseline;
		gap: 0.28em;
		margin: 0;
		max-width: 100%;
		font-size: 0.98rem;
		font-weight: 800;
		letter-spacing: 0.055em;
		line-height: 1;
		white-space: nowrap;
		overflow: hidden;
		text-align: center;
		color: var(--nds-color-ink, #0a1f28);
	}

	/* RIGHT — clean search icon + unchanged teal cart */
	.nds-header-tools {
		position: relative;
		z-index: 2;
		display: inline-flex;
		align-items: center;
		justify-content: flex-end;
		gap: 0.1rem;
		margin-left: auto;
		flex: 0 0 auto;
		width: max-content;
		min-width: max-content;
		padding: 0;
		border: 0;
		border-radius: 0;
		background: transparent;
		box-shadow: none;
	}

	.nds-site-header--premium .nds-header-actions,
	.nds-header-actions {
		display: contents;
		padding: 0;
		border: 0;
		background: transparent;
		box-shadow: none;
	}

	.nds-site-header--premium .nds-header-actions:hover,
	.nds-header-actions:hover {
		border: 0;
		box-shadow: none;
	}

	.nds-header-link--account,
	.nds-site-header--premium .nds-header-link--account {
		display: none !important;
	}

	.nds-header-icon-btn--search-mobile,
	.nds-site-header--premium .nds-header-icon-btn--search-mobile {
		position: relative;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		order: 0;
		width: 1.5rem;
		min-width: 1.5rem;
		min-height: 2.55rem;
		height: 2.55rem;
		padding: 0;
		margin: 0;
		border: 0 !important;
		border-radius: 0;
		background: transparent !important;
		box-shadow: none !important;
		color: var(--nds-color-ink, #0a1f28);
	}

	.nds-header-icon-btn--search-mobile::after {
		content: '';
		position: absolute;
		left: 50%;
		top: 50%;
		width: 44px;
		height: 44px;
		transform: translate(-50%, -50%);
	}

	.nds-header-icon-btn--search-mobile:hover,
	.nds-header-icon-btn--search-mobile:focus-visible {
		background: transparent !important;
		box-shadow: none !important;
		color: var(--nds-color-teal-deep, #063f46);
	}

	.nds-header-icon-btn--search-mobile .nds-icon {
		width: 1.15rem;
		height: 1.15rem;
	}

	/* Cart — leave premium teal control as-is; only ensure it follows search */
	.nds-header-cart,
	.nds-site-header--premium .nds-header-cart,
	.nds-site-header--premium .nds-header-action--cart {
		order: 1;
		margin-left: 0.1rem;
		flex-shrink: 0;
	}

	/* —— No cloned compact sticky bar —— */
	.nds-compact-header {
		display: none !important;
		visibility: hidden !important;
		pointer-events: none !important;
		height: 0 !important;
		min-height: 0 !important;
		overflow: hidden !important;
	}

	/* —— Remove mobile bottom navigation + reserved space —— */
	.nds-bottom-bar,
	nav.nds-bottom-bar[data-nds-bottom-bar] {
		display: none !important;
		visibility: hidden !important;
		pointer-events: none !important;
		height: 0 !important;
		min-height: 0 !important;
		padding: 0 !important;
		margin: 0 !important;
		border: 0 !important;
		box-shadow: none !important;
		background: transparent !important;
	}

	body.nds-has-header-chrome:not(.nds-hide-bottom-bar),
	body.nds-has-header-chrome {
		padding-bottom: 0 !important;
	}

	body.nds-storefront .nds-site-footer.nds-ft {
		padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
	}

	body.nds-storefront .nds-sticky-cart {
		padding-bottom: calc(var(--nds-space-3, 0.75rem) + env(safe-area-inset-bottom, 0px));
	}
}

@media (max-width: 390px) {
	.nds-site-header .nds-brand--header,
	.nds-site-header--premium .nds-brand--header {
		max-width: calc(100% - 13rem);
	}

	.nds-site-header .nds-brand--header .nds-brand__name,
	.nds-site-header--premium .nds-brand--header .nds-brand__name {
		font-size: 0.92rem;
		letter-spacing: 0.05em;
	}
}

@media (max-width: 360px) {
	.nds-site-header .nds-brand--header,
	.nds-site-header--premium .nds-brand--header {
		max-width: calc(100% - 13.25rem);
	}

	.nds-site-header .nds-brand--header .nds-brand__name,
	.nds-site-header--premium .nds-brand--header .nds-brand__name {
		font-size: 0.84rem;
		letter-spacing: 0.035em;
	}
}

@media (max-width: 320px) {
	.nds-site-header .nds-brand--header,
	.nds-site-header--premium .nds-brand--header {
		max-width: calc(100% - 12.75rem);
		overflow: visible;
	}

	.nds-site-header .nds-brand--header .nds-brand__name,
	.nds-site-header--premium .nds-brand--header .nds-brand__name {
		font-size: 0.68rem;
		letter-spacing: 0;
		overflow: visible;
	}

	.nds-site-header__inner,
	.nds-site-header--premium .nds-site-header__inner {
		gap: 0.1rem;
	}

	.nds-header-tools {
		gap: 0;
	}

	.nds-header-cart,
	.nds-site-header--premium .nds-header-cart,
	.nds-site-header--premium .nds-header-action--cart {
		margin-left: 0;
	}
}
