/**
 * Site header (1.2.62.2): keep a static height (no Divi shrink-on-scroll)
 * and let the logo fill more of the bar without cropping.
 * Loaded on every front-end page. Does not change Warhammer content.
 *
 * Divi settings this overrides (Theme Customizer → Header & Navigation):
 * - Primary Menu Bar → Logo Max Height (34% desktop / 54% tablet), which
 *   left the wordmark ~32px in an 80px bar.
 * - Fixed Navigation Settings → shrink header and logo on scroll, which
 *   dropped the bar from 94px to 74px (menu height 80 → 60) and the logo
 *   to ~25px. That height change also shifted the slim sticky Hoard search.
 */

/* -------------------------------------------------------------------------- */
/* Desktop: freeze the fixed header at the resting height; larger logo.       */
/* -------------------------------------------------------------------------- */
@media only screen and (min-width: 981px) {
	#main-header,
	#main-header.et-fixed-header {
		min-height: 94px;
	}

	/* Logo and menu share one row so a larger wordmark cannot cover the menu.
	   Hawthorne / Divi Customizer had centered the menu with display:table. */
	#main-header .container.et_menu_container {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 20px;
		box-sizing: border-box;
		min-height: 94px;
		padding-top: 12px;
		padding-bottom: 12px;
	}

	#main-header .logo_container {
		flex: 0 1 auto;
		float: none;
		width: auto !important;
		height: auto !important;
		position: relative;
	}

	/* Divi spacer used to vertically align the logo in the old padding model. */
	#main-header .logo_helper {
		display: none;
	}

	#main-header #logo,
	#main-header.et-fixed-header #logo,
	.et_pb_svg_logo #logo,
	.et_pb_svg_logo #main-header.et-fixed-header #logo {
		max-height: 64px !important;
		height: 64px !important;
		width: auto !important;
		max-width: 100%;
		object-fit: contain;
		object-position: left center;
		display: block;
	}

	#main-header #et-top-navigation,
	#main-header.et-fixed-header #et-top-navigation,
	.et_header_style_left #et-top-navigation,
	.et_header_style_left .et-fixed-header #et-top-navigation,
	.et_header_style_split #et-top-navigation,
	.et_header_style_split .et-fixed-header #et-top-navigation {
		float: none !important;
		display: flex !important;
		align-items: center;
		justify-content: flex-end;
		flex: 1 1 auto;
		margin: 0 !important;
		padding: 0 !important;
	}

	.et_header_style_left #et-top-navigation nav > ul > li > a,
	.et_header_style_left .et-fixed-header #et-top-navigation nav > ul > li > a,
	.et_header_style_split #et-top-navigation nav > ul > li > a,
	.et_header_style_split .et-fixed-header #et-top-navigation nav > ul > li > a {
		padding-bottom: 0 !important;
	}

	.et_header_style_centered #main-header .logo_container,
	.et_header_style_centered header#main-header.et-fixed-header .logo_container {
		height: auto;
	}

	#main-header #top-menu,
	#main-header.et-fixed-header #top-menu {
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
		white-space: nowrap;
		margin: 0;
	}

	#main-header #top-menu > li {
		white-space: nowrap;
		float: none;
	}
}

/* -------------------------------------------------------------------------- */
/* Tablet / phone: header already stays 80px; enlarge the logo in that bar.   */
/* The wordmark is very wide, so width is capped to leave room for the menu.  */
/* -------------------------------------------------------------------------- */
@media only screen and (max-width: 980px) {
	#main-header #logo,
	#main-header.et-fixed-header #logo {
		max-height: 56px !important;
		height: auto !important;
		width: auto !important;
		max-width: calc(100vw - 110px);
		object-fit: contain;
		object-position: left center;
	}
}

/* ========================================================================== */
/* 1.2.62.5: compact header + dropdowns that stay on screen.                  */
/* Fixed bar 68px desktop / 58px tablet+phone, logo ~76% of the bar, smaller  */
/* menu type. Sub-menus open inside the viewport (CSS + site-header.js edge   */
/* check), wrap long labels, and use dark text on white.                      */
/* ========================================================================== */
@media only screen and (min-width: 981px) {
	#main-header,
	#main-header.et-fixed-header {
		min-height: 68px;
	}
	#main-header .container.et_menu_container,
	#main-header.et-fixed-header .container.et_menu_container {
		min-height: 68px;
		height: 68px;
		padding-top: 0;
		padding-bottom: 0;
		gap: 24px;
		overflow: visible;
	}
	#main-header #logo,
	#main-header.et-fixed-header #logo,
	.et_pb_svg_logo #logo,
	.et_pb_svg_logo #main-header.et-fixed-header #logo {
		max-height: 52px !important;
		height: 52px !important;
	}
	#main-header #et-top-navigation,
	#main-header #top-menu-nav,
	#main-header #top-menu {
		overflow: visible;
	}
	#main-header #top-menu > li,
	#main-header.et-fixed-header #top-menu > li {
		padding-right: 20px;
		display: flex;
		align-items: center;
		height: 68px;
	}
	#main-header #top-menu > li:last-child {
		padding-right: 0;
	}
	#main-header #top-menu > li > a,
	#main-header.et-fixed-header #top-menu > li > a {
		font-size: 17px !important;
		line-height: 1.2;
		letter-spacing: 1.2px;
		padding-bottom: 0 !important;
	}
	#main-header #top-menu .menu-item-has-children > a:first-child:after {
		font-size: 15px;
		top: 50%;
		transform: translateY(-50%);
	}

	/* Dropdown panels */
	#main-header #top-menu li ul.sub-menu {
		top: 100%;
		width: 250px;
		max-width: calc(100vw - 24px);
		padding: 8px 0;
		background: #fff;
		border-top: 3px solid #bf9e77;
		box-shadow: 0 6px 18px rgba(0, 0, 0, .16);
		box-sizing: border-box;
		overflow: visible;
	}
	#main-header #top-menu li ul.sub-menu li {
		display: block;
		float: none;
		width: 100%;
		height: auto;
		padding: 0;
		margin: 0;
		position: relative;
	}
	#main-header #top-menu li ul.sub-menu li a,
	#main-header.et-fixed-header #top-menu li ul.sub-menu li a {
		width: auto;
		box-sizing: border-box;
		padding: 9px 36px 9px 18px;
		font-size: 16px !important;
		line-height: 1.3;
		letter-spacing: 1px;
		white-space: normal;
		overflow-wrap: anywhere;
		color: #2b2b2b !important;
		opacity: 1;
	}
	#main-header #top-menu li ul.sub-menu li a:hover,
	#main-header #top-menu li ul.sub-menu li a:focus {
		background: #f4ede4;
		color: #000 !important;
		opacity: 1;
	}
	#main-header #top-menu li ul.sub-menu .menu-item-has-children > a:first-child:after {
		right: 14px;
		top: 50%;
		transform: translateY(-50%);
		content: "5"; /* ETmodules right arrow */
	}
	/* Nested fly-outs: default to the right of the panel ... */
	#main-header #top-menu li ul.sub-menu ul.sub-menu {
		top: -11px;
		left: 100%;
		right: auto;
	}
	/* ... the last two top-level dropdowns and anything the JS flags open leftward. */
	#main-header #top-menu > li:nth-last-child(-n+2) > ul.sub-menu,
	#main-header #top-menu > li.ddh-sub-left > ul.sub-menu {
		left: auto;
		right: 0;
	}
	#main-header #top-menu > li:nth-last-child(-n+2) ul.sub-menu ul.sub-menu,
	#main-header #top-menu li li.ddh-sub-left > ul.sub-menu {
		left: auto;
		right: 100%;
	}
	#main-header #top-menu > li:nth-last-child(-n+2) ul.sub-menu .menu-item-has-children > a:first-child:after,
	#main-header #top-menu li li.ddh-sub-left > a:first-child:after {
		content: "4"; /* left arrow */
	}
}

/* Narrow desktops: tighter type so the whole menu fits one row. */
@media only screen and (min-width: 981px) and (max-width: 1279px) {
	#main-header #top-menu > li,
	#main-header.et-fixed-header #top-menu > li {
		padding-right: 13px;
	}
	#main-header #top-menu > li > a,
	#main-header.et-fixed-header #top-menu > li > a {
		font-size: 15px !important;
		letter-spacing: .8px;
	}
	#main-header #logo,
	#main-header.et-fixed-header #logo {
		max-height: 46px !important;
		height: 46px !important;
	}
}

/* Tablet + phone: 58px bar, logo ~76% of it, readable hamburger menu. */
@media only screen and (max-width: 980px) {
	#main-header,
	#main-header.et-fixed-header {
		min-height: 58px;
	}
	.et_header_style_left #main-header #et-top-navigation,
	.et_header_style_left #main-header.et-fixed-header #et-top-navigation {
		padding-top: 13px !important;
	}
	.et_header_style_left #main-header #et-top-navigation .mobile_menu_bar,
	.et_header_style_left #main-header.et-fixed-header #et-top-navigation .mobile_menu_bar {
		padding-bottom: 13px !important;
	}
	#main-header #logo,
	#main-header.et-fixed-header #logo {
		max-height: 44px !important;
		max-width: calc(100vw - 100px);
	}
	#main-header .et_mobile_menu {
		max-height: calc(100vh - 140px);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		padding: 10px 0;
		border-top: 3px solid #bf9e77;
		background: #fff;
		box-sizing: border-box;
		left: 0;
		right: 0;
		width: 100%;
	}
	#main-header .et_mobile_menu li a {
		font-size: 17px !important;
		line-height: 1.3;
		letter-spacing: 1px;
		padding: 11px 6%;
		white-space: normal;
		overflow-wrap: anywhere;
		color: #2b2b2b !important;
	}
	#main-header .et_mobile_menu li li a,
	#main-header .et_mobile_menu .sub-menu a {
		font-size: 15px !important;
		padding-left: 10%;
	}
	#main-header .et_mobile_menu li li li a {
		padding-left: 14%;
	}
}

/* ========================================================================== */
/* 1.2.62.6: slim tan top bar (phone, email, sign-in).                        */
/* Desktop ~34px, one row. Phones/tablets: one ~34px line, phone + email      */
/* icon on the left, Books to Get + sign-in on the right, nothing stacking.   */
/* site-header.js keeps the fixed main header and sticky search below it.     */
/* ========================================================================== */
#top-header {
	font-size: 12px;
	line-height: 1.2;
}
#top-header .container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 34px;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	box-sizing: border-box;
}
#top-header #et-info,
#top-header #et-secondary-menu {
	float: none;
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 !important;
	margin: 0;
	min-height: 34px;
}
#top-header #et-info .et-social-icons:empty,
#top-header #et-secondary-menu .et_duplicate_social_icons {
	display: none;
}
#top-header #et-info-phone,
#top-header #et-info-email {
	margin: 0;
	padding: 0;
	font-size: 12px;
	white-space: nowrap;
}
#top-header #et-info-phone:before,
#top-header #et-info-email:before {
	font-size: 12px;
	margin-right: 5px;
	vertical-align: -1px;
}
#top-header #et-info a.ddh-tel,
#top-header #et-info a.ddh-tel:hover {
	color: inherit;
	text-decoration: none;
}
#top-header #et-secondary-nav {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0;
	padding: 0;
	line-height: 1;
}
#top-header #et-secondary-nav > li {
	display: flex;
	align-items: center;
	margin: 0 !important;
	padding: 0 !important;
	top: 0 !important;
}
#top-header #et-secondary-nav > li > a:not(.ddh-acct-top-btn) {
	padding: 0 !important;
	font-size: 12px;
	line-height: 1;
}
#top-header #et-secondary-nav li.ddh-acct-top {
	gap: 10px;
	margin-right: 4px !important;
	height: auto;
}
#top-header #et-secondary-nav li.ddh-acct-top a,
#top-header .ddh-acct-top-m a,
#top-header .ddh-acct-top-who {
	font-size: 12px;
}
#top-header .ddh-acct-top-btn,
#top-header #et-secondary-nav li.ddh-acct-top a.ddh-acct-top-btn {
	padding: 3px 10px !important;
	line-height: 1.2;
}
#top-header .ddh-acct-top-pile {
	font-size: 12px !important;
	padding: 2px 6px 2px 8px !important;
	min-height: 0 !important;
}
#top-header .ddh-acct-top-pile .ddh-bag-count {
	min-width: 16px;
	height: 16px;
	font-size: 10px;
}

@media only screen and (max-width: 980px) {
	#top-header .container {
		width: 100%;
		max-width: 100%;
		padding-left: 12px !important;
		padding-right: 12px !important;
		min-height: 34px;
	}
	#top-header #et-info {
		width: 100%;
		flex-wrap: nowrap;
		justify-content: flex-start;
		gap: 12px;
		text-align: left;
		min-height: 34px;
	}
	#top-header #et-info-phone,
	#top-header #et-info > a {
		display: inline-flex;
		align-items: center;
		flex: 0 0 auto;
	}
	/* Email: icon only on small screens (the address stays in the link and its label). */
	#top-header #et-info-email {
		font-size: 0;
		line-height: 0;
	}
	#top-header #et-info-email:before {
		font-size: 14px;
		line-height: 1;
		margin: 0;
	}
	#top-header .ddh-acct-top-m {
		display: flex !important;
		flex-wrap: nowrap !important;
		align-items: center;
		gap: 8px !important;
		margin: 0 0 0 auto !important;
		min-width: 0;
	}
	#top-header .ddh-acct-top-who {
		max-width: 96px;
	}
	#top-header .ddh-acct-top-pile {
		min-height: 22px !important;
		padding: 0 6px !important;
	}
}
@media only screen and (max-width: 480px) {
	/* Signed out, "Sign in" goes to the same page as "Your shelf", so drop the duplicate link. */
	#top-header .ddh-acct-top-m:has(.ddh-acct-top-btn) .ddh-acct-top-link:not(.ddh-acct-top-btn) {
		display: none !important;
	}
	#top-header .ddh-acct-top-m .ddh-acct-top-btn[data-ddh-short] {
		font-size: 0 !important;
	}
	#top-header .ddh-acct-top-m .ddh-acct-top-btn[data-ddh-short]:after {
		content: attr(data-ddh-short);
		font-size: 12px;
		line-height: 1.2;
	}
}
