/*
 * The header's menu. WordPress leaves a dropdown plain, hangs every one of them off the right edge
 * of its item when the menu itself is set to the right, and lays the phone overlay out flush
 * against the screen's edge; Keel adds only the touch-sized targets. Loaded with core/navigation.
 */

/* A label is as tall as a touch target and centerd in it, so it lines up with its arrow and with
   the buttons beside the menu. (Keel asks for this; WordPress's display: block outranks it.) */
.wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content {
	display: flex;
	align-items: center;
	box-sizing: border-box;
}

/* The menu is a row only where a row fits beside the logo and the wordmark: from 1100px, now that
   it has seven entries (six fitted from 1024px). Below
   that the overlay takes over, as WordPress does on its own under 600px, so the header stays one
   line on a tablet instead of wrapping. These are WordPress's two rules for the narrow case,
   carried up to 1100px. */
@media ( min-width: 600px ) and ( max-width: 1099.98px ) {

	.wp-block-navigation .wp-block-navigation__responsive-container-open:not( .always-shown ) {
		display: flex;
	}

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

/* Dropdowns, where the menu is a row. */

.wp-block-navigation .wp-block-navigation__responsive-container:not( .is-menu-open ) .wp-block-navigation__submenu-container {
	border: 1px solid var( --wp--preset--color--surface-alt );
	border-radius: var( --wp--custom--radius--md );
	background: var( --wp--preset--color--base );
	color: var( --wp--preset--color--contrast );
	box-shadow: var( --wp--custom--shadow--md );
}

/* Keel's two-column "wide" submenu keeps its own spacing. */
.wp-block-navigation .wp-block-navigation__responsive-container:not( .is-menu-open ) .wp-block-navigation-submenu:not( .is-style-wide ) > .wp-block-navigation__submenu-container {
	gap: 0;
}

.wp-block-navigation .wp-block-navigation__responsive-container:not( .is-menu-open ) .wp-block-navigation-submenu:not( .is-style-wide ) > .wp-block-navigation-submenu__toggle[aria-expanded="true"] ~ .wp-block-navigation__submenu-container {
	min-inline-size: 13rem;
	padding: var( --wp--preset--spacing--20 );
}

/* A dropdown opens under the start of its item. The last one keeps to the right edge, where it
   would otherwise run off a narrow window. */
.wp-block-navigation.items-justified-right .wp-block-navigation__responsive-container:not( .is-menu-open ) .wp-block-navigation__container > .has-child > .wp-block-navigation__submenu-container {
	inset-inline: 0 auto;
}

.wp-block-navigation.items-justified-right .wp-block-navigation__responsive-container:not( .is-menu-open ) .wp-block-navigation__container > .has-child:last-child > .wp-block-navigation__submenu-container {
	inset-inline: auto 0;
}

.wp-block-navigation .wp-block-navigation__responsive-container:not( .is-menu-open ) .wp-block-navigation__submenu-container > .wp-block-navigation-item > .wp-block-navigation-item__content {
	min-block-size: 2.75rem;
	padding: var( --wp--preset--spacing--10 ) var( --wp--preset--spacing--30 );
	border-radius: var( --wp--custom--radius--sm );
	font-weight: 500;
}

.wp-block-navigation .wp-block-navigation__responsive-container:not( .is-menu-open ) .wp-block-navigation__submenu-container > .wp-block-navigation-item > .wp-block-navigation-item__content:is( :hover, :focus-visible ) {
	background: var( --wp--preset--color--surface );
}

/* The overlay on a phone or a tablet: a padded column from the start edge, each top-level item a
   heading with its pages listed under it, in type large enough to read and tap. */

.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open {
	padding: var( --wp--preset--spacing--40 );
}

.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container,
.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation-item {
	align-items: stretch;
}

.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container {
	gap: 0;
	inline-size: 100%;
}

.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container > .wp-block-navigation-item {
	padding-block: var( --wp--preset--spacing--20 );
	border-block-end: 1px solid var( --wp--preset--color--surface-alt );
}

.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container > .wp-block-navigation-item:last-child {
	border-block-end: 0;
}

.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
	min-block-size: 2.75rem;
	font-size: var( --wp--preset--font-size--lg );
	font-weight: 600;
}

.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .has-child .wp-block-navigation__submenu-container {
	gap: 0;
	min-inline-size: 0;
	padding: 0 0 var( --wp--preset--spacing--20 ) var( --wp--preset--spacing--40 );
}

.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	min-block-size: 2.75rem;
	font-size: var( --wp--preset--font-size--md );
	font-weight: 400;
}

/* Keel's header sits below its bar of shortcuts at the foot of a small screen, and the overlay is
   inside the header, so the bar lay over the last links of an open menu. While the menu is open
   the header comes to the front. */
.has-modal-open .keel-header {
	z-index: 100000;
}
