/* Trendy Multilingual language switcher */

.tcml-switcher {
	--tcml-bg: #ffffff;
	--tcml-fg: #1d2327;
	--tcml-muted: #646970;
	--tcml-border: rgba(0, 0, 0, .12);
	--tcml-shadow: 0 8px 28px rgba(0, 0, 0, .16);
	--tcml-radius: 8px;
	position: relative;
	display: inline-block;
	font-size: 14px;
	line-height: 1.4;
	text-align: left;
	z-index: 9;
}

.tcml-switcher * {
	box-sizing: border-box;
}

.tcml-flag {
	display: block;
	width: 22px;
	height: 15px;
	border-radius: 2px;
	flex: 0 0 auto;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

/* Toggle button --------------------------------------------------------- */

.tcml-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 8px 12px;
	width: 100%;
	background: var(--tcml-bg);
	color: var(--tcml-fg);
	border: 1px solid var(--tcml-border);
	border-radius: var(--tcml-radius);
	font: inherit;
	cursor: pointer;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.tcml-toggle:hover,
.tcml-toggle:focus-visible {
	border-color: rgba(0, 0, 0, .3);
	box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.tcml-label {
	white-space: nowrap;
}

.tcml-caret {
	width: 0;
	height: 0;
	margin-left: auto;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
	opacity: .55;
	transition: transform .18s ease;
}

.tcml-switcher.is-open .tcml-caret {
	transform: rotate(180deg);
}

/* Dropdown list --------------------------------------------------------- */

.tcml-list {
	position: absolute;
	left: 0;
	right: 0;
	min-width: 100%;
	margin: 6px 0 0;
	padding: 6px;
	list-style: none;
	background: var(--tcml-bg);
	border: 1px solid var(--tcml-border);
	border-radius: var(--tcml-radius);
	box-shadow: var(--tcml-shadow);
	max-height: 320px;
	overflow-y: auto;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition: opacity .15s ease, transform .15s ease, visibility .15s;
}

.tcml-switcher[data-open="up"] .tcml-list {
	top: auto;
	bottom: 100%;
	margin: 0 0 6px;
	transform: translateY(4px);
}

.tcml-switcher.is-open .tcml-list {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.tcml-list li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tcml-list a,
.tcml-inline-list a {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 7px 10px;
	border-radius: 5px;
	color: var(--tcml-fg);
	text-decoration: none;
	white-space: nowrap;
}

.tcml-list a:hover,
.tcml-list a:focus-visible {
	background: rgba(0, 0, 0, .06);
	text-decoration: none;
}

.tcml-list .is-current a {
	font-weight: 600;
	background: rgba(0, 0, 0, .04);
}

/* Inline flag row ------------------------------------------------------- */

.tcml-inline-list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tcml-inline-list li {
	margin: 0;
	list-style: none;
}

.tcml-inline-list a {
	padding: 5px 8px;
	color: var(--tcml-muted);
}

.tcml-inline-list .is-current a {
	color: var(--tcml-fg);
	font-weight: 600;
}

/* Floating placement ---------------------------------------------------- */

.tcml-floating {
	position: fixed;
	z-index: 99980;
}

.tcml-floating .tcml-toggle {
	background: var(--tcml-bg);
	box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
}

.tcml-pos-bottom-left  { bottom: 20px; left: 20px; }
.tcml-pos-bottom-right { bottom: 20px; right: 20px; }
.tcml-pos-top-left     { top: 20px; left: 20px; }
.tcml-pos-top-right    { top: 20px; right: 20px; }

@media (max-width: 640px) {
	.tcml-floating { font-size: 13px; }
	.tcml-pos-bottom-left,
	.tcml-pos-bottom-right { bottom: 14px; }
	.tcml-pos-bottom-left  { left: 14px; }
	.tcml-pos-bottom-right { right: 14px; }
	.tcml-floating .tcml-label { display: none; }
}

/* Right-to-left --------------------------------------------------------- */

[dir="rtl"] .tcml-switcher { text-align: right; }
[dir="rtl"] .tcml-caret { margin-left: 0; margin-right: auto; }

/* Dark backgrounds ------------------------------------------------------ */

@media (prefers-color-scheme: dark) {
	.tcml-floating {
		--tcml-bg: #1f2126;
		--tcml-fg: #f2f3f5;
		--tcml-muted: #a7abb3;
		--tcml-border: rgba(255, 255, 255, .16);
		--tcml-shadow: 0 8px 28px rgba(0, 0, 0, .5);
	}

	.tcml-floating .tcml-list a:hover,
	.tcml-floating .tcml-list a:focus-visible { background: rgba(255, 255, 255, .1); }
	.tcml-floating .tcml-list .is-current a { background: rgba(255, 255, 255, .07); }
}
