/**
 * GTranslate x Obsidian Gallery
 *
 * The integration consumes the theme's public --og-* design tokens and keeps
 * local fallbacks so the switcher remains usable while the theme is loading.
 * Rules are component-scoped to avoid changing unrelated WordPress controls.
 */

:where(.gtranslate_wrapper, [class*="gt_container-"], [class*="gt_raw_link-"]) {
	--gt-bg: var(--og-card, rgba(10, 10, 12, 0.94));
	--gt-bg-solid: var(--og-bg-color, #0b0b0d);
	--gt-bg-hover: color-mix(in srgb, var(--og-accent, #0066cc) 32%, var(--gt-bg-solid));
	--gt-text: var(--og-text, #fff);
	--gt-muted: var(--og-text-muted, #b9bcc2);
	--gt-link: var(--og-link, #7db4ec);
	--gt-accent: var(--og-accent, #0066cc);
	--gt-border: var(--og-border, #3a3d42);
	--gt-hairline: var(--og-card-border, rgba(255, 255, 255, 0.09));
	--gt-radius: var(--og-radius, 10px);
	--gt-radius-sm: var(--og-radius-sm, 6px);
	--gt-shadow: var(--og-shadow, 0 8px 28px rgba(0, 0, 0, 0.4));
	--gt-focus: 0 0 0 3px color-mix(in srgb, var(--gt-accent) 38%, transparent);
	font-family: var(--og-font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
	color: var(--gt-text);
	line-height: 1.45;
}

/* Shared language links and flags ----------------------------------- */

:where(.gtranslate_wrapper, [class*="gt_container-"], [class*="gt_raw_link-"]) a.glink {
	color: var(--gt-link, var(--og-link, #7db4ec)) !important;
	border-radius: var(--gt-radius-sm, var(--og-radius-sm, 6px));
	text-decoration: none !important;
	text-underline-offset: 0.18em;
	transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

:where(.gtranslate_wrapper, [class*="gt_container-"], [class*="gt_raw_link-"]) a.glink:hover {
	color: var(--og-link-hover, #fff) !important;
}

:where(.gtranslate_wrapper, [class*="gt_container-"], [class*="gt_raw_link-"]) a.glink:focus-visible,
:where(.gtranslate_wrapper, [class*="gt_container-"]) :where(.gt-selected, .gt_selected) a:focus-visible,
.gt_white_content a:focus-visible,
.gt_language_search:focus-visible,
.gt_selector:focus-visible,
.gglobe:focus-visible {
	outline: 2px solid var(--og-accent, #0066cc) !important;
	outline-offset: 3px;
	box-shadow: var(--gt-focus, 0 0 0 3px rgba(0, 102, 204, 0.38)) !important;
}

:where(.gtranslate_wrapper, [class*="gt_container-"]) a.glink img,
.gt_white_content a img {
	border: 1px solid rgba(255, 255, 255, 0.16) !important;
	border-radius: 3px;
	box-shadow: 0 2px 7px rgba(0, 0, 0, 0.28);
	opacity: 0.9 !important;
}

:where(.gtranslate_wrapper, [class*="gt_container-"]) a.glink:hover img,
:where(.gtranslate_wrapper, [class*="gt_container-"]) a.glink:focus-visible img,
.gt_white_content a:hover img,
.gt_white_content a:focus-visible img {
	opacity: 1 !important;
}

:where(.gtranslate_wrapper, [class*="gt_container-"]) a.gt-current-lang {
	color: var(--gt-text, var(--og-text, #fff)) !important;
	font-weight: 700;
}

/* Native language selector ----------------------------------------- */

.gt_selector {
	min-width: 12rem;
	min-height: 42px;
	margin: 0;
	padding: 0.62rem 2.45rem 0.62rem 0.8rem;
	border: 1px solid var(--og-border, #3a3d42) !important;
	border-radius: var(--og-radius-sm, 6px) !important;
	color: var(--og-text, #fff) !important;
	background-color: var(--og-card, #111216) !important;
	background-image: linear-gradient(45deg, transparent 50%, var(--og-text-muted, #b9bcc2) 50%), linear-gradient(135deg, var(--og-text-muted, #b9bcc2) 50%, transparent 50%) !important;
	background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50% !important;
	background-repeat: no-repeat !important;
	background-size: 5px 5px, 5px 5px !important;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 14px rgba(0, 0, 0, 0.2) !important;
	font: 600 0.92rem/1.3 var(--og-font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif) !important;
	letter-spacing: 0.01em;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
	transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.gt_selector:hover {
	border-color: color-mix(in srgb, var(--og-accent, #0066cc) 62%, var(--og-border, #3a3d42)) !important;
	background-color: color-mix(in srgb, var(--og-card, #111216) 88%, var(--og-accent, #0066cc)) !important;
}

.gt_selector option {
	color: var(--og-text, #fff);
	background: var(--og-bg-color, #0b0b0d);
}

/* Nice dropdown with flags ----------------------------------------- */

:where(.gtranslate_wrapper, [class*="gt_container-"]) .gt_switcher {
	border: 1px solid var(--og-border, #3a3d42) !important;
	border-radius: var(--og-radius, 10px) !important;
	background: var(--og-card, rgba(10, 10, 12, 0.94)) !important;
	box-shadow: var(--og-shadow, 0 8px 28px rgba(0, 0, 0, 0.35)) !important;
	font-family: var(--og-font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif) !important;
	line-height: 1.4 !important;
	overflow: visible !important;
}

:where(.gtranslate_wrapper, [class*="gt_container-"]) .gt_switcher .gt_selected {
	border-radius: calc(var(--og-radius, 10px) - 1px) !important;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0)), var(--og-card, #111216) !important;
}

:where(.gtranslate_wrapper, [class*="gt_container-"]) .gt_switcher .gt_selected a {
	min-height: 42px;
	padding: 8px 38px 8px 10px !important;
	border: 0 !important;
	border-radius: calc(var(--og-radius, 10px) - 1px) !important;
	color: var(--og-text, #fff) !important;
	font-weight: 700;
	line-height: 24px;
}

:where(.gtranslate_wrapper, [class*="gt_container-"]) .gt_switcher .gt_selected a:hover {
	background: color-mix(in srgb, var(--og-accent, #0066cc) 16%, transparent) !important;
}

:where(.gtranslate_wrapper, [class*="gt_container-"]) .gt_switcher .gt_selected a::after {
	filter: brightness(0) invert(1);
	opacity: 0.72;
}

:where(.gtranslate_wrapper, [class*="gt_container-"]) .gt_switcher .gt_option {
	width: 100% !important;
	border: 1px solid var(--og-border, #3a3d42) !important;
	border-radius: 0 0 var(--og-radius, 10px) var(--og-radius, 10px) !important;
	color: var(--og-text, #fff) !important;
	background: var(--og-bg-color, #0b0b0d) !important;
	box-shadow: 0 18px 34px rgba(0, 0, 0, 0.46) !important;
	box-sizing: border-box !important;
	overscroll-behavior: contain;
}

:where(.gtranslate_wrapper, [class*="gt_container-"]) .gt_switcher .gt_option a {
	min-height: 40px;
	padding: 8px 10px !important;
	color: var(--og-text-muted, #b9bcc2) !important;
	line-height: 24px;
}

:where(.gtranslate_wrapper, [class*="gt_container-"]) .gt_switcher .gt_option a:hover,
:where(.gtranslate_wrapper, [class*="gt_container-"]) .gt_switcher .gt_option a:focus-visible {
	color: var(--og-text, #fff) !important;
	background: color-mix(in srgb, var(--og-accent, #0066cc) 28%, var(--og-bg-color, #0b0b0d)) !important;
}

/* Floating switcher ------------------------------------------------- */

.gt_float_switcher {
	border: 1px solid var(--og-border, #3a3d42) !important;
	border-radius: var(--og-radius, 10px) !important;
	color: var(--og-text, #fff) !important;
	background: var(--og-card, rgba(10, 10, 12, 0.96)) !important;
	box-shadow: var(--og-shadow, 0 8px 28px rgba(0, 0, 0, 0.42)) !important;
	font-family: var(--og-font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif) !important;
	font-size: 0.96rem !important;
	backdrop-filter: blur(14px) saturate(120%);
}

.gt_float_switcher .gt-selected {
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent), var(--og-card, #111216) !important;
}

.gt_float_switcher .gt-selected .gt-current-lang {
	min-height: 44px;
	padding: 9px 12px !important;
	color: var(--og-text, #fff) !important;
}

.gt_float_switcher .gt-selected .gt-current-lang span.gt_float_switcher-arrow {
	filter: brightness(0) invert(1);
	opacity: 0.75;
}

.gt_float_switcher .gt_options {
	background: var(--og-bg-color, #0b0b0d) !important;
	overscroll-behavior: contain;
}

.gt_float_switcher .gt_options a {
	min-height: 40px;
	padding: 9px 12px !important;
	color: var(--og-text-muted, #b9bcc2) !important;
}

.gt_float_switcher .gt_options a:hover,
.gt_float_switcher .gt_options a:focus-visible {
	color: var(--og-text, #fff) !important;
	background: color-mix(in srgb, var(--og-accent, #0066cc) 28%, var(--og-bg-color, #0b0b0d)) !important;
}

/* Popup and searchable popup --------------------------------------- */

.gt_black_overlay {
	background: rgba(0, 0, 0, 0.78) !important;
	opacity: 1 !important;
	backdrop-filter: blur(5px);
}

.gt_white_content {
	padding: 12px 16px !important;
	border: 1px solid var(--og-border, #3a3d42) !important;
	border-radius: var(--og-radius, 10px) !important;
	color: var(--og-text, #fff) !important;
	background: var(--og-card, rgba(10, 10, 12, 0.98)) !important;
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.64), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
	font-family: var(--og-font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif) !important;
	box-sizing: border-box;
	overscroll-behavior: contain;
	backdrop-filter: blur(18px) saturate(120%);
}

.gt_white_content a {
	min-height: 42px;
	padding-inline: 8px !important;
	border-bottom: 1px solid var(--og-card-border, rgba(255, 255, 255, 0.09)) !important;
	border-radius: var(--og-radius-sm, 6px) !important;
	color: var(--og-text-muted, #b9bcc2) !important;
	line-height: 22px !important;
}

.gt_white_content a:hover,
.gt_white_content a:focus-visible,
.gt_white_content a.gt-search-selected {
	color: var(--og-text, #fff) !important;
	background: color-mix(in srgb, var(--og-accent, #0066cc) 28%, var(--og-bg-color, #0b0b0d)) !important;
}

.gt_search {
	position: sticky;
	top: -12px;
	z-index: 2;
	padding: 12px 0 10px !important;
	border-bottom: 1px solid var(--og-border, #3a3d42) !important;
	color: var(--og-text-muted, #b9bcc2) !important;
	background: var(--og-card, #111216) !important;
}

.gt_language_search {
	min-height: 42px;
	padding: 9px 11px !important;
	border: 1px solid var(--og-border, #3a3d42) !important;
	border-radius: var(--og-radius-sm, 6px) !important;
	color: var(--og-text, #fff) !important;
	background: rgba(0, 0, 0, 0.34) !important;
	font-family: inherit;
	caret-color: var(--og-accent, #0066cc);
}

.gt_language_search::placeholder {
	color: var(--og-text-muted, #b9bcc2);
	opacity: 0.82;
}

.gt_language_search:focus {
	border-color: var(--og-accent, #0066cc) !important;
}

.gt_enter_icon {
	color: var(--og-text-muted, #b9bcc2) !important;
}

/* Popup trigger ----------------------------------------------------- */

a.gt_switcher-popup {
	display: inline-flex;
	min-height: 42px;
	align-items: center;
	gap: 0.45rem;
	padding: 0.55rem 0.72rem;
	border: 1px solid var(--og-border, #3a3d42);
	border-radius: var(--og-radius-sm, 6px);
	color: var(--og-text, #fff) !important;
	background: var(--og-card, rgba(10, 10, 12, 0.9));
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
	font-weight: 650;
}

a.gt_switcher-popup:hover,
a.gt_switcher-popup:focus-visible {
	border-color: color-mix(in srgb, var(--og-accent, #0066cc) 62%, var(--og-border, #3a3d42));
	color: var(--og-link-hover, #fff) !important;
	background: color-mix(in srgb, var(--og-accent, #0066cc) 18%, var(--og-card, #111216));
}

/* Globe ------------------------------------------------------------- */

.gglobe {
	border: 1px solid var(--og-card-border, rgba(255, 255, 255, 0.09));
	box-shadow: 0 5px 18px rgba(0, 0, 0, 0.36);
	filter: drop-shadow(0 0 7px color-mix(in srgb, var(--og-accent, #0066cc) 30%, transparent));
}

.gsatelite img {
	border: 2px solid var(--og-border, #3a3d42) !important;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.gsatelite.gt-current-lang img {
	border-color: var(--og-accent, #0066cc) !important;
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--og-accent, #0066cc) 28%, transparent), 0 8px 26px rgba(0, 0, 0, 0.5) !important;
}

/* Menus ------------------------------------------------------------- */

.menu-item-gtranslate .gtranslate_wrapper,
.menu-item-gtranslate[class*="gt-menu-"] {
	font-family: var(--og-font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.menu-item-gtranslate .gt_switcher_wrapper {
	position: static !important;
}

.menu-item-gtranslate > a.glink {
	display: flex !important;
	min-height: 40px;
	align-items: center;
	gap: 0.4rem;
}

/* Scrollbars -------------------------------------------------------- */

:where(.gt_white_content, .gt_float_switcher .gt_options, .gt_switcher .gt_option) {
	scrollbar-color: var(--og-text-muted, #b9bcc2) rgba(0, 0, 0, 0.3);
	scrollbar-width: thin;
}

:where(.gt_white_content, .gt_float_switcher .gt_options, .gt_switcher .gt_option)::-webkit-scrollbar-track {
	background: rgba(0, 0, 0, 0.3) !important;
}

:where(.gt_white_content, .gt_float_switcher .gt_options, .gt_switcher .gt_option)::-webkit-scrollbar {
	width: 8px !important;
}

:where(.gt_white_content, .gt_float_switcher .gt_options, .gt_switcher .gt_option)::-webkit-scrollbar-thumb {
	border: 2px solid transparent;
	border-radius: 999px;
	background: var(--og-text-muted, #b9bcc2) !important;
	background-clip: padding-box !important;
}

/* Responsive and accessibility ------------------------------------- */

@media (max-width: 560px) {
	.gt_white_content {
		top: 50% !important;
		left: 50% !important;
		width: min(calc(100vw - 24px), 420px) !important;
		height: min(calc(100dvh - 48px), 620px) !important;
		margin: 0 !important;
		transform: translate(-50%, -50%);
	}

	.gt_white_content .gt_languages {
		max-height: none !important;
		flex-flow: column nowrap !important;
	}

	.gt_selector {
		max-width: 100%;
	}

	.gt_switcher_wrapper {
		max-width: calc(100vw - 24px);
	}
}

@media (prefers-reduced-motion: reduce) {
	:where(.gtranslate_wrapper, [class*="gt_container-"]) *,
	.gt_white_content *,
	.gt_black_overlay,
	.gglobe,
	.gsatelite img {
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}
}

@media (forced-colors: active) {
	.gt_selector,
	.gt_float_switcher,
	.gt_white_content,
	:where(.gtranslate_wrapper, [class*="gt_container-"]) .gt_switcher {
		border: 1px solid CanvasText !important;
		box-shadow: none !important;
	}
}
