/* Tectalic Display Toolbar. Panel sizes are in px so they don't grow with the text size setting. */

#tdt-root {
	--tdt-accent: #482b88;
	--tdt-accent-text: #fff;
	--tdt-offset: 20px;
	--tdt-ink: #1e1f28;
	--tdt-muted: #575a6b;
	--tdt-line: #cfd1db;
	position: fixed;
	bottom: calc(var(--tdt-offset) + env(safe-area-inset-bottom, 0px));
	right: 20px;
	z-index: 999999;
	font-family: inherit;
	font-size: 16px;
	line-height: 1.4;
	word-spacing: normal;
	color: var(--tdt-ink);
}
#tdt-root[data-position="bottom-left"] { right: auto; left: 20px; }
#tdt-root[hidden] { display: none; }

#tdt-root *,
#tdt-root *::before,
#tdt-root *::after { box-sizing: border-box; }

.tdt-sr {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* One shared reset so theme and Elementor Kit styles don't leak into the panel */
#tdt-root :is(button, h2, h3, p, select, output) {
	font: inherit;
	text-transform: none;
	letter-spacing: normal;
}

/* Toggle button */
#tdt-root .tdt-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 48px;
	min-width: 48px;
	margin: 0;
	padding: 10px 16px 10px 12px;
	border: 2px solid var(--tdt-accent-text);
	border-radius: 999px;
	background: var(--tdt-accent);
	color: var(--tdt-accent-text);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
	cursor: pointer;
}
#tdt-root .tdt-toggle:hover { filter: brightness(1.1); }
#tdt-root .tdt-icon { flex: none; width: 24px; height: 24px; }

#tdt-root button:focus-visible,
#tdt-root select:focus-visible,
#tdt-root .tdt-title:focus-visible {
	outline: 3px solid var(--tdt-ink);
	outline-offset: 2px;
	box-shadow: 0 0 0 6px #fff;
}
#tdt-root .tdt-title:focus:not(:focus-visible) { outline: none; }

@media (max-width: 599px) {
	#tdt-root { right: 12px; }
	#tdt-root[data-position="bottom-left"] { left: 12px; }
	#tdt-root .tdt-toggle { padding: 10px; }
	#tdt-root .tdt-toggle-text {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
	}
}

/* Panel */
#tdt-root .tdt-panel {
	position: absolute;
	bottom: calc(100% + 10px);
	right: 0;
	width: 340px;
	max-width: calc(100vw - 24px);
	/* Room left above the toggle: offset, 48px toggle, 10px gap and a margin at the top */
	max-height: calc(100vh - var(--tdt-offset) - env(safe-area-inset-bottom, 0px) - 90px);
	max-height: calc(100dvh - var(--tdt-offset) - env(safe-area-inset-bottom, 0px) - 90px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px;
	background: #fff;
	color: var(--tdt-ink);
	border: 1px solid var(--tdt-line);
	border-radius: 12px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
	text-align: left;
}
#tdt-root[data-position="bottom-left"] .tdt-panel { right: auto; left: 0; }
#tdt-root .tdt-panel[hidden] { display: none; }

#tdt-root .tdt-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}
#tdt-root .tdt-title {
	margin: 0;
	padding: 0;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--tdt-ink);
}
#tdt-root .tdt-close {
	flex: none;
	width: 44px;
	height: 44px;
	margin: -10px -10px 0 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--tdt-ink);
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}
#tdt-root .tdt-close:hover { background: #eff0f4; }

#tdt-root .tdt-section { margin: 0; padding: 12px 0; border-top: 1px solid var(--tdt-line); }
#tdt-root .tdt-section[hidden] { display: none; }
#tdt-root .tdt-label {
	margin: 0 0 8px;
	padding: 0;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--tdt-muted);
}

/* GTranslate dropdown inside the panel */
#tdt-root .tdt-lang .gtranslate_wrapper { display: block; }
#tdt-root .tdt-lang select.gt_selector {
	display: block;
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: 8px 10px;
	border: 1px solid var(--tdt-muted);
	border-radius: 8px;
	background-color: #fff;
	color: var(--tdt-ink);
	font-size: 16px;
}

/* Rows */
#tdt-root .tdt-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: 6px 0;
	color: var(--tdt-ink);
	font-size: 16px;
	text-align: left;
}
#tdt-root .tdt-stepper { display: inline-flex; align-items: center; gap: 6px; }
#tdt-root .tdt-step {
	min-width: 44px;
	height: 44px;
	padding: 0 8px;
	border: 1px solid var(--tdt-muted);
	border-radius: 8px;
	background: #fff;
	color: var(--tdt-ink);
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
}
#tdt-root .tdt-step[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
#tdt-root .tdt-text-val { min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }

#tdt-root .tdt-switch {
	border: 0;
	border-radius: 8px;
	background: transparent;
	cursor: pointer;
	font-weight: 400;
}
#tdt-root .tdt-switch:hover { background: #f7f7fa; }
#tdt-root .tdt-switch-track {
	position: relative;
	flex: none;
	width: 44px;
	height: 26px;
	border: 2px solid var(--tdt-muted);
	border-radius: 999px;
	background: #fff;
}
#tdt-root .tdt-switch-thumb {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--tdt-muted);
	transition: transform 0.15s ease;
}
#tdt-root .tdt-switch[aria-checked="true"] .tdt-switch-track { border-color: var(--tdt-accent); background: var(--tdt-accent); }
#tdt-root .tdt-switch[aria-checked="true"] .tdt-switch-thumb { transform: translateX(18px); background: var(--tdt-accent-text); }

#tdt-root .tdt-reset {
	width: 100%;
	min-height: 44px;
	margin: 10px 0 0;
	padding: 8px 12px;
	border: 1px solid var(--tdt-muted);
	border-radius: 8px;
	background: #fff;
	color: var(--tdt-ink);
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
}
#tdt-root .tdt-small,
#tdt-root .tdt-note { margin: 8px 0 0; font-size: 14px; color: var(--tdt-muted); }
#tdt-root .tdt-note { padding-top: 12px; border-top: 1px solid var(--tdt-line); }

/* GTranslate's own floating switcher. Hidden from first paint; JS removes the class if the panel dropdown never loads. */
html.tdt-gt-hide #gt_float_wrapper,
html.tdt-gt-hide .gt_switcher_wrapper:not(.tdt-root *) { display: none !important; }

/* ---------- Visitor preferences ---------- */

html.tdt-switching *,
html.tdt-switching *::before,
html.tdt-switching *::after { transition: none !important; }

/* Text size: scales rem/em text. Text set in fixed px does not change. */
html.tdt-text-m1 { font-size: 90% !important; }
html.tdt-text-1 { font-size: 115% !important; }
html.tdt-text-2 { font-size: 130% !important; }
html.tdt-text-3 { font-size: 150% !important; }
html.tdt-text-4 { font-size: 175% !important; }

/* Common fixed-px text in Elementor V3 menus, buttons and Gravity Forms */
html.tdt-text-up .elementor-nav-menu .elementor-item,
html.tdt-text-up .elementor-nav-menu .elementor-sub-item,
html.tdt-text-up .elementor-button,
html.tdt-text-up .gform_wrapper .gfield_label,
html.tdt-text-up .gform_wrapper input,
html.tdt-text-up .gform_wrapper textarea,
html.tdt-text-up .gform_wrapper select { font-size: max(1em, 1rem) !important; }

/* High contrast: black on white everywhere except media and this toolbar */
html.tdt-contrast,
html.tdt-contrast body { background: #fff !important; }
/* :where() keeps this rule low in specificity so the link and form rules below win */
html.tdt-contrast body :where(*:not(img, svg, svg *, video, iframe, picture, .tdt-root, .tdt-root *)) {
	background-color: #fff !important;
	background-image: none !important;
	color: #000 !important;
	text-shadow: none !important;
	box-shadow: none !important;
	border-color: #000 !important;
}
html.tdt-contrast a:not(.tdt-root *),
html.tdt-contrast a:not(.tdt-root *) * { color: #0000cc !important; text-decoration: underline !important; }
html.tdt-contrast a:not(.tdt-root *):visited { color: #551a8b !important; }
html.tdt-contrast button:not(.tdt-root *),
html.tdt-contrast .elementor-button,
html.tdt-contrast input:not(.tdt-root *),
html.tdt-contrast select:not(.tdt-root *),
html.tdt-contrast textarea { border: 2px solid #000 !important; }
/* Recolour only fills that are set explicitly or by Elementor icon widgets; outline-style icons keep fill: none */
html.tdt-contrast svg:not(.tdt-root *) [fill]:not([fill="none"]),
html.tdt-contrast :is(.elementor-icon, .elementor-social-icon, .elementor-icon-list-icon, .elementor-button-icon) svg { fill: currentColor !important; }
/* The colour reset removes box-shadows, which some sites use as their focus ring */
html.tdt-contrast :focus-visible { outline: 3px solid #000 !important; outline-offset: 2px !important; }
html.tdt-contrast .elementor-background-overlay,
html.tdt-contrast .elementor-background-video-container,
html.tdt-contrast .elementor-background-slideshow { display: none !important; }
html.tdt-contrast #tdt-root {
	--tdt-accent: #000;
	--tdt-accent-text: #fff;
	--tdt-ink: #000;
	--tdt-muted: #000;
	--tdt-line: #000;
}
html.tdt-contrast #tdt-root .tdt-panel { border: 2px solid #000; box-shadow: none; }

/* Reduce motion */
html.tdt-motion-off { scroll-behavior: auto !important; }
html.tdt-motion-off *,
html.tdt-motion-off *::before,
html.tdt-motion-off *::after {
	animation-duration: 0.001ms !important;
	animation-delay: 0s !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.001ms !important;
	transition-delay: 0s !important;
	scroll-behavior: auto !important;
}
html.tdt-motion-off .elementor-invisible { visibility: visible !important; }
html.tdt-motion-off .animated { animation: none !important; }
html.tdt-motion-off .elementor-motion-effects-layer,
html.tdt-motion-off .elementor-motion-effects-element { transform: none !important; }
html.tdt-motion-off .elementor-ken-burns { transform: none !important; transition: none !important; }

/* Underline links */
html.tdt-underline a:not(.tdt-root *):not(.elementor-button):not([role="button"]) {
	text-decoration: underline !important;
	text-underline-offset: 0.15em;
	text-decoration-thickness: max(1px, 0.08em);
}

/* Readable spacing (WCAG 1.4.12 values) */
html.tdt-spacing body :where(*:not(.tdt-root, .tdt-root *)) {
	line-height: 1.5 !important;
	letter-spacing: 0.12em !important;
	word-spacing: 0.16em !important;
}
html.tdt-spacing p:not(.tdt-root *) { margin-bottom: 2em !important; }

/* Stronger focus outlines */
html.tdt-focus *:focus-visible {
	outline: 3px solid #000 !important;
	outline-offset: 2px !important;
	box-shadow: 0 0 0 6px #fff !important;
}
