/*
 * Component: navbar — fixed header under the topbar.
 * >= 1025px: logo + horizontal menu (dropdowns on hover/focus) + gold search square.
 * <= 1024px: logo + green burger; menu and search slide in from the right (assets/js/navbar.js toggles .is-open).
 * Geometry reproduces the live site (incl. its 30px side padding on a 100%-wide fixed bar >= 1090px, which only
 * overflows off-screen: fixed boxes never create scrollbars).
 */

.hg-navbar {
	position: fixed;
	top: var(--hg-topbar-h);
	left: 0;
	z-index: var(--hg-z-navbar);
	box-sizing: content-box;
	width: 100%;
	background: var(--hg-bg-navbar);
}

.hg-navbar::after {
	content: "";
	display: table;
	clear: both;
}

.hg-navbar--static {
	position: relative;
	top: 0;
}

.hg-navbar__inner {
	max-width: 1680px;
	margin: 0 auto;
}

/* Logo: inline-block strut + vertical-align centres the image in the bar. */
.hg-navbar__brand {
	float: left;
	display: block;
	max-width: 100%;
	height: var(--hg-navbar-h);
	margin: 0 30px 0 -30px;
	padding: 0 30px;
	font-size: var(--hg-fs-md);
	color: #444;
}

.hg-navbar__brand::before {
	content: "";
	display: inline-block;
	height: 100%;
	vertical-align: middle;
}

.hg-navbar__logo {
	display: inline;
	max-width: 100%;
	vertical-align: middle;
}

.hg-navbar__menu {
	float: left;
	max-width: 100%;
}

/* ---------- level 1 ---------- */

.hg-nav {
	display: table;
	margin: 0 auto;
	list-style: none;
}

.hg-nav__item--l1 {
	position: relative;
	float: left;
	margin-right: 30px;
	color: var(--hg-text-nav);
}

.hg-nav__item--l1 > .hg-nav__link {
	display: block;
	height: var(--hg-navbar-h);
	padding: 0;
	font-size: var(--hg-fs-base);
	font-weight: var(--hg-fw-black);
	line-height: var(--hg-lh-nav);
	color: var(--hg-text-nav);
	text-decoration: none;
}

.hg-nav__link--separator {
	cursor: default;
}

a.hg-nav__link:hover,
a.hg-nav__link:focus {
	color: var(--hg-brown);
	text-decoration: none;
}

.hg-nav__toggle {
	display: none;
}

/* ---------- level 2: dropdown ---------- */

.hg-nav__dropdown {
	display: none;
	position: absolute;
	top: 100%;
	left: -30px;
	z-index: var(--hg-z-dropdown);
	width: 350px;
	margin-top: -1px;
	padding: 15px 30px;
	background: var(--hg-bg-dropdown);
	font-size: var(--hg-fs-base);
}

.hg-nav__sub,
.hg-nav__sub3 {
	margin: 0 -30px;
	list-style: none;
}

.hg-nav__item--l2 {
	position: relative;
}

.hg-nav__item--l2 > .hg-nav__link {
	display: block;
	padding: 5px 30px;
	color: var(--hg-text-nav);
	text-decoration: none;
}

.hg-nav__item--l2.is-active > .hg-nav__link {
	color: var(--hg-brown);
}

/* ▶ marker on items that have a 3rd level */
.hg-nav__item--l2.hg-nav__item--parent > .hg-nav__link {
	position: relative;
}

.hg-nav__item--l2.hg-nav__item--parent > .hg-nav__link::before {
	content: url("../../img/next-page.svg");
	position: absolute;
	top: 20%;
	right: 15px;
	width: 15px;
	height: 15px;
}

/* ---------- level 3: flyout ---------- */

.hg-nav__item--l2 > .hg-nav__dropdown {
	top: -12px;
	left: 100%;
	align-items: start;
	height: 100%;
	background: transparent;
}

.hg-nav__sub3 {
	padding: 5px 30px;
	background: var(--hg-bg-flyout);
}

.hg-nav__item--l3 > .hg-nav__link {
	display: block;
	padding: 2px 0;
	color: var(--hg-text-nav);
	text-decoration: none;
}

/* ---------- search ---------- */

.hg-navbar__search {
	position: relative;
	float: right;
	max-width: 100%;
	line-height: 0;
}

.hg-search {
	position: absolute;
	top: 20px;
	right: 25px;
	width: 50px;
	height: 50px;
	margin: 0;
	background: var(--hg-gold);
}

.hg-search::before {
	content: "";
	position: absolute;
	top: 5px;
	left: 5px;
	width: 30px;
	height: 30px;
	background: url("../../img/icon-search.svg") no-repeat 0 80%;
}

.hg-search__field {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	opacity: 0;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.hg-search__field::-webkit-search-cancel-button,
.hg-search__field::-webkit-search-decoration {
	-webkit-appearance: none;
}

/* Focus: the field opens to the left of the button and the icon becomes «close» (live: .uk-search.focused). */
.hg-search:focus-within::before {
	z-index: 99;
	background-image: url("../../img/icon-close.svg");
	cursor: pointer;
}

.hg-search__field:focus {
	inset: 0 auto auto -160px;
	z-index: 1;
	width: 160px;
	height: 50px;
	padding: 10px 10px 10px 20px;
	border: 1px solid var(--hg-green);
	outline: 0;
	background: rgba(255, 255, 255, 0.85);
	color: #000;
	font-size: 16px;
	text-align: left;
	opacity: 1;
	cursor: text;
}

/* ---------- burger (mobile) ---------- */

.hg-burger {
	display: none;
	position: absolute;
	top: 22px;
	right: 0;
	z-index: var(--hg-z-burger);
	width: 56px;
	height: 50px;
	padding: 0;
	border: 0;
	background: var(--hg-green);
	transition: right 0.15s linear;
}

.hg-burger__bar {
	position: absolute;
	top: 10px;
	right: 0;
	left: 0;
	display: block;
	width: 35px;
	height: 5px;
	margin: 0 auto;
	border-radius: var(--hg-radius-card);
	background: var(--hg-text-inverse);
	transform-origin: left center;
	transition: var(--hg-ease);
}

.hg-burger__bar:nth-child(2) {
	top: 20px;
}

.hg-burger__bar:nth-child(3) {
	top: 30px;
}

/* ---------- desktop >= 1025 ---------- */

@media (min-width: 1025px) {
	.hg-nav__item--l1.is-active > a.hg-nav__link::after,
	.hg-nav__item--l1 > a.hg-nav__link:hover::after,
	.hg-nav__item--l1 > a.hg-nav__link:focus::after {
		width: 100%;
	}

	.hg-nav__item--l1 > a.hg-nav__link::after {
		content: "";
		position: absolute;
		bottom: 30px;
		left: 0;
		width: 0;
		height: 2px;
		background: var(--hg-brown);
		transition: width 0.5s;
	}

	.hg-nav__item--l1:hover > .hg-nav__dropdown,
	.hg-nav__item--l1:focus-within > .hg-nav__dropdown {
		display: block;
	}

	.hg-nav__item--l2:hover > .hg-nav__dropdown,
	.hg-nav__item--l2:focus-within > .hg-nav__dropdown {
		display: flex;
	}

	a.hg-nav__link:hover,
	a.hg-nav__link:focus {
		color: var(--hg-brown);
	}
}

@media (min-width: 1090px) {
	.hg-navbar {
		padding: 0 30px;
	}
}

@media (max-width: 1440px) {
	.hg-navbar__brand,
	.hg-nav__item--l1 {
		margin-right: 25px;
	}

	.hg-nav__item--l1 > a.hg-nav__link {
		font-size: var(--hg-fs-sm);
	}

	.hg-nav__dropdown {
		width: 210px;
		padding: 15px;
	}
}

@media (max-width: 1366px) {
	.hg-navbar__brand,
	.hg-nav__item--l1 {
		margin-right: 20px;
	}

	.hg-nav__item--l1 > .hg-nav__link--separator {
		font-size: var(--hg-fs-sm);
	}
}

@media (max-width: 1280px) {
	.hg-navbar__brand {
		width: 18%;
	}
}

@media (max-width: 1024px) {
	.hg-navbar__brand {
		width: auto;
	}
}

@media (min-width: 1000px) and (max-width: 1200px) {
	.hg-navbar__brand,
	.hg-nav__item--l1 {
		margin-right: 10px;
	}

	.hg-navbar__brand {
		width: 14%;
		padding-right: 0;
	}

	.hg-nav .hg-nav__sub .hg-nav__link,
	.hg-nav .hg-nav__sub3 .hg-nav__link {
		font-size: var(--hg-fs-sm);
	}
}

/* ---------- mobile <= 1024 ---------- */

@media (max-width: 1024px) {
	.hg-navbar.is-open::before {
		content: "";
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background: rgba(0, 0, 0, 0.5);
	}

	.hg-navbar__menu {
		position: relative;
		background: var(--hg-bg);
	}

	.hg-nav {
		display: block;
		position: fixed;
		top: 0;
		right: -100%;
		width: 35%;
		max-width: 100%;
		height: 100%;
		max-height: 100%;
		margin: 0;
		padding: 0;
		overflow: auto;
		background: var(--hg-bg);
		transition: right 0.1s linear;
	}

	.hg-navbar.is-open .hg-nav {
		right: 0;
	}

	.hg-nav .hg-nav__item {
		float: left;
		display: block;
		width: 100%;
		margin-right: 0;
		padding-left: 20px;
		overflow: hidden auto;
	}

	.hg-nav__item--l1:first-child {
		margin-top: 100px;
	}

	.hg-nav__item--l1:last-child {
		margin-bottom: 80px;
	}

	.hg-nav .hg-nav__link {
		height: auto;
		padding: 15px 25px;
		line-height: 1;
	}

	.hg-nav__item--l1 > .hg-nav__link--separator {
		height: 44px;
		padding: 0 0 0 25px;
		line-height: 44px;
	}

	.hg-nav__toggle {
		display: flex;
		justify-content: center;
		align-items: flex-start;
		position: absolute;
		top: -3px;
		right: 0;
		width: 50px;
		height: 50px;
		padding: 0;
		border: 0;
		background: none;
	}

	.hg-nav__toggle img {
		margin-top: 17px;
	}

	.hg-nav__dropdown,
	.hg-nav__item--l2 > .hg-nav__dropdown {
		position: relative;
		top: auto;
		left: 0;
		width: 100%;
		height: auto;
		padding: 10px 20px;
		background: inherit;
	}

	.hg-nav__item.is-open > .hg-nav__dropdown {
		display: block;
	}

	.hg-nav__sub,
	.hg-nav__sub3 {
		display: flow-root;
		margin: 0 -30px 0 0;
		padding: 0;
		background: none;
	}

	.hg-nav__item--l2 > .hg-nav__link,
	.hg-nav__item--l3 > .hg-nav__link {
		font-size: var(--hg-fs-base);
		font-weight: var(--hg-fw-light);
	}

	.hg-navbar__search {
		display: block;
		position: fixed;
		top: 0;
		left: 100%;
		float: none;
		width: 35%;
		padding: 20px 0;
		background: var(--hg-bg);
		transition: left 0.15s linear;
	}

	.hg-navbar__search::before {
		content: "";
		position: absolute;
		top: 0;
		right: 0;
		z-index: -2;
		display: block;
		width: 100%;
		height: 100px;
		background: var(--hg-bg);
	}

	.hg-navbar.is-open .hg-navbar__search {
		left: 65%;
	}

	.hg-search {
		top: -15px;
		right: 10%;
	}

	.hg-burger {
		display: block;
	}

	.hg-navbar.is-open .hg-burger {
		right: 34.8%;
	}

	.hg-navbar.is-open .hg-burger__bar:nth-child(1) {
		top: 10px;
		left: 10px;
		transform: rotate(45deg);
	}

	.hg-navbar.is-open .hg-burger__bar:nth-child(2) {
		width: 0;
		opacity: 0;
	}

	.hg-navbar.is-open .hg-burger__bar:nth-child(3) {
		top: 35px;
		left: 11px;
		transform: rotate(-45deg);
	}
}

@media (max-width: 960px) {
	.hg-navbar__brand {
		margin: 0;
	}
}

@media (max-width: 768px) {
	.hg-nav,
	.hg-navbar__search {
		width: 45%;
	}

	.hg-navbar.is-open .hg-navbar__search {
		left: 55%;
	}

	.hg-navbar.is-open .hg-burger {
		right: 44.8%;
	}
}

@media (max-width: 767px) {
	.hg-navbar {
		top: var(--hg-topbar-h-mobile);
		background: var(--hg-bg);
	}

	.hg-navbar--static {
		top: 0;
	}

	.hg-navbar__brand {
		width: 50%;
		height: var(--hg-navbar-h-mobile);
		padding: 0 10px;
	}

	.hg-burger {
		top: 7px;
	}

	.hg-nav .hg-nav__item {
		padding-left: 0;
	}

	.hg-nav__sub,
	.hg-nav__sub3 {
		margin-left: -5px;
	}

	.hg-nav__item--l1 > .hg-nav__link--separator {
		height: 44px;
		padding: 10px 24px;
		line-height: 20px;
	}

	.hg-nav__item--l2 > .hg-nav__link {
		max-width: 60%;
	}
}

@media (max-width: 414px) {
	.hg-nav,
	.hg-navbar__search {
		width: 70%;
	}

	.hg-navbar.is-open .hg-navbar__search {
		left: 30%;
	}

	.hg-navbar.is-open .hg-burger {
		right: 69.8%;
	}

	.hg-search {
		right: 5%;
	}
}

/* Focused search field in the mobile menu, as measured on the live site: opaque; 40px wide up to 414px (live bug). */
@media (max-width: 1024px) {
	.hg-search__field:focus {
		background: #fff;
	}
}

@media (max-width: 414px) {
	.hg-search__field:focus {
		max-width: 80%;
	}
}

/* Live: a first-level link with keyboard focus (no hover) is black and underlined (Phase 5 QA). */
@media (min-width: 1025px) {
	.hg-nav__item--l1 > a.hg-nav__link:focus:not(:hover) {
		color: #000;
		text-decoration: underline;
	}
}
