/**
 * The language switcher: a quiet globe, the current language and a small chevron, opening a compact
 * white card with one language per row.
 *
 * The design is deliberately minimal — names only, no flags and no dividers. It keeps the reference's
 * type and palette (`public/images/img.png`: 14px on a 20px line, `#3f3f46` text, a 1px light border,
 * 8px corners) and tightens everything around them: a 32px trigger, 36px rows inset 4px inside the
 * card, and a hover that is a rounded pill rather than a full-width band. Every value is a custom
 * property on `.nx-lang`, so a panel control writes one variable and nothing else.
 *
 * Two traps this file answers on purpose:
 *
 *  - The parent theme paints every bare `<button>` pink on hover and focus (`[type=button]:hover`,
 *    `button:focus`, both 0-2-0 or lower) and every link the kit colour (`.elementor-kit-N a:hover`,
 *    0-2-1). So every state of the trigger and the rows is named as `.nx-lang .nx-lang__…`, three
 *    classes with the pseudo-class, and names **both** `background` and `color`; a state that named
 *    only one would get the other from the parent theme.
 *  - The closed card is `visibility: hidden`, not `display: none`, so it can fade and still leave
 *    the accessibility tree and the tab order. Visibility is delayed on close and immediate on open,
 *    which is what lets the fade run in both directions.
 */
.nx-lang {
	--nx-lang-fg: #3f3f46;
	--nx-lang-fg-hover: #18181b;
	--nx-lang-icon: #71717a;
	--nx-lang-trigger-hover-bg: rgba(24, 24, 27, .05);
	--nx-lang-menu-bg: #fff;
	--nx-lang-border: #e4e4e7;
	--nx-lang-option-fg: #3f3f46;
	--nx-lang-option-hover-bg: #f4f4f5;
	--nx-lang-focus: #3f3f46;
	--nx-lang-radius: 8px;
	--nx-lang-offset: 6px;
	--nx-lang-shadow: 0 6px 16px -6px rgba(24, 24, 27, .12);
	--nx-lang-duration: .15s;
	position: relative;
	display: inline-block;
	font-size: 14px;
	line-height: 20px;
}

/* ------------------------------------------------------------------ trigger */

.nx-lang .nx-lang__trigger,
.nx-lang .nx-lang__trigger:hover,
.nx-lang .nx-lang__trigger:focus,
.nx-lang .nx-lang__trigger:active {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 32px;
	margin: 0;
	padding: 6px 8px;
	border: 0;
	border-radius: var(--nx-lang-radius);
	background: transparent;
	color: var(--nx-lang-fg);
	font: inherit;
	font-weight: 500;
	line-height: inherit;
	text-transform: none;
	letter-spacing: normal;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: none;
	transition: background-color var(--nx-lang-duration) ease, color var(--nx-lang-duration) ease;
}

.nx-lang .nx-lang__trigger:hover {
	background: var(--nx-lang-trigger-hover-bg);
	color: var(--nx-lang-fg-hover);
}

/* Open, the trigger keeps the header's own background and only darkens its text. */
.nx-lang.is-open .nx-lang__trigger {
	color: var(--nx-lang-fg-hover);
}

.nx-lang .nx-lang__trigger:focus:not(:focus-visible) {
	outline: none;
}

.nx-lang .nx-lang__trigger:focus-visible {
	outline: 2px solid var(--nx-lang-focus);
	outline-offset: 2px;
}

.nx-lang__icon,
.nx-lang__chevron {
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* The globe is a hint, not a second label: lighter than the text, until the trigger is in use. */
.nx-lang__icon {
	width: 16px;
	height: 16px;
	stroke-width: 1.5;
	color: var(--nx-lang-icon);
	transition: color var(--nx-lang-duration) ease;
}

.nx-lang .nx-lang__trigger:hover .nx-lang__icon,
.nx-lang.is-open .nx-lang__icon {
	color: currentColor;
}

.nx-lang__chevron {
	width: 14px;
	height: 14px;
	stroke-width: 1.5;
	opacity: .6;
	transition: transform var(--nx-lang-duration) ease, opacity var(--nx-lang-duration) ease;
}

.nx-lang .nx-lang__trigger:hover .nx-lang__chevron,
.nx-lang.is-open .nx-lang__chevron {
	opacity: 1;
}

.nx-lang.is-open .nx-lang__chevron {
	transform: rotate(180deg);
}

.nx-lang__code {
	display: none;
}

.nx-lang__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------------ card */

.nx-lang__menu {
	position: absolute;
	z-index: 1000;
	top: calc(100% + var(--nx-lang-offset));
	inset-inline-start: 0;
	min-width: max(100%, 128px);
	max-width: calc(100vw - 32px);
	max-height: min(320px, 60vh);
	margin: 0;
	padding: 4px;
	overflow-x: hidden;
	overflow-y: auto;
	list-style: none;
	box-sizing: border-box;
	background: var(--nx-lang-menu-bg);
	border: 1px solid var(--nx-lang-border);
	border-radius: var(--nx-lang-radius);
	box-shadow: var(--nx-lang-shadow);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition:
		opacity var(--nx-lang-duration) ease,
		transform var(--nx-lang-duration) ease,
		visibility 0s linear var(--nx-lang-duration);
}

.nx-lang--end .nx-lang__menu,
.nx-lang.is-flipped .nx-lang__menu {
	inset-inline-start: auto;
	inset-inline-end: 0;
}

/* Open: by the script, or — until the script has run — by the trigger or a row holding focus. */
.nx-lang.is-open .nx-lang__menu,
.nx-lang:not(.is-ready):focus-within .nx-lang__menu {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition-delay: 0s;
}

.nx-lang__menu > li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.nx-lang__menu > li + li {
	margin-top: 2px;
}

.nx-lang .nx-lang__option,
.nx-lang .nx-lang__option:link,
.nx-lang .nx-lang__option:visited,
.nx-lang .nx-lang__option:hover,
.nx-lang .nx-lang__option:focus,
.nx-lang .nx-lang__option:active {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 36px;
	padding: 8px 10px;
	box-sizing: border-box;
	border-radius: calc(var(--nx-lang-radius) - 2px);
	background: transparent;
	color: var(--nx-lang-option-fg);
	text-decoration: none;
	white-space: nowrap;
	outline: none;
	transition: background-color var(--nx-lang-duration) ease, color var(--nx-lang-duration) ease;
}

.nx-lang .nx-lang__option:hover,
.nx-lang .nx-lang__option:focus {
	background: var(--nx-lang-option-hover-bg);
	color: var(--nx-lang-fg-hover);
}

.nx-lang .nx-lang__option:active {
	background: var(--nx-lang-option-hover-bg);
	color: var(--nx-lang-fg-hover);
	transform: scale(.98);
}

.nx-lang .nx-lang__option:focus-visible {
	box-shadow: inset 0 0 0 2px var(--nx-lang-focus);
}

/* Only with "List the current language too": the page's own language, marked with a check. */
.nx-lang .nx-lang__option[aria-selected="true"] {
	color: var(--nx-lang-fg-hover);
	font-weight: 500;
}

.nx-lang .nx-lang__option[aria-selected="true"]::after {
	content: "";
	flex: none;
	width: 8px;
	height: 4px;
	margin-inline-start: auto;
	border-bottom: 1.5px solid currentColor;
	border-left: 1.5px solid currentColor;
	transform: translateY(-2px) rotate(-45deg);
}

/* A language this page has not been translated into: the link opens its home page, so it reads quieter. */
.nx-lang .nx-lang__option[data-missing] {
	color: var(--nx-lang-icon);
}

.nx-lang .nx-lang__option[data-missing]:hover,
.nx-lang .nx-lang__option[data-missing]:focus {
	color: var(--nx-lang-fg-hover);
}

/* ------------------------------------------------------------------ tablet and phone */

@media (max-width: 1023px) {
	/* No hover on a touch screen: the hover background would stick after a tap. */
	.nx-lang .nx-lang__trigger:hover {
		background: transparent;
		color: var(--nx-lang-fg);
	}

	.nx-lang.is-open .nx-lang__trigger {
		color: var(--nx-lang-fg-hover);
	}
}

@media (max-width: 767px) {
	/* 44px is the smallest target a thumb hits reliably, so the compact sizes stop here. */
	.nx-lang .nx-lang__trigger,
	.nx-lang .nx-lang__trigger:hover,
	.nx-lang .nx-lang__trigger:focus,
	.nx-lang .nx-lang__trigger:active {
		min-height: 44px;
		padding-inline: 10px;
	}

	.nx-lang .nx-lang__option,
	.nx-lang .nx-lang__option:link,
	.nx-lang .nx-lang__option:visited,
	.nx-lang .nx-lang__option:hover,
	.nx-lang .nx-lang__option:focus,
	.nx-lang .nx-lang__option:active {
		min-height: 44px;
		padding-block: 12px;
	}

	.nx-lang--mobile-code .nx-lang__label,
	.nx-lang--mobile-none .nx-lang__label {
		display: none;
	}

	.nx-lang--mobile-code .nx-lang__code {
		display: inline;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nx-lang__menu,
	.nx-lang.is-open .nx-lang__menu,
	.nx-lang .nx-lang__option:active {
		transform: none;
	}

	.nx-lang__chevron {
		transition: none;
	}
}
