/**
 * Sélecteur de langue.
 *
 * Menu déroulant bâti sur <details>/<summary>, sans JavaScript.
 *
 * Le panneau n'utilise volontairement ni <ul> ni <li> : GeneratePress insère ce
 * composant dans <nav class="main-navigation"> et masque toute liste qui s'y
 * trouve en mobile. Les sélecteurs ci-dessous sont par ailleurs préfixés par
 * .lg-switcher pour rester prioritaires sur les styles de navigation du thème.
 */

.lg-switcher {
	--lg-switcher-accent: #d81e5b;
	--lg-switcher-accent-contrast: #fff;
	--lg-switcher-panel-bg: #14101a;
	--lg-switcher-panel-fg: #f2eef7;

	display: flex;
	align-items: center;
}

.lg-switcher .lg-switcher__menu {
	position: relative;
}

/* ------------------------------------------------------------------ *
 * Déclencheur
 * ------------------------------------------------------------------ */

.lg-switcher .lg-switcher__toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	padding: 0.35em 0.6em;
	border: 1px solid currentColor;
	border-radius: 3px;
	color: inherit;
	font-size: 0.8125em;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	opacity: 0.75;
	transition: opacity 0.15s ease;
	list-style: none;
}

/* Masque le triangle natif (WebKit et standard). */
.lg-switcher .lg-switcher__toggle::-webkit-details-marker {
	display: none;
}

.lg-switcher .lg-switcher__toggle::marker {
	content: '';
}

/* Chevron dessiné en CSS, pour ne dépendre d'aucune police d'icônes. */
.lg-switcher .lg-switcher__toggle::after {
	content: '';
	width: 0.4em;
	height: 0.4em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-0.12em) rotate(45deg);
	transition: transform 0.15s ease;
}

.lg-switcher .lg-switcher__toggle:hover,
.lg-switcher .lg-switcher__toggle:focus-visible {
	opacity: 1;
}

.lg-switcher .lg-switcher__menu[open] > .lg-switcher__toggle {
	opacity: 1;
}

.lg-switcher .lg-switcher__menu[open] > .lg-switcher__toggle::after {
	transform: translateY(0.12em) rotate(-135deg);
}

/* ------------------------------------------------------------------ *
 * Panneau
 * ------------------------------------------------------------------ */

.lg-switcher .lg-switcher__list {
	position: absolute;
	z-index: 1000;
	top: calc(100% + 0.4em);
	display: block;
	min-width: 11em;

	/* Ne jamais dépasser du viewport, quelle que soit la largeur d'écran. */
	max-width: calc(100vw - 2rem);
	max-height: 60vh;
	overflow-y: auto;
	margin: 0;
	padding: 0.3em 0;
	background-color: var(--lg-switcher-panel-bg);
	color: var(--lg-switcher-panel-fg);
	border-radius: 4px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);

	/*
	 * Aligné sur le bord droit du déclencheur. GeneratePress place la barre
	 * d'outils de l'en-tête à droite, juste avant le bouton du menu mobile :
	 * un ancrage à gauche projetterait le panneau hors de l'écran sur
	 * téléphone. Vérifié par mesure de 320 px à 1280 px.
	 */
	left: auto;
	right: 0;
}

.lg-switcher .lg-switcher__link {
	display: block;
	padding: 0.5em 1em;
	color: inherit;
	font-size: 0.875em;
	line-height: 1.3;
	text-decoration: none;
	white-space: nowrap;
}

.lg-switcher .lg-switcher__link:hover,
.lg-switcher .lg-switcher__link:focus-visible {
	background-color: rgba(255, 255, 255, 0.09);
	color: inherit;
}

.lg-switcher .lg-switcher__link--current {
	font-weight: 700;
	box-shadow: inset 0.2em 0 0 var(--lg-switcher-accent);
}

/*
 * Écrans très étroits : le panneau occupe la largeur disponible plutôt que de
 * conserver une largeur minimale qui le ferait déborder.
 */
@media (max-width: 360px) {
	.lg-switcher .lg-switcher__list {
		min-width: 0;
		width: max-content;
	}
}
