/* VEFtranslate language switcher. Sizes are fluid, colors come from the theme. */
:root {
	--vefwt-font-size-normal: clamp(0.875rem, 0.79rem + 0.39vw, 1.1rem);
}

.vefwt-switcher {
	font-size: var(--wp--preset--font-size--normal, var(--vefwt-font-size-normal));
	line-height: 1.4;
}

.vefwt-switcher__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.vefwt-switcher__item a {
	display: inline-flex;
	align-items: center;
	color: inherit;
	text-decoration: none;
}

/* Text kept for screen readers when a flag stands alone. */
.vefwt-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	white-space: nowrap;
	border: 0;
	clip-path: inset(50%);
}

/* A flag is drawn as a background (see VEFWT_Flags); its size follows the text around it. */
.vefwt-flag {
	display: inline-block;
	box-sizing: border-box;
	width: 1.5em;
	height: 1em;
	vertical-align: -0.15em;
	background-color: rgb(128 128 128 / 20%);
	background-repeat: no-repeat;
	background-position: center;
	background-size: 100% 100%;
	border-radius: 0.12em;
	box-shadow: 0 0 0 1px rgb(0 0 0 / 18%);
}

/* A language without a flag: its code in a small box. */
.vefwt-flag--code {
	width: auto;
	height: auto;
	padding: 0 0.3em;
	font-size: 0.72em;
	font-weight: 700;
	line-height: 1.35;
	letter-spacing: 0.03em;
	text-align: center;
	background: transparent;
	border: 1px solid currentcolor;
	box-shadow: none;
}

.vefwt-flag + .vefwt-switcher__name {
	margin-inline-start: 0.45em;
}

.vefwt-switcher--flags .vefwt-flag {
	width: 1.7em;
	height: 1.15em;
}

.vefwt-switcher--flags .vefwt-flag--code {
	width: auto;
	height: auto;
}

.vefwt-switcher--flags .is-current .vefwt-flag,
.vefwt-switcher-menu-item--flags.current-menu-item .vefwt-flag {
	box-shadow: 0 0 0 2px currentcolor;
}

.vefwt-switcher__item a:hover,
.vefwt-switcher__item a:focus-visible {
	text-decoration: underline;
}

.vefwt-switcher__item.is-current a {
	font-weight: 700;
}

.vefwt-switcher--dropdown {
	position: relative;
	display: inline-block;
}

.vefwt-switcher__details > summary {
	display: inline-flex;
	align-items: center;
	cursor: pointer;
	list-style: none;
	padding: 0.25rem 0.5rem;
	border: 1px solid currentcolor;
}

.vefwt-switcher__details > summary::-webkit-details-marker {
	display: none;
}

.vefwt-switcher__details > summary::after {
	content: "";
	display: inline-block;
	margin-inline-start: 0.5em;
	vertical-align: 0.15em;
	border: 0.3em solid transparent;
	border-top-color: currentcolor;
	border-bottom-width: 0;
}

.vefwt-switcher--dropdown .vefwt-switcher__list {
	position: absolute;
	z-index: 9999;
	inset-inline-start: 0;
	flex-direction: column;
	min-width: 100%;
	padding: 0.5rem;
	background: Canvas;
	color: CanvasText;
	border: 1px solid currentcolor;
}

.vefwt-floating {
	position: fixed;
	z-index: 9999;
}

.vefwt-floating--bottom-right {
	inset-block-end: 1rem;
	inset-inline-end: 1rem;
}

.vefwt-floating--bottom-left {
	inset-block-end: 1rem;
	inset-inline-start: 1rem;
}

.vefwt-floating--top-right {
	inset-block-start: 1rem;
	inset-inline-end: 1rem;
}

.vefwt-floating--top-left {
	inset-block-start: 1rem;
	inset-inline-start: 1rem;
}

.vefwt-floating .vefwt-switcher__details > summary {
	background: Canvas;
	color: CanvasText;
}

/* The list opens away from the edge of the screen, and scrolls if there are many languages. */
.vefwt-floating .vefwt-switcher__list {
	max-height: 60vh;
	overflow-y: auto;
}

.vefwt-floating--bottom-right .vefwt-switcher__list,
.vefwt-floating--bottom-left .vefwt-switcher__list {
	inset-block-start: auto;
	inset-block-end: 100%;
}

.vefwt-floating--bottom-right .vefwt-switcher__list,
.vefwt-floating--top-right .vefwt-switcher__list {
	inset-inline-start: auto;
	inset-inline-end: 0;
}
