/* wp_transl – compact language switcher, menu-safe on desktop and mobile */

.wpt-flags {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	line-height: 1;
}

.wpt-flags a {
	display: inline-flex;
	align-items: center;
	padding: 2px;
	line-height: 1;
	text-decoration: none;
	opacity: .55;
	transition: opacity .15s ease, transform .15s ease;
}

.wpt-flags a:hover,
.wpt-flags a:focus {
	opacity: 1;
	transform: translateY(-1px);
}

.wpt-flags a.is-active {
	opacity: 1;
}

.wpt-flags img {
	display: block;
	width: 18px;
	height: 12px;
	object-fit: cover;
}

/* Floating positions. They never sit above the navigation on small screens. */
.wpt-top-bar {
	position: fixed;
	top: 0;
	right: 12px;
	z-index: 9999;
	padding: 4px 6px;
	background: rgba(255, 255, 255, .94);
	border-radius: 0 0 6px 6px;
	box-shadow: 0 1px 6px rgba(0, 0, 0, .14);
}

.wpt-side {
	position: fixed;
	top: 50%;
	right: 0;
	z-index: 9999;
	transform: translateY(-50%);
	padding: 7px 5px;
	background: rgba(255, 255, 255, .95);
	border: 1px solid #dcdcde;
	border-right: 0;
	border-radius: 8px 0 0 8px;
	box-shadow: -1px 0 8px rgba(0, 0, 0, .12);
}

.wpt-side .wpt-flags {
	flex-direction: column;
	gap: 9px;
}

.wpt-bottom {
	position: fixed;
	left: 50%;
	bottom: 12px;
	z-index: 9999;
	transform: translateX(-50%);
	padding: 6px 10px;
	background: rgba(255, 255, 255, .95);
	border: 1px solid #dcdcde;
	border-radius: 999px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .14);
}

/* List output from the [wp_transl_lang_switcher] shortcode. */
.wpt-switcher {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 14px;
	line-height: 1.4;
}

.wpt-switcher li {
	display: inline-block;
	margin: 0 8px 4px 0;
}

.wpt-switcher a {
	text-decoration: none;
	color: currentColor;
	opacity: .75;
}

.wpt-switcher li.is-active a {
	opacity: 1;
	font-weight: 700;
}

.wpt-switcher .wpt-flag,
.wpt-switcher .wpt-name {
	display: inline-block;
	vertical-align: middle;
}

.wpt-switcher .wpt-flag img {
	width: 18px;
	height: 12px;
}

/* The switcher as the last item of the existing navigation. */
.wpt-menu-item {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	list-style: none;
}

.wpt-menu-item .wpt-flags {
	margin-left: 12px;
	gap: 6px;
}

.wpt-menu-item .wpt-flags a {
	padding: 3px;
}

/* Dropdown variant: native <details>, keyboard- and touch-friendly. */
.wpt-menu-item--dropdown {
	position: relative;
}

.wpt-lang-dropdown {
	position: relative;
	display: inline-flex;
	align-items: center;
	font-size: 13px;
	line-height: 1;
}

.wpt-lang-summary {
	display: inline-flex;
	align-items: center;
	margin-left: 12px;
	cursor: pointer;
	list-style: none;
	text-decoration: none;
}

.wpt-lang-summary::-webkit-details-marker {
	display: none;
}

.wpt-current-flag img {
	display: block;
	width: 20px;
	height: 14px;
}

.wpt-lang-panel {
	display: none;
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	min-width: 170px;
	z-index: 10000;
	padding: 5px;
	background: #fff;
	color: #1d2327;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .16);
}

/* Our panels have a light background: keep their text dark in every theme. */
html body .wpt-top-bar,
html body .wpt-side,
html body .wpt-bottom,
html body .wpt-lang-panel,
html body .wpt-lang-dropdown,
html body .wpt-lang-summary,
html body .wpt-switcher,
html body .wpt-switcher a,
html body .wpt-switcher a.is-active,
html body .wpt-switcher li.is-active a,
html body .wpt-name,
html body .wpt-flags a,
html body .wpt-lang-panel .wpt-switcher a,
html body .wpt-lang-panel .wpt-switcher a.is-active,
html body .wpt-lang-panel .wpt-switcher li.is-active a {
	color: #1d2327 !important;
}

/* Tablet and mobile themes often apply their own link colors in media
   queries. Repeat the same dark value there so desktop, tablet, mobile and
   plain browser views all stay identical. */
@media (max-width: 1024px) {
	html body .wpt-top-bar,
	html body .wpt-side,
	html body .wpt-bottom,
	html body .wpt-lang-panel,
	html body .wpt-lang-dropdown,
	html body .wpt-lang-summary,
	html body .wpt-switcher,
	html body .wpt-switcher a,
	html body .wpt-switcher a.is-active,
html body .wpt-switcher li.is-active a,
	html body .wpt-name,
	html body .wpt-flags a,
	html body .wpt-lang-panel .wpt-switcher a,
	html body .wpt-lang-panel .wpt-switcher a.is-active,
html body .wpt-lang-panel .wpt-switcher li.is-active a {
		color: #1d2327 !important;
	}
}

/* Use the same visual language as menu submenus. The extra `sub-menu` class
   lets a theme's existing submenu rules apply where available; our defaults
   keep the widget readable when the theme has no such rules. */
html body .wpt-lang-dropdown > .wpt-lang-panel.sub-menu {
	display: none;
	margin: 0;
	transform-origin: top right;
}

html body .wpt-lang-dropdown[open] > .wpt-lang-panel.sub-menu {
	display: block !important;
	animation: wpt-submenu-open .16s ease-out both;
}

html body .wpt-lang-dropdown.wpt-closing > .wpt-lang-panel.sub-menu {
	animation: wpt-submenu-close .14s ease-in both;
}

@keyframes wpt-submenu-open {
	from { opacity: 0; transform: translateY(-6px) scale(.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes wpt-submenu-close {
	from { opacity: 1; transform: translateY(0) scale(1); }
	to   { opacity: 0; transform: translateY(-6px) scale(.98); }
}

.wpt-lang-panel .wpt-switcher {
	margin: 0;
	padding: 0;
}

.wpt-lang-panel .wpt-switcher li {
	display: block;
	margin: 0;
}

.wpt-lang-panel .wpt-switcher a {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	border-radius: 4px;
	opacity: 1;
}

.wpt-lang-panel .wpt-switcher a:hover,
.wpt-lang-panel .wpt-switcher a:focus {
	background: #f0f0f1;
}

.wpt-lang-panel .wpt-switcher a.is-active {
	background: #f0f0f1;
}

.wpt-lang-panel img {
	display: block;
	width: 20px;
	height: 14px;
	object-fit: cover;
}

/* Small screens: no floating element may cover the menu. */
@media (max-width: 782px) {
	.wpt-top-bar,
	.wpt-side {
		top: auto;
		bottom: 10px;
		right: 10px;
		transform: none;
		padding: 6px 8px;
		border: 1px solid #dcdcde;
		border-radius: 999px;
	}

	.wpt-top-bar .wpt-flags,
	.wpt-side .wpt-flags {
		flex-direction: row;
		gap: 2px;
	}

	.wpt-top-bar .wpt-flags a,
	.wpt-side .wpt-flags a {
		padding: 6px;
	}

	.wpt-top-bar .wpt-flags img,
	.wpt-side .wpt-flags img {
		width: 24px;
		height: 16px;
	}

	.wpt-bottom {
		bottom: 10px;
		max-width: calc(100% - 20px);
	}

	/* Menu variants keep the same breathing room on small screens. */
	.wpt-menu-item .wpt-flags {
		margin-top: 4px;
		margin-left: 10px;
		gap: 8px;
	}

	.wpt-menu-item .wpt-flags a {
		padding: 4px;
	}

	.wpt-lang-summary {
		margin-top: 4px;
		margin-left: 10px;
	}

	.wpt-current-flag img,
	.wpt-lang-panel img {
		width: 22px;
		height: 15px;
	}

	.wpt-lang-panel,
	html body .wpt-lang-dropdown > .wpt-lang-panel.sub-menu {
		position: fixed;
		left: auto;
		right: 12px;
		top: auto;
		bottom: 16px;
		width: max-content;
		min-width: 170px;
		max-width: calc(100vw - 24px);
		max-height: 70vh;
		overflow: auto;
		transform-origin: bottom right;
	}

	/* Same dark text style as desktop/tablet, even with theme overrides. */
	html body .wpt-top-bar,
	html body .wpt-side,
	html body .wpt-bottom,
	html body .wpt-lang-panel,
	html body .wpt-lang-dropdown,
	html body .wpt-lang-summary,
	html body .wpt-switcher,
	html body .wpt-switcher a,
	html body .wpt-switcher a.is-active,
html body .wpt-switcher li.is-active a,
	html body .wpt-name,
	html body .wpt-flags a,
	html body .wpt-lang-panel .wpt-switcher a,
	html body .wpt-lang-panel .wpt-switcher a.is-active,
html body .wpt-lang-panel .wpt-switcher li.is-active a {
		color: #1d2327 !important;
	}
}

/* Hidden translation trigger. Only our own wrapper is hidden. */
.wpt-hidden-widget,
.wpt-hidden-widget .gtranslate_wrapper {
	display: none !important;
}
