/**
 * Polylang language switcher in the primary navigation.
 * Progressive enhancement: the markup is two `.lang-item` links; the
 * accompanying language-switcher.js collapses them into a compact dropdown
 * (current language + caret as the trigger, the other language(s) in a panel).
 * Without JS the two links simply show inline. Styled for the desktop nav and
 * the mobile burger panel.
 */

/* Trigger ------------------------------------------------------------------ */
.site-nav-header-primary .pll-switcher {
	position: relative;
}

.site-nav-header-primary .pll-switcher__toggle {
	display: flex;
	align-items: center;
	gap: 0.4em;
	margin: 0;
	padding: 0.4rem 0.6rem;
	background: none;
	border: 0;
	border-radius: var(--border-radius-xl);
	font: inherit;
	color: inherit;
	cursor: pointer;
	transition: var(--transition-fast);
}

.site-nav-header-primary .pll-switcher__code {
	font-size: var(--size-13);
	font-weight: var(--weight-medium);
	letter-spacing: 0.02em;
}

.site-nav-header-primary .pll-switcher__caret {
	width: 9px;
	height: 9px;
	background-color: currentColor;
	opacity: 0.8;
	-webkit-mask-image: var(--icon-svg-chevron-down);
	mask-image: var(--icon-svg-chevron-down);
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	transition: transform var(--transition-fast-no-property);
}

.site-nav-header-primary .pll-switcher.is-open .pll-switcher__caret {
	transform: rotate(180deg);
}

/* Panel -------------------------------------------------------------------- */
.site-nav-header-primary .pll-switcher__menu {
	margin: 0;
	padding: 6px;
	list-style: none;
}

.site-nav-header-primary .pll-switcher__menu .lang-item {
	display: block;
}

/* Current language lives in the trigger; hide it inside the panel. */
.site-nav-header-primary .pll-switcher__menu .lang-item.is-current {
	display: none;
}

.site-nav-header-primary .pll-switcher__menu .lang-item > a {
	display: flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.45rem 0.6rem;
	border-radius: var(--border-radius-s);
	text-decoration: none;
	white-space: nowrap;
}

.site-nav-header-primary .pll-switcher__menu .lang-item span {
	margin-left: 0 !important;
}

/* Fallback if JS does not run: keep the two inline links readable. */
.site-nav-header-primary .lang-item > a {
	display: flex;
	align-items: center;
	gap: 0.4em;
	text-decoration: none;
}

/* ------------------------------------------------------------------ */
/* Desktop: compact trigger + absolute dropdown                         */
/* ------------------------------------------------------------------ */
@media screen and (min-width: 1200px) {
	.site-nav-header-primary .pll-switcher {
		margin-left: var(--spacing-5);
		display: flex;
		align-items: center;
	}

	.site-nav-header-primary .pll-switcher__toggle:hover,
	.site-nav-header-primary .pll-switcher.is-open .pll-switcher__toggle {
		background-color: rgba(255, 255, 255, 0.12);
	}

	.site-nav-header-primary .pll-switcher__menu {
		position: absolute;
		top: calc(100% + 4px);
		right: 0;
		min-width: 168px;
		background-color: var(--color-white);
		box-shadow: var(--shadow-m);
		border-radius: var(--border-radius-s);
		opacity: 0;
		transform: translateY(4px);
		pointer-events: none;
		transition: var(--transition-fast);
		z-index: 5;
	}

	.site-nav-header-primary .pll-switcher.is-open .pll-switcher__menu {
		opacity: 1;
		transform: none;
		pointer-events: auto;
	}

	.site-nav-header-primary .pll-switcher__menu .lang-item > a {
		color: var(--color-black);
	}

	.site-nav-header-primary .pll-switcher__menu .lang-item > a:hover {
		background-color: var(--color-gray-extra-light);
	}
}

/* ------------------------------------------------------------------ */
/* Mobile burger panel: compact trigger + inline accordion             */
/* ------------------------------------------------------------------ */
@media screen and (max-width: 1199.98px) {
	.site-nav-header-primary .pll-switcher {
		border-bottom: 1px solid var(--color-gray-light);
	}

	.site-nav-header-primary .pll-switcher__toggle {
		width: 100%;
		justify-content: flex-start;
		padding: 0.6rem 1rem;
		color: var(--color-black);
		font-size: var(--size-16);
		font-weight: var(--weight-medium);
		border-radius: 0;
	}

	.site-nav-header-primary .pll-switcher__caret {
		margin-left: auto;
	}

	.site-nav-header-primary .pll-switcher__menu {
		max-height: 0;
		padding: 0 1rem;
		overflow: hidden;
		transition: max-height var(--transition-fast-no-property);
	}

	.site-nav-header-primary .pll-switcher.is-open .pll-switcher__menu {
		max-height: 220px;
		padding-top: 4px;
		padding-bottom: 8px;
	}

	.site-nav-header-primary .pll-switcher__menu .lang-item > a {
		color: var(--color-black);
	}
}
