/* ──────────────────────────────────────────────
   SIA Translate — language switcher (front-end)
   Scoped .sia-tr-* so it can't collide with theme
   classes (.ct-* Blocksy / .wd-* WoodMart /
   .elementor-*). System fonts only.
   ────────────────────────────────────────────── */

.sia-tr-switcher,
.sia-tr-switcher * {
	box-sizing: border-box;
}
.sia-tr-switcher {
	--sia-tr-bg: #ffffff;
	--sia-tr-text: #1f2937;
	--sia-tr-border: rgba(0, 0, 0, 0.12);
	--sia-tr-hover: rgba(0, 0, 0, 0.05);
	--sia-tr-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
	display: inline-block;
	position: relative;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1;
	max-width: 100%;
}
.sia-tr-switcher.sia-tr-theme-dark {
	--sia-tr-bg: #111827;
	--sia-tr-text: #f9fafb;
	--sia-tr-border: rgba(255, 255, 255, 0.14);
	--sia-tr-hover: rgba(255, 255, 255, 0.08);
	--sia-tr-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* Toggle palette — the pill sits ON a surface rather than being one, so it
   needs its own translucent tokens instead of the solid --sia-tr-bg. */
.sia-tr-switcher--toggle {
	--sia-tr-pill-bg: rgba(0, 0, 0, 0.05);
	--sia-tr-pill-border: rgba(0, 0, 0, 0.12);
	--sia-tr-pill-text: #4b5563;
	--sia-tr-pill-on-bg: #111827;
	--sia-tr-pill-on-text: #ffffff;
}
.sia-tr-switcher--toggle.sia-tr-theme-dark {
	--sia-tr-pill-bg: rgba(255, 255, 255, 0.08);
	--sia-tr-pill-border: rgba(255, 255, 255, 0.14);
	--sia-tr-pill-text: rgb(201, 203, 232);
	--sia-tr-pill-on-bg: #ffffff;
	--sia-tr-pill-on-text: rgb(40, 42, 113);
}

/* Visually hidden but still announced — themes can't be trusted to ship
   .screen-reader-text, so the switcher carries its own. */
.sia-tr-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* SVG flag, or the lettered badge when we ship no file for that country. The
   pack draws each flag centred inside a square canvas, so a square box keeps
   every flag at its own aspect ratio instead of squashing it. */
.sia-tr-flag {
	width: 20px;
	height: 20px;
	line-height: 1;
	flex-shrink: 0;
	display: inline-block;
	vertical-align: middle;
}
.sia-tr-flag--badge {
	width: auto;
	min-width: 20px;
	height: 14px;
	padding: 0 3px;
	border-radius: 3px;
	background: var(--sia-tr-hover);
	color: var(--sia-tr-text);
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-align: center;
	line-height: 14px;
	opacity: 0.8;
}
.sia-tr-menu-flag {
	width: 18px;
	height: 18px;
	margin-right: 6px;
	display: inline-block;
	vertical-align: middle;
	flex-shrink: 0;
}
.sia-tr-name {
	white-space: nowrap;
}

/* ─── Dropdown ─── */
.sia-tr-current {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	margin: 0;
	background: var(--sia-tr-bg);
	color: var(--sia-tr-text);
	border: 1px solid var(--sia-tr-border);
	border-radius: 999px;
	cursor: pointer;
	font: inherit;
	transition: background 0.15s;
	position: relative;
}
/* Anti-illusion 1px inner outline (SIA design rule 6). */
.sia-tr-current::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	pointer-events: none;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.sia-tr-current:hover {
	background: color-mix(in srgb, var(--sia-tr-bg) 92%, var(--sia-tr-text));
}
.sia-tr-caret {
	transition: transform 0.15s;
	opacity: 0.65;
}
.sia-tr-switcher.is-open .sia-tr-caret {
	transform: rotate(180deg);
}

.sia-tr-switcher--dropdown .sia-tr-list {
	position: absolute;
	left: 0;
	min-width: 100%;
	margin: 6px 0 0;
	padding: 5px;
	list-style: none;
	background: var(--sia-tr-bg);
	color: var(--sia-tr-text);
	border: 1px solid var(--sia-tr-border);
	border-radius: 12px;
	box-shadow: var(--sia-tr-shadow);
	z-index: 9990;
}
.sia-tr-drop-up .sia-tr-list {
	top: auto;
	bottom: calc(100% + 6px);
	margin: 0 0 0;
}
.sia-tr-switcher--dropdown .sia-tr-list li {
	margin: 0;
	padding: 0;
	list-style: none;
}
.sia-tr-switcher--dropdown .sia-tr-link {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 11px;
	border-radius: 8px;
	color: var(--sia-tr-text);
	text-decoration: none;
	white-space: nowrap;
}
.sia-tr-switcher--dropdown .sia-tr-link:hover {
	background: var(--sia-tr-hover);
	color: var(--sia-tr-text);
}

/* ─── Inline list ─── */
.sia-tr-switcher--list ul {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.sia-tr-switcher--list li {
	margin: 0;
	list-style: none;
}
.sia-tr-switcher--list .sia-tr-link {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 7px 11px;
	border-radius: 8px;
	color: inherit;
	text-decoration: none;
	opacity: 0.75;
}
.sia-tr-switcher--list .sia-tr-link:hover {
	opacity: 1;
	background: var(--sia-tr-hover);
}
.sia-tr-switcher--list .sia-tr-link.is-current {
	opacity: 1;
	font-weight: 600;
	background: var(--sia-tr-hover);
}

/* ─── Toggle (segmented pill) ─── */
.sia-tr-switcher--toggle {
	display: inline-flex;
	align-items: center;
	gap: 0;
	padding: 2px;
	border: 1px solid var(--sia-tr-pill-border);
	border-radius: 999px;
	background: var(--sia-tr-pill-bg);
	line-height: 1;
	vertical-align: middle;
}
.sia-tr-switcher--toggle .sia-tr-link {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin: 0;
	padding: 3px 9px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--sia-tr-pill-text);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: 0.04em;
	text-decoration: none;
	transition: background 0.2s ease, color 0.2s ease;
}
.sia-tr-switcher--toggle .sia-tr-link:hover {
	color: var(--sia-tr-pill-on-bg);
	text-decoration: none;
}
.sia-tr-switcher--toggle.sia-tr-theme-dark .sia-tr-link:hover {
	color: var(--sia-tr-pill-on-bg);
}
.sia-tr-switcher--toggle .sia-tr-link.is-current {
	background: var(--sia-tr-pill-on-bg);
	color: var(--sia-tr-pill-on-text);
	cursor: default;
}
.sia-tr-switcher--toggle .sia-tr-flag { width: 16px; height: 16px; }
.sia-tr-switcher--toggle .sia-tr-flag--badge { height: 12px; line-height: 12px; font-size: 8px; }

/* Inside a nav menu the theme's own <li> spacing already positions it. */
.sia-tr-menu-item > .sia-tr-switcher--toggle { margin: 0 8px; }

/* A switcher that is the SOLE content of its wrapper — the header-embed case,
   Blocksy's .ct-header-text > .entry-content being the canonical one — leaves
   the inline line box entirely. As an inline element it rides the text
   baseline, and half-leading pushes it a few px below centre. Mid-sentence
   placements keep the inline behaviour. */
.sia-tr-switcher--toggle:only-child,
.sia-tr-switcher--list:only-child,
.sia-tr-switcher--dropdown:only-child {
	display: flex;
	width: fit-content;
}

/* Blocksy gives its header text element an asymmetric margin on mobile
   (7px 0 -15px on a stock install) — typographic compensation that is right
   for a line of text and wrong by construction for a widget: it shoved the
   pill ~11px below the row's centre. Zeroed only when the element contains
   nothing but our switcher, so real text keeps the theme's spacing.
   (:has() is in every browser that gets WP admin support today; where it
   isn't, the pill is merely a few px low — the pre-fix behaviour.) */
.ct-header-text:has(> .entry-content > .sia-tr-switcher:only-child) {
	margin: 0 !important;
}

/* ─── Floating wrapper ─── */
.sia-tr-floating {
	position: fixed;
	z-index: 9990; /* below WP admin bar (99999) and most modals */
}
.sia-tr-pos-bottom-right { right: 22px; bottom: 22px; }
.sia-tr-pos-bottom-left  { left: 22px;  bottom: 22px; }
.sia-tr-pos-top-right    { right: 22px; top: 22px; }
.sia-tr-pos-top-left     { left: 22px;  top: 22px; }
.admin-bar .sia-tr-pos-top-right,
.admin-bar .sia-tr-pos-top-left { top: 54px; }

.sia-tr-floating .sia-tr-current {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}


@media (max-width: 480px) {
	.sia-tr-pos-bottom-right,
	.sia-tr-pos-bottom-left { bottom: 14px; }
	.sia-tr-pos-bottom-right { right: 14px; }
	.sia-tr-pos-bottom-left { left: 14px; }
}
