/**
 * Just Wedi — Astra header polish (no layout overrides; Astra Header Builder owns structure).
 * Mega menu panels, visual tokens, inline search styling, mobile slide-out search.
 */

/* Logo — larger than Astra defaults; cap to primary header bar height */
#masthead .site-logo-img .custom-logo,
#ast-fixed-header .site-logo-img .custom-logo,
#masthead .site-logo-img .custom-logo-link img,
#ast-fixed-header .site-logo-img .custom-logo-link img {
	width: auto;
	height: auto;
	max-width: min(280px, 46vw) !important;
	max-height: 4.25rem;
	object-fit: contain;
}

@media (max-width: 921px) {
	#masthead .site-logo-img .custom-logo,
	#ast-fixed-header .site-logo-img .custom-logo,
	#masthead .site-logo-img .custom-logo-link img,
	#ast-fixed-header .site-logo-img .custom-logo-link img {
		max-width: min(220px, 52vw) !important;
		max-height: 3.5rem;
	}
}

@media (max-width: 544px) {
	#masthead .site-logo-img .custom-logo,
	#ast-fixed-header .site-logo-img .custom-logo,
	#masthead .site-logo-img .custom-logo-link img,
	#ast-fixed-header .site-logo-img .custom-logo-link img {
		max-width: min(200px, 58vw) !important;
		max-height: 3.15rem;
	}
}

/* Sticky bar */
.ast-header-sticked .ast-primary-header-bar,
.ast-primary-sticky-header-active .ast-primary-header-bar,
#ast-fixed-header .ast-primary-header-bar {
	box-shadow: var(--jw-header-shadow, 0 4px 24px rgba(26, 54, 93, 0.08));
	border-bottom: 1px solid var(--jw-color-border);
}

/* Primary nav links */
.ast-header-break-point .main-header-menu > .menu-item > .menu-link,
.main-header-menu.ast-nav-menu > .menu-item > .menu-link {
	font-weight: var(--jw-fw-semibold, 600);
	letter-spacing: -0.02em;
}

.main-header-menu > .menu-item > .menu-link:hover,
.main-header-menu > .menu-item > .menu-link:focus {
	color: var(--jw-color-primary-mid, #2c5282);
}

/* Inline product search — border on .search-form only (Astra borders the form wrapper) */
.ast-header-search .search-form,
.ast-header-search .ast-search-menu-icon {
	width: 100%;
	max-width: 100%;
}

.ast-header-search .ast-inline-search .search-form {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	min-height: 2.75rem;
	border: 1px solid var(--jw-color-border) !important;
	border-radius: 6px;
	background-color: #fff;
	overflow: hidden;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ast-header-search .ast-inline-search .search-form:focus-within {
	border-color: var(--jw-color-primary-mid, #2c5282) !important;
	box-shadow: 0 0 0 2px rgba(44, 82, 130, 0.35);
}

.ast-header-search .ast-inline-search .search-field {
	box-sizing: border-box;
	width: 100%;
	min-height: 2.75rem;
	padding: 0.5rem 2.75rem 0.5rem 0.85rem;
	border: none !important;
	border-radius: 0;
	background: transparent !important;
	color: var(--jw-color-body, #334155);
	font-size: 0.9375rem;
	line-height: 1.4;
}

.ast-header-search .ast-inline-search .search-field::placeholder {
	color: var(--jw-color-muted, #475569);
	opacity: 1;
}

.ast-header-search .ast-inline-search .search-field:focus {
	outline: none;
}

.ast-header-search .search-submit {
	color: var(--jw-color-primary, #1a365d);
}

/* Astra Pro full-width mega menu panels */
.ast-desktop .main-header-menu .astra-full-megamenu-wrapper {
	box-sizing: border-box;
	background: #fff;
	border-top: 1px solid var(--jw-color-border);
	box-shadow: none;
}

.ast-desktop .main-header-menu.ast-menu-shadow .astra-full-megamenu-wrapper,
.ast-desktop .main-header-menu .astra-full-megamenu-wrapper .astra-megamenu {
	box-shadow: none;
}

.ast-desktop .main-header-menu .astra-megamenu.sub-menu,
.ast-desktop .main-header-menu .astra-mega-menu-width-full {
	padding: clamp(1.25rem, 2.5vw, 1.75rem) var(--jw-header-pad-x, clamp(0.75rem, 4vw, 2.25rem));
}

/* Pack mega menu columns from the right (Astra defaults stretch with flex: 1) */
.ast-desktop .ast-mega-menu-enabled .astra-megamenu-li .astra-megamenu.sub-menu,
.ast-desktop .ast-mega-menu-enabled .astra-megamenu-li:hover .astra-megamenu,
.ast-desktop .ast-mega-menu-enabled .astra-megamenu-li .astra-megamenu.astra-megamenu-focus,
.ast-desktop .ast-mega-menu-enabled .astra-megamenu-li .astra-full-megamenu-wrapper .astra-megamenu {
	justify-content: flex-end;
}

.ast-desktop .ast-mega-menu-enabled .astra-full-megamenu-wrapper .astra-megamenu.sub-menu {
	margin-left: auto;
	margin-right: 0;
	max-width: min(1280px, 100%);
}

.ast-desktop .ast-mega-menu-enabled .astra-megamenu.sub-menu > .menu-item,
.ast-desktop .ast-mega-menu-enabled .astra-megamenu-li:hover .astra-megamenu > .menu-item,
.ast-desktop .ast-mega-menu-enabled .astra-megamenu-li .astra-megamenu.astra-megamenu-focus.sub-menu > .menu-item {
	flex: 0 0 auto;
	width: auto;
	max-width: 14rem;
}

.ast-desktop .ast-mega-menu-enabled .astra-megamenu-li:hover .astra-megamenu.col-3 .menu-item,
.ast-desktop .ast-mega-menu-enabled .astra-megamenu-li .astra-megamenu.astra-megamenu-focus.sub-menu.col-3 .menu-item,
.ast-desktop .ast-mega-menu-enabled .astra-megamenu-li:hover .astra-megamenu.col-4 .menu-item,
.ast-desktop .ast-mega-menu-enabled .astra-megamenu-li .astra-megamenu.astra-megamenu-focus.sub-menu.col-4 .menu-item,
.ast-desktop .ast-mega-menu-enabled .astra-megamenu-li:hover .astra-megamenu.col-2 .menu-item,
.ast-desktop .ast-mega-menu-enabled .astra-megamenu-li .astra-megamenu.astra-megamenu-focus.sub-menu.col-2 .menu-item {
	width: auto;
}

.ast-desktop .main-header-menu .menu-item-heading > .menu-link,
.ast-desktop .astra-megamenu-li .menu-item-heading > .menu-link {
	font-family: 'Rubik', sans-serif;
	font-weight: var(--jw-fw-semibold, 600);
	font-size: 0.8125rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--jw-color-heading, #0f172a);
}

.ast-desktop .astra-megamenu-li .sub-menu .menu-item > .menu-link {
	padding-top: 0.35rem;
	padding-bottom: 0.35rem;
	color: var(--jw-color-body, #334155);
	font-size: 0.9375rem;
}

.ast-desktop .astra-megamenu-li .sub-menu .menu-item > .menu-link:hover,
.ast-desktop .astra-megamenu-li .sub-menu .menu-item > .menu-link:focus {
	color: var(--jw-color-primary-mid, #2c5282);
}

/* Mega menu CTA-style “Browse category” items in panel */
.ast-desktop .astra-megamenu-li .sub-menu > .menu-item.browse-category > .menu-link {
	font-weight: var(--jw-fw-semibold, 600);
	color: var(--jw-color-primary-mid, #2c5282);
}

/* Mobile off-canvas — accordion submenu, not desktop full-width flyout */
.ast-mobile-popup-drawer.active .ast-mobile-popup-inner,
.ast-mobile-popup-content {
	background-color: #fff;
	overflow-x: hidden;
	max-width: 100%;
}

.ast-mobile-popup-content .main-header-menu .menu-item > .menu-link,
.ast-mobile-popup-content .main-header-menu .menu-item > .ast-disable-link {
	padding-top: 0.65rem;
	padding-bottom: 0.65rem;
	font-weight: var(--jw-fw-semibold, 600);
	color: var(--jw-color-primary, #1a365d);
}

.ast-mobile-popup-content .main-header-menu .menu-item > .ast-disable-link {
	cursor: pointer;
}

.ast-mobile-popup-content .astra-megamenu-li .sub-menu .menu-item > .menu-link,
.ast-mobile-popup-content .main-header-menu .sub-menu .menu-item > .menu-link {
	padding-left: 1.25rem;
	font-weight: 400;
	font-size: 0.9375rem;
	color: var(--jw-color-body, #334155);
}

/* Undo desktop full-width mega JS positioning inside the drawer */
.ast-mobile-popup-content .astra-full-megamenu-wrapper,
.ast-header-break-point .ast-mobile-popup-content .astra-full-megamenu-wrapper {
	position: static !important;
	left: auto !important;
	right: auto !important;
	width: 100% !important;
	max-width: 100% !important;
	transform: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border-top: 1px solid var(--jw-color-border);
	box-shadow: none !important;
}

.ast-mobile-popup-content .astra-megamenu.sub-menu,
.ast-header-break-point .ast-mobile-popup-content .astra-megamenu.sub-menu {
	position: static !important;
	left: auto !important;
	right: auto !important;
	width: 100% !important;
	max-width: 100% !important;
	opacity: 1 !important;
	visibility: visible !important;
	display: none;
	flex-wrap: wrap;
	padding: 0;
	box-shadow: none !important;
}

.ast-mobile-popup-content .ast-submenu-expanded > .astra-full-megamenu-wrapper,
.ast-mobile-popup-content .ast-submenu-expanded > .astra-full-megamenu-wrapper > .astra-megamenu,
.ast-mobile-popup-content .menu-item.ast-submenu-expanded > .sub-menu {
	display: block !important;
}

.ast-mobile-popup-content .astra-megamenu.sub-menu > .menu-item,
.ast-header-break-point .ast-mobile-popup-content .astra-megamenu.sub-menu > .menu-item {
	display: block !important;
	width: 100% !important;
	flex: none !important;
}

.ast-mobile-popup-content .astra-megamenu.sub-menu > .menu-item.browse-category {
	margin-top: 0.35rem;
	padding-top: 0.35rem;
	border-top: 1px solid var(--jw-color-border);
}

/* Focus visibility for keyboard users */
.ast-header-account-link:focus-visible,
.ast-site-header-cart .cart-container:focus-visible,
.ast-mobile-popup-drawer .menu-toggle:focus-visible {
	outline: 2px solid rgba(44, 82, 130, 0.45);
	outline-offset: 3px;
	border-radius: 4px;
}

/* Mobile slide-out search (icon in bar; full-width panel below — VP-style) */
@media (max-width: 921px) {
	html,
	body {
		overflow-x: clip;
	}

	#page {
		overflow-x: clip;
		max-width: 100%;
	}

	.ast-header-break-point .ast-header-search {
		flex: 0 0 auto;
		min-width: 0;
		max-width: none;
	}

	.ast-header-break-point .ast-header-search .ast-search-menu-icon.slide-search {
		position: static;
	}

	.ast-header-break-point .ast-header-search .ast-search-menu-icon.slide-search .ast-search-icon {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.ast-header-break-point .ast-header-search .ast-search-menu-icon.slide-search .search-form {
		position: fixed;
		left: 0;
		right: 0;
		top: var(--jw-mobile-search-top, 3.5rem);
		width: 100%;
		max-width: 100vw;
		margin: 0;
		padding: 0.75rem var(--jw-header-pad-x, clamp(0.75rem, 4vw, 2.25rem));
		box-sizing: border-box;
		border-radius: 0;
		border-left: none;
		border-right: none;
		border-top: 1px solid var(--jw-color-border);
		border-bottom: 1px solid var(--jw-color-border);
		box-shadow: 0 10px 28px rgba(26, 54, 93, 0.12);
		transform: translateY(-0.35rem);
		transition:
			transform 0.25s ease,
			opacity 0.2s ease,
			visibility 0.2s ease;
		z-index: 99998;
	}

	.ast-header-break-point .ast-header-search .ast-search-menu-icon.slide-search:not(.ast-dropdown-active) .search-form {
		visibility: hidden;
		opacity: 0;
		pointer-events: none;
	}

	.ast-header-break-point .ast-header-search .ast-search-menu-icon.slide-search.ast-dropdown-active .search-form {
		visibility: visible;
		opacity: 1;
		transform: translateY(0);
		pointer-events: auto;
	}

	.ast-header-break-point .ast-header-search .ast-search-menu-icon.slide-search .search-field {
		width: 100% !important;
		min-height: 2.75rem;
		padding: 0.5rem 4.75rem 0.5rem 0.85rem;
		border: 1px solid var(--jw-color-border);
		border-radius: 6px;
		background-color: #fff;
		font-size: 0.9375rem;
		color: var(--jw-color-body, #334155);
	}

	.ast-header-break-point .ast-header-search .ast-search-menu-icon.slide-search .search-submit {
		display: flex;
		align-items: center;
		justify-content: center;
		position: absolute;
		right: calc(var(--jw-header-pad-x, clamp(0.75rem, 4vw, 2.25rem)) + 4.15rem);
		top: 50%;
		transform: translateY(-50%);
		margin: 0;
		padding: 0.25rem 0.4rem 0.25rem 0.25rem;
	}

	.ast-header-break-point .ast-header-search .ast-search-menu-icon.slide-search .search-submit .ast-icon,
	.ast-header-break-point .ast-header-search .ast-search-menu-icon.slide-search .search-submit .astra-search-icon {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.ast-header-break-point .ast-header-search .jw-search-close {
		position: absolute;
		right: var(--jw-header-pad-x, clamp(0.75rem, 4vw, 2.25rem));
		top: 50%;
		transform: translateY(-50%);
		margin: 0;
		padding: 0.35rem 0.5rem;
		border: 0;
		background: transparent;
		color: var(--jw-color-primary-mid, #2c5282);
		font-family: inherit;
		font-size: 0.8125rem;
		font-weight: 600;
		line-height: 1.2;
		cursor: pointer;
		text-decoration: underline;
		text-underline-offset: 2px;
	}

	.ast-header-break-point .ast-header-search .jw-search-close:focus-visible {
		outline: 2px solid rgba(44, 82, 130, 0.45);
		outline-offset: 2px;
		border-radius: 4px;
	}
}
