/* Keep saved shared headers safe when menu labels or links change. */
.mira-va-shared-header > .mira-va-header-inner.wp-block-group {
	grid-template-columns: max-content minmax(0, 1fr) max-content;
}

.mira-va-shared-header .mira-va-brand.wp-block-group,
.mira-va-shared-header .mira-va-header-inner > .mira-va-tools {
	min-width: max-content;
}

.mira-va-shared-header .mira-va-brand.wp-block-group {
	justify-self: start;
	width: max-content;
}

.mira-va-shared-header .mira-va-header-inner > .mira-va-navigation {
	justify-self: stretch;
	width: 100%;
	max-width: 100%;
}

/* Wrapping is the fallback before the fit check, or without JavaScript. */
.mira-va-shared-header .mira-va-navigation .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__container {
	flex-wrap: wrap;
}

.mira-va-shared-header .mira-va-navigation .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__container > .wp-block-navigation-item,
.mira-va-shared-header .mira-va-tools .wp-block-navigation__container > .wp-block-navigation-item {
	flex: 0 0 auto;
}

/* The fit check uses the native WordPress menu, including its keyboard controls. */
.mira-va-header.mira-va-shared-header.mira-va-header-compact > .mira-va-header-inner.wp-block-group {
	grid-template-columns: minmax(0, 1fr) auto max-content;
}

.mira-va-header.mira-va-shared-header.mira-va-header-compact .mira-va-navigation {
	justify-self: end;
	width: auto;
}

.mira-va-header.mira-va-shared-header.mira-va-header-compact .mira-va-navigation > .wp-block-navigation__responsive-container-open {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
}

.mira-va-header.mira-va-shared-header.mira-va-header-compact .mira-va-navigation > .wp-block-navigation__responsive-container:not(.is-menu-open) {
	display: none !important;
}

.mira-va-header-compact .mira-va-navigation .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-size: 1rem;
	white-space: normal;
}

/* Measure the full menu synchronously, outside flow, without a visible flash. */
.mira-va-header.mira-va-shared-header.mira-va-header-measuring .mira-va-navigation > .wp-block-navigation__responsive-container:not(.is-menu-open) {
	display: block !important;
	position: absolute !important;
	inset: 0 auto auto 0 !important;
	width: max-content !important;
	max-width: none !important;
	visibility: hidden !important;
	pointer-events: none;
}

.mira-va-header-measuring .mira-va-navigation .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__container {
	flex-wrap: nowrap;
	width: max-content;
}

@media (max-width: 1120px) {
	.mira-va-shared-header > .mira-va-header-inner.wp-block-group {
		grid-template-columns: minmax(0, 1fr) auto max-content;
	}
	.mira-va-shared-header .mira-va-header-inner > .mira-va-navigation {
		justify-self: end;
		width: auto;
	}
}
