/*
 * Header dropdown menu (Appearance > Menus).
 *
 * WordPress outputs submenus as <ul class="sub-menu"> inside the parent <li>. The older
 * rules targeted ul.dp-menu, which WordPress never adds, so submenus sat in normal flow
 * and pushed the centred main menu out of place. These rules position every submenu
 * absolutely under its parent, open on hover or keyboard focus, and support three levels
 * (the Arolax "Pages" dropdown goes three deep).
 */

/* The header must sit above the page content so open dropdowns are never covered by the hero. */
/* Keep the header's own positioning from the master stylesheets (absolute); only lift it above the page. */
.header-area {
	z-index: 50;
}

.header__nav .main-menu > ul {
	display: flex;
	align-items: stretch;
	margin: 0;
	padding: 0;
	list-style: none;
}

.header__nav .main-menu li {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Chevron on top-level items that have children (Font Awesome is loaded by the theme). */
.header__nav .main-menu > ul > li.menu-item-has-children > a::after {
	content: "\f107";
	font-family: "Font Awesome 6 Free";
	font-weight: 900;
	font-size: 11px;
	margin-inline-start: 6px;
	transition: transform .3s ease;
}

.header__nav .main-menu > ul > li.menu-item-has-children:hover > a::after,
.header__nav .main-menu > ul > li.menu-item-has-children:focus-within > a::after {
	transform: rotate(180deg);
}

/* Dropdown panel. Hidden until its parent is hovered or focused. */
.header__nav .main-menu .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 100;
	min-width: 240px;
	margin: 0;
	padding: 14px 0;
	list-style: none;
	background-color: #232529;
	border-radius: 10px;
	box-shadow: 0 20px 40px rgba(0, 0, 0, .18);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(10px);
	transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
}

/* Second and third levels open to the right of their parent row. */
.header__nav .main-menu .sub-menu .sub-menu {
	top: -14px;
	left: 100%;
	min-width: 230px;
	margin-left: 6px;
	transform: translateX(10px);
}

.header__nav .main-menu li:hover > .sub-menu,
.header__nav .main-menu li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: none;
}

.header__nav .main-menu .sub-menu li {
	display: block;
	padding: 0 12px;
}

/* Rows inside a dropdown. Overrides the 37px top-level padding from the master stylesheet. */
.header__nav .main-menu .sub-menu li > a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0;
	text-transform: capitalize;
	white-space: nowrap;
	color: #999;
	background-color: transparent;
	transition: color .2s ease, background-color .2s ease;
}

.header__nav .main-menu .sub-menu li > a:hover,
.header__nav .main-menu .sub-menu li > a:focus-visible,
.header__nav .main-menu .sub-menu li > a.current {
	color: #fff;
	background-color: rgba(255, 255, 255, .06);
}

/* Arrow for rows that open a further level. */
.header__nav .main-menu .sub-menu li.menu-item-has-children > a::after {
	content: "\f105";
	font-family: "Font Awesome 6 Free";
	font-weight: 900;
	font-size: 11px;
	margin: 0;
}

/* Mobile offcanvas menu: the first items were hidden behind the close button because the
   nav's top margin collapsed through the wrapper. flow-root stops the collapse and clears the button. */
.offcanvas-3__menu-wrapper {
	display: flow-root;
}

.offcanvas-3__menu-wrapper nav.mobile-menu {
	margin-top: 110px;
}

/* Mobile offcanvas menu: plain nested lists, indented, no hover behaviour. */
.offcanvas-3__menu-wrapper .mobile-menu .sub-menu {
	margin: 14px 0 0 14px;
	padding: 0;
	list-style: none;
}

.offcanvas-3__menu-wrapper .mobile-menu .sub-menu li {
	padding-bottom: 14px;
}

.offcanvas-3__menu-wrapper .mobile-menu .sub-menu li a {
	font-size: 19px;
}

@media (prefers-reduced-motion: reduce) {
	.header__nav .main-menu .sub-menu,
	.header__nav .main-menu > ul > li.menu-item-has-children > a::after {
		transition: none;
	}
}
