/* Shared responsive header contract for Persian, English and Arabic. */
#rwh .site-header > .container,
#rwh .nav,
#rwh .header-quick-actions,
#rwh .rasa-header-command {
	min-width: 0;
}

#rwh .nav {
	flex-wrap: nowrap !important;
}

#rwh .nav > a,
#rwh .nav > .has-dropdown > .dd-toggle {
	white-space: nowrap !important;
	text-wrap: nowrap !important;
}

/*
 * The theme keeps its desktop navigation active down to 769px. At the
 * constrained-desktop widths the 860px catalog panels can no longer remain
 * parent-anchored, especially in RTL. Pin them to the viewport gutter so the
 * same menu stays usable in all three locales without changing its behavior.
 */
@media (min-width: 769px) and (max-width: 1100px) {
	#rwh .nav > .has-dropdown > .dropdown {
		position: fixed !important;
		top: 84px !important;
		inset-inline: 24px !important;
		width: auto !important;
		max-width: none !important;
		transform-origin: top center !important;
	}

	body.admin-bar #rwh .nav > .has-dropdown > .dropdown {
		top: 116px !important;
	}
}

/* Arabic labels are wider and need a slightly calmer rhythm on desktop. */
@media (min-width: 1101px) and (max-width: 1480px) {
	html[lang^="ar"] #rwh .nav {
		gap: clamp(10px, 1vw, 16px) !important;
	}

	html[lang^="ar"] #rwh .nav > a,
	html[lang^="ar"] #rwh .nav > .has-dropdown > .dd-toggle {
		font-size: 14px !important;
		line-height: 1.35 !important;
	}
}

/* Keep each locale's reading order and alignment explicit in shared menus. */
html[dir="ltr"] #rwh :is(.nav, .dropdown, .rasa-dd-shell) {
	direction: ltr;
	text-align: left;
}

html[dir="rtl"] #rwh :is(.nav, .dropdown, .rasa-dd-shell) {
	direction: rtl;
	text-align: right;
}

@media (max-width: 768px) {
	.rasa-mobile-menu {
		background-color: var(--card, #fff) !important;
	}

	html[dir="ltr"] .rasa-mobile-menu {
		direction: ltr !important;
		text-align: left !important;
	}

	html[dir="rtl"] .rasa-mobile-menu {
		direction: rtl !important;
		text-align: right !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rasa-mobile-menu,
	.rasa-mobile-menu-view {
		transition-duration: 0.01ms !important;
	}
}
