/*
 * Multicharts Universe — Header (v0.2.1)
 *
 * Sticky cosmic header. Transparent at rest (so hero shows through), gains
 * frosted-glass background once the page is scrolled. Three-section layout:
 * branding · navigation · actions (cart + account + mobile burger).
 *
 * Specificity strategy: prefix every selector with `body.mcu-theme` so we
 * always win against Storefront's customizer-injected inline CSS (which
 * uses bare `.site-header` and friends).
 */

/* === Neutralise leftover Storefront / Deli markup ===================== */
/* If any callback we couldn't remove still emits these chunks, hide them
   so they never break the visual layout. */
body.mcu-theme .site-header > .col-full > .site-search,
body.mcu-theme .site-header > .col-full > .secondary-navigation,
body.mcu-theme .site-header > .col-full > .site-branding:not(.mcu-header__branding),
body.mcu-theme .site-header .deli-primary-navigation,
body.mcu-theme .site-header .site-header-cart,
body.mcu-theme .site-header .header-widget-region,
body.mcu-theme .header-widget-region,
body.mcu-theme .storefront-handheld-footer-bar,
body.mcu-theme a.skip-link.screen-reader-text:not(.mcu-skip-link),
/* Storefront/WooCommerce breadcrumb — visually overlaps the sticky header
   and adds clutter to the cosmic-luxury style. Internal nav + page titles
   provide enough orientation. (Re-enable if SEO breadcrumb schema needs it.) */
body.mcu-theme .storefront-breadcrumb,
body.mcu-theme .woocommerce-breadcrumb {
	display: none !important;
}

/* === Sticky header shell =============================================== */
/* Transparent at rest, but with a subtle top-down dark fade so logo/nav/
   icons always have a readable backdrop even over the busy starfield hero. */
body.mcu-theme #masthead.site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: var(--z-sticky);
	min-height: var(--header-height-mobile);
	padding: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.25) 60%, transparent 100%);
	border: 0;
	box-shadow: none;
	transition: background var(--dur-base) var(--ease-celestial),
	            backdrop-filter var(--dur-base) var(--ease-celestial),
	            box-shadow var(--dur-base) var(--ease-celestial);
}

@media (min-width: 768px) {
	body.mcu-theme #masthead.site-header {
		min-height: var(--header-height-desktop);
	}
}

html[data-mcu-scrolled="true"] body.mcu-theme #masthead.site-header,
body.mcu-theme html[data-mcu-scrolled="true"] #masthead.site-header {
	background-color: rgba(10, 10, 15, 0.92);
	backdrop-filter: saturate(140%) blur(18px);
	-webkit-backdrop-filter: saturate(140%) blur(18px);
	box-shadow: 0 1px 0 0 var(--color-border-subtle), 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Push first content down by header height so it isn't hidden underneath */
body.mcu-theme #content.site-content {
	padding-top: var(--header-height-mobile);
}
@media (min-width: 768px) {
	body.mcu-theme #content.site-content {
		padding-top: var(--header-height-desktop);
	}
}
/* Front page hero spans behind header — don't push it down */
body.mcu-home #content.site-content {
	padding-top: 0 !important;
}

body.mcu-theme #masthead .col-full {
	padding: 0 !important;
	max-width: var(--container-extra) !important;
	margin-inline: auto;
	background: transparent;
}

body.mcu-theme .mcu-header__inner {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: var(--space-md);
	padding-inline: var(--container-padding);
	min-height: var(--header-height-mobile);
}
@media (min-width: 768px) {
	body.mcu-theme .mcu-header__inner { min-height: var(--header-height-desktop); }
}

body.mcu-theme .mcu-skip-link {
	position: absolute;
	top: -100px;
	left: var(--space-sm);
	z-index: var(--z-max);
}
body.mcu-theme .mcu-skip-link:focus {
	position: fixed;
	top: var(--space-sm);
	clip: auto;
	width: auto;
	height: auto;
	padding: var(--space-sm) var(--space-md);
	background: var(--color-gold-bright);
	color: var(--color-text-on-gold);
	border-radius: var(--radius-md);
}

/* === Branding ========================================================== */
body.mcu-theme .mcu-header__branding { display: flex; align-items: center; }

body.mcu-theme .mcu-brand {
	display: inline-flex;
	align-items: center;
	gap: var(--space-sm);
	color: var(--color-text-primary);
	background: none;
	text-decoration: none;
}
body.mcu-theme .mcu-brand:hover,
body.mcu-theme .mcu-brand:focus {
	color: var(--color-gold-bright);
	background: none;
}

body.mcu-theme .mcu-brand__logo {
	width: 44px;
	height: 44px;
	flex: 0 0 auto;
	transition: transform var(--dur-base) var(--ease-spring),
	            filter var(--dur-base) var(--ease-celestial);
	filter: drop-shadow(0 4px 12px rgba(212, 175, 55, 0.25));
}
body.mcu-theme .mcu-brand:hover .mcu-brand__logo { transform: rotate(-8deg) scale(1.05); }

body.mcu-theme .mcu-brand__wordmark {
	display: none;
	flex-direction: column;
	line-height: 1.1;
}
@media (min-width: 1024px) {
	body.mcu-theme .mcu-brand__wordmark { display: flex; }
}

body.mcu-theme .mcu-brand__name {
	font-family: var(--font-display);
	font-size: var(--text-lg);
	font-weight: var(--weight-regular);
	letter-spacing: var(--tracking-tight);
	color: inherit;
	white-space: nowrap;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);  /* readability over starfield */
}
body.mcu-theme .mcu-brand__name em {
	font-style: italic;
	color: var(--color-gold-bright);
}
body.mcu-theme .mcu-brand__tagline {
	font-size: 0.6875rem;
	letter-spacing: var(--tracking-widest);
	text-transform: uppercase;
	color: var(--color-text-secondary);  /* was --muted, too dim on hero */
	margin-top: 2px;
	white-space: nowrap;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* === Navigation ======================================================== */
body.mcu-theme .mcu-nav {
	display: none;
	justify-content: center;
}
@media (min-width: 960px) {
	body.mcu-theme .mcu-nav { display: flex; }
}

body.mcu-theme .mcu-nav__list,
body.mcu-theme .mcu-nav > ul {
	display: flex;
	align-items: center;
	gap: var(--space-md);
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	background: none !important;
}

body.mcu-theme .mcu-nav__item,
body.mcu-theme .mcu-nav .menu-item {
	margin: 0 !important;
	padding: 0 !important;
	position: relative;
	list-style: none !important;
	background: none !important;
	border: 0 !important;
}

body.mcu-theme .mcu-nav__link,
body.mcu-theme .mcu-nav a {
	display: inline-block;
	padding: var(--space-xs) 2px !important;
	font-family: var(--font-body) !important;
	font-size: var(--text-sm) !important;
	font-weight: var(--weight-medium) !important;
	letter-spacing: var(--tracking-wide) !important;
	text-transform: uppercase;
	color: #e6e6ee !important;  /* near-white for high contrast over hero */
	background: none !important;
	border: 0 !important;
	text-decoration: none !important;
	position: relative;
	transition: color var(--dur-fast) var(--ease-celestial);
	line-height: 1.4;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

body.mcu-theme .mcu-nav__link::after,
body.mcu-theme .mcu-nav a::after {
	content: '';
	position: absolute;
	left: 0; right: 0; bottom: -4px;
	height: 1px;
	background: linear-gradient(90deg, transparent, var(--color-gold-bright), transparent);
	transform: scaleX(0);
	transform-origin: center;
	transition: transform var(--dur-base) var(--ease-out-soft);
}

body.mcu-theme .mcu-nav__link:hover,
body.mcu-theme .mcu-nav__link:focus,
body.mcu-theme .mcu-nav a:hover,
body.mcu-theme .mcu-nav a:focus,
body.mcu-theme .mcu-nav .current-menu-item > a,
body.mcu-theme .mcu-nav .current_page_item > a {
	color: var(--color-text-primary) !important;
}

body.mcu-theme .mcu-nav__link:hover::after,
body.mcu-theme .mcu-nav__link:focus::after,
body.mcu-theme .mcu-nav a:hover::after,
body.mcu-theme .mcu-nav a:focus::after,
body.mcu-theme .mcu-nav .current-menu-item > a::after,
body.mcu-theme .mcu-nav .current_page_item > a::after {
	transform: scaleX(1);
}

/* === Sub-menu (dropdown on hover, hidden by default) =================== */
body.mcu-theme .mcu-nav .menu-item-has-children > a::before {
	content: '';
	display: inline-block;
	width: 0;
	height: 0;
	margin-left: 6px;
	border-left: 3px solid transparent;
	border-right: 3px solid transparent;
	border-top: 4px solid currentColor;
	vertical-align: middle;
	transition: transform var(--dur-fast) var(--ease-celestial);
	opacity: 0.6;
}

body.mcu-theme .mcu-nav .sub-menu,
body.mcu-theme .mcu-nav ul.children {
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%) translateY(8px);
	min-width: 240px;
	padding: var(--space-sm) 0 !important;
	margin: 0 !important;
	list-style: none !important;
	background: rgba(10, 10, 15, 0.96);
	backdrop-filter: saturate(140%) blur(20px);
	-webkit-backdrop-filter: saturate(140%) blur(20px);
	border: 1px solid var(--color-border-default);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-xl), var(--glow-gold-sm);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity var(--dur-fast) var(--ease-celestial),
	            visibility var(--dur-fast) var(--ease-celestial),
	            transform var(--dur-fast) var(--ease-out-soft);
	z-index: var(--z-overlay);
}

body.mcu-theme .mcu-nav .menu-item-has-children:hover > .sub-menu,
body.mcu-theme .mcu-nav .menu-item-has-children:focus-within > .sub-menu,
body.mcu-theme .mcu-nav .menu-item-has-children:hover > ul.children,
body.mcu-theme .mcu-nav .menu-item-has-children:focus-within > ul.children {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateX(-50%) translateY(0);
}

body.mcu-theme .mcu-nav .sub-menu li,
body.mcu-theme .mcu-nav ul.children li {
	display: block !important;
	width: 100%;
	margin: 0 !important;
}

body.mcu-theme .mcu-nav .sub-menu a,
body.mcu-theme .mcu-nav ul.children a {
	display: block;
	width: 100%;
	padding: var(--space-xs) var(--space-md) !important;
	text-transform: none !important;
	letter-spacing: var(--tracking-tight) !important;
	font-family: var(--font-body) !important;
	font-size: var(--text-sm) !important;
	color: var(--color-text-secondary) !important;
	white-space: normal;
	line-height: 1.4;
}

body.mcu-theme .mcu-nav .sub-menu a::after,
body.mcu-theme .mcu-nav ul.children a::after {
	display: none;
}

body.mcu-theme .mcu-nav .sub-menu a:hover,
body.mcu-theme .mcu-nav .sub-menu a:focus,
body.mcu-theme .mcu-nav ul.children a:hover,
body.mcu-theme .mcu-nav ul.children a:focus {
	background: var(--color-gold-veil) !important;
	color: var(--color-gold-bright) !important;
}

/* === Actions: cart / account / mobile menu ============================ */
body.mcu-theme .mcu-header__actions {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	justify-self: end;
}

/* === Language switcher (emoji flag + native name pills) =============== */
body.mcu-theme .mcu-header__lang {
	display: flex;
	align-items: center;
}
body.mcu-theme .mcu-header__lang ul {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	list-style: none;
	padding: 0;
	margin: 0;
}
body.mcu-theme .mcu-header__lang li { margin: 0; padding: 0; list-style: none; }

body.mcu-theme .mcu-header__lang a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	font-family: var(--font-body);
	font-size: 0.75rem;
	font-weight: var(--weight-medium);
	letter-spacing: var(--tracking-wide);
	color: var(--color-text-secondary);
	background: rgba(0, 0, 0, 0.35);
	border: 1px solid var(--color-border-subtle);
	border-radius: var(--radius-pill);
	text-decoration: none;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
	transition: color var(--dur-fast) var(--ease-celestial),
	            background var(--dur-fast) var(--ease-celestial),
	            border-color var(--dur-fast) var(--ease-celestial);
}
body.mcu-theme .mcu-header__lang a:hover,
body.mcu-theme .mcu-header__lang a:focus {
	color: var(--color-text-primary);
	background: var(--color-gold-veil);
	border-color: var(--color-gold);
}
body.mcu-theme .mcu-header__lang li.is-current a {
	color: var(--color-text-on-gold);
	background: linear-gradient(135deg, var(--color-gold-bright) 0%, var(--color-gold) 100%);
	border-color: var(--color-gold);
	text-shadow: none;
	cursor: default;
}
body.mcu-theme .mcu-header__lang .mcu-flag {
	font-size: 1.1em;
	line-height: 1;
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
}
body.mcu-theme .mcu-header__lang .mcu-lang-name {
	white-space: nowrap;
}

/* On narrow viewports, hide the language name and show just the flag */
@media (max-width: 1024px) {
	body.mcu-theme .mcu-header__lang .mcu-lang-name { display: none; }
	body.mcu-theme .mcu-header__lang a {
		padding: 6px 8px;
		font-size: 1rem;
	}
}

body.mcu-theme .mcu-header__icon {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	color: #ffffff;  /* full white for cart/account icons — was --text-secondary */
	border-radius: var(--radius-circle);
	background: none !important;
	border: 0 !important;
	box-shadow: none !important;
	transition: color var(--dur-fast) var(--ease-celestial),
	            background-color var(--dur-fast) var(--ease-celestial);
	position: relative;
	text-decoration: none !important;
	padding: 0 !important;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));  /* svg drop-shadow for readability */
}
body.mcu-theme .mcu-header__icon:hover,
body.mcu-theme .mcu-header__icon:focus {
	color: var(--color-gold-bright);
	background-color: var(--color-gold-veil) !important;
	transform: none;
}

body.mcu-theme .mcu-header__cart-count {
	position: absolute;
	top: 4px; right: 2px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	background: var(--color-gold-bright);
	color: var(--color-text-on-gold);
	font-family: var(--font-mono);
	font-size: 11px;
	font-weight: var(--weight-bold);
	line-height: 18px;
	text-align: center;
	border-radius: var(--radius-pill);
	box-shadow: var(--glow-gold-sm);
}

/* === Mobile menu toggle =============================================== */
body.mcu-theme .mcu-header__menu-toggle {
	display: inline-flex !important;
	width: 40px; height: 40px;
	padding: 0 !important;
	background: none !important;
	border: 0 !important;
	color: var(--color-text-primary);
	cursor: pointer;
	box-shadow: none !important;
}
body.mcu-theme .mcu-header__menu-toggle:hover {
	background: var(--color-gold-veil) !important;
	transform: none;
}
@media (min-width: 960px) {
	body.mcu-theme .mcu-header__menu-toggle { display: none !important; }
}

body.mcu-theme .mcu-burger {
	display: flex;
	flex-direction: column;
	gap: 5px;
	width: 22px;
	margin: auto;
}
body.mcu-theme .mcu-burger span {
	display: block;
	height: 1.5px;
	width: 100%;
	background: currentColor;
	border-radius: var(--radius-pill);
	transition: transform var(--dur-base) var(--ease-spring),
	            opacity var(--dur-fast) var(--ease-celestial);
	transform-origin: center;
}
body.mcu-theme .mcu-header__menu-toggle[aria-expanded="true"] .mcu-burger span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
body.mcu-theme .mcu-header__menu-toggle[aria-expanded="true"] .mcu-burger span:nth-child(2) { opacity: 0; }
body.mcu-theme .mcu-header__menu-toggle[aria-expanded="true"] .mcu-burger span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* === Mobile nav (full-screen drawer) =================================== */
@media (max-width: 959px) {
	body.mcu-theme .mcu-nav {
		display: block;
		position: fixed;
		inset: 0;
		padding: calc(var(--header-height-mobile) + var(--space-lg)) var(--container-padding) var(--space-xl);
		background: linear-gradient(180deg, var(--color-deep-space) 0%, var(--color-void) 100%);
		opacity: 0;
		pointer-events: none;
		transform: translateY(-12px);
		transition: opacity var(--dur-base) var(--ease-celestial),
		            transform var(--dur-base) var(--ease-celestial);
		z-index: calc(var(--z-sticky) - 1);
		overflow-y: auto;
	}
	html[data-mcu-menu="open"] body.mcu-theme .mcu-nav,
	body.mcu-theme html[data-mcu-menu="open"] .mcu-nav {
		opacity: 1;
		pointer-events: auto;
		transform: translateY(0);
	}
	html[data-mcu-menu="open"] { overflow: hidden; }

	body.mcu-theme .mcu-nav__list,
	body.mcu-theme .mcu-nav > ul {
		flex-direction: column;
		align-items: stretch;
		gap: var(--space-md);
	}
	body.mcu-theme .mcu-nav__link,
	body.mcu-theme .mcu-nav a {
		font-family: var(--font-display) !important;
		font-size: var(--text-2xl) !important;
		font-weight: var(--weight-regular) !important;
		text-transform: none !important;
		letter-spacing: var(--tracking-tight) !important;
		color: var(--color-text-primary) !important;
		padding: var(--space-sm) 0 !important;
		border-bottom: 1px solid var(--color-border-subtle) !important;
	}
	body.mcu-theme .mcu-nav__link::after,
	body.mcu-theme .mcu-nav a::after { display: none; }

	/* On mobile, submenu becomes inline (no hover) — show always within drawer */
	body.mcu-theme .mcu-nav .sub-menu,
	body.mcu-theme .mcu-nav ul.children {
		position: static;
		transform: none;
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		background: none !important;
		backdrop-filter: none !important;
		border: 0 !important;
		box-shadow: none !important;
		padding-left: var(--space-md) !important;
	}
	body.mcu-theme .mcu-nav .sub-menu a,
	body.mcu-theme .mcu-nav ul.children a {
		font-size: var(--text-lg) !important;
		padding-block: var(--space-xs) !important;
	}
	body.mcu-theme .mcu-nav .menu-item-has-children > a::before {
		display: none;
	}
}
