/*
 * Navigation style "Numbered" (header anchor menu): "01 Products", hamburger
 * below 1024px. Core navigation markup has no BEM hooks of ours, so selectors
 * are scoped by the style class.
 */
.is-style-numbered {
	counter-reset: gms-menu;
}

.is-style-numbered .wp-block-navigation-item {
	counter-increment: gms-menu;
}

.is-style-numbered .wp-block-navigation-item__content {
	display: inline-flex;
	align-items: baseline;
	gap: 0.375rem;
	min-height: 44px;
	padding-top: 0.875rem;
	box-sizing: border-box;
	border-bottom: 2px solid transparent;
	white-space: nowrap;
}

/* Decorative number; the empty alt text keeps it out of the accessible name. */
.is-style-numbered .wp-block-navigation-item__content::before {
	content: counter(gms-menu, decimal-leading-zero) / "";
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--caption);
	color: var(--wp--preset--color--subtle);
}

.is-style-numbered .wp-block-navigation-item__content:hover {
	border-bottom-color: var(--wp--preset--color--primary);
}

/* Current page or section (inc/navigation.php sets aria-current). */
.is-style-numbered .wp-block-navigation-item__content[aria-current] {
	border-bottom-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary-strong);
	font-weight: 600;
}

/*
 * Overlay (mobile) menu: full-width rows with dividers (matches core's
 * open-menu selector weight).
 */
.is-style-numbered .is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container {
	width: 100%;
	gap: 0;
}

.is-style-numbered .is-menu-open .wp-block-navigation-item {
	width: 100%;
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.is-style-numbered .is-menu-open .wp-block-navigation-item__content {
	align-items: center;
	gap: 0.875rem;
	width: 100%;
	min-height: 56px;
	padding-top: 0;
	border-bottom: 0;
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
}

.is-style-numbered .is-menu-open .wp-block-navigation-item__content::before {
	min-width: 1.375rem;
	font-size: var(--wp--preset--font-size--x-small);
}

/*
 * Core switches to the overlay below 600px; the design needs the hamburger
 * below 1024px.
 */
@media (min-width: 600px) and (max-width: 1023.98px) {

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

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

/*
 * Small laptops (1024–1279px): the full menu does not fit next to the logo and
 * the CTA, so it becomes compact — no numbers, tighter gaps — and stays visible
 * instead of turning into a hamburger.
 */
@media (min-width: 1024px) and (max-width: 1279.98px) {

	.is-style-numbered .wp-block-navigation__container {
		gap: var(--wp--preset--spacing--20);
	}

	.is-style-numbered .wp-block-navigation-item__content::before {
		content: none;
	}
}

/* Hamburger and close buttons: 44px targets with the icon centered. */
.is-style-numbered .wp-block-navigation__responsive-container-open,
.is-style-numbered .wp-block-navigation__responsive-container-close {
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--wp--preset--border-radius--sm);
}

.is-style-numbered .wp-block-navigation__responsive-container-close {
	display: flex;
}

/*
 * The open menu is a panel below the header (header stays visible), from the
 * header to the bottom of the screen. The close button takes the place of the
 * hamburger inside the header.
 */

/*
 * Like the design: the panel hangs right under the header (which stays where it
 * is, the announcement bar included) and reaches the bottom of the screen. Its
 * top is anchored to the header; browsers without anchor positioning fall back
 * to a header pinned at the top of the screen.
 */
.is-style-numbered .wp-block-navigation__responsive-container.is-menu-open {
	top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--wp--custom--header-height));
	bottom: 0;
	height: auto;
	padding-top: 0;
	padding-bottom: 0;
	overflow: visible;
}

@supports (top: anchor(bottom)) {

	.is-style-numbered .wp-block-navigation__responsive-container.is-menu-open {
		top: anchor(--gms-site-header bottom);
	}
}

.is-style-numbered .is-menu-open .wp-block-navigation__responsive-close,
.is-style-numbered .is-menu-open .wp-block-navigation__responsive-dialog {
	height: 100%;
}

/*
 * The menu content scrolls inside the panel (the panel itself must not clip the
 * close button).
 */
.is-style-numbered .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	height: 100%;
	max-height: none;
	box-sizing: border-box;
	padding-top: var(--wp--preset--spacing--10);
	padding-bottom: var(--wp--preset--spacing--50);
	overflow-y: auto;
}

/*
 * Positioned against the dialog: the panel's open animation leaves a transform,
 * so "fixed" can't be used.
 */
.is-style-numbered .is-menu-open .wp-block-navigation__responsive-container-close {
	position: absolute;
	top: calc((var(--wp--custom--header-height) + 44px) / -2);
	right: 0;
	background: var(--wp--preset--color--base);
}

/* The contact details list item is not a numbered menu entry. */
.is-style-numbered .wp-block-navigation-item:has(> .site-menu__contact) {
	counter-increment: none;
}

.is-style-numbered .is-menu-open .wp-block-navigation-item:has(> .site-menu__contact) {
	border-bottom: 0;
}

/*
 * Extra items at the end of the open menu: quote button and contacts; hidden in
 * the desktop bar.
 */
.is-style-numbered .wp-block-navigation__responsive-container:not(.is-menu-open) .site-menu__cta,
.is-style-numbered .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item:has(> .site-menu__contact) {
	display: none;
}

.is-style-numbered .is-menu-open .site-menu__cta {
	width: 100%;
	margin-top: var(--wp--preset--spacing--40);
}

.is-style-numbered .is-menu-open .site-menu__contact {
	width: 100%;
	margin-top: var(--wp--preset--spacing--30);
	font-size: var(--wp--preset--font-size--small);
}

.is-style-numbered .wp-block-navigation__responsive-container-open:focus-visible,
.is-style-numbered .wp-block-navigation__responsive-container-close:focus-visible,
.is-style-numbered .wp-block-navigation-item__content:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

/* Vertical text menus (footer). */
.is-style-plain-list .wp-block-navigation__container {
	gap: var(--wp--preset--spacing--10);
}

.is-style-plain-list .wp-block-navigation-item__content {
	display: inline-flex;
	align-items: center;
	min-height: 24px;
}

.is-style-plain-list .wp-block-navigation-item__content:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.is-style-plain-list .wp-block-navigation-item__content:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

/*
 * Footer legal menu (Privacy Policy): underlined like body links, as in the
 * design.
 */
.site-footer__legal .wp-block-navigation-item__content {
	text-decoration: underline;
	text-underline-offset: 2px;
}
