/*
 * Navigation.
 * Sits directly below the hero on load, then sticks to the top once scrolling
 * carries it there. Opaque background + z-index keep it above both the fixed
 * hero image and the scrolling content.
 */
.yogaacademie-navigation-part {
	position: sticky;
	top: 0;
	z-index: 40;
	width: 100%;
	background-color: var(--color-sand);
}

.yogaacademie-navigation {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	width: 100%;
	min-height: var(--navigation-height);
	background-color: var(--color-sand);
	color: var(--color-charcoal);
	box-shadow: 0 2px 8px var(--color-black-16);
}

.yogaacademie-navigation .yogaacademie-logo {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	white-space: nowrap;
	text-decoration: none;
	color: var(--color-charcoal);
}

.yogaacademie-logo__mark {
	font-weight: 700;
	letter-spacing: 3px;
	text-transform: uppercase;
}

.yogaacademie-logo__sub {
	font-weight: 400;
	color: var(--color-charcoal);
}

.yogaacademie-navigation .wp-block-navigation__responsive-container.is-menu-open {
	padding: 24px;
}

/*
 * Core paints the overlay white whenever the nav block itself carries no
 * background colour — here the colour sits on the parent group, which core does
 * not count. Its selector is five classes deep, so this one mirrors it and adds
 * the theme class to outrank it without !important.
 */
.yogaacademie-navigation .wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) {
	background-color: var(--color-sand);
}

.yogaacademie-navigation .wp-block-navigation-item__content {
	position: relative;
	color: var(--color-charcoal);
	text-decoration: none;
	transition: color 220ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.yogaacademie-navigation .wp-block-navigation-item__content:hover,
.yogaacademie-navigation .wp-block-navigation-item__content:focus-visible {
	color: var(--color-white) !important;
	transform: translateY(-1px);
}

.yogaacademie-navigation .current-menu-item > .wp-block-navigation-item__content {
	color: var(--color-white) !important;
}

@keyframes ya-menu-overlay-in {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes ya-menu-items-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.yogaacademie-navigation .wp-block-navigation-item__content {
		transition: none;
	}
}

/*
 * Core's Navigation block switches from the hamburger overlay to the flat
 * inline menu at a fixed 600px breakpoint. Override that up to 1040px so
 * the overlay menu is used on tablet widths too.
 */
@media (max-width: 1039px) {
	.yogaacademie-navigation .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}

	.yogaacademie-navigation .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}

	/*
	 * Keep the bar itself visible while the menu is open. Core's overlay is
	 * fixed to all four edges; starting it below the bar leaves the logo and the
	 * sand strip uncovered while everything further down, footer included, stays
	 * behind it.
	 */
	/*
	 * Core's own fade-in is replaced rather than kept: its keyframes end on
	 * `transform: translateY(0)` and hold it via animation-fill-mode, and a
	 * transformed element becomes the containing block for its fixed-position
	 * children — which would anchor the close button below to the overlay
	 * instead of the viewport, with `overflow: auto` then clipping it. Opacity
	 * creates no such containing block, so the movement sits one level down on
	 * the items instead.
	 */
	.yogaacademie-navigation .wp-block-navigation__responsive-container.is-menu-open {
		top: var(--navigation-height);
		animation: ya-menu-overlay-in 200ms ease-out;
	}

	.yogaacademie-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
		animation: ya-menu-items-in 280ms 60ms ease-out backwards;
	}

	/*
	 * Swap the hamburger for core's own close button, which is lifted out of the
	 * overlay into the bar. It can paint over the bar because it inherits the
	 * overlay's z-index, and using core's button rather than a second one of our
	 * own keeps its focus handling and aria-label intact. `visibility` rather
	 * than `display` so the bar's layout does not shift as the menu opens.
	 */
	html.has-modal-open .yogaacademie-navigation .wp-block-navigation__responsive-container-open {
		visibility: hidden;
	}

	.yogaacademie-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
		position: fixed;
		top: 0;
		right: clamp(1rem, 4vw, 4rem);
		display: flex;
		align-items: center;
		height: var(--navigation-height);
		color: var(--color-charcoal);
	}
}

/* After the rules above, not next to the other reduced-motion block further up:
   same specificity, so only source order can switch the animations back off. */
@media (prefers-reduced-motion: reduce) {
	.yogaacademie-navigation .wp-block-navigation__responsive-container.is-menu-open,
	.yogaacademie-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
		animation: none;
	}
}