/**
 * Переключатели языка и валюты.
 *
 * Стили нарочно скромные: переключатель живёт в чужой шапке и должен
 * подстраиваться под неё, а не спорить с ней.
 */

.gwi-switcher {
	position: relative;
	display: inline-block;
	font-size: 14px;
	line-height: 1.2;
}

.gwi-switcher__toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 10px;
	margin: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
	/* Палец на телефоне заметно шире курсора — меньше 44px не делаем. */
	min-height: 40px;
}

.gwi-switcher__toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.gwi-switcher__arrow {
	font-size: 10px;
	opacity: 0.7;
	transition: transform 0.15s ease;
}

.gwi-switcher__toggle[aria-expanded="true"] .gwi-switcher__arrow {
	transform: rotate(180deg);
}

.gwi-switcher__flag {
	font-size: 16px;
	line-height: 1;
	display: inline-flex;
	align-items: center;
}

/* Флаг — рисованный SVG, а не эмодзи: в Windows флагов в шрифтах нет,
   и значок пропадал у большинства посетителей. Скругление и тонкая
   рамка нужны белым флагам (финский, эстонский), иначе они сливаются
   со светлым фоном переключателя. */
.gwi-flag {
	display: block;
	border-radius: 2px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.gwi-switcher__menu {
	position: absolute;
	z-index: 999;
	top: calc(100% + 4px);
	right: 0;
	min-width: 150px;
	margin: 0;
	padding: 4px;
	list-style: none;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 8px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

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

.gwi-switcher__item {
	display: block;
	width: auto;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gwi-switcher__item a {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 9px 10px;
	border-radius: 5px;
	color: #1a1a1a;
	text-decoration: none;
	white-space: nowrap;
}

.gwi-switcher__item.is-current a {
	font-weight: 600;
}

/* Список вместо выпадашки — для подвала, где место есть. */
.gwi-switcher--list {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gwi-switcher--list .gwi-switcher__item {
	flex: 0 0 auto;
	width: auto;
}

.gwi-switcher--list .gwi-switcher__item a {
	padding: 8px 10px;
	color: inherit;
	opacity: 0.75;
}

.gwi-switcher--list .gwi-switcher__item.is-current a {
	opacity: 1;
}

/* Подсветку показываем только там, где есть мышь: на телефоне
   :hover залипает после тапа и выглядит как выбранный пункт. */
@media (hover: hover) {
	.gwi-switcher__toggle:hover {
		background: rgba(0, 0, 0, 0.05);
	}

	.gwi-switcher__item a:hover {
		background: rgba(0, 0, 0, 0.06);
	}

	.gwi-switcher--list .gwi-switcher__item a:hover {
		opacity: 1;
		background: transparent;
		text-decoration: underline;
	}
}

@media (prefers-color-scheme: dark) {
	.gwi-switcher__menu {
		background: #23262b;
		border-color: rgba(255, 255, 255, 0.12);
	}

	.gwi-switcher__item a {
		color: #f2f3f5;
	}

	@media (hover: hover) {
		.gwi-switcher__toggle:hover,
		.gwi-switcher__item a:hover {
			background: rgba(255, 255, 255, 0.08);
		}
	}
}

@media (max-width: 600px) {
	.gwi-switcher__menu {
		right: auto;
		left: 0;
	}

	.gwi-switcher__toggle .gwi-switcher__name {
		display: none;
	}

	/* На узком экране флага достаточно — название языка съедает
	   всю шапку. У валюты флага нет, код оставляем. */
	.gwi-switcher--currency .gwi-switcher__toggle .gwi-switcher__name {
		display: inline;
	}
}
