/* Translation Tool – front-end language switcher */

.ttool-switcher {
	list-style: none;
	margin: 0;
	padding: 0;
	/* inline-flex so the switcher follows the surrounding text-align (center it by
	   centering its container, or use align="center"). */
	display: inline-flex;
	gap: 10px;
	flex-wrap: wrap;
	align-items: center;
	font-size: inherit;
	vertical-align: middle;
}

.ttool-switcher--inline {
	display: inline-flex;
}

/* Alignment wrapper (align="left|center|right") */
.ttool-switcher-align {
	display: block;
	width: 100%;
}

/* Stacked vertically, one language per line */
.ttool-switcher--vertical {
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
}

.ttool-switcher li {
	margin: 0;
	padding: 0;
}

.ttool-switcher a {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	text-decoration: none;
	color: inherit;
	padding: 4px 8px;
	border-radius: 8px;
	line-height: 1.2;
	transition: background-color .15s ease, opacity .15s ease;
}

.ttool-switcher a:hover {
	background: rgba(0, 0, 0, .06);
}

.ttool-switcher .ttool-current a {
	font-weight: 700;
	/* Active language stays fully visible; it just isn't clickable (you're on it). */
	pointer-events: none;
}

.ttool-flag {
	font-size: 1.15em;
	line-height: 1;
	display: inline-block;
}

/* Flags: inactive = greyscale + slightly dimmed, active = full colour,
   and hovering an inactive language colours it in. */
.ttool-flag {
	filter: grayscale(1);
	opacity: .6;
	transition: filter .18s ease, opacity .18s ease;
}

.ttool-switcher .ttool-current .ttool-flag,
.ttool-switcher a:hover .ttool-flag,
.ttool-switcher a:focus-visible .ttool-flag {
	filter: grayscale(0);
	opacity: 1;
}

/* SVG flags: sharp, device-independent */
.ttool-flag--svg {
	display: inline-flex;
	line-height: 0;
}

.ttool-flag--svg img,
.ttool-flag--svg svg {
	height: 1em;
	width: auto;
	display: block;
	border-radius: 2px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .1);
}

/* Flag shapes: wrap the emoji in a badge and clip it */
.ttool-flags-rounded .ttool-flag,
.ttool-flags-circle .ttool-flag {
	display: inline-grid;
	place-items: center;
	width: 1.7em;
	height: 1.7em;
	overflow: hidden;
	font-size: 1.3em;
	background: rgba(0, 0, 0, .05);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}

.ttool-flags-rounded .ttool-flag {
	border-radius: 6px;
}

.ttool-flags-circle .ttool-flag {
	border-radius: 50%;
}

/* SVG flags fill the badge and crop cleanly to the shape */
.ttool-flags-rounded .ttool-flag--svg,
.ttool-flags-circle .ttool-flag--svg {
	background: none;
	box-shadow: none;
}

.ttool-flags-rounded .ttool-flag--svg img,
.ttool-flags-circle .ttool-flag--svg img,
.ttool-flags-rounded .ttool-flag--svg svg,
.ttool-flags-circle .ttool-flag--svg svg {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: inherit;
	box-shadow: none;
}

.ttool-lang-code {
	font-weight: 600;
	letter-spacing: .3px;
}

/* Separator (inline lists) */
.ttool-sep {
	opacity: .4;
	user-select: none;
}

/* Dropdown variant */
.ttool-switcher-dropdown {
	padding: 6px 30px 6px 10px;
	border-radius: 8px;
	border: 1px solid rgba(0, 0, 0, .18);
	background: #fff;
	font: inherit;
	cursor: pointer;
	line-height: 1.3;
}

/* Sensible defaults in dark contexts (theme can override) */
@media (prefers-color-scheme: dark) {
	.ttool-switcher a:hover {
		background: rgba(255, 255, 255, .1);
	}
	.ttool-switcher-dropdown {
		background: #1e293b;
		color: #e2e8f0;
		border-color: rgba(255, 255, 255, .2);
	}
}
