/* Glass navigation for mobile pages outside the home and product catalogs. */
@media (max-width: 780px) {
	/* The brand header stays in normal flow and scrolls away with the page. */
	body.lsh-mobile-glass-header .ls-topbar {
		display: block !important;
		position: static;
		top: auto;
	}

	body.single-product .ct-breadcrumbs,
	body.single-product .hero-section[data-type="type-1"] {
		display: none !important;
	}

	body.lsh-mobile-glass-header .ls-category-row,
	body.lsh-mobile-glass-header .ls-nav-icons > .lsips-wrap,
	body.lsh-mobile-glass-header .ls-nav-icons > a[aria-label="Search"],
	body.lsh-mobile-glass-header .ls-nav-icons > .ls-account-menu,
	body.lsh-mobile-glass-header .ls-mobile-back > span {
		display: none !important;
	}

	body.lsh-mobile-glass-header nav.ls-main-nav {
		display: block !important;
		background: transparent !important;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		left: auto;
		margin: 4px max(16px, env(safe-area-inset-right)) 4px max(16px, env(safe-area-inset-left));
		max-width: none;
		pointer-events: none;
		position: sticky;
		right: auto;
		top: calc(max(6px, env(safe-area-inset-top)) + var(--wp-admin--admin-bar--height, 0px));
		width: auto;
		z-index: 9990;
	}

	body.lsh-mobile-glass-header .ls-main-nav::before { display: none; }

	body.lsh-mobile-glass-header .ls-main-nav .ls-nav-inner {
		display: block;
		margin: 0;
		max-width: none;
		padding: 0;
		width: 100%;
	}

	body.lsh-mobile-glass-header .ls-main-nav .ls-nav-icons {
		align-items: center;
		background: transparent;
		border: 0;
		border-radius: 0;
		display: flex;
		gap: 10px;
		margin: 0;
		padding: 0;
		pointer-events: none;
		width: 100%;
	}

	body.lsh-mobile-glass-header .ls-nav-icons > .ls-mobile-back,
	body.lsh-mobile-glass-header .ls-nav-icons > .ls-cart,
	body.lsh-mobile-glass-header .ls-product-more__trigger,
	body.lsh-mobile-glass-header .ls-product-more__panel {
		-webkit-backdrop-filter: blur(16px) saturate(140%);
		backdrop-filter: blur(16px) saturate(140%);
		background: rgba(249, 255, 253, .66);
		border: 1px solid rgba(255, 255, 255, .9);
		box-shadow: 0 4px 18px rgba(19, 63, 67, .12), inset 0 1px 0 rgba(255, 255, 255, .7);
		color: #164f4b;
	}

	body.lsh-mobile-glass-header .ls-nav-icons > .ls-mobile-back,
	body.lsh-mobile-glass-header .ls-nav-icons > .ls-cart,
	body.lsh-mobile-glass-header .ls-product-more__trigger {
		align-items: center;
		border-radius: 50%;
		box-sizing: border-box;
		cursor: pointer;
		display: inline-flex;
		flex: 0 0 44px;
		height: 44px;
		justify-content: center;
		min-height: 44px;
		min-width: 44px;
		padding: 0;
		pointer-events: auto;
		touch-action: manipulation;
		width: 44px;
	}

	body.lsh-mobile-glass-header .ls-nav-icons > .ls-mobile-back { margin-left: 0; margin-right: auto; order: 0; }
	body.lsh-mobile-glass-header .ls-nav-icons > .ls-cart { order: 3; }
	body.lsh-mobile-glass-header .ls-nav-icons > .ls-mobile-back svg,
	body.lsh-mobile-glass-header .ls-nav-icons > .ls-cart svg,
	body.lsh-mobile-glass-header .ls-product-more svg { height: 21px; width: 21px; }
	body.lsh-mobile-glass-header .ls-product-more__trigger { margin: 0; }
	body.lsh-mobile-glass-header .ls-product-more__trigger svg { fill: none; stroke: currentColor; }
	body.lsh-mobile-glass-header .ls-cart-count {
		background: #0b5f4a;
		border: 1px solid rgba(255, 255, 255, .95);
		border-radius: 9px;
		color: #fff;
		font-size: 10px;
		height: 18px;
		line-height: 1;
		min-width: 18px;
		padding-inline: 4px;
		right: -3px;
		top: -3px;
	}

	body.lsh-mobile-glass-header .ls-product-more {
		display: block;
		flex: 0 0 44px;
		order: 2;
		pointer-events: auto;
		position: relative;
	}
	body.lsh-mobile-glass-header .ls-product-more__panel {
		border-radius: 18px;
		display: flex;
		gap: 4px;
		padding: 6px;
		position: absolute;
		right: 0;
		top: calc(100% + 10px);
		width: max-content;
	}
	body.lsh-mobile-glass-header .ls-product-more__panel[hidden] { display: none; }
	body.lsh-mobile-glass-header .ls-nav-icons .ls-product-more__panel > a {
		align-items: center;
		background: transparent;
		border-radius: 12px;
		color: #164f4b;
		display: flex;
		flex: 0 0 44px;
		height: 44px;
		justify-content: center;
		padding: 0;
		touch-action: manipulation;
		width: 44px;
	}
	body.lsh-mobile-glass-header .ls-nav-icons > .ls-mobile-back:hover,
	body.lsh-mobile-glass-header .ls-nav-icons > .ls-cart:hover,
	body.lsh-mobile-glass-header .ls-product-more__trigger:hover,
	body.lsh-mobile-glass-header .ls-product-more__trigger[aria-expanded="true"],
	body.lsh-mobile-glass-header .ls-nav-icons .ls-product-more__panel > a:hover {
		background: rgba(235, 250, 245, .92);
		color: #0b5f4a;
	}
	body.lsh-mobile-glass-header .ls-nav-icons > .ls-mobile-back:focus-visible,
	body.lsh-mobile-glass-header .ls-nav-icons > .ls-cart:focus-visible,
	body.lsh-mobile-glass-header .ls-product-more__trigger:focus-visible,
	body.lsh-mobile-glass-header .ls-nav-icons .ls-product-more__panel > a:focus-visible {
		outline: 2px solid #0b5f4a;
		outline-offset: 3px;
	}

	/* Navigation now reserves its own row below the scrolling brand header. */
	body.lsh-mobile-glass-header:not(.single-product) #main-container {
		padding-top: 0;
	}

	body.single-product main .ct-container-full[data-content="normal"] {
		padding-top: 0 !important;
	}

	/* Keep the usual card inset; the controls no longer overlap the product heading. */
	body.single-product .summary.entry-summary.lspa-summary-with-gallery {
		padding-top: 22px;
	}

	/* Match the main image arrows to the floating glass controls. */
	body.single-product main .woocommerce-product-gallery .flexy > :is(.flexy-arrow-prev, .flexy-arrow-next) {
		-webkit-backdrop-filter: blur(16px) saturate(140%);
		backdrop-filter: blur(16px) saturate(140%);
		background: rgba(249, 255, 253, .66) !important;
		border: 1px solid rgba(255, 255, 255, .9);
		box-shadow: 0 4px 18px rgba(19, 63, 67, .12), inset 0 1px 0 rgba(255, 255, 255, .7);
		color: #164f4b !important;
	}

	body.single-product main .woocommerce-product-gallery .flexy > :is(.flexy-arrow-prev, .flexy-arrow-next):is(:hover, :focus-visible) {
		background: rgba(235, 250, 245, .92) !important;
		color: #0b5f4a !important;
	}

	body.single-product main .woocommerce-product-gallery .flexy > :is(.flexy-arrow-prev, .flexy-arrow-next):focus-visible {
		outline: 2px solid #0b5f4a;
		outline-offset: 3px;
	}
}

/* Keep the registration heading beside the back control on mobile. */
@media (max-width: 780px) {
	body.lsua-registration-page.lsh-mobile-glass-header .lsh-has-registration-title > .ls-mobile-back {
		margin-right: 0;
	}
	body.lsua-registration-page.lsh-mobile-glass-header .ls-nav-icons > .lsh-mobile-registration-title {
		color: var(--lsua-ink, #143e46);
		flex: 1 1 0;
		font-size: clamp(16px, calc(4.4vw + 2px), 20px);
		font-weight: 700;
		letter-spacing: 0;
		line-height: 1.2;
		margin: 0;
		min-width: 0;
		order: 1;
		text-align: left;
		text-transform: none;
	}
}

/* Place registration guidance below the submit button only on mobile. */
@media (max-width: 780px) {
	body.lsua-registration-page .lsua-register__header.lsh-registration-notice-moved {
		display: none;
	}
	body.lsua-registration-page .lsua-form > .lsh-mobile-registration-notice {
		color: var(--lsua-muted, #57767d);
		font-size: 14px;
		font-weight: 400;
		line-height: 1.5;
		margin: 12px 0 0;
		text-align: left;
	}
}

/* Center plain page titles in the navigation row while letting them scroll normally. */
@media (max-width: 780px) {
	body:is(.woocommerce-cart, .woocommerce-checkout, .woocommerce-account) > .lsh-mobile-title-slot {
		display: flow-root;
		height: 0;
		margin: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
		pointer-events: none;
		position: relative;
	}
	body:is(.woocommerce-cart, .woocommerce-checkout, .woocommerce-account):not(.woocommerce-order-received) .lsh-mobile-title-slot > .lsh-mobile-page-title {
		color: #173f43;
		font-size: clamp(18px, 5.8vw, 24px);
		left: 50%;
		line-height: 1.2;
		margin: 0;
		max-width: calc(100% - 200px);
		overflow: hidden;
		pointer-events: none;
		position: absolute;
		text-align: center;
		text-overflow: ellipsis;
		/* Match the normal navigation row: 4px top margin + half a 44px control. */
		top: 26px;
		transform: translate(-50%, -50%);
		white-space: nowrap;
	}
	body:is(.woocommerce-cart, .woocommerce-checkout, .woocommerce-account):not(.woocommerce-order-received) #main .hero-section.lsh-page-title-moved {
		display: none;
	}
	body:is(.woocommerce-cart, .woocommerce-checkout):not(.woocommerce-order-received) #main .entry-content {
		box-sizing: border-box;
		/* The cart and checkout blocks already reserve 16px on each side. */
		padding-left: max(0px, calc(env(safe-area-inset-left) - 16px));
		padding-right: max(0px, calc(env(safe-area-inset-right) - 16px));
	}
}

/* Move the guest login heading into the shared, scrolling mobile title row. */
@media (max-width: 780px) {
	body.woocommerce-account.lightsign-account-login .lsh-mobile-title-slot > .lsh-mobile-page-title {
		left: 54px;
		max-width: calc(100% - 160px);
		text-align: left;
		transform: translateY(-50%);
	}
	body.woocommerce-account.lightsign-account-login .lightsign-login-heading.lsh-page-title-moved {
		display: none;
	}
	/* Remove the empty title space once the login heading is in the mobile toolbar. */
	body.woocommerce-account.lightsign-account-login:has(> .lsh-mobile-title-slot) #main .hero-section {
		display: none;
	}
	body.woocommerce-account.lightsign-account-login:has(> .lsh-mobile-title-slot) #main .entry-content > .woocommerce.ct-woo-unauthorized {
		margin-top: 0 !important;
	}
}

/* Keep the full label clear of the controls on narrow phones. */
@media (max-width: 359px) {
	body.woocommerce-account.lightsign-account-login .lsh-mobile-title-slot > .lsh-mobile-page-title {
		font-size: 16px;
	}
}

/* Place the lost-password page title immediately after the mobile back button. */
@media (max-width: 780px) {
	body.woocommerce-lost-password.lsh-mobile-glass-header .lsh-has-reset-title > .ls-mobile-back {
		margin-right: 0;
	}
	body.woocommerce-lost-password.lsh-mobile-glass-header .ls-nav-icons > .lsh-mobile-reset-title {
		color: #143e46;
		flex: 1 1 0;
		font-size: 20px;
		font-weight: 700;
		letter-spacing: 0;
		line-height: 1.2;
		margin: 0;
		min-width: 0;
		order: 1;
		text-align: left;
		white-space: nowrap;
	}
}

/* Keep Back first, followed by the title and account/cart controls on mobile. */
@media (max-width: 780px) {
	html body.lsh-mobile-glass-header:not(.single-product) > .lsh-mobile-title-slot {
		display: flow-root;
		height: 0;
		margin: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
		pointer-events: none;
		position: relative;
	}
	html body.lsh-mobile-glass-header:not(.single-product) .lsh-mobile-title-slot > .lsh-mobile-page-title,
	html body.lsh-mobile-glass-header:not(.single-product) .ls-nav-icons > :is(.lsh-mobile-registration-title, .lsh-mobile-reset-title) {
		color: #173f43;
		display: -webkit-box;
		font-size: clamp(16px, 4.65vw, 20px);
		font-weight: 700;
		letter-spacing: 0;
		line-height: 1.1;
		margin: 0;
		min-width: 0;
		overflow: hidden;
		overflow-wrap: anywhere;
		text-align: left;
		text-overflow: ellipsis;
		text-transform: none;
		white-space: normal;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
	}
	html body.lsh-mobile-glass-header:not(.single-product) .lsh-mobile-title-slot > .lsh-mobile-page-title {
		left: 54px;
		max-width: calc(100% - 162px);
		position: absolute;
		top: 26px;
		transform: translateY(-50%);
	}
	html body.lsh-mobile-glass-header:not(.single-product) .lsh-mobile-title-slot > .lsh-mobile-page-title.lsh-mobile-title-long {
		font-size: clamp(14px, 4.2vw, 18px);
	}
	html body.lsh-mobile-glass-header:not(.single-product) .ls-nav-icons > :is(.lsh-mobile-registration-title, .lsh-mobile-reset-title) {
		flex: 1 1 0;
		order: 1;
	}
	html body.lsh-mobile-glass-header:not(.single-product) .lsh-has-page-title > .ls-mobile-back {
		margin-left: 0;
		margin-right: auto;
	}
	html body.lsh-mobile-glass-header:not(.single-product) #main :is(.ls-info-heading, .lightsign-legal-heading).lsh-page-title-moved,
	html body.lsh-mobile-glass-header:not(.single-product) #main .hero-section.lsh-page-title-moved:not(:has(.ct-breadcrumbs)) {
		display: none;
	}
	html body:is(.ls-info-content-page, .lightsign-legal-page, .lscu-contact-page):has(> .lsh-mobile-title-slot) #main .entry-content {
		padding-top: 12px !important;
	}
}
