/* AI Translate 180D — language switcher.
 * Everything inherits from the theme unless a colour, size or radius is set
 * in AI Translate → Settings (delivered as the --ait-sw-* custom properties). */
.ait180d-switcher {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: var(--ait-sw-fs, inherit);
	line-height: 1.4;
	color: var(--ait-sw-c, inherit);
}

.ait180d-switcher ul,
.ait180d-switcher li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ait180d-switcher a,
.ait180d-switcher > summary {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
	border-radius: var(--ait-sw-r, 8px);
	transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
}

.ait180d-switcher a:focus-visible,
.ait180d-switcher > summary:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.ait180d-flag {
	display: inline-block;
	vertical-align: middle;
	flex: none;
	width: 1.4em;
	height: 1.05em;
	min-width: 18px;
	min-height: 13.5px;
	object-fit: cover;
	border-radius: 2px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.ait180d-show-flag .ait180d-flag {
	width: 1.7em;
	height: 1.275em;
}

.ait180d-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---- Side by side ---------------------------------------------------- */
.ait180d-switcher--inline {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.3em 0.9em;
}

.ait180d-switcher--inline li {
	display: inline-flex;
	align-items: center;
}

/* Text links */
.ait180d-look-text a {
	opacity: 0.72;
}

.ait180d-look-text a:hover,
.ait180d-look-text a:focus-visible,
.ait180d-look-text .is-current a {
	opacity: 1;
	color: var(--ait-sw-ac, inherit);
}

.ait180d-look-text .is-current a {
	font-weight: 600;
}

.ait180d-look-text.ait180d-switcher--inline a {
	padding: 0.15em 0;
}

/* Separators (text look only) */
.ait180d-sep-slash,
.ait180d-sep-pipe,
.ait180d-sep-dot {
	gap: 0.3em 0;
}

.ait180d-look-text.ait180d-sep-slash li + li::before,
.ait180d-look-text.ait180d-sep-pipe li + li::before,
.ait180d-look-text.ait180d-sep-dot li + li::before {
	margin-inline: 0.55em;
	opacity: 0.45;
}

.ait180d-look-text.ait180d-sep-slash li + li::before {
	content: "/";
}

.ait180d-look-text.ait180d-sep-pipe li + li::before {
	content: "|";
}

.ait180d-look-text.ait180d-sep-dot li + li::before {
	content: "·";
	font-weight: 700;
}

/* Buttons */
.ait180d-look-buttons.ait180d-switcher--inline {
	gap: 0.4em;
}

.ait180d-look-buttons a,
.ait180d-look-buttons > summary {
	padding: 0.42em 0.85em;
	background: var(--ait-sw-bg, rgba(127, 127, 127, 0.12));
	border: 1px solid var(--ait-sw-bd, transparent);
}

.ait180d-look-buttons.ait180d-show-flag a,
.ait180d-look-buttons.ait180d-show-flag > summary {
	padding: 0.42em 0.6em;
}

.ait180d-look-buttons a:hover,
.ait180d-look-buttons a:focus-visible,
.ait180d-look-buttons .is-current a {
	color: var(--ait-sw-ac, inherit);
	background: var(--ait-sw-abg, rgba(127, 127, 127, 0.26));
	border-color: var(--ait-sw-abg, var(--ait-sw-bd, transparent));
}

.ait180d-look-buttons .is-current a {
	font-weight: 600;
}

/* ---- Dropdown --------------------------------------------------------- */
.ait180d-switcher--dropdown {
	position: relative;
	display: inline-block;
}

.ait180d-switcher--dropdown > summary {
	cursor: pointer;
	list-style: none;
	user-select: none;
}

.ait180d-switcher--dropdown > summary::-webkit-details-marker {
	display: none;
}

.ait180d-switcher--dropdown > summary::after {
	content: "";
	flex: none;
	width: 0.45em;
	height: 0.45em;
	margin-inline-start: 0.15em;
	margin-top: -0.2em;
	/* Physical sides on purpose: the arrow points down in right-to-left pages too. */
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.15s ease;
	opacity: 0.7;
}

.ait180d-switcher--dropdown[open] > summary::after {
	margin-top: 0.15em;
	transform: rotate(-135deg);
}

.ait180d-look-text.ait180d-switcher--dropdown > summary {
	padding: 0.3em 0.1em;
}

.ait180d-switcher--dropdown > ul {
	position: absolute;
	inset-inline-start: 0;
	top: calc(100% + 6px);
	z-index: 9999;
	min-width: 100%;
	padding: 0.3em;
	/* The open list is a white panel unless a background is chosen; the text colour chosen for the
	   button (which may be white, for a dark header) is only reused together with that background. */
	background: var(--ait-sw-bg, #fff);
	color: var(--ait-sw-pc, #1b0f0d);
	border: 1px solid var(--ait-sw-bd, rgba(0, 0, 0, 0.08));
	border-radius: var(--ait-sw-r, 8px);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
}

.ait180d-switcher--dropdown > ul li {
	display: block;
}

.ait180d-switcher--dropdown > ul a {
	display: flex;
	padding: 0.5em 0.75em;
	opacity: 1;
	background: transparent;
	border: 0;
	border-radius: calc(var(--ait-sw-r, 8px) * 0.6);
}

.ait180d-switcher--dropdown > ul a:hover,
.ait180d-switcher--dropdown > ul a:focus-visible {
	color: var(--ait-sw-pac, inherit);
	background: var(--ait-sw-abg, rgba(127, 127, 127, 0.14));
}

/* Flags inside theme menus (the "Language switcher" menu item) */
.ait180d-lang-item > a {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
}

/* ---- Touch screens: comfortable targets -------------------------------- */
@media (pointer: coarse) {
	.ait180d-look-buttons a,
	.ait180d-look-buttons > summary {
		min-height: 40px;
	}

	.ait180d-look-text.ait180d-switcher--inline a {
		padding-block: 0.5em;
	}

	.ait180d-switcher--dropdown > ul a {
		padding-block: 0.7em;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ait180d-switcher a,
	.ait180d-switcher > summary,
	.ait180d-switcher--dropdown > summary::after {
		transition: none;
	}
}
