/* ==========================================================================
   Language selector
   Kept apart from main.css. Brand tokens only. Logical properties so the
   dropdown sits on the inline-end in both LTR and RTL.
   Accent (#D4804E) is not used for this control's text or checkmark: on the
   light active row it is below 3:1. The check and label use primary on light.
   ========================================================================== */

.lang-switch {
	position: relative;
	z-index: 5;
	display: flex;
	align-items: center;
	max-width: 100%;
}

/* The scripted control is hidden until the document gets the js class. */
.lang-switch__widget { display: none; }
.js .lang-switch__widget {
	position: relative;
	display: flex;
	align-items: center;
	max-width: 100%;
}

.lang-switch__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	flex: none;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0.5rem;
	border: 1px solid var(--c-border);
	border-radius: var(--radius-sm);
	background: var(--c-white);
	color: var(--c-primary);
	font: 500 0.9375rem/1 var(--font);
	cursor: pointer;
}
button.lang-switch__toggle {
	appearance: none;
	-webkit-appearance: none;
}
.lang-switch__toggle:hover {
	border-color: var(--c-primary);
	text-decoration: none;
}
.lang-switch__toggle[aria-expanded="true"],
.lang-switch__fallback[open] > .lang-switch__toggle {
	background: var(--c-light);
	border-color: var(--c-primary);
}
.lang-switch__toggle:focus-visible,
.lang-switch__option:focus-visible {
	outline: 2px solid var(--c-primary);
	outline-offset: 3px;
	box-shadow: var(--focus);
}
.lang-switch__globe,
.lang-switch__check { display: block; }
.lang-switch__globe { width: 1.25rem; height: 1.25rem; }
.lang-switch__check { width: 1rem; height: 1rem; flex: none; color: var(--c-primary); }

.lang-switch__fallback { position: relative; }
.lang-switch__fallback > summary { list-style: none; }
.lang-switch__fallback > summary::-webkit-details-marker { display: none; }

.lang-switch__menu {
	list-style: none;
	margin: 0;
	padding: 0.35rem;
	min-width: 12.5rem;
	background: var(--c-white);
	color: var(--c-primary);
	border: 1px solid var(--c-border);
	border-radius: var(--radius-sm);
	box-shadow: 0 12px 24px rgba(30, 43, 58, 0.12);
}
.lang-switch__menu[hidden] { display: none !important; }

.js .lang-switch__widget .lang-switch__menu:not([hidden]),
.lang-switch__fallback[open] > .lang-switch__menu {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	position: absolute;
	z-index: 6;
	inset-block-start: calc(100% + 0.35rem);
	inset-inline-end: 0;
	inset-inline-start: auto;
	width: max-content;
	max-width: min(18rem, calc(100vw - (2 * var(--gutter))));
}

.lang-switch__item { margin: 0; padding: 0; }
.lang-switch__option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	min-height: 44px;
	padding-block: 0.45rem;
	padding-inline: 0.75rem;
	border: 0;
	border-inline-start: 3px solid transparent;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--c-primary);
	font: 500 0.9375rem/1.3 var(--font);
	text-align: start;
	text-decoration: none;
}
.lang-switch__option:hover {
	background: var(--c-light);
	color: var(--c-primary);
	text-decoration: none;
}
.lang-switch__option[aria-current="true"] {
	background: var(--c-light);
	font-weight: 600;
	border-inline-start-color: var(--c-primary);
}
.lang-switch__name { min-width: 0; }

/* Inside the mobile panel the list stacks in normal flow, full width. */
@media (max-width: 860px) {
	.js .nav .lang-switch,
	.js .nav .lang-switch__widget,
	html:not(.js) .lang-switch,
	html:not(.js) .lang-switch__fallback {
		flex-basis: 100%;
		width: 100%;
		max-width: 100%;
	}
	.js .nav .lang-switch__widget {
		flex-direction: column;
		align-items: stretch;
	}
	.js .nav .lang-switch__toggle,
	html:not(.js) .lang-switch__toggle {
		align-self: flex-start;
	}
	.js .nav .lang-switch__widget .lang-switch__menu:not([hidden]),
	html:not(.js) .lang-switch__fallback[open] > .lang-switch__menu {
		position: static;
		inset: auto;
		width: 100%;
		min-width: 0;
		max-width: 100%;
		margin-block-start: 0.5rem;
		box-shadow: none;
	}
}
