/*
 * Selector de idioma (abajo a la izquierda) y aviso de traducción automática.
 * Colores propios, sin depender del tema, con contraste AA comprobado:
 * blanco sobre #a4442a 6,1:1 · blanco sobre #7a2f1c 9,3:1 · #1f1b16 sobre blanco 17:1 ·
 * #5c534a sobre blanco 7,5:1 y sobre #f4ede4 6,5:1 · borde del campo #8a8178 3,8:1.
 */

.st-idioma {
	--st-idioma-acento: #a4442a;
	--st-idioma-oscuro: #7a2f1c;
	--st-idioma-texto: #1f1b16;
	--st-idioma-suave: #f4ede4;
	--st-idioma-gris: #5c534a;
	bottom: 1rem;
	font-family: inherit;
	font-size: 1rem;
	left: 1rem;
	line-height: 1.4;
	position: fixed;
	z-index: 9990;
}

.st-idioma [hidden] {
	display: none !important;
}

.st-idioma__boton {
	align-items: center;
	background: var(--st-idioma-acento);
	border: 2px solid #fff;
	border-radius: 999px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	font-weight: 600;
	gap: 0.45rem;
	list-style: none;
	max-width: calc(50vw - 1.5rem);
	min-height: 44px;
	padding: 0.45rem 1rem 0.45rem 0.75rem;
	user-select: none;
}

.st-idioma__boton::-webkit-details-marker,
.st-idioma__boton::marker {
	content: "";
	display: none;
}

.st-idioma__boton:hover,
.st-idioma__desplegable[open] > .st-idioma__boton {
	background: var(--st-idioma-oscuro);
	color: #fff;
}

/* Anillo blanco + oscuro + blanco: se ve sobre cualquier fondo. */
.st-idioma__boton:focus-visible {
	box-shadow: 0 0 0 5px #fff, 0 4px 16px rgba(0, 0, 0, 0.25);
	outline: 3px solid var(--st-idioma-texto);
	outline-offset: 0;
}

.st-idioma__icono {
	flex: none;
}

.st-idioma__etiqueta {
	font-weight: 400;
}

.st-idioma__actual {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.st-idioma__panel {
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 12px;
	bottom: calc(100% + 0.6rem);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
	color: var(--st-idioma-texto);
	left: 0;
	max-height: min(70vh, 34rem);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 1rem;
	position: absolute;
	text-align: start;
	width: min(23rem, calc(100vw - 2rem));
}

.st-idioma__titulo {
	font-size: 1.1rem;
	font-weight: 700;
	margin: 0 0 0.25rem;
}

.st-idioma__nota {
	color: var(--st-idioma-gris);
	font-size: 0.875rem;
	margin: 0 0 0.75rem;
}

.st-idioma__rotulo {
	display: block;
	font-size: 0.9rem;
	font-weight: 600;
	margin-bottom: 0.25rem;
}

.st-idioma__campo {
	background: #fff;
	border: 2px solid #8a8178;
	border-radius: 8px;
	box-sizing: border-box;
	color: var(--st-idioma-texto);
	font: inherit;
	font-size: 1rem;
	padding: 0.5rem 0.65rem;
	width: 100%;
}

.st-idioma__campo:focus-visible {
	border-color: var(--st-idioma-acento);
	outline: 3px solid var(--st-idioma-acento);
	outline-offset: 1px;
}

.st-idioma__contador {
	color: var(--st-idioma-gris);
	font-size: 0.85rem;
	margin: 0.35rem 0 0.25rem;
	min-height: 1.2em;
}

.st-idioma__grupo {
	color: var(--st-idioma-gris);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	margin: 0.9rem 0 0.3rem;
	text-transform: uppercase;
}

.st-idioma__lista {
	list-style: none;
	margin: 0;
	padding: 0;
}

.st-idioma__lista li {
	margin: 0;
}

.st-idioma__opcion {
	align-items: baseline;
	border-radius: 8px;
	color: var(--st-idioma-texto);
	display: flex;
	flex-wrap: wrap;
	gap: 0.15rem 0.6rem;
	justify-content: space-between;
	min-height: 40px;
	padding: 0.5rem 0.6rem;
	text-decoration: none;
}

.st-idioma__opcion:hover {
	background: var(--st-idioma-suave);
	color: var(--st-idioma-texto);
}

.st-idioma__opcion:focus-visible {
	background: var(--st-idioma-suave);
	outline: 3px solid var(--st-idioma-acento);
	outline-offset: -3px;
}

.st-idioma__opcion[aria-current="true"] {
	background: var(--st-idioma-suave);
	font-weight: 700;
}

.st-idioma__opcion[aria-current="true"] .st-idioma__nativo::after {
	content: " ✓";
	content: " ✓" / "";
	color: var(--st-idioma-oscuro);
}

.st-idioma__es {
	color: var(--st-idioma-gris);
	font-size: 0.85em;
}

/* Aviso al principio de una página traducida */
.st-trad-aviso {
	background: #f4ede4;
	border-bottom: 1px solid rgba(0, 0, 0, 0.12);
	color: #1f1b16;
	font-size: 0.875rem;
	line-height: 1.45;
	padding: 0.45rem 1rem;
	text-align: center;
}

.st-trad-aviso__texto {
	margin: 0 auto;
	max-width: 70rem;
}

.st-trad-aviso__enlace,
.st-trad-aviso__enlace:visited {
	color: #7a2f1c;
	font-weight: 600;
	text-decoration: underline;
	white-space: nowrap;
}

.st-trad-aviso__enlace:focus-visible {
	outline: 3px solid #7a2f1c;
	outline-offset: 2px;
}

@media (max-width: 600px) {
	.st-idioma {
		bottom: 0.75rem;
		left: 0.75rem;
	}

	.st-idioma__etiqueta {
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		height: 1px;
		overflow: hidden;
		position: absolute;
		white-space: nowrap;
		width: 1px;
	}

	.st-idioma__boton {
		max-width: calc(50vw - 1rem);
		padding-right: 0.85rem;
	}

	.st-idioma__panel {
		max-height: 70vh;
		width: calc(100vw - 1.5rem);
	}

	/* Que los botones flotantes no tapen el final de la página. */
	body:has(.st-idioma) {
		padding-bottom: 4.5rem;
	}
}

@media (forced-colors: active) {
	.st-idioma__boton,
	.st-idioma__panel {
		border: 2px solid CanvasText;
	}
}

@media print {
	.st-idioma {
		display: none !important;
	}
}
