/**
 * Header overrides — align Salient's header with the R3 design system.
 *
 * Loads after the parent stylesheet and depends on the AOR token layer
 * (aor-wpb-tokens), which the components plugin registers site-wide.
 */

/* 1. Header uses the AOR 1440px container, same edge padding as breakouts.
 * The header runs full-width (#header-outer[data-full-width=true]), and
 * Salient's own full-width rule outranks a plain .container selector — the
 * first selector here out-specifies it. */
body #header-outer[data-full-width="true"] header#top > .container,
body header#top .container {
	width: 100%;
	max-width: calc(var(--aor-container-max) + 2 * var(--aor-space-md));
	margin-inline: auto;
	padding-inline: var(--aor-space-md);
}

/* 2. Menu typography — Montserrat 600, the design's 16px nav size. */
body header#top nav > ul > li > a,
body header#top nav > ul > li > a .menu-title-text {
	font-family: var(--aor-font-heading);
	font-size: var(--aor-font-size-md);
	font-weight: var(--aor-weight-heading);
	letter-spacing: 0;
	text-transform: none;
}

/* Utility (secondary) bar — the R3 alert bar: 48px #333 strip, 12.4px
 * regular white items, and the callout as a full-height brand-red block. */
/* Salient sizes the bar at 32px from several rules of its own (dynamic CSS
 * included), so every layer of the chain gets pinned or the taller anchors
 * poke out of the strip. */
body #header-secondary-outer,
body #header-secondary-outer .container,
body #header-secondary-outer nav,
body #header-secondary-outer nav > ul,
body #header-secondary-outer nav > ul > li,
body #header-secondary-outer nav > ul > li > a {
	height: 48px !important;
	line-height: 48px !important;
}

body #header-secondary-outer {
	background-color: var(--aor-color-surface-dark);
	border-bottom: none;
}

/* The bar's items sit flush to the viewport edge — no right padding on its
 * full-width container. */
body #header-secondary-outer[data-full-width="true"] > .container {
	padding-right: 0;
}

body #header-secondary-outer nav > ul > li {
	margin: 0 !important;
	border: none !important;
}

body #header-secondary-outer nav > ul > li > a {
	display: block;
	padding: 0 var(--aor-space-4xs) !important;
	border: none !important;
}

body #header-secondary-outer ul li a,
body #header-secondary-outer ul li a .menu-title-text {
	font-family: var(--aor-font-body);
	font-size: var(--aor-font-size-xs);
	font-weight: var(--aor-weight-body);
	color: var(--aor-color-text-inverse);
	letter-spacing: 0;
	text-transform: none;
	opacity: 1;
}

body #header-secondary-outer nav > ul > li.callout-menu-btn > a {
	background-color: var(--aor-color-brand);
}

body #header-secondary-outer nav > ul > li.callout-menu-btn > a:hover {
	background-color: var(--aor-color-brand-dark);
}

/* Utility dropdown (e.g. Support). Salient's JS tracks its left position —
 * hence the !important — which lets it hang off the viewport for
 * right-edge items; pin it to the item's right edge instead. Dark panel so
 * the white link text (set above) reads. */
body #header-secondary-outer nav ul li ul.sub-menu {
	left: auto !important;
	right: 0 !important;
	min-width: 200px;
	padding: var(--aor-space-6xs) 0;
	background-color: var(--aor-color-surface-dark);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

body #header-secondary-outer nav ul li ul.sub-menu li {
	display: block;
	float: none;
	margin: 0 !important;
	border: none !important;
}

body #header-secondary-outer nav ul li ul.sub-menu li a {
	display: block;
	height: auto !important;
	line-height: var(--aor-leading-body) !important;
	padding: var(--aor-space-6xs) var(--aor-space-4xs) !important;
	color: var(--aor-color-text-inverse);
	white-space: nowrap;
}

body #header-secondary-outer nav ul li ul.sub-menu li a:hover {
	background-color: var(--aor-color-brand);
}

/* 3. Logo sizing. Salient pins the logo height in its dynamic CSS with an
 * !important of its own on the identical selector — the html prefix wins
 * the specificity tie. Width is governed by the 200px cap below. */
html body header#top #logo img {
	width: auto;
	max-width: 175px;
	height: auto !important;
}

html body header#top .row .col img {
	max-width: 200px;
}

/* Menu text is pure white over the transparent header — Salient dims it
 * slightly. Scoped to the transparent state so the solid (scrolled) header
 * keeps its own colours. */
body #header-outer.transparent header#top nav > ul > li > a,
body #header-outer.transparent header#top nav > ul > li > a .menu-title-text,
body #header-outer.transparent header#top nav > ul > li > a .sf-sub-indicator [class^="icon-"] {
	/* Salient's skin CSS dims transparent-header links (opacity .75 on the
	 * anchor, colour !important) — both flags needed to beat it. */
	color: var(--aor-color-text-inverse) !important;
	opacity: 1 !important;
}

/* Salient pads the top of the content wrap 40px when header resize is off
 * (its dynamic CSS may load after this sheet — the html prefix outranks
 * it). The AOR sections own their own spacing. */
html body[data-header-resize="0"] .container-wrap,
html body[data-header-resize="0"] .project-title {
	padding-top: 0;
}

/* The same skin rule dims the search icon (and the other icon toggles) to
 * opacity .75 in the transparent state — full strength, like the links. */
body #header-outer.transparent #top nav ul #search-btn a .icon-salient-search,
body #header-outer.transparent #top nav ul #nectar-user-account a span,
body #header-outer.transparent #top nav ul .slide-out-widget-area-toggle a i {
	color: var(--aor-color-text-inverse) !important;
	opacity: 1 !important;
}

/* Solid (scrolled) header state — Salient's light skin renders the links
 * #999, too faint. Use the design's heading colour. */
body #header-outer:not(.transparent) header#top nav > ul > li > a,
body #header-outer:not(.transparent) header#top nav > ul > li > a .menu-title-text,
body #header-outer:not(.transparent) header#top nav > ul > li > a .sf-sub-indicator [class^="icon-"],
body #header-outer:not(.transparent) header#top nav > ul > li > a .sf-sub-indicator svg {
	color: var(--aor-color-heading);
}

/* 4. No divider or extra gap between the menu and the search icon.
 * Salient sets the border and 25px pads from .ascend/full-width/transparent
 * rule variants three ids deep, and draws dividers on the neighbouring
 * toggle too — hence the blanket selectors and !important. */
body #top nav ul #search-btn,
body #top nav ul #search-btn > div,
body #top nav ul #search-btn a,
body #top nav ul .slide-out-widget-area-toggle a {
	border-left: none !important;
	margin-left: 0 !important;
	padding-left: 0 !important;
}

body #top nav ul #search-btn a {
	padding-right: 0 !important;
}

/* Mobile header (Salient's mobile layout starts below 1000px). */
@media (max-width: 999px) {
	html body header#top #logo img {
		max-width: 115px;
	}

	body header#top .col.span_9.col_last {
		margin-top: 10px;
	}

	/* The shrunken sticky header re-centres itself — drop the offset. */
	body #header-outer.scrolled-down header#top .col.span_9.col_last {
		margin-top: 0;
	}
}

/* The divider line itself is an ::after pseudo-element on the anchor, not a
 * border on the element — Salient draws it on the search, user-account,
 * cart and slide-out toggles. */
body #top nav ul #search-btn a::after,
body #top nav ul .slide-out-widget-area-toggle a::after,
body #top nav ul #nectar-user-account a::after,
body #top .cart-contents::after {
	content: none !important;
	display: none !important;
}
