/**
 * Mobile menu: a hamburger button in the header and a full-height panel
 * holding the primary menu. Replaces the WP Responsive Menu plugin.
 *
 * The desktop nav (.header_bottom) is hidden at 768px and below in
 * responsive.css; this sheet uses the same breakpoint, so there is never a
 * width with both menus or neither.
 */

.qh-menu-toggle,
.qh-mobile-menu {
	display: none !important;
}

@media only screen and (max-width: 768px) {

	/* The button sits at the left of the logo row, vertically centred. */
	#header .header-content {
		position: relative;
	}
	#header .header-col-menu {
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		width: auto;
		padding: 0;
		z-index: 2;
	}
	#header .header-col-menu .header-right {
		position: static;
		height: 100%;
		display: flex;
		align-items: center;
	}

	.qh-menu-toggle {
		display: block !important;
		position: relative;
		width: 43px;
		height: 43px;
		margin: 0;
		padding: 0;
		background-color: #C8B484;
		border: 1px solid #fff;
		border-radius: 8px;
		cursor: pointer;
	}
	.qh-menu-toggle:focus-visible {
		outline: 3px solid #fff;
		outline-offset: 2px;
	}
	.qh-menu-toggle__bars span {
		position: absolute;
		left: 7px;
		width: 27px;
		height: 2px;
		border-radius: 6px;
		background: #503454;
		transition: transform .25s ease-in-out, opacity .25s ease-in-out;
	}
	.qh-menu-toggle__bars span:nth-child(1) { top: 13px; }
	.qh-menu-toggle__bars span:nth-child(2) { top: 20px; }
	.qh-menu-toggle__bars span:nth-child(3) { top: 27px; }
	.qh-menu-toggle[aria-expanded="true"] .qh-menu-toggle__bars span:nth-child(1) {
		transform: translateY(7px) rotate(45deg);
	}
	.qh-menu-toggle[aria-expanded="true"] .qh-menu-toggle__bars span:nth-child(2) {
		opacity: 0;
	}
	.qh-menu-toggle[aria-expanded="true"] .qh-menu-toggle__bars span:nth-child(3) {
		transform: translateY(-7px) rotate(-45deg);
	}

	/* The panel. No display rule while closed, so the hidden attribute wins. */
	.qh-mobile-menu:not([hidden]) {
		display: block !important;
	}
	.qh-mobile-menu {
		position: fixed;
		top: var(--qh-header-height, 90px); /* menu.js sets the real top on open */
		right: 0;
		bottom: 0;
		left: 0;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
		background-color: #503454;
		border-top: 1px solid rgba(255, 255, 255, .2);
		padding: 10px 0 40px;
		z-index: 1;
	}
	.qh-menu-open #header {
		z-index: 9999;
	}
	html.qh-menu-open,
	html.qh-menu-open body {
		overflow: hidden;
	}

	.qh-mobile-menu ul {
		list-style: none;
		margin: 0;
		padding: 0;
	}
	.qh-mobile-menu li {
		position: relative;
		margin: 0;
		border-bottom: 1px solid rgba(255, 255, 255, .12);
	}
	.qh-mobile-menu li a {
		display: block;
		padding: 15px 64px 15px 30px;
		color: #fff;
		font-family: 'avenir-lt-pro';
		font-size: 18px;
		line-height: 1.4;
		text-transform: uppercase;
		text-decoration: none;
	}
	.qh-mobile-menu li a:hover,
	.qh-mobile-menu li a:focus-visible,
	.qh-mobile-menu .current-menu-item > a,
	.qh-mobile-menu .current_page_item > a {
		color: #C8B484;
	}
	.qh-mobile-menu a:focus-visible,
	.qh-mobile-menu button:focus-visible {
		outline: 2px solid #fff;
		outline-offset: -4px;
	}

	/* Second level, opened with the button beside its parent. */
	.qh-mobile-menu li ul {
		background-color: rgba(0, 0, 0, .15);
	}
	.qh-mobile-menu li li {
		border-bottom: 0;
		border-top: 1px solid rgba(255, 255, 255, .08);
	}
	.qh-mobile-menu li li a {
		padding-left: 48px;
		font-size: 16px;
		text-transform: none;
	}
	.qh-mobile-menu li li li a {
		padding-left: 66px;
	}

	.qh-submenu-toggle {
		position: absolute;
		top: 0;
		right: 10px;
		width: 48px;
		height: 55px;
		margin: 0;
		padding: 0;
		background: none;
		border: 0;
		cursor: pointer;
	}
	.qh-submenu-toggle::before {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		width: 9px;
		height: 9px;
		margin: -7px 0 0 -5px;
		border-right: 2px solid #C8B484;
		border-bottom: 2px solid #C8B484;
		transform: rotate(45deg);
		transition: transform .2s ease;
	}
	.qh-submenu-toggle[aria-expanded="true"]::before {
		margin-top: -2px;
		transform: rotate(-135deg);
	}
	.qh-mobile-menu li li .qh-submenu-toggle {
		height: 51px;
	}

	/* Phone and contact: the header hides them at this width. */
	.qh-mobile-menu__contact {
		display: flex;
		flex-direction: column;
		align-items: center;
		row-gap: 18px;
		padding: 30px 30px 0;
	}
	.qh-mobile-menu__contact a {
		color: #fff;
		font-family: 'avenir-lt-pro';
		font-size: 20px;
		text-decoration: none;
	}
	.qh-mobile-menu__contact a.qh-mobile-menu__button {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 160px;
		height: 44px;
		padding: 0 20px;
		border-radius: 8px;
		background-color: #C8B484;
		font-size: 17px;
		text-transform: uppercase;
	}
	.qh-mobile-menu__contact a.qh-mobile-menu__button:hover {
		background-color: #9B8756;
	}
}

@media (prefers-reduced-motion: reduce) {
	.qh-menu-toggle__bars span,
	.qh-submenu-toggle::before {
		transition: none;
	}
}
