/*
 * core/navigation — header menu. Structure and behaviour follow hoffmanacademy.com, styling is ours:
 * desktop (≥ 1200px) — one row, submenus open on click as cards with a pointer;
 * below 1200px — a burger opens a panel sliding in from the right over a dimmed page,
 * everything expanded (no accordions). See README, section 5.1.
 */

.wp-block-navigation .wp-block-navigation-item__content {
	padding-block: 8px;
}

.site-footer__nav .wp-block-navigation-item__content {
	padding-block: 0;
}

.site-header__nav .wp-block-navigation__container {
	gap: 4px clamp(14px, 1.6vw, 26px);
}

/* Desktop submenus -------------------------------------------------------- */

.site-header__nav .wp-block-navigation-submenu__toggle {
	cursor: pointer;
}

.site-header__nav .has-child .wp-block-navigation__submenu-container {
	top: calc(100% + 12px); /* Room for the pointer. */
	left: -16px;
	min-width: 250px;
	padding: 6px;
	border: 0 !important;
	border-radius: 20px;
	background: #fff;
	color: var(--fc-ink);
	box-shadow: 0 14px 36px rgba(27, 43, 68, 0.18);
	transform: translateY(6px);
}

.site-header__nav .has-child .wp-block-navigation-submenu__toggle[aria-expanded="true"] ~ .wp-block-navigation__submenu-container {
	min-width: 250px;
	transform: none;
}

@media not (prefers-reduced-motion) {
	.site-header__nav .has-child .wp-block-navigation__submenu-container {
		transition: opacity 0.2s ease-out, transform 0.2s ease-out;
	}
}

/* Pointer towards the menu item. */
.site-header__nav .has-child .wp-block-navigation__submenu-container::after {
	content: "";
	position: absolute;
	top: -6px;
	left: 30px;
	width: 14px;
	height: 14px;
	border-radius: 3px 0 0 0;
	background: #fff;
	transform: rotate(45deg);
}

.site-header__nav .wp-block-navigation__submenu-container .wp-block-navigation-item + .wp-block-navigation-item {
	border-top: 1px solid var(--wp--preset--color--line);
}

.site-header__nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	align-items: center;
	gap: 12px;
	padding: 9px 12px;
	border-radius: 12px;
	font-weight: 700;
}

.site-header__nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover,
.site-header__nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content:focus-visible {
	background: var(--wp--preset--color--tint-blue);
	color: var(--fc-blue-dark);
}

/* Lesson icons: matched by link address, so the menu itself needs no setup; unknown items get none. */
.site-header__nav a[href$="/lessons/"]::before,
.site-header__nav a[href$="/lessons/piano/"]::before,
.site-header__nav a[href$="/lessons/voice/"]::before,
.site-header__nav a[href$="/lessons/guitar/"]::before,
.site-header__nav a[href$="/lessons/bass-guitar/"]::before,
.site-header__nav a[href$="/lessons/drums/"]::before,
.site-header__nav a[href$="/lessons/violin/"]::before,
.site-header__nav a[href$="/lessons/music-theory/"]::before,
.site-header__nav a[href$="/lessons/music-programs/"]::before {
	content: "";
	flex: 0 0 32px;
	width: 32px;
	height: 32px;
	background: center / contain no-repeat;
}

.site-header__nav a[href$="/lessons/"]::before { background-image: url("../../images/icons/lessons.svg"); }
.site-header__nav a[href$="/lessons/piano/"]::before { background-image: url("../../images/icons/piano.svg"); }
.site-header__nav a[href$="/lessons/voice/"]::before { background-image: url("../../images/icons/voice.svg"); }
.site-header__nav a[href$="/lessons/guitar/"]::before { background-image: url("../../images/icons/guitar.svg"); }
.site-header__nav a[href$="/lessons/bass-guitar/"]::before { background-image: url("../../images/icons/bass.svg"); }
.site-header__nav a[href$="/lessons/drums/"]::before { background-image: url("../../images/icons/drums.svg"); }
.site-header__nav a[href$="/lessons/violin/"]::before { background-image: url("../../images/icons/violin.svg"); }
.site-header__nav a[href$="/lessons/music-theory/"]::before { background-image: url("../../images/icons/theory.svg"); }
.site-header__nav a[href$="/lessons/music-programs/"]::before { background-image: url("../../images/icons/programs.svg"); }

/* Extra items only for the phone panel (Log In, trial button, social links; plain Locations link). */
.site-nav-panel,
.site-header__nav a.site-nav-panel-link {
	display: none;
}

/* Burger --------------------------------------------------------------------- */

.wp-block-navigation__responsive-container-open {
	padding: 10px;
	border-radius: 999px;
	background: var(--wp--preset--color--tint-blue);
}

/* Burger: three bars instead of core's two-bar icon. */
.site-header__nav .wp-block-navigation__responsive-container-open svg {
	display: none;
}

.site-header__nav .wp-block-navigation__responsive-container-open::before {
	content: "";
	display: block;
	width: 24px;
	height: 24px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 6.5h16M4 12h16M4 17.5h16' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 6.5h16M4 12h16M4 17.5h16' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* The core switches to the burger below 600px; the header menu needs it below 1200px. */
@media (min-width: 600px) and (max-width: 1199px) {
	.site-header__nav.site-header__nav .wp-block-navigation__responsive-container:not(.is-menu-open) {
		display: none;
	}

	.site-header__nav.site-header__nav .wp-block-navigation__responsive-container-open {
		display: flex;
	}
}

@media (max-width: 1199px) {
	/* Direct child only: core also puts the block class on the inner <ul>. */
	.site-header__row > .site-header__nav {
		flex: 0 0 auto;
		order: 3; /* Burger after "Call" and the trial button. */
	}

	.site-header__row > .site-header__actions {
		margin-left: auto;
	}
}

/* Phone panel --------------------------------------------------------------- */

/* The container covers the screen and is the dimmed backdrop (a click on it closes the menu, see nav-overlay.js). */
/*
 * overflow: clip, not hidden: core focuses the first menu item while the panel is still translated off-screen;
 * a hidden-overflow box is still a scroll container, so the browser scrolled it sideways to show the focused
 * item and the panel flashed in from the left (iPhone). A clipped box cannot be scrolled at all.
 */
.site-header__nav .wp-block-navigation__responsive-container.is-menu-open {
	padding: 0 !important;
	overflow: hidden;
	overflow: clip;
	background: transparent !important;
	color: var(--fc-ink) !important;
	animation: none;
}

.site-header__nav .wp-block-navigation__responsive-container.is-menu-open::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(27, 43, 68, 0.55);
}

.site-header__nav .is-menu-open .wp-block-navigation__responsive-close {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(330px, 88vw);
	max-width: none;
	margin: 0;
	padding: 20px 28px 40px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: #fff;
	box-shadow: -12px 0 32px rgba(27, 43, 68, 0.2);
}

@media not (prefers-reduced-motion) {
	.site-header__nav .wp-block-navigation__responsive-container.is-menu-open::before {
		animation: fc-backdrop-in 0.3s ease-out;
	}

	.site-header__nav .is-menu-open .wp-block-navigation__responsive-close {
		animation: fc-panel-in 0.3s ease-out;
	}
}

@keyframes fc-backdrop-in {
	from {
		opacity: 0;
	}
}

@keyframes fc-panel-in {
	from {
		transform: translateX(100%);
	}
}

.has-modal-open .admin-bar .site-header__nav .is-menu-open .wp-block-navigation__responsive-dialog {
	margin-top: 0;
}

.site-header__nav .is-menu-open .wp-block-navigation__responsive-container-close {
	top: -4px;
	right: -12px;
	padding: 8px;
	border-radius: 999px;
}

.site-header__nav .is-menu-open .wp-block-navigation__responsive-container-close:hover {
	background: var(--wp--preset--color--tint-blue);
}

.site-header__nav .is-menu-open .wp-block-navigation__responsive-container-content {
	align-items: stretch;
	padding-top: 40px !important;
}

/* Flat list: groups separated by lines, submenus always expanded. */
.site-header__nav .is-menu-open .wp-block-navigation__container.wp-block-navigation__container {
	flex: 0 0 auto;
	width: 100%;
	gap: 0;
	align-items: stretch;
	font-family: var(--fc-heading);
	font-size: 19px;
	font-weight: 700;
}

.site-header__nav .is-menu-open .wp-block-navigation__container > .wp-block-navigation-item {
	align-items: stretch;
}

.site-header__nav .is-menu-open .wp-block-navigation__container > .wp-block-navigation-item:first-child {
	margin-bottom: 8px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.site-header__nav .is-menu-open .wp-block-navigation-item__content {
	justify-content: flex-start;
	padding: 9px 0 !important;
}

/* Submenu parents (Lessons, Locations) become small group titles. */
.site-header__nav .is-menu-open .wp-block-navigation-submenu__toggle {
	padding-bottom: 2px !important;
	color: var(--fc-muted);
	font-size: 13px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	pointer-events: none;
}

/* Locations: one link to /locations/ instead of the group title and the studios. */
.site-header__nav .is-menu-open .has-panel-link > .wp-block-navigation-submenu__toggle,
.site-header__nav .is-menu-open .has-panel-link > .wp-block-navigation__submenu-container {
	display: none;
}

.site-header__nav .is-menu-open .site-nav-panel-link {
	display: flex;
}

.site-header__nav .is-menu-open .has-child .wp-block-navigation__submenu-container {
	min-width: 0;
	padding: 0 !important;
	border-radius: 0;
	box-shadow: none;
	transform: none;
	font-size: 17px;
}

.site-header__nav .is-menu-open .has-child .wp-block-navigation__submenu-container::after {
	display: none;
}

.site-header__nav .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item + .wp-block-navigation-item {
	border-top: 0;
}

.site-header__nav .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 7px 0 !important;
	border-radius: 0;
}

.site-header__nav .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover {
	background: none;
}

.site-header__nav .is-menu-open .site-nav-panel {
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: 100%;
}

/* Top of the panel: "Book a Free Trial", then "Log In ▾"; a line separates them from the menu items. */
.site-header__nav .is-menu-open .site-nav-panel--top {
	position: relative;
	z-index: 10; /* The opened account menu covers the items below (core gives submenu lists z-index 2). */
	margin-bottom: 12px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--wp--preset--color--line);
}

/* Bottom of the panel: social links. */
.site-header__nav .is-menu-open .site-nav-panel--bottom {
	margin-top: 8px;
	padding-top: 20px;
	border-top: 1px solid var(--wp--preset--color--line);
}

/* "Log In ▾" in the panel: full-width button; its menu opens downwards over the menu items (like the
   header). Button styles are shared with the header (global.css). */
.site-account--panel .site-account__button {
	justify-content: center;
	width: 100%;
	font-size: 18px;
}

.site-account--panel .site-account__menu,
.site-trial--panel .site-account__menu {
	left: 0;
	right: 0;
	min-width: 0;
}

.site-trial--panel .site-trial__button {
	justify-content: center;
	width: 100%;
	box-sizing: border-box;
}

.site-nav-panel .fc-trial-cta {
	margin: 0;
}

.site-nav-panel .fc-button {
	display: flex;
	justify-content: center;
	width: 100%;
	box-sizing: border-box;
}

.site-nav-panel .wp-block-social-links {
	justify-content: center;
	margin: 0;
}
