/**
 * Language switcher — theme-first styling.
 *
 * Typography and colors inherit from the surrounding theme (currentColor /
 * font:inherit). Tune per-site via the custom properties below, e.g.:
 *   .ekl-switcher { --ekl-sw-panel-bg:#0b1f3a; --ekl-sw-radius:10px; }
 * Switcher designs inject the same variables inline on the root element.
 * RTL-safe: logical properties only (no left/right).
 */

.ekl-switcher {
	--ekl-sw-gap: .5em;
	--ekl-sw-radius: 6px;
	--ekl-sw-pad-y: .35em;
	--ekl-sw-pad-x: .75em;
	--ekl-sw-panel-bg: #fff;
	--ekl-sw-panel-color: inherit;
	--ekl-sw-panel-border: 1px solid rgba(0, 0, 0, .12);
	--ekl-sw-panel-shadow: 0 6px 24px rgba(0, 0, 0, .12);
	--ekl-sw-item-color: inherit;
	--ekl-sw-item-hover-bg: rgba(0, 0, 0, .06);
	--ekl-sw-item-active-color: inherit;
	--ekl-sw-toggle-color: inherit;
	--ekl-sw-active-weight: 700;
	--ekl-sw-active-opacity: .7;
	--ekl-sw-globe-size: 1.25em;
	--ekl-sw-group-color: inherit;
	--ekl-sw-group-size: .75em;
	--ekl-sw-group-border: 1px solid rgba(0, 0, 0, .08);
}

/* ---- colour schemes ----
   Default (auto) inherits the theme. These name the background the switcher
   sits ON: --scheme-dark for a dark header, --scheme-light for a white one.
   A design's own colours are inline on the same element, so they still win. */
.ekl-switcher--scheme-light {
	--ekl-sw-toggle-color: #111827;
	--ekl-sw-panel-bg: #fff;
	--ekl-sw-panel-color: #111827;
	--ekl-sw-panel-border: 1px solid rgba(0, 0, 0, .12);
	--ekl-sw-panel-shadow: 0 6px 24px rgba(0, 0, 0, .12);
	--ekl-sw-item-color: #111827;
	--ekl-sw-item-hover-bg: rgba(0, 0, 0, .06);
	--ekl-sw-item-active-color: #111827;
	--ekl-sw-group-color: #111827;
	--ekl-sw-group-border: 1px solid rgba(0, 0, 0, .08);
}

.ekl-switcher--scheme-dark {
	--ekl-sw-toggle-color: #fff;
	--ekl-sw-panel-bg: #111827;
	--ekl-sw-panel-color: #fff;
	--ekl-sw-panel-border: 1px solid rgba(255, 255, 255, .16);
	--ekl-sw-panel-shadow: 0 6px 24px rgba(0, 0, 0, .35);
	--ekl-sw-item-color: #fff;
	--ekl-sw-item-hover-bg: rgba(255, 255, 255, .12);
	--ekl-sw-item-active-color: #fff;
	--ekl-sw-group-color: #fff;
	--ekl-sw-group-border: 1px solid rgba(255, 255, 255, .14);
}

/* ---- shared item bits ---- */
.ekl-switcher__item {
	color: var(--ekl-sw-item-color);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: .35em;
}

.ekl-switcher__item.is-active {
	color: var(--ekl-sw-item-active-color);
	font-weight: var(--ekl-sw-active-weight);
	opacity: var(--ekl-sw-active-opacity);
}

.ekl-switcher__flag {
	line-height: 1;
	display: inline-flex;
	align-items: center;
}

.ekl-switcher__flag-img {
	display: block;
	width: 1.25em;
	height: auto;
	max-height: 1em;
	object-fit: cover;
	border-radius: 2px;
}

.ekl-switcher__sep {
	white-space: pre;
}

/* ---- list ---- */
.ekl-switcher--list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: var(--ekl-sw-gap);
}

/* ---- pills ---- */
.ekl-switcher--pills .ekl-switcher__items {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: var(--ekl-sw-gap);
}

.ekl-switcher--pills .ekl-switcher__item {
	padding: var(--ekl-sw-pad-y) var(--ekl-sw-pad-x);
	border: 1px solid currentColor;
	border-radius: 999px;
}

.ekl-switcher--pills .ekl-switcher__item.is-active {
	opacity: 1;
}

/* ---- dropdown (native select) ---- */
select.ekl-switcher--dropdown {
	font: inherit;
	color: inherit;
}

/* ---- popover ---- */
.ekl-switcher--popover {
	position: relative;
	display: inline-block;
}

.ekl-switcher--popover .ekl-switcher__toggle {
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	font: inherit;
	color: var(--ekl-sw-toggle-color);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: .35em;
}

/* The icons are line art in currentColor. Themes that style bare `path` /
   `circle` selectors would beat the SVG's own inherited fill, so pin it. */
.ekl-switcher__globe,
.ekl-switcher__chevron,
.ekl-switcher__check,
.ekl-switcher__globe :is(circle, path),
.ekl-switcher__chevron path,
.ekl-switcher__check path {
	fill: none;
	stroke: currentColor;
}

.ekl-switcher__globe {
	flex: none;
	width: var(--ekl-sw-globe-size);
	height: var(--ekl-sw-globe-size);
}

.ekl-switcher__chevron {
	flex: none;
	transition: transform .15s ease;
}

/* Marks the current locale in the panel — the globe trigger doesn't name it. */
.ekl-switcher__check {
	flex: none;
	margin-inline-start: auto;
	padding-inline-start: 1em;
}

.ekl-switcher__toggle[aria-expanded="true"] .ekl-switcher__chevron {
	transform: rotate(180deg);
}

.ekl-switcher--popover .ekl-switcher__panel {
	position: absolute;
	top: 100%;
	inset-inline-start: 0;
	/* width (not min-width) so max-width can clamp it on narrow screens;
	   switcher.js nudges it back in when it would overhang the window. */
	width: max-content;
	max-width: calc(100vw - 1rem);
	margin: .25em 0 0;
	padding: .25em 0;
	list-style: none;
	background: var(--ekl-sw-panel-bg);
	color: var(--ekl-sw-panel-color);
	border: var(--ekl-sw-panel-border);
	border-radius: var(--ekl-sw-radius);
	box-shadow: var(--ekl-sw-panel-shadow);
	z-index: 9999;
}

.ekl-switcher--popover .ekl-switcher__panel li {
	margin: 0;
}

.ekl-switcher--popover .ekl-switcher__panel .ekl-switcher__item {
	display: flex;
	padding: var(--ekl-sw-pad-y) var(--ekl-sw-pad-x);
}

.ekl-switcher--popover .ekl-switcher__panel a.ekl-switcher__item:hover,
.ekl-switcher--popover .ekl-switcher__panel a.ekl-switcher__item:focus-visible {
	background: var(--ekl-sw-item-hover-bg);
}

/* ---- popover grouped by market ---- */
.ekl-switcher__trigger-market {
	opacity: .7;
}

.ekl-switcher__trigger-market::after {
	content: "\00b7";
	margin-inline-start: .35em;
}

.ekl-switcher--popover .ekl-switcher__panel--grouped {
	padding: .5em 0;
}

.ekl-switcher__group + .ekl-switcher__group {
	margin-block-start: .5em;
	padding-block-start: .5em;
	border-block-start: var(--ekl-sw-group-border);
}

.ekl-switcher__group-label {
	display: block;
	padding: .25em var(--ekl-sw-pad-x);
	color: var(--ekl-sw-group-color);
	font-size: var(--ekl-sw-group-size);
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	opacity: .65;
}

.ekl-switcher__group-items {
	list-style: none;
	margin: 0;
	padding: 0;
}
