/*
 * Mobile header (below 900px): one 64px bar (logo, primary action, 44x44 menu button) and the
 * navigation overlay as a full-screen sheet: brand on top, 56px rows, the two actions at the bottom
 * where the thumb reaches. Sizes follow Apple HIG accessibility (44x44 controls) and layout (reach).
 * Loaded after theme.css so equal-specificity rules here win.
 */

/* The mobile action button is hidden on desktop, where ie-nav-cta (Mi cuenta + Hazte socio) shows. */
.ie-header .wp-block-buttons.ie-nav-cta-mobile {
	display: none;
}

@media (max-width: 899px) {
	.ie-header .ie-bar {
		height: 64px;
		gap: .5rem;
	}

	.ie-header .ie-logo img {
		height: 36px;
	}

	/* Order on the bar: logo (left) · Hazte socio · menu button. The nav block keeps DOM order for focus. */
	.ie-header .ie-menu {
		order: 3;
		flex: none;
	}

	.ie-header .wp-block-buttons.ie-nav-cta-mobile {
		order: 2;
		display: flex;
		align-items: center;
		margin-left: auto;
	}

	.ie-header .ie-nav-cta-mobile .wp-block-button__link {
		display: inline-flex;
		align-items: center;
		min-height: 44px;
		padding: 0 1.1rem;
		font-size: .95rem;
	}

	/* 44x44 menu and close buttons on a soft sand tile (HIG: default control size 44x44 pt). */
	.ie-header .ie-menu .wp-block-navigation__responsive-container-open,
	.ie-header .ie-menu .wp-block-navigation__responsive-container-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 0;
		border-radius: 12px;
		background: var(--ie-sand);
		color: var(--ie-ink);
	}

	.ie-header .ie-menu .wp-block-navigation__responsive-container-open svg,
	.ie-header .ie-menu .wp-block-navigation__responsive-container-close svg {
		width: 26px;
		height: 26px;
	}

	.ie-header .ie-menu .wp-block-navigation__responsive-container-open:focus-visible,
	.ie-header .ie-menu .wp-block-navigation__responsive-container-close:focus-visible {
		outline: 3px solid var(--ie-blue);
		outline-offset: 2px;
	}

	/* The open menu: a white full-screen sheet. */
	.ie-header .ie-menu .wp-block-navigation__responsive-container.is-menu-open {
		padding: 0;
		background: #fff;
		color: var(--ie-ink);
	}

	.ie-header .ie-menu .is-menu-open .wp-block-navigation__responsive-close {
		width: 100%;
		max-width: none;
		height: 100%;
	}

	.ie-header .ie-menu .is-menu-open .wp-block-navigation__responsive-dialog {
		position: relative;
		display: flex;
		flex-direction: column;
		min-height: 100%;
		padding: 12px 20px 24px;
		padding-bottom: max(24px, env(safe-area-inset-bottom));
	}

	/* Brand at the top of the sheet, same place as in the bar. */
	.ie-header .ie-menu .is-menu-open .wp-block-navigation__responsive-dialog::before {
		content: "";
		display: block;
		flex: none;
		width: 110px;
		height: 44px;
		margin: 2px 0 10px;
		background: url("../img/logo-negro.png") left center / contain no-repeat;
	}

	.ie-header .ie-menu .is-menu-open .wp-block-navigation__responsive-container-close {
		position: absolute;
		top: 12px;
		right: 20px;
		margin: 0;
	}

	.ie-header .ie-menu .is-menu-open .wp-block-navigation__responsive-container-content {
		display: flex;
		flex: 1;
		flex-direction: column;
	}

	.ie-header .ie-menu .is-menu-open .wp-block-navigation__container {
		display: flex;
		flex: 1;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		margin: 0;
		padding: 0;
	}

	/* 56px rows with hairline dividers: one job per row, easy to hit. */
	.ie-header .ie-menu .is-menu-open .wp-block-navigation-item {
		display: block;
		border-bottom: 1px solid var(--ie-line);
	}

	.ie-header .ie-menu .is-menu-open .wp-block-navigation-item__content {
		display: flex;
		align-items: center;
		min-height: 56px;
		padding: 0;
		font-size: 1.125rem;
		font-weight: 600;
		color: var(--ie-ink);
		text-decoration: none;
	}

	.ie-header .ie-menu .is-menu-open .ie-mobile-only {
		display: block;
		border-bottom: 0;
	}

	/* The two actions sit at the bottom of the sheet (HIG layout: important controls within reach). */
	.ie-header .ie-menu .is-menu-open .ie-menu-account {
		margin-top: auto;
		padding-top: 16px;
	}

	.ie-header .ie-menu .is-menu-open .ie-menu-account .wp-block-navigation-item__content {
		justify-content: center;
		min-height: 48px;
		border: 1px solid var(--ie-line);
		border-radius: 999px;
		font-size: 1rem;
	}

	.ie-header .ie-menu .is-menu-open .ie-menu-join {
		margin-top: 10px;
	}

	.ie-header .ie-menu .is-menu-open .ie-menu-join .wp-block-navigation-item__content {
		display: flex;
		justify-content: center;
		min-height: 52px;
		padding: 0 1.4rem;
		border-radius: 999px;
		background: var(--ie-green);
		color: #082a0f;
		font-size: 1rem;
		font-weight: 700;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ie-header .ie-menu .wp-block-navigation__responsive-container {
		transition: none;
		animation: none;
	}
}
