/* Переключатель языков huk-tr. Только раскладка: цвета и шрифт берутся у темы. */
.huk-tr-switcher__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em 1em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.huk-tr-switcher__item {
	margin: 0;
}

.huk-tr-switcher__link[aria-current] {
	font-weight: 700;
	text-decoration: none;
}

.huk-tr-switcher--dropdown,
.huk-tr-switcher__dropdown {
	position: relative;
	display: inline-block;
}

.huk-tr-switcher__toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	cursor: pointer;
	list-style: none;
}

/* Штатный треугольник details убран, вместо него SVG-стрелка */
.huk-tr-switcher__toggle::-webkit-details-marker {
	display: none;
}

.huk-tr-switcher__toggle::marker {
	content: "";
}

.huk-tr-switcher__chevron {
	flex: none;
	width: 0.75em;
	height: 0.75em;
	transition: transform 0.15s ease;
}

.huk-tr-switcher__dropdown[open] .huk-tr-switcher__chevron {
	transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
	.huk-tr-switcher__chevron {
		transition: none;
	}
}

.huk-tr-switcher__toggle:focus-visible,
.huk-tr-switcher__link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.huk-tr-switcher--dropdown .huk-tr-switcher__list {
	position: absolute;
	z-index: 100;
	top: 100%;
	inset-inline-start: 0;
	display: block;
	box-sizing: border-box;
	/* Ширина по самому длинному пункту: темы нередко задают спискам свою ширину и обрезку */
	width: max-content;
	min-width: 100%;
	max-width: calc(100vw - 2rem);
	margin: 0.35em 0;
	padding: 0.3em;
	overflow: visible;
	background: #fff;
	color: #111;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 0.6em;
	box-shadow: 0 0.4em 1.4em rgba(0, 0, 0, 0.18);
	white-space: nowrap;
	text-align: start;
}

.huk-tr-switcher--dropdown .huk-tr-switcher__item {
	margin: 0;
	padding: 0;
}

.huk-tr-switcher--dropdown .huk-tr-switcher__link {
	display: flex;
	align-items: center;
	gap: 0.6em;
	padding: 0.45em 0.8em;
	border-radius: 0.4em;
	color: inherit;
	text-decoration: none;
	line-height: 1.3;
}

.huk-tr-switcher--dropdown .huk-tr-switcher__link:hover,
.huk-tr-switcher--dropdown .huk-tr-switcher__link:focus-visible {
	background: rgba(0, 0, 0, 0.06);
}

.huk-tr-switcher--dropdown .huk-tr-switcher__link[aria-current] {
	background: rgba(0, 0, 0, 0.08);
}

.huk-tr-switcher--dropdown .huk-tr-switcher__link .huk-tr-flag {
	margin: 0;
}

li.huk-tr-menu-item {
	list-style: none;
}

/* Плавающий блок в углу экрана. Здесь цвета свои: блок лежит поверх любого фона. */
.huk-tr-floating {
	position: fixed;
	z-index: 9990;
	max-width: calc(100vw - 2rem);
	padding: 0.5em 0.9em;
	background: #fff;
	color: #111;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 0.5em;
	box-shadow: 0 0.25em 1em rgba(0, 0, 0, 0.15);
	font-size: 0.9rem;
	line-height: 1.4;
}

.huk-tr-floating a {
	color: inherit;
}

.huk-tr-floating--bottom-right { inset-block-end: 1rem; inset-inline-end: 1rem; }
.huk-tr-floating--bottom-left { inset-block-end: 1rem; inset-inline-start: 1rem; }
.huk-tr-floating--top-right { inset-block-start: 1rem; inset-inline-end: 1rem; }
.huk-tr-floating--top-left { inset-block-start: 1rem; inset-inline-start: 1rem; }

/* С панелью администратора верхние углы не должны уходить под неё */
.admin-bar .huk-tr-floating--top-right,
.admin-bar .huk-tr-floating--top-left { inset-block-start: calc(1rem + var(--wp-admin--admin-bar--height, 32px)); }

/* Внизу экрана выпадающий список раскрывается вверх, справа — прижимается к правому краю */
.huk-tr-floating--bottom-right .huk-tr-switcher--dropdown .huk-tr-switcher__list,
.huk-tr-floating--bottom-left .huk-tr-switcher--dropdown .huk-tr-switcher__list { top: auto; bottom: 100%; }
.huk-tr-floating--bottom-right .huk-tr-switcher--dropdown .huk-tr-switcher__list,
.huk-tr-floating--top-right .huk-tr-switcher--dropdown .huk-tr-switcher__list { inset-inline-start: auto; inset-inline-end: 0; }

/* Список встаёт вровень с краями плавающего блока и отступает от него */
.huk-tr-floating .huk-tr-switcher--dropdown .huk-tr-switcher__list { margin: 0.9em -0.9em; }
.huk-tr-floating .huk-tr-switcher__toggle { gap: 0.5em; font-weight: 600; }

@media print {
	.huk-tr-floating { display: none; }
}

/* В нижних углах список раскрывается вверх: закрытая стрелка смотрит вверх, открытая вниз */
.huk-tr-floating--bottom-right .huk-tr-switcher__chevron,
.huk-tr-floating--bottom-left .huk-tr-switcher__chevron { transform: rotate(180deg); }
.huk-tr-floating--bottom-right .huk-tr-switcher__dropdown[open] .huk-tr-switcher__chevron,
.huk-tr-floating--bottom-left .huk-tr-switcher__dropdown[open] .huk-tr-switcher__chevron { transform: none; }

/* Флаг рядом с подписью языка */
.huk-tr-flag {
	display: inline-block;
	flex: none;
	width: 1.25em;
	height: auto;
	aspect-ratio: 4 / 3;
	margin-inline-end: 0.4em;
	border-radius: 2px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
	vertical-align: -0.15em;
}

.huk-tr-switcher__toggle .huk-tr-flag {
	margin-inline-end: 0;
}
.huk-tr-floating .huk-tr-switcher--dropdown .huk-tr-switcher__list { min-width: calc(100% + 1.8em); }
