/*
 * WWG Custom Header
 * Replaces Divi theme builder header (layout ID 387388)
 * v1.0.0
 */

/* ============================================================
   NOTIBAR
   ============================================================ */

#wwg_notibar {
	background: #307373;
	text-align: center;
	padding: 6px 16px;
}
.wwg-notibar-link,
.wwg-notibar-link:hover {
	color: #fff;
	font-family: 'Jost', sans-serif;
	font-size: 15px;
	text-decoration: none;
}
.wwg-notibar-link strong {
	color: #fff;
}


/* ============================================================
   HEADER SHELL
   ============================================================ */

#wwg_custom_header {
	background: #FEFBF7;
	box-shadow: 0 0 9px rgba(0,0,0,0.12);
	position: relative;
	z-index: 99999;
}

/* Sticky state — applied by JS on scroll */
#wwg_custom_header.wwg-sticky {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
}

/* Inner container: max-width + padding */
.wwg-header-inner {
	max-width: 1600px;
	margin: 0 auto;
	padding: 0 24px;
	display: flex;
	align-items: center;
	gap: 0;
}


/* ============================================================
   LOGO
   ============================================================ */

.wwg-logo-link {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	margin-right: 24px;
}
#wwg-logo-img {
	max-width: 200px;
	height: auto;
	display: block;
}


/* ============================================================
   MAIN NAV (desktop)
   ============================================================ */

#wwg_nav_header {
	flex: 1;
	min-width: 0;
	padding-top: 0 !important;
	margin-right: 0 !important;
}

#menu-divi-mega-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: stretch;
	justify-content: center;
	gap: 0;
	visibility: hidden; /* JS reveals after first reflow — prevents flash of unprocessed items */
}

#menu-divi-mega-menu > li {
	position: relative;
	flex-shrink: 0 !important;
}

#menu-divi-mega-menu > li > a {
	display: flex;
	align-items: center;
	height: 100%;
	padding: 16px 14px;
	font-family: 'Jost', sans-serif;
	font-size: 16px;
	letter-spacing: -0.5px;
	color: #2B2929;
	text-decoration: none;
	white-space: nowrap;
	transition: color 0.2s;
}

#menu-divi-mega-menu > li > a:hover,
#menu-divi-mega-menu > li.current-menu-item > a,
#menu-divi-mega-menu > li.current-menu-ancestor > a {
	color: #b35838;
}

/* Override Divi's absolute-positioned caret (top:0 puts it above text in tall flex links) */
#menu-divi-mega-menu > li > a:first-child::after {
	position: static;
	margin-left: 4px;
	font-size: 12px;
	line-height: 1;
}

/* Dropdown */
#menu-divi-mega-menu .sub-menu {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 200px;
	background: #FEFBF7;
	border: 1px solid #e8e0d5;
	border-top: 2px solid #b35838;
	box-shadow: 0 4px 12px rgba(0,0,0,0.1);
	list-style: none;
	margin: 0;
	padding: 8px 0;
	z-index: 100;
}

#menu-divi-mega-menu > li:hover > .sub-menu,
#menu-divi-mega-menu > li:focus-within > .sub-menu {
	display: block;
}

#menu-divi-mega-menu .sub-menu li a {
	display: block;
	padding: 8px 20px;
	font-family: 'Jost', sans-serif;
	font-size: 15px;
	color: #2B2929;
	text-decoration: none;
	white-space: nowrap;
}

#menu-divi-mega-menu .sub-menu li a:hover {
	color: #b35838;
	background: #f7f2ea;
}


/* Priority nav "More" overflow item */
#wwg-more-nav-item > .sub-menu {
	left: auto;
	right: 0;
	min-width: 200px;
}

/* Overflow items with sub-menus: need position:relative so the flyout
   anchors to the hovered row, not to the top of the whole More dropdown */
#wwg-overflow-menu > .menu-item-has-children {
	position: relative;
}

/* Sub-sub-menus open to the RIGHT */
#wwg-overflow-menu > .menu-item-has-children:hover > .sub-menu,
#wwg-overflow-menu > .menu-item-has-children:focus-within > .sub-menu {
	display: block;
	left: 100%;
	right: auto;
	top: 0;
}

/* Right-pointing caret — replaces Divi's default down-arrow on these items */
#wwg-overflow-menu > .menu-item-has-children > a {
	padding-right: 32px;
}

#wwg-overflow-menu > .menu-item-has-children > a::after {
	content: '›' !important;
	position: absolute !important;
	right: 14px !important;
	top: calc(50% - 2px) !important;
	transform: translateY(-50%) !important;
	font-family: sans-serif !important;
	font-size: 20px !important;
	font-style: normal !important;
	line-height: 1 !important;
	margin: 0 !important;
}


/* ============================================================
   SECONDARY MENU (Help / Account / Cart)
   ============================================================ */

#wwg_secondary_menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	flex-shrink: 0;
	margin-left: 8px;
}

#wwg_secondary_menu li {
	display: flex;
	align-items: center;
}

#wwg_secondary_menu a,
#wwg_secondary_menu a:hover {
	color: #2B2929;
	font-family: 'Jost', sans-serif;
	font-size: 16px;
	text-decoration: none;
	display: flex;
	align-items: center;
	padding: 16px 10px;
	white-space: nowrap;
}

/* Suppress Divi's legacy ::after cart count — we use span.wwg-cart-badge instead */
#wwg_custom_header .wwg_nav_cart a::after,
#wwg_custom_header .wwg_nav_cart a .amount {
	display: none !important;
	content: '' !important;
}

/* Cart badge */
.wwg-cart-badge {
	display: inline-block;
	line-height: 18px;
	height: 18px;
	min-width: 18px;
	padding: 0 4px;
	background: #307373;
	color: #fff;
	font-size: 11px;
	font-weight: bold;
	text-align: center;
	border-radius: 99px;
	margin-left: 4px;
}


/* ============================================================
   MOBILE CONTROLS (hamburger + cart, shown ≤ 980px)
   ============================================================ */

.wwg-mobile-controls {
	display: none;
	align-items: center;
	gap: 4px;
	margin-left: auto;
}

.wwg-mobile-actions {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
}

.wwg-mobile-actions a {
	color: #2B2929;
	text-decoration: none;
	padding: 12px 8px;
	display: flex;
	align-items: center;
	font-size: 16px;
}

/* Hamburger button */
#wwg-hamburger {
	background: none;
	border: none;
	cursor: pointer;
	padding: 10px 8px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 40px;
}

#wwg-hamburger span {
	display: block;
	height: 2px;
	width: 100%;
	background: #2B2929;
	border-radius: 2px;
	transition: transform 0.2s, opacity 0.2s;
}

/* Animate to X when open */
#wwg-hamburger[aria-expanded="true"] span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}
#wwg-hamburger[aria-expanded="true"] span:nth-child(2) {
	opacity: 0;
}
#wwg-hamburger[aria-expanded="true"] span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}


/* ============================================================
   MOBILE DRAWER
   ============================================================ */

#wwg-mobile-drawer {
	background: #FEFBF7;
	border-top: 1px solid #e8e0d5;
	padding: 8px 0 16px;
}

#wwg-mobile-drawer[hidden] {
	display: none;
}

/* Mobile menu list */
.wwg-mobile-menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wwg-mobile-menu li a {
	display: block;
	padding: 12px 24px;
	font-family: 'Jost', sans-serif;
	font-size: 17px;
	color: #2B2929;
	text-decoration: none;
	border-bottom: 1px solid #f0e8da;
}

.wwg-mobile-menu li a:hover {
	color: #b35838;
	background: #f7f2ea;
}

/* Mobile sub-menu (collapsed by default, toggled by JS) */
.wwg-mobile-menu .sub-menu {
	display: none;
	list-style: none;
	margin: 0;
	padding: 0;
	background: #f7f2ea;
}

.wwg-mobile-menu .sub-menu.wwg-open {
	display: block;
}

.wwg-mobile-menu .sub-menu li a {
	padding-left: 40px;
	font-size: 15px;
	border-bottom-color: #e8e0d5;
}

/* Arrow indicator on parent items */
.wwg-mobile-menu .menu-item-has-children > a::after {
	content: '+';
	margin-left: auto;
	padding-left: 12px;
	font-size: 20px;
	line-height: 1;
	color: #999;
	transition: transform 0.2s;
}

.wwg-mobile-menu .menu-item-has-children.wwg-open > a::after {
	content: '−';
}

/* Mobile utility links (Help, Account) at bottom of drawer */
.wwg-mobile-utility {
	list-style: none;
	margin: 16px 0 0;
	padding: 0;
	border-top: 2px solid #e8e0d5;
}

.wwg-mobile-utility li a {
	display: block;
	padding: 12px 24px;
	font-family: 'Jost', sans-serif;
	font-size: 16px;
	color: #2B2929;
	text-decoration: none;
}

.wwg-mobile-utility li a:hover {
	color: #b35838;
}


/* ============================================================
   RESPONSIVE — switch to mobile at ≤ 980px
   ============================================================ */


@media (min-width: 981px) {
	.wwg-mobile-controls { display: none !important; }
}

@media (max-width: 980px) {
	#wwg_nav_header,
	#wwg_secondary_menu { display: none !important; }

	.wwg-logo-link { margin-right: 0; }

	.wwg-mobile-controls { display: flex; }

	.wwg-header-inner {
		padding: 4px 16px;
		justify-content: space-between;
	}

	#wwg-logo-img { max-width: 160px; }
}
