/**
 * Manual language switcher (Fanyi2).
 *
 * Lives in the header actions row next to search / account / cart, so it
 * inherits the same icon-button rhythm.
 */

.ei-lang {
	position: relative;
	display: inline-flex;
	align-items: center;
}

/* --- Trigger ------------------------------------------------------------ */

.ei-lang__toggle {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	width: auto;
	min-width: 42px;
	padding-inline: 8px;
	cursor: pointer;
	font-family: var(--ei-ui-font);
}

.ei-lang__code {
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1;
}

.ei-lang__toggle[aria-expanded="true"] {
	color: var(--ei-link-hover);
}

/* --- Panel -------------------------------------------------------------- */

.ei-lang__panel {
	position: absolute;
	top: calc(100% + 8px);
	z-index: 80;
	min-width: 186px;
	padding: 6px;
	border: 1px solid var(--ei-border);
	border-radius: var(--ei-radius);
	background: var(--ei-sticky-bg, #070713);
	box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
	/* The header sits on a translucent blur; match it so the panel reads as one surface. */
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
}

.ei-lang--align-end .ei-lang__panel {
	right: 0;
}

.ei-lang--align-start .ei-lang__panel {
	left: 0;
}

.ei-lang__panel[hidden] {
	display: none;
}

/* --- Items -------------------------------------------------------------- */

.ei-lang__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 11px;
	border-radius: calc(var(--ei-radius) - 3px);
	color: var(--ei-nav-text);
	font-family: var(--ei-ui-font);
	font-size: 0.85rem;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.18s ease, color 0.18s ease;
}

.ei-lang__item:hover,
.ei-lang__item:focus-visible {
	background: rgba(216, 167, 67, 0.14);
	color: var(--ei-link-hover);
}

.ei-lang__item.is-active {
	color: var(--ei-primary);
	font-weight: 600;
}

.ei-lang__item.is-active::after {
	margin-left: auto;
	color: var(--ei-primary);
	content: "✓";
	font-size: 0.8rem;
}

.ei-lang__flag {
	font-size: 1.05rem;
	line-height: 1;
}

/* --- Inline variant (mobile panel / footer) ----------------------------- */

.ei-lang--inline {
	display: block;
	width: 100%;
	margin-top: 18px;
	padding-top: 16px;
	border-top: 1px solid rgba(216, 167, 67, 0.22);
}

.ei-lang__legend {
	display: block;
	margin-bottom: 10px;
	color: var(--ei-muted);
	font-family: var(--ei-ui-font);
	font-size: 0.7rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

.ei-lang--inline .ei-lang__items {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.ei-lang--inline .ei-lang__item {
	border: 1px solid rgba(216, 167, 67, 0.28);
	background: rgba(216, 167, 67, 0.05);
}

.ei-lang--inline .ei-lang__item.is-active::after {
	margin-left: 4px;
}

/* --- Responsive --------------------------------------------------------- */

/*
 * Breakpoints follow style.css:
 *   >1200px  desktop nav + header switcher
 *   ≤1200px  hamburger appears; header switcher still shown
 *   ≤768px   icon buttons shrink to 36px
 *   ≤576px   the theme hides secondary header icons — the switcher goes with
 *            them, and the inline copy inside the mobile panel takes over.
 */

@media (max-width: 768px) {
	.ei-lang__toggle {
		min-width: 36px;
		padding-inline: 6px;
	}

	/* The globe alone carries the meaning once space gets tight. */
	.ei-lang__code {
		display: none;
	}

	.ei-lang__panel {
		min-width: 168px;
	}
}
