/* INI Translator — language switcher.
 * Layout comes from CSS only: the markup is the same for every visitor. */

.initr-switcher {
	--initr-sw-bg: #ffffff;
	--initr-sw-bg-hover: #f0f0f1;
	--initr-sw-text: #1d2327;
	--initr-sw-text-hover: #1d2327;
	--initr-sw-border: #c3c4c7;
	--initr-sw-border-width: 1px;
	--initr-sw-radius: 6px;
	--initr-sw-gap: 0.4em;
	--initr-sw-pad: 0.35em 0.7em;
	--initr-sw-focus: #2271b1;
	position: relative;
	display: inline-block;
	font-size: 14px;
	line-height: 1.4;
	color: var(--initr-sw-text);
	text-align: start;
}

.initr-switcher.initr-preset-dark {
	--initr-sw-bg: #1d2327;
	--initr-sw-bg-hover: #2c3338;
	--initr-sw-text: #f0f0f1;
	--initr-sw-text-hover: #ffffff;
	--initr-sw-border: #1d2327;
	--initr-sw-focus: #72aee6;
}

.initr-switcher.initr-preset-border {
	--initr-sw-bg: transparent;
	--initr-sw-bg-hover: rgba(0, 0, 0, 0.05);
	--initr-sw-text: inherit;
	--initr-sw-text-hover: inherit;
	--initr-sw-border: currentColor;
}

.initr-switcher.initr-preset-transparent {
	--initr-sw-bg: transparent;
	--initr-sw-bg-hover: transparent;
	--initr-sw-text: inherit;
	--initr-sw-text-hover: inherit;
	--initr-sw-border: transparent;
	--initr-sw-border-width: 0px;
}

.initr-switcher.initr-size-large {
	font-size: 16px;
	--initr-sw-pad: 0.5em 0.9em;
}

.initr-switcher .initr-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;
}

.initr-switcher ul.initr-switcher__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.initr-switcher .initr-switcher__toggle,
.initr-switcher .initr-switcher__link {
	display: flex;
	align-items: center;
	gap: var(--initr-sw-gap);
	padding: var(--initr-sw-pad);
	margin: 0;
	font: inherit;
	color: var(--initr-sw-text);
	text-decoration: none;
	background: var(--initr-sw-bg);
	border: 0;
	border-radius: 0;
	cursor: pointer;
	white-space: nowrap;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
}

.initr-switcher .initr-switcher__toggle {
	width: 100%;
	border: var(--initr-sw-border-width) solid var(--initr-sw-border);
	border-radius: var(--initr-sw-radius);
}

.initr-switcher .initr-switcher__toggle:hover,
.initr-switcher .initr-switcher__link:hover,
.initr-switcher .initr-switcher__link:focus {
	background: var(--initr-sw-bg-hover);
	color: var(--initr-sw-text-hover);
}

.initr-switcher .initr-switcher__toggle:focus-visible,
.initr-switcher .initr-switcher__link:focus-visible {
	outline: 2px solid var(--initr-sw-focus);
	outline-offset: 1px;
}

.initr-switcher .initr-switcher__caret {
	width: 0.45em;
	height: 0.45em;
	margin-inline-start: auto;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-25%) rotate(45deg);
	transition: transform 0.15s ease;
}

/* Flags: corner radius, outline and size come from custom properties whose fallbacks are the defaults
 * (2 px, a faint line, the switcher's size). The site's own values are in the inline style (on
 * .initr-switcher and .initr-menu-item); a single switcher's are the initr-flag-* classes below and, for
 * the outline colour, a style attribute. The outline is a ring (box-shadow): it takes no space. */
.initr-switcher .initr-flag {
	display: block;
	flex: none;
	width: var(--initr-flag-w, 20px);
	height: var(--initr-flag-h, 15px);
	object-fit: cover;
	border-radius: var(--initr-flag-radius, 2px);
	box-shadow: var(--initr-flag-shadow, 0 0 0 1px rgba(0, 0, 0, var(--initr-flag-line-alpha, 0.08)));
	margin: 0;
}

.initr-switcher .initr-flag--square,
.initr-switcher .initr-flag--round {
	width: var(--initr-flag-sq, 16px);
	height: var(--initr-flag-sq, 16px);
}

.initr-switcher .initr-flag--round {
	border-radius: 50%;
}

.initr-switcher.initr-size-large .initr-flag {
	width: var(--initr-flag-w, 24px);
	height: var(--initr-flag-h, 18px);
}

.initr-switcher.initr-size-large .initr-flag--square,
.initr-switcher.initr-size-large .initr-flag--round {
	width: var(--initr-flag-sq, 20px);
	height: var(--initr-flag-sq, 20px);
}

/* One switcher's own flag style (INITR_Switcher::flag_vars()). */
.initr-switcher.initr-flag-radius-none { --initr-flag-radius: 0px; }
.initr-switcher.initr-flag-radius-slight { --initr-flag-radius: 2px; }
.initr-switcher.initr-flag-radius-rounded { --initr-flag-radius: 4px; }
.initr-switcher.initr-flag-outline-none { --initr-flag-shadow: none; }
.initr-switcher.initr-flag-outline-faint { --initr-flag-shadow: initial; --initr-flag-line-strength: 9%; --initr-flag-line-alpha: 0.08; }
.initr-switcher.initr-flag-outline-strong { --initr-flag-shadow: initial; --initr-flag-line-strength: 35%; --initr-flag-line-alpha: 0.35; }
.initr-switcher.initr-flag-size-auto { --initr-flag-w: initial; --initr-flag-h: initial; --initr-flag-sq: initial; }
.initr-switcher.initr-flag-size-small { --initr-flag-w: 16px; --initr-flag-h: 12px; --initr-flag-sq: 14px; }
.initr-switcher.initr-flag-size-medium { --initr-flag-w: 20px; --initr-flag-h: 15px; --initr-flag-sq: 16px; }
.initr-switcher.initr-flag-size-large { --initr-flag-w: 24px; --initr-flag-h: 18px; --initr-flag-sq: 20px; }

.initr-switcher .initr-switcher__draft {
	font-size: 0.75em;
	padding: 0 0.35em;
	border-radius: 3px;
	background: #f0c33c;
	color: #1d2327;
}

/* Dropdown */
.initr-switcher--dropdown .initr-switcher__list {
	position: absolute;
	inset-inline-start: 0;
	top: 100%;
	z-index: 99999;
	min-width: 100%;
	background: var(--initr-sw-bg);
	border: var(--initr-sw-border-width) solid var(--initr-sw-border);
	border-radius: var(--initr-sw-radius);
	overflow: hidden;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
	visibility: hidden;
	opacity: 0;
	transform: translateY(-4px);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
}

.initr-switcher--dropdown.is-open .initr-switcher__list,
.initr-switcher--dropdown.initr-open-hover:not(.is-closed):hover .initr-switcher__list,
.initr-switcher--dropdown:not(.initr-js):focus-within .initr-switcher__list {
	visibility: visible;
	opacity: 1;
	transform: none;
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
}

.initr-switcher--dropdown.is-open .initr-switcher__caret {
	transform: translateY(15%) rotate(225deg);
}

.initr-switcher--dropdown .initr-switcher__item.is-current .initr-switcher__link {
	font-weight: 600;
}

/* Side by side */
.initr-switcher--inline .initr-switcher__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em;
}

.initr-switcher--inline .initr-switcher__link,
.initr-switcher--opposite .initr-switcher__link {
	border: var(--initr-sw-border-width) solid var(--initr-sw-border);
	border-radius: var(--initr-sw-radius);
}

.initr-switcher--inline .is-current .initr-switcher__link {
	font-weight: 600;
	background: var(--initr-sw-bg-hover);
}

/* Floating */
.initr-switcher.initr-floating {
	position: fixed;
	z-index: 99998;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
	border-radius: var(--initr-sw-radius);
}

.initr-floating.initr-pos-bottom-right { right: 16px; bottom: 16px; }
.initr-floating.initr-pos-bottom-left { left: 16px; bottom: 16px; }
.initr-floating.initr-pos-top-right { right: 16px; top: calc(16px + var(--wp-admin--admin-bar--height, 0px)); }
.initr-floating.initr-pos-top-left { left: 16px; top: calc(16px + var(--wp-admin--admin-bar--height, 0px)); }

.initr-floating.initr-pos-bottom-right .initr-switcher__list,
.initr-floating.initr-pos-bottom-left .initr-switcher__list {
	top: auto;
	bottom: 100%;
	transform: translateY(4px);
}

.initr-floating.initr-pos-bottom-right.is-open .initr-switcher__list,
.initr-floating.initr-pos-bottom-left.is-open .initr-switcher__list {
	transform: none;
}

.initr-floating.initr-pos-bottom-right .initr-switcher__caret,
.initr-floating.initr-pos-bottom-left .initr-switcher__caret {
	transform: translateY(15%) rotate(225deg);
}

.initr-floating.initr-pos-bottom-right.is-open .initr-switcher__caret,
.initr-floating.initr-pos-bottom-left.is-open .initr-switcher__caret {
	transform: translateY(-25%) rotate(45deg);
}

/* Narrow screens: a smaller floating switcher, closer to the edge. */
@media (max-width: 600px) {
	.initr-switcher.initr-floating {
		font-size: 13px;
	}
	.initr-floating.initr-pos-bottom-right { right: 8px; bottom: 8px; }
	.initr-floating.initr-pos-bottom-left { left: 8px; bottom: 8px; }
	.initr-floating.initr-pos-top-right { right: 8px; }
	.initr-floating.initr-pos-top-left { left: 8px; }
}

/* Menus: the theme styles the links. */
.initr-menu-item > a {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
}

.initr-menu-item .initr-flag {
	display: inline-block;
	width: var(--initr-flag-w, 20px);
	height: var(--initr-flag-h, 15px);
	object-fit: cover;
	vertical-align: middle;
	border-radius: var(--initr-flag-radius, 2px);
	box-shadow: var(--initr-flag-shadow, 0 0 0 1px rgba(0, 0, 0, var(--initr-flag-line-alpha, 0.08)));
}

.initr-menu-item .initr-flag--square,
.initr-menu-item .initr-flag--round {
	width: var(--initr-flag-sq, 16px);
	height: var(--initr-flag-sq, 16px);
}

.initr-menu-item .initr-flag--round {
	border-radius: 50%;
}

/* The outline's colour: the text colour (currentColor) at the outline's strength, or the chosen colour at
 * that strength. Browsers without color-mix() keep the black line above. */
@supports (color: color-mix(in srgb, red 50%, transparent)) {
	.initr-switcher .initr-flag,
	.initr-menu-item .initr-flag {
		box-shadow: var(--initr-flag-shadow, 0 0 0 1px color-mix(in srgb, var(--initr-flag-line-color, currentColor) var(--initr-flag-line-strength, 9%), transparent));
	}
}

/* Inside a Navigation block */
.wp-block-navigation .initr-switcher {
	font-size: inherit;
}

.initr-switcher.initr-no-anim *,
.initr-switcher.initr-no-anim .initr-switcher__list {
	transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
	.initr-switcher *,
	.initr-switcher .initr-switcher__list {
		transition: none !important;
	}
}
