/* ============================================================
   KA Language Switcher — floating top-right, Apple-style chip
   ============================================================ */

.ka-langswitch {
	position: fixed;
	top: 18px;
	right: 18px;
	z-index: 2147483645;
	font-family: var(--ka-font, "Inter", system-ui, -apple-system, sans-serif);
	/* Override browser default display:none for [popover] in the closed state. */
	display: block;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	overflow: visible;
	width: auto;
	max-width: none;
	height: auto;
	max-height: none;
	inset: auto;
	top: 18px;
	right: 18px;
}
/* When in top-layer (popover open) — keep the same look, no backdrop. */
.ka-langswitch:popover-open {
	display: block;
}
.ka-langswitch::backdrop {
	display: none;
	background: transparent;
}

.ka-langswitch__btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 13px;
	background: rgba(255, 255, 255, .94);
	backdrop-filter: saturate(180%) blur(14px);
	-webkit-backdrop-filter: saturate(180%) blur(14px);
	border: 1px solid rgba(15, 23, 42, .08);
	border-radius: 999px;
	box-shadow: 0 4px 14px rgba(15, 23, 42, .08), 0 1px 3px rgba(15, 23, 42, .04);
	color: #0f172a;
	font: 600 13px/1 var(--ka-font, "Inter", system-ui, sans-serif);
	letter-spacing: .04em;
	cursor: pointer;
	transition: box-shadow .25s ease, transform .25s ease, background-color .25s ease;
}
.ka-langswitch__btn:hover {
	box-shadow: 0 8px 24px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .06);
	transform: translateY(-1px);
}
.ka-langswitch__btn:focus-visible {
	outline: 3px solid rgba(13, 110, 253, .55);
	outline-offset: 2px;
}

.ka-langswitch__flag {
	font-size: 16px;
	line-height: 1;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.ka-langswitch__code {
	font-weight: 700;
	letter-spacing: .06em;
}

.ka-langswitch__chev {
	transition: transform .25s ease;
	opacity: .55;
}
.ka-langswitch.is-open .ka-langswitch__chev {
	transform: rotate(180deg);
}

.ka-langswitch__list {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	min-width: 170px;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: rgba(255, 255, 255, .98);
	backdrop-filter: saturate(180%) blur(20px);
	-webkit-backdrop-filter: saturate(180%) blur(20px);
	border: 1px solid rgba(15, 23, 42, .08);
	border-radius: 14px;
	box-shadow: 0 18px 42px rgba(15, 23, 42, .18), 0 4px 10px rgba(15, 23, 42, .06);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px) scale(.98);
	transform-origin: top right;
	transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.ka-langswitch.is-open .ka-langswitch__list {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	transition: opacity .22s ease, transform .22s ease, visibility 0s;
}

.ka-langswitch__link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 11px;
	border-radius: 9px;
	color: #0f172a;
	font: 500 14px/1.2 var(--ka-font, "Inter", system-ui, sans-serif);
	text-decoration: none;
	transition: background-color .18s ease, color .18s ease;
}
.ka-langswitch__link:hover {
	background: rgba(15, 23, 42, .06);
	color: #0f172a;
	text-decoration: none;
}
.ka-langswitch__link.is-active {
	background: rgba(0, 83, 146, .08);
	color: var(--ka-primary, #005392);
	font-weight: 600;
}
.ka-langswitch__link svg {
	margin-left: auto;
	color: var(--ka-primary, #005392);
}

.ka-langswitch__label {
	flex: 1;
}

/* Mobile — keep top-right but a touch smaller, account for safe-area. */
@media (max-width: 575px) {
	.ka-langswitch {
		top: max(12px, env(safe-area-inset-top));
		right: max(12px, env(safe-area-inset-right));
	}
	.ka-langswitch__btn {
		padding: 8px 11px;
		font-size: 12px;
	}
	.ka-langswitch__flag {
		font-size: 14px;
	}
}

/* When april-navbar is at the top (some pages?), we keep the switcher above it. */
.ka-langswitch { will-change: transform; }
