/*
 * Core Property Services — menus.
 *
 * Dropdown arrows on the header bar, and the mobile menu restyled as an
 * accordion (assets/js/mobile-nav.js opens and closes it). The parent's
 * header.css still lays both out; this dresses them.
 */

/* ==========================================================================
   Header bar: an arrow after every parent
   ========================================================================== */

/*
 * The selectors keep the parent's anchor on the bar's own list, so nothing
 * here reaches the copy of the menu inside the mobile overlay. The arrow
 * hangs off the label, not the link: the link's ::after is the parent's
 * hover underline (animations.css).
 */
.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .has-child > .wp-block-navigation-item__content .wp-block-navigation-item__label {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
}

.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .has-child > .wp-block-navigation-item__content .wp-block-navigation-item__label::after {
	content: "";
	flex: none;
	width: 0.42em;
	height: 0.42em;
	margin-block-start: -0.25em;
	border-inline-end: 1.5px solid currentColor;
	border-block-end: 1.5px solid currentColor;
	rotate: 45deg;
	opacity: 0.7;
	transition: rotate var(--fwf--transition), margin var(--fwf--transition);
}

.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .has-child:hover > .wp-block-navigation-item__content .wp-block-navigation-item__label::after,
.site-header .site-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container > .has-child:focus-within > .wp-block-navigation-item__content .wp-block-navigation-item__label::after {
	margin-block-start: 0.2em;
	rotate: 225deg;
}

/* ==========================================================================
   Mobile menu
   ========================================================================== */

.fwf-nav-overlay {
	gap: var(--wp--preset--spacing--30);
}

/* Top-level items: larger, with a rule between each. */
.fwf-nav-overlay .fwf-nav-overlay__menu.fwf-menu-primary > .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-block: 1rem;
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	color: var(--wp--preset--color--secondary);
}

/* A parent ends in an arrow that turns when its submenu is open. */
.fwf-nav-overlay .fwf-nav-overlay__menu .has-child > .wp-block-navigation-item__content::after {
	content: "";
	flex: none;
	width: 0.5rem;
	height: 0.5rem;
	margin-inline-end: 0.35rem;
	margin-block-start: -0.3rem;
	border-inline-end: 2px solid currentColor;
	border-block-end: 2px solid currentColor;
	rotate: 45deg;
	transition: rotate var(--fwf--transition), margin var(--fwf--transition);
}

.fwf-nav-overlay .fwf-nav-overlay__menu .has-child.is-open > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--primary);
	border-block-end-color: transparent;
}

.fwf-nav-overlay .fwf-nav-overlay__menu .has-child.is-open > .wp-block-navigation-item__content::after {
	margin-block-start: 0.3rem;
	rotate: 225deg;
}

/*
 * Submenus run the full width of the screen, out past the menu's gutter,
 * and slide open: the panel grows to its height (mobile-nav.js measures it)
 * while its items drop in one after another. Closed, the panel is no height
 * and hidden, so its links are out of the tab order too.
 *
 * Core forces submenus open twice over: in an open overlay at (0,5,0), and
 * on :focus-within at (0,6,0) — a tap focuses the parent, so the panel
 * jumped to full height before it could animate. These are (0,6,2).
 */
.site-header .wp-block-navigation__responsive-container .fwf-nav-overlay .fwf-nav-overlay__menu li.has-child > ul.wp-block-navigation__submenu-container {
	--fwf-sub-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	gap: 0;
	width: calc(100% + 2 * var(--wp--preset--spacing--20));
	height: 0;
	margin-inline: calc(-1 * var(--wp--preset--spacing--20));
	padding: 0;
	overflow: hidden;
	visibility: hidden;
	background: var(--wp--preset--color--surface);
	box-shadow: inset 0 1px 0 var(--wp--preset--color--border), inset 0 -1px 0 var(--wp--preset--color--border);
	transition: height 0.4s var(--fwf-sub-ease), visibility 0s linear 0.4s;
}

.site-header .wp-block-navigation__responsive-container .fwf-nav-overlay .fwf-nav-overlay__menu li.has-child.is-open > ul.wp-block-navigation__submenu-container {
	visibility: visible;
	transition: height 0.4s var(--fwf-sub-ease), visibility 0s;
}

.site-header .wp-block-navigation__responsive-container .fwf-nav-overlay .fwf-nav-overlay__menu li.has-child > ul.wp-block-navigation__submenu-container > li {
	opacity: 0;
	translate: 0 -10px;
	transition: opacity 0.2s ease, translate 0.2s ease;
}

/* --fwf-i is each item's position, set by mobile-nav.js. */
.site-header .wp-block-navigation__responsive-container .fwf-nav-overlay .fwf-nav-overlay__menu li.has-child.is-open > ul.wp-block-navigation__submenu-container > li {
	opacity: 1;
	translate: 0 0;
	transition: opacity 0.35s ease, translate 0.45s var(--fwf-sub-ease);
	transition-delay: calc(80ms + var(--fwf-i, 0) * 40ms);
}

.site-header .wp-block-navigation__responsive-container .fwf-nav-overlay .fwf-nav-overlay__menu li.has-child > ul.wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0.85rem var(--wp--preset--spacing--20);
	border-block-end-color: var(--wp--preset--color--border);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 500;
	color: var(--wp--preset--color--contrast);
	transition: background-color 0.2s ease, color 0.2s ease;
}

.site-header .wp-block-navigation__responsive-container .fwf-nav-overlay .fwf-nav-overlay__menu li.has-child > ul.wp-block-navigation__submenu-container .wp-block-navigation-item__content:active {
	background: color-mix(in srgb, var(--wp--preset--color--primary) 8%, var(--wp--preset--color--surface));
}

.site-header .wp-block-navigation__responsive-container .fwf-nav-overlay .fwf-nav-overlay__menu li.has-child > ul.wp-block-navigation__submenu-container > .wp-block-navigation-item:last-child > .wp-block-navigation-item__content {
	border-block-end: 0;
}

/* The parent row hands its rule to the panel below it while open. */
.fwf-nav-overlay .fwf-nav-overlay__menu .has-child > .wp-block-navigation-item__content {
	transition: color 0.25s ease, border-color 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
	.site-header .wp-block-navigation__responsive-container .fwf-nav-overlay .fwf-nav-overlay__menu li.has-child > ul.wp-block-navigation__submenu-container,
	.site-header .wp-block-navigation__responsive-container .fwf-nav-overlay .fwf-nav-overlay__menu li.has-child > ul.wp-block-navigation__submenu-container > li,
	.fwf-nav-overlay .fwf-nav-overlay__menu .has-child > .wp-block-navigation-item__content::after {
		transition: none;
	}
}

/* The parent's own page, first in its submenu. */
.fwf-nav-overlay .fwf-nav-overlay__menu .fwf-nav-overlay__overview > .wp-block-navigation-item__content {
	font-weight: 600;
	color: var(--wp--preset--color--primary);
}

.fwf-nav-overlay .fwf-nav-overlay__menu .wp-block-navigation-item__content:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
	border-radius: 4px;
}

/* Audience links: the second row of the desktop header, as a panel. */
.fwf-nav-overlay .fwf-nav-overlay__audience {
	padding: var(--wp--preset--spacing--20);
	border-radius: 12px;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
}

.fwf-nav-overlay .fwf-nav-overlay__audience .fwf-nav-overlay__audience-label {
	color: rgb(255 255 255 / 0.75);
}

.fwf-nav-overlay .fwf-nav-overlay__audience .wp-block-navigation-item__content {
	padding-block: 0.65rem;
	border-block-end-color: rgb(255 255 255 / 0.18);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--wp--preset--color--base);
}

.fwf-nav-overlay .fwf-nav-overlay__audience .wp-block-navigation-item__content::before {
	content: "\00BB";
	margin-inline-end: 0.55em;
	opacity: 0.7;
}

.fwf-nav-overlay .fwf-nav-overlay__audience .wp-block-navigation-item:last-child > .wp-block-navigation-item__content {
	border-block-end: 0;
}

.fwf-nav-overlay .fwf-nav-overlay__audience .wp-block-navigation-item__content:hover,
.fwf-nav-overlay .fwf-nav-overlay__audience .current-menu-item > .wp-block-navigation-item__content {
	color: var(--wp--preset--color--accent);
}

/* The header button, full width at the foot of the menu. */
.fwf-nav-overlay .fwf-nav-overlay__cta,
.fwf-nav-overlay .fwf-nav-overlay__cta .wp-block-button {
	width: 100%;
}

.fwf-nav-overlay .fwf-nav-overlay__cta .wp-block-button__link {
	display: block;
	width: 100%;
	padding: 1rem 1.25rem;
	border-radius: var(--fwf--button--radius);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	font-weight: 600;
	text-align: center;
	text-decoration: none;
}
