/**
 * Header language selector (Polylang dropdown)
 *
 * Renders the active language in the header. On hover (or keyboard focus)
 * the other available languages drop down and link to their translated page.
 * Markup is produced by twiser_render_language_selector() in inc/polylang.php.
 */

.lang-switcher {
	position: relative;
	padding-left: 12px;
}

.lang-switcher::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	margin: auto 0;
	width: 1px;
	height: 20px;
	opacity: 0.3;
	background: #000;
}

/* Toggle (current language) */
.lang-switcher__toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 6px 4px;
	border: 0;
	background: transparent;
	color: #0f122b;
	font-size: 13px;
	font-weight: 600;
	line-height: 20px;
	letter-spacing: 0.14px;
	cursor: pointer;
	transition: color 0.2s ease;
}

.lang-switcher__toggle:hover,
.lang-switcher__toggle:focus-visible {
	color: #4b3df5;
}

.lang-switcher__code {
	text-transform: uppercase;
}

.lang-switcher__flag {
	display: inline-flex;
	align-items: center;
}

.lang-switcher__flag img {
	display: block;
	width: 18px;
	height: auto;
	border-radius: 2px;
}

.lang-switcher__arrow {
	transition: transform 0.2s ease;
}

/* Dropdown panel */
.lang-switcher__dropdown {
	position: absolute;
	top: 100%;
	right: 0;
	z-index: 100;
	min-width: 160px;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: #fff;
	border: 1px solid rgba(15, 18, 43, 0.08);
	border-radius: 12px;
	box-shadow: 0 12px 30px rgba(15, 18, 43, 0.12);
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
	pointer-events: none;
}

/* A small invisible bridge so the cursor can travel from the
   toggle to the dropdown without the hover state dropping. */
.lang-switcher__dropdown::before {
	content: "";
	position: absolute;
	bottom: 100%;
	left: 0;
	right: 0;
	height: 10px;
}

.lang-switcher:hover .lang-switcher__dropdown,
.lang-switcher:focus-within .lang-switcher__dropdown {
	opacity: 1;
	visibility: visible;
	transform: translateY(4px);
	pointer-events: auto;
}

.lang-switcher:hover .lang-switcher__arrow,
.lang-switcher:focus-within .lang-switcher__arrow {
	transform: rotate(180deg);
}

/* Dropdown items */
.lang-switcher__item {
	margin: 0;
}

.lang-switcher__link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 8px;
	color: #0f122b;
	font-size: 14px;
	font-weight: 500;
	line-height: 20px;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.lang-switcher__link:hover,
.lang-switcher__link:focus-visible {
	background: rgba(75, 61, 245, 0.08);
	color: #4b3df5;
}

.lang-switcher__item.is-current .lang-switcher__link {
	font-weight: 600;
	background: rgba(15, 18, 43, 0.04);
}

.lang-switcher__link .lang-switcher__flag img {
	width: 20px;
}

/* Mobile: dropdown could overflow the small screen, so anchor it
   to the right edge and keep it readable. */
@media (max-width: 575.98px) {
	.lang-switcher__dropdown {
		min-width: 150px;
	}
}
