/* Langferry language switcher */
.lf-switcher {
	--lf-bg: #fff;
	--lf-fg: #1f2933;
	--lf-muted: #616e7c;
	--lf-border: rgba(15, 23, 42, .12);
	--lf-hover: rgba(15, 23, 42, .06);
	--lf-active: rgba(37, 99, 235, .1);
	--lf-accent: #2563eb;
	--lf-shadow: 0 10px 30px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .08);
	--lf-radius: 10px;
	position: relative;
	display: inline-block;
	font: inherit;
	font-size: 15px;
	line-height: 1.3;
	color: var(--lf-fg);
	text-align: start;
	z-index: 50;
}
.lf-switcher.lf-theme-dark {
	--lf-bg: #1e2430;
	--lf-fg: #f1f5f9;
	--lf-muted: #a3adbb;
	--lf-border: rgba(255, 255, 255, .14);
	--lf-hover: rgba(255, 255, 255, .08);
	--lf-active: rgba(96, 165, 250, .18);
	--lf-accent: #60a5fa;
	--lf-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
@media (prefers-color-scheme: dark) {
	.lf-switcher.lf-theme-auto {
		--lf-bg: #1e2430;
		--lf-fg: #f1f5f9;
		--lf-muted: #a3adbb;
		--lf-border: rgba(255, 255, 255, .14);
		--lf-hover: rgba(255, 255, 255, .08);
		--lf-active: rgba(96, 165, 250, .18);
		--lf-accent: #60a5fa;
		--lf-shadow: 0 10px 30px rgba(0, 0, 0, .45);
	}
}

/*
 * Every rule is scoped under .lf-switcher (or doubled on it) so it outranks a theme's element and
 * kit rules, which load later with the same specificity: `button { display: inline-block }` or
 * `.elementor-kit-5 a { color: … }` would otherwise win. Buttons and links reset each property such
 * rules set, including their :hover and :focus states. tests/ui/test_switcher_ui.py checks this
 * against a theme reset modelled on Hello Elementor's.
 */
.lf-switcher *,
.lf-switcher *::before,
.lf-switcher *::after { box-sizing: border-box; }
.lf-switcher ul { list-style: none; margin: 0; padding: 0; }
.lf-switcher li { margin: 0; padding: 0; line-height: inherit; background: none; border: 0; }
.lf-switcher li::before, .lf-switcher li::marker { content: none; }
.lf-switcher a[href],
.lf-switcher a[href]:hover,
.lf-switcher a[href]:focus,
.lf-switcher a[href]:active,
.lf-switcher a[href]:visited {
	display: flex;
	align-items: center;
	gap: .55em;
	color: inherit;
	text-decoration: none;
	text-transform: none;
	letter-spacing: normal;
	border: 0;
	border-radius: 7px;
	box-shadow: none;
	white-space: nowrap;
}
.lf-switcher a[href]:focus-visible,
.lf-switcher button:focus-visible,
.lf-switcher input:focus-visible { outline: 2px solid var(--lf-accent); outline-offset: 2px; }
.lf-switcher button:focus:not(:focus-visible) { outline: none; }
.lf-switcher svg { display: inline-block; max-width: none; }

.lf-switcher .lf-flag {
	display: block;
	flex: none;
	width: 20px;
	max-width: none;
	height: 15px;
	margin: 0;
	object-fit: cover;
	border: 0;
	border-radius: 2px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}
.lf-switcher.lf-flags-round .lf-flag { width: 18px; height: 18px; border-radius: 50%; }
.lf-switcher .lf-code { font-weight: 600; letter-spacing: .02em; font-size: .9em; }

/* Toggle button (dropdown, globe, popup) */
.lf-switcher .lf-toggle,
.lf-switcher .lf-toggle:hover,
.lf-switcher .lf-toggle:focus,
.lf-switcher .lf-toggle:active {
	display: inline-flex;
	align-items: center;
	gap: .55em;
	width: auto;
	min-width: 0;
	height: auto;
	min-height: 0;
	margin: 0;
	padding: .5em .8em;
	font: inherit;
	font-weight: inherit;
	line-height: inherit;
	text-align: start;
	text-transform: none;
	text-decoration: none;
	text-shadow: none;
	letter-spacing: normal;
	white-space: nowrap;
	color: var(--lf-fg);
	background: var(--lf-bg);
	border: 1px solid var(--lf-border);
	border-radius: var(--lf-radius);
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
	transition: background-color .15s, border-color .15s;
}
.lf-switcher .lf-toggle:hover { background: color-mix(in srgb, var(--lf-bg) 92%, var(--lf-fg)); }
.lf-switcher .lf-chevron { flex: none; opacity: .65; transition: transform .2s; }
.lf-switcher.lf-open > .lf-toggle .lf-chevron { transform: rotate(180deg); }
.lf-switcher .lf-globe { flex: none; }

/* Dropdown menu */
.lf-switcher .lf-menu {
	position: absolute;
	top: calc(100% + 6px);
	inset-inline-start: 0;
	min-width: 100%;
	max-height: min(60vh, 420px);
	overflow-y: auto;
	margin: 0;
	padding: 6px !important;
	background: var(--lf-bg);
	border: 1px solid var(--lf-border);
	border-radius: var(--lf-radius);
	box-shadow: var(--lf-shadow);
}
.lf-switcher .lf-menu[hidden], .lf-switcher .lf-popup[hidden] { display: none !important; }
.lf-switcher .lf-menu a[href] { padding: .5em .65em; }
.lf-switcher .lf-menu a[href]:hover, .lf-switcher .lf-grid a[href]:hover { background: var(--lf-hover); }
.lf-switcher a[href].lf-active, .lf-switcher a[href].lf-active:hover { background: var(--lf-active); font-weight: 600; }

/* Inline lists */
.lf-switcher .lf-inline { display: flex; flex-wrap: wrap; gap: .35em; align-items: center; }
.lf-switcher .lf-inline a[href] { padding: .3em .5em; }
.lf-switcher .lf-inline a[href]:hover { background: var(--lf-hover); }
.lf-switcher.lf-style-flags .lf-inline a[href] { padding: .3em; }
.lf-switcher.lf-style-flags .lf-flag { width: 24px; height: 18px; }
.lf-switcher.lf-style-flags.lf-flags-round .lf-flag { width: 22px; height: 22px; }

/* Popup */
.lf-switcher .lf-popup {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(15, 23, 42, .45);
	backdrop-filter: blur(2px);
}
.lf-switcher .lf-popup-box {
	width: min(720px, 100%);
	max-height: min(80vh, 640px);
	display: flex;
	flex-direction: column;
	background: var(--lf-bg);
	color: var(--lf-fg);
	border-radius: 14px;
	box-shadow: var(--lf-shadow);
	overflow: hidden;
}
.lf-switcher .lf-popup-head { display: flex; gap: 8px; padding: 14px; border-bottom: 1px solid var(--lf-border); }
.lf-switcher .lf-search {
	flex: 1;
	min-width: 0;
	margin: 0;
	padding: .6em .8em;
	font: inherit;
	color: inherit;
	background: transparent;
	border: 1px solid var(--lf-border);
	border-radius: 8px;
	box-shadow: none;
}
.lf-switcher .lf-close,
.lf-switcher .lf-close:hover,
.lf-switcher .lf-close:focus {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	min-height: 0;
	margin: 0;
	padding: 0;
	font-size: 24px;
	line-height: 1;
	text-transform: none;
	color: var(--lf-muted);
	background: transparent;
	border: 0;
	border-radius: 8px;
	box-shadow: none;
	cursor: pointer;
}
.lf-switcher .lf-close:hover { background: var(--lf-hover); color: var(--lf-fg); }
.lf-switcher .lf-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 4px;
	margin: 0;
	padding: 10px !important;
	overflow-y: auto;
}
.lf-switcher .lf-grid a[href] { padding: .6em .7em; }
.lf-switcher .lf-grid li[hidden] { display: none; }

/* Floating */
.lf-switcher.lf-floating { position: fixed; z-index: 99999; }
.lf-switcher.lf-pos-bottom_right { right: 20px; bottom: 20px; }
.lf-switcher.lf-pos-bottom_left { left: 20px; bottom: 20px; }
.lf-switcher.lf-pos-top_right { right: 20px; top: 20px; }
.lf-switcher.lf-pos-top_left { left: 20px; top: 20px; }
body.admin-bar .lf-switcher.lf-pos-top_right, body.admin-bar .lf-switcher.lf-pos-top_left { top: 52px; }
.lf-switcher.lf-floating .lf-toggle,
.lf-switcher.lf-floating .lf-toggle:hover,
.lf-switcher.lf-floating .lf-toggle:focus,
.lf-switcher.lf-floating .lf-toggle:active { box-shadow: var(--lf-shadow); border-radius: 999px; padding: .55em 1em; }
.lf-switcher.lf-pos-bottom_right .lf-menu, .lf-switcher.lf-pos-bottom_left .lf-menu { top: auto; bottom: calc(100% + 8px); }
.lf-switcher.lf-pos-bottom_right .lf-menu, .lf-switcher.lf-pos-top_right .lf-menu { inset-inline-start: auto; inset-inline-end: 0; }
.lf-switcher.lf-pos-bottom_right .lf-chevron, .lf-switcher.lf-pos-bottom_left .lf-chevron { transform: rotate(180deg); }
.lf-switcher.lf-pos-bottom_right.lf-open .lf-chevron, .lf-switcher.lf-pos-bottom_left.lf-open .lf-chevron { transform: none; }

/* Inside menus */
.lf-menu-item .lf-switcher { font-size: inherit; }
.lf-switcher.lf-in-menu .lf-toggle,
.lf-switcher.lf-in-menu .lf-toggle:hover,
.lf-switcher.lf-in-menu .lf-toggle:focus,
.lf-switcher.lf-in-menu .lf-toggle:active { background: transparent; border-color: transparent; box-shadow: none; padding: .3em .5em; color: inherit; }
.lf-switcher.lf-in-menu .lf-menu { inset-inline-start: auto; inset-inline-end: 0; }

@media (max-width: 600px) {
	.lf-switcher.lf-floating .lf-toggle .lf-label { display: none; }
	.lf-switcher.lf-pos-bottom_right { right: 12px; bottom: 12px; }
	.lf-switcher.lf-pos-bottom_left { left: 12px; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
	.lf-switcher .lf-chevron,
	.lf-switcher .lf-toggle,
	.lf-switcher .lf-toggle:hover,
	.lf-switcher .lf-toggle:focus { transition: none; }
}
