/*
 * Language switcher and RTL refinements for English, Afghan Pashto and Dari.
 * The landing page is a compiled single-file build, so these styles deliberately
 * sit outside the bundle and can be maintained without rebuilding the app.
 */

.watan-language-switcher {
	display: inline-flex;
	min-height: 2.5rem;
	flex: 0 0 auto;
	align-items: center;
	gap: 0.45rem;
	padding: 0.2rem 0.6rem;
	border: 0.1rem solid var(--rule);
	border-radius: 0.4rem;
	background: var(--paper);
	box-shadow: inset 0.3rem 0 #c2352a, inset -0.3rem 0 #247a47;
	color: var(--ink);
}

.watan-language-switcher__mark {
	display: grid;
	width: 1.4rem;
	height: 1.4rem;
	place-items: center;
	border: 0.1rem solid var(--rule);
	border-radius: 50%;
	font-family: "IBM Plex Mono", monospace;
	font-size: 0.6rem;
	font-weight: 600;
	letter-spacing: 0.05em;
}

.watan-language-switcher select {
	min-width: 4.8rem;
	border: 0;
	outline: 0;
	background: transparent;
	font-family: "IBM Plex Sans Arabic", Inter, sans-serif;
	font-size: 0.82rem;
	font-weight: 600;
	line-height: 1.4;
	cursor: pointer;
}

.watan-language-switcher:focus-within {
	border-color: var(--muhr);
	box-shadow: inset 0.3rem 0 #c2352a, inset -0.3rem 0 #247a47,
		0 0 0 0.2rem color-mix(in srgb, var(--muhr) 22%, transparent);
}

html[dir="rtl"] body {
	direction: rtl;
	text-align: right;
}

html[dir="rtl"] body,
html[dir="rtl"] .ps,
html[dir="rtl"] .dsp,
html[dir="rtl"] .mono {
	font-family: "IBM Plex Sans Arabic", Inter, sans-serif;
}

/* The original English page uses Pashto as a small secondary label. Once the
 * whole interface is localised, that second label would repeat every heading. */
html[dir="rtl"] .ps {
	display: none !important;
}

html[dir="rtl"] .dsp {
	font-weight: 700;
	line-height: 1.35;
}

html[dir="rtl"] .mono,
html[dir="rtl"] [class*="tracking-"] {
	letter-spacing: 0 !important;
	text-transform: none;
}

html[dir="rtl"] .mono {
	unicode-bidi: plaintext;
}

html[dir="rtl"] .text-left {
	text-align: right;
}

html[dir="rtl"] .text-right {
	text-align: left;
}

html[dir="rtl"] ul li,
html[dir="rtl"] ol li {
	text-align: right;
}

html[dir="rtl"] [aria-label="Entry type"] {
	direction: rtl;
}

@media (max-width: 74rem) {
	header .watan-language-switcher__mark {
		display: none;
	}

	header .watan-language-switcher {
		padding-inline: 0.65rem;
	}

	header .watan-language-switcher select {
		min-width: 4.6rem;
	}
}

@media (max-width: 40rem) {
	header .watan-language-switcher {
		min-height: 2.5rem;
		padding-inline: 0.5rem;
	}

	header .watan-language-switcher select {
		width: 4.5rem;
		min-width: 4.5rem;
		font-size: 0.78rem;
	}
}

@media (max-width: 30rem) {
	header a[href="#top"] .ps {
		display: none;
	}

	header > div:first-child {
		gap: 0.8rem;
		padding-inline: 1.4rem;
	}

	header .watan-language-switcher select {
		width: 4.2rem;
		min-width: 4.2rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.watan-language-switcher,
	.watan-language-switcher * {
		transition: none !important;
	}
}
