/* Tashkent Language Switcher — front end */

.tls-switcher {
	--tls-bg: #fff;
	--tls-ink: #17202a;
	--tls-muted: #5b6773;
	--tls-line: #e4e8ec;
	--tls-accent: #1d4ed8;
	--tls-radius: 10px;
	--tls-shadow: 0 6px 24px rgba(16, 24, 40, .12), 0 1px 2px rgba(16, 24, 40, .06);

	position: relative;
	display: inline-block;
	font-size: 15px;
	line-height: 1.4;
	color: var(--tls-ink);
	box-sizing: border-box;
}

.tls-switcher *,
.tls-switcher *::before,
.tls-switcher *::after {
	box-sizing: inherit;
}

/* Never rely on the theme to provide this — some do not. */
.tls-switcher .screen-reader-text,
.tls-suggest .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Flags ------------------------------------------------------------------ */

.tls-flag {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	font-size: 1.15em;
}

.tls-flag__code {
	display: none;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .02em;
	padding: 3px 5px;
	border-radius: 4px;
	background: #eef1f5;
	color: #46505a;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Set by JS when the OS has no flag emoji (Windows). */
.tls-no-flag-emoji .tls-flag__emoji {
	display: none;
}

.tls-no-flag-emoji .tls-flag__code {
	display: inline-block;
}

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

.tls-switcher__toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 14px;
	margin: 0;
	background: var(--tls-bg);
	border: 1px solid var(--tls-line);
	border-radius: var(--tls-radius);
	font: inherit;
	color: inherit;
	cursor: pointer;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.tls-switcher__toggle:hover {
	border-color: var(--tls-accent);
}

.tls-switcher__toggle:focus-visible {
	outline: 2px solid var(--tls-accent);
	outline-offset: 2px;
}

.tls-switcher__caret {
	width: 8px;
	height: 8px;
	margin-left: 2px;
	border-right: 2px solid var(--tls-muted);
	border-bottom: 2px solid var(--tls-muted);
	transform: rotate(45deg) translate(-2px, -2px);
	transition: transform .2s ease;
}

.tls-switcher__toggle[aria-expanded="true"] .tls-switcher__caret {
	transform: rotate(-135deg) translate(-2px, -2px);
}

/* Menu ------------------------------------------------------------------- */

.tls-switcher__menu {
	position: absolute;
	z-index: 9999;
	top: calc(100% + 6px);
	left: 0;
	min-width: 220px;
	max-height: 340px;
	overflow-y: auto;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: var(--tls-bg);
	border: 1px solid var(--tls-line);
	border-radius: var(--tls-radius);
	box-shadow: var(--tls-shadow);

	opacity: 0;
	transform: translateY(-6px);
	transition: opacity .16s ease, transform .16s ease;
}

.tls-switcher__menu[hidden] {
	display: none;
}

.tls-switcher__menu.is-open {
	opacity: 1;
	transform: translateY(0);
}

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

.tls-switcher__link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border-radius: 7px;
	text-decoration: none;
	color: inherit;
	white-space: nowrap;
}

.tls-switcher__link:hover,
.tls-switcher__link:focus {
	background: #f2f5f9;
	color: inherit;
}

.tls-switcher__link:focus-visible {
	outline: 2px solid var(--tls-accent);
	outline-offset: -2px;
}

.tls-switcher__link.is-current {
	font-weight: 700;
	color: var(--tls-accent);
}

.tls-switcher__link.is-current::after {
	content: "";
	width: 6px;
	height: 10px;
	margin-left: auto;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
}

/* Inline variant --------------------------------------------------------- */

.tls-switcher__inline {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tls-switcher--inline .tls-switcher__link {
	padding: 5px 10px;
	border: 1px solid var(--tls-line);
	border-radius: 999px;
	font-size: .9em;
}

.tls-switcher--inline .tls-switcher__link.is-current {
	border-color: var(--tls-accent);
	background: rgba(29, 78, 216, .08);
}

.tls-switcher--inline .tls-switcher__link.is-current::after {
	display: none;
}

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

.tls-switcher--floating {
	position: fixed;
	z-index: 99998;
}

.tls-switcher--floating .tls-switcher__toggle {
	box-shadow: var(--tls-shadow);
}

.tls-switcher--bottom-right { right: 20px; bottom: 20px; }
.tls-switcher--bottom-left  { left: 20px;  bottom: 20px; }
.tls-switcher--top-right    { right: 20px; top: 20px; }
.tls-switcher--top-left     { left: 20px;  top: 20px; }

/* Open upwards when pinned to the bottom. */
.tls-switcher--bottom-right .tls-switcher__menu,
.tls-switcher--bottom-left .tls-switcher__menu {
	top: auto;
	bottom: calc(100% + 6px);
	transform: translateY(6px);
}

.tls-switcher--bottom-right .tls-switcher__menu.is-open,
.tls-switcher--bottom-left .tls-switcher__menu.is-open {
	transform: translateY(0);
}

.tls-switcher--bottom-right .tls-switcher__menu,
.tls-switcher--top-right .tls-switcher__menu {
	left: auto;
	right: 0;
}

/* Suggestion bar --------------------------------------------------------- */

.tls-suggest {
	position: fixed;
	z-index: 99999;
	left: 50%;
	bottom: 20px;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: calc(100vw - 32px);
	padding: 11px 14px;
	background: #17202a;
	color: #fff;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
	font-size: 14px;
	line-height: 1.4;
}

.tls-suggest[hidden] {
	display: none;
}

.tls-suggest__link {
	color: #fff;
	text-decoration: none;
	border-bottom: 1px solid rgba(255, 255, 255, .45);
}

.tls-suggest__link:hover {
	color: #fff;
	border-bottom-color: #fff;
}

.tls-suggest__close {
	margin-left: 4px;
	padding: 5px 10px;
	background: rgba(255, 255, 255, .14);
	border: 0;
	border-radius: 7px;
	color: #fff;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	white-space: nowrap;
}

.tls-suggest__close:hover {
	background: rgba(255, 255, 255, .26);
}

/* RTL -------------------------------------------------------------------- */

[dir="rtl"] .tls-switcher__menu {
	left: auto;
	right: 0;
}

[dir="rtl"] .tls-switcher__link.is-current::after {
	margin-left: 0;
	margin-right: auto;
}

[dir="rtl"] .tls-switcher--bottom-right { right: auto; left: 20px; }
[dir="rtl"] .tls-switcher--bottom-left  { left: auto;  right: 20px; }

@media (prefers-reduced-motion: reduce) {
	.tls-switcher *,
	.tls-suggest {
		transition: none !important;
	}
}

@media (max-width: 520px) {
	.tls-suggest {
		left: 16px;
		right: 16px;
		transform: none;
		max-width: none;
	}
}
