/* preserve astra's native typography, icons, logo, and header interactions.
 * only layout safeguards and compact sizing are applied here. */
#masthead,
.site-header {
	position: sticky !important;
	top: 0;
	z-index: 999;
	display: block !important;
	width: 100%;
	margin: 0 !important;
	clear: both;
	background: var(--eth-color-surface);
	transform: none !important;
}

/* sticky positioning must not be trapped by astra's page overflow wrapper. */
#page.site {
	overflow: visible !important;
}

body.admin-bar #masthead,
body.admin-bar .site-header {
	top: 32px;
}

/* do not render a second theme builder header over astra's header. */
.elementor-location-header {
	display: none !important;
}

.ast-primary-header-bar,
.ast-primary-header-bar .site-primary-header-wrap,
.ast-primary-header-bar .ast-builder-grid-row {
	min-height: 88px;
}

.ast-primary-header-bar {
	position: relative !important;
	top: auto !important;
	left: auto !important;
	width: 100%;
	border-bottom: 1px solid var(--eth-color-border);
	background: var(--eth-color-surface);
	transform: none !important;
}

.ast-primary-header-bar .site-primary-header-wrap {
	box-sizing: border-box;
	width: 100% !important;
	max-width: 1280px !important;
	margin-inline: auto !important;
	padding-inline: 12px;
}

.ast-primary-header-bar .ast-builder-grid-row {
	width: 100% !important;
	max-width: 100% !important;
}

/* astra versions place the width constraint on different nested wrappers. */
body .ast-primary-header-bar .site-primary-header-wrap,
body .ast-primary-header-bar .ast-builder-grid-row-container-inner {
	box-sizing: border-box !important;
	width: calc(100% - 32px) !important;
	max-width: 1280px !important;
	margin-right: auto !important;
	margin-left: auto !important;
	padding-right: 0 !important;
	padding-left: 0 !important;
}

body .ast-primary-header-bar .ast-builder-grid-row-container-inner > .ast-builder-grid-row {
	width: calc(100% - 32px) !important;
	max-width: 1280px !important;
	margin-right: auto !important;
	margin-left: auto !important;
}

.ast-primary-header-bar .site-header-primary-section-left {
	justify-self: start;
}

.ast-primary-header-bar .site-header-primary-section-center {
	justify-self: center;
}

.ast-primary-header-bar .site-header-primary-section-right {
	justify-self: end;
}

/* keep every native astra header element consistently black. */
#masthead :where(
	.site-title a,
	.main-header-menu > .menu-item > .menu-link,
	.main-header-menu .sub-menu .menu-link,
	.ast-header-search,
	.ast-search-icon,
	.ast-header-account-link,
	.ast-header-woo-cart,
	.ast-cart-menu-wrap,
	.ast-addon-cart-wrap,
	.ast-mobile-menu-trigger-minimal
) {
	color: var(--eth-color-heading) !important;
}

#masthead :where(svg, svg path, svg circle, svg rect, svg line, svg polyline) {
	color: var(--eth-color-heading) !important;
	stroke: var(--eth-color-heading) !important;
}

#masthead :where(.ast-icon, .ast-icon svg) {
	color: var(--eth-color-heading) !important;
}

#masthead :where(
	.main-header-menu > .menu-item > .menu-link,
	.ast-header-search,
	.ast-header-account-link,
	.ast-header-woo-cart,
	.ast-cart-menu-wrap,
	.ast-addon-cart-wrap
):hover {
	color: var(--eth-color-heading) !important;
	opacity: .68;
}

#masthead .ast-cart-menu-wrap .count,
#masthead .ast-addon-cart-wrap .count,
#masthead .ast-woo-header-cart-info-wrap .count {
	border-color: var(--eth-color-heading) !important;
	background: var(--eth-color-heading) !important;
	color: var(--eth-color-surface) !important;
}

/* cap only genuinely oversized uploads and keep astra's proportions. */
.ast-primary-header-bar .custom-logo,
.ast-primary-header-bar .site-logo-img img {
	width: auto !important;
	max-width: 170px !important;
	max-height: 54px !important;
	object-fit: contain;
	filter: brightness(0) saturate(100%) !important;
}

/* keep the first elementor section in the normal flow below the header. */
#masthead + #content,
#masthead + .site-content,
#masthead ~ #content,
#masthead ~ .site-content,
.site-header + #content,
.site-header + .site-content {
	position: relative !important;
	z-index: 1;
	margin-top: 0 !important;
	padding-top: 0;
	transform: none !important;
}

@media (max-width: 921px) {
	#masthead.site-header {
		position: sticky !important;
		top: 0;
		height: auto !important;
		min-height: 0 !important;
		transform: none !important;
	}

	body.admin-bar #masthead.site-header {
		top: 46px;
	}

	#masthead .ast-mobile-header-wrap,
	#masthead .ast-mobile-header-content {
		position: relative;
		width: 100%;
		transform: none !important;
	}

	.ast-primary-header-bar,
	.ast-primary-header-bar .site-primary-header-wrap,
	.ast-primary-header-bar .ast-builder-grid-row {
		min-height: 70px;
	}

	.ast-primary-header-bar .site-primary-header-wrap {
		padding-inline: 16px;
	}

	body .ast-primary-header-bar .site-primary-header-wrap,
	body .ast-primary-header-bar .ast-builder-grid-row-container-inner {
		width: calc(100% - 28px) !important;
		padding-inline: 0 !important;
	}

	.ast-primary-header-bar .custom-logo,
	.ast-primary-header-bar .site-logo-img img {
		max-width: 135px !important;
		max-height: 44px !important;
	}
}

@media (max-width: 782px) {
	body.admin-bar #masthead,
	body.admin-bar .site-header {
		top: 46px;
	}
}

/* wordpress stops fixing the admin bar on narrow phones. */
@media (max-width: 600px) {
	body.admin-bar #masthead,
	body.admin-bar .site-header,
	body.admin-bar #masthead.site-header {
		top: 0;
	}
}



/* === ETHEREAL ASTRA MOBILE MENU COLORS === */
@media (max-width: 921px) {
	.ast-header-break-point .ast-mobile-menu-trigger-outline,
	.ast-header-break-point .main-header-menu-toggle,
	.ast-header-break-point [data-section="section-header-mobile-trigger"] .ast-button-wrap .menu-toggle,
	.ast-header-break-point .mobile-menu-toggle-icon,
	.ast-header-break-point .mobile-menu-toggle-icon svg {
		color: #000 !important;
		fill: #000 !important;
		stroke: #000 !important;
	}

	.ast-mobile-popup-drawer,
	.ast-mobile-popup-drawer .ast-mobile-popup-inner,
	.ast-mobile-popup-drawer .ast-mobile-popup-header,
	.ast-mobile-popup-drawer .ast-mobile-popup-content,
	.ast-mobile-popup-drawer .ast-builder-menu-mobile,
	.ast-mobile-popup-drawer #ast-hf-mobile-menu {
		background-color: #fff !important;
		background-image: none !important;
	}

	.ast-mobile-popup-header .menu-toggle-close,
	.ast-mobile-popup-header .menu-toggle-close svg {
		color: #000 !important;
		fill: #000 !important;
		stroke: #000 !important;
	}

	#ast-hf-mobile-menu .menu-link {
		color: var(--eth-color-heading) !important;
		background-color: #fff !important;
		background-image: none !important;
	}

	#ast-hf-mobile-menu .current-menu-item > .menu-link,
	#ast-hf-mobile-menu .current_page_item > .menu-link,
	#ast-hf-mobile-menu .menu-link:hover,
	#ast-hf-mobile-menu .menu-link:focus-visible {
		color: var(--eth-color-accent) !important;
	}
}
