/*
 * Factorial2000 Translator — language switcher.
 * Inherits the typography and the colour of the place it sits in (header, menu,
 * footer); the open popup has its own background so it stays readable on a
 * dark or transparent header. Override with the custom properties below.
 */

.f2000tr-switcher {
	--f2000tr-flag-width: 24px;
	--f2000tr-popup-bg: #fff;
	--f2000tr-popup-color: #1d2327;
	--f2000tr-popup-hover: rgba(0, 0, 0, 0.06);
	--f2000tr-popup-z: 1100;

	margin: 0;
	line-height: 1.2;
}

/* Theme resets for lists and links in header columns must not leak in. */
.f2000tr-switcher ul,
.f2000tr-switcher li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.f2000tr-switcher a {
	text-decoration: none;
}

/* ---- Flag --------------------------------------------------------------- */

.f2000tr-switcher .f2000tr-flag {
	display: inline-block;
	flex: 0 0 auto;
	width: var(--f2000tr-flag-width);
	height: auto;
	aspect-ratio: 4 / 3;
	max-width: none;
	margin: 0;
	padding: 0;
	vertical-align: middle;
	border: 0;
	border-radius: 3px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
	object-fit: cover;
}

.f2000tr-switcher .f2000tr-flag--none {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(127, 127, 127, 0.25);
	box-shadow: 0 0 0 1px rgba(127, 127, 127, 0.45);
	font-size: 10px;
	font-weight: 600;
	line-height: 1;
}

/* ---- List and flags row ------------------------------------------------- */

.f2000tr-switcher-list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 12px;
}

.f2000tr-switcher--flags .f2000tr-switcher-list {
	flex-wrap: nowrap;
	gap: 6px;
}

.f2000tr-switcher-item a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: inherit;
}

.f2000tr-switcher-item a:hover,
.f2000tr-switcher-item a:focus-visible {
	text-decoration: underline;
}

.f2000tr-switcher-item.is-current a {
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* A flags-only row: no underline, show the current language with a ring. */
.f2000tr-switcher--flags .f2000tr-switcher-item a,
.f2000tr-switcher--flags .f2000tr-switcher-item a:hover {
	padding: 2px;
	border-radius: 4px;
	text-decoration: none;
	opacity: 0.7;
	transition: opacity 0.15s ease;
}

.f2000tr-switcher--flags .f2000tr-switcher-item a:hover,
.f2000tr-switcher--flags .f2000tr-switcher-item a:focus-visible,
.f2000tr-switcher--flags .f2000tr-switcher-item.is-current a {
	opacity: 1;
}

.f2000tr-switcher--flags .f2000tr-switcher-item.is-current a {
	box-shadow: 0 2px 0 0 currentColor;
	border-radius: 4px 4px 0 0;
}

/* ---- Native select ------------------------------------------------------ */

.f2000tr-switcher-select {
	max-width: 100%;
	padding: 4px 28px 4px 8px;
	font: inherit;
	color: inherit;
}

/* ---- Popup -------------------------------------------------------------- */

.f2000tr-switcher--popup {
	position: relative;
	display: inline-block;
}

/* Themes style every <button> (background, padding, uppercase, shadow); undo it. */
.f2000tr-switcher .f2000tr-popup-toggle,
.f2000tr-switcher .f2000tr-popup-toggle:hover,
.f2000tr-switcher .f2000tr-popup-toggle:focus,
.f2000tr-switcher .f2000tr-popup-toggle:active {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	width: auto;
	min-width: 0;
	min-height: 0;
	height: auto;
	margin: 0;
	padding: 4px 2px;
	border: 0;
	border-radius: 4px;
	background: transparent;
	box-shadow: none;
	color: inherit;
	font: inherit;
	line-height: inherit;
	text-transform: none;
	letter-spacing: normal;
	text-decoration: none;
	cursor: pointer;
}

.f2000tr-switcher .f2000tr-popup-toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.f2000tr-popup-caret {
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 4px 4px 0;
	border-color: currentColor transparent transparent;
	transition: transform 0.15s ease;
}

.f2000tr-switcher--popup.is-open .f2000tr-popup-caret {
	transform: rotate(180deg);
}

.f2000tr-popup-list {
	position: absolute;
	top: 100%;
	inset-inline-start: 0;
	z-index: var(--f2000tr-popup-z);
	display: none;
	min-width: 100%;
	width: max-content;
	max-width: 80vw;
	margin-top: 6px;
	padding: 6px;
	border-radius: 6px;
	background: var(--f2000tr-popup-bg);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.06);
	color: var(--f2000tr-popup-color);
}

.f2000tr-switcher--popup.is-align-end .f2000tr-popup-list {
	inset-inline-start: auto;
	inset-inline-end: 0;
}

/* Invisible bridge so the pointer can cross the gap between button and list. */
.f2000tr-popup-list::before {
	content: "";
	position: absolute;
	inset: -8px 0 100%;
}

.f2000tr-popup-list .f2000tr-switcher-item a {
	display: flex;
	width: 100%;
	box-sizing: border-box;
	padding: 6px 8px;
	border-radius: 4px;
	color: inherit;
	font-weight: 400;
	text-decoration: none;
	white-space: nowrap;
}

.f2000tr-popup-list .f2000tr-switcher-item a:hover,
.f2000tr-popup-list .f2000tr-switcher-item a:focus-visible {
	background: var(--f2000tr-popup-hover);
	text-decoration: none;
}

.f2000tr-popup-list .f2000tr-switcher-item.is-current a {
	font-weight: 600;
	text-decoration: none;
}

/* Without JavaScript: hover and keyboard focus open the list. */
.f2000tr-switcher--popup:not([data-enhanced]):hover .f2000tr-popup-list,
.f2000tr-switcher--popup:not([data-enhanced]):focus-within .f2000tr-popup-list {
	display: block;
}

/* With JavaScript: click opens it, hover also does on mouse devices. */
.f2000tr-switcher--popup.is-open .f2000tr-popup-list {
	display: block;
}

@media (hover: hover) {
	.f2000tr-switcher--popup[data-enhanced]:hover .f2000tr-popup-list {
		display: block;
	}
}

@media (prefers-reduced-motion: reduce) {
	.f2000tr-popup-caret,
	.f2000tr-switcher--flags .f2000tr-switcher-item a {
		transition: none;
	}
}
