/*
 * Light mode for ThaSpeakerBoxx (docs/02-brand-guide.md §3).
 * Elementor sets its global colour variables on <body> (class .elementor-kit-N). The selectors
 * below are more specific than that class, so they override the dark defaults from Site Settings.
 * Variable names come from the colour IDs set in Site Settings (primary, secondary, text, accent, surface, …).
 */

html[data-theme="light"] body {
	--e-global-color-secondary: #F5F3EF; /* Background */
	--e-global-color-text: #111111;      /* Text */
	--e-global-color-accent: #C8102E;    /* Accent Text (red text and focus ring) */
	--e-global-color-surface: #FFFFFF;
	--e-global-color-muted: #5C5C5C;
	--e-global-color-fieldbd: #7D7871;   /* Field Border */
	--e-global-color-divider: #DDD8D0;
	color-scheme: light;
}

html[data-theme="dark"] body,
html:not([data-theme]) body {
	color-scheme: dark;
}

/* Heroes and photo sections stay dark in both modes: add the CSS class "sbx-always-dark" to the container. */
html[data-theme="light"] .sbx-always-dark {
	--e-global-color-secondary: #0A0A0A;
	--e-global-color-text: #F5F5F5;
	--e-global-color-accent: #FF4040;
	--e-global-color-surface: #1A1A1A;
	--e-global-color-muted: #A3A3A3;
	--e-global-color-fieldbd: #757575;
	--e-global-color-divider: #2E2E2E;
	color: var(--e-global-color-text);
}

/*
 * One visible focus style everywhere (WCAG 2.4.7 / 2.4.11).
 * Hello Elementor's reset.css styles "a:focus-visible", "button:focus-visible" and focusable [tabindex]
 * elements with a black outline + white halo, and those selectors beat a plain ":focus-visible". Repeating
 * them here (this file loads after reset.css, so equal specificity wins; "html" tips the [tabindex] one)
 * gives every link and button the brand ring. Form fields keep their own focus style (Site Settings).
 */
:focus-visible,
a:focus-visible,
button:focus-visible,
html [tabindex]:not([tabindex="-1"]):not([contenteditable]):focus-visible {
	outline: 2px solid var(--e-global-color-accent);
	outline-offset: 2px;
	box-shadow: none;
}

/*
 * Mode toggle button ([sbx_mode_toggle]) — 44px touch target, sun/moon drawn in CSS (no icon font).
 * The class is doubled on purpose: Elementor's Site Settings button style (".elementor-kit-5 button",
 * one class + one element) would otherwise paint this button red with button padding.
 */
.sbx-mode-toggle.sbx-mode-toggle {
	display: inline-grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	min-height: 0;
	border: 1px solid var(--e-global-color-fieldbd);
	border-radius: 50%;
	box-shadow: none;
	background: transparent;
	color: var(--e-global-color-text);
	cursor: pointer;
	transition: color .15s ease-out, border-color .15s ease-out;
}

.sbx-mode-toggle.sbx-mode-toggle:hover,
.sbx-mode-toggle.sbx-mode-toggle:focus {
	background: transparent;
	color: var(--e-global-color-accent);
	border-color: var(--e-global-color-accent);
}

.sbx-mode-toggle__icon {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	/* Dark mode shows a sun (offer: go light). */
	background: currentColor;
	box-shadow: 0 0 0 3px transparent;
}

html[data-theme="light"] .sbx-mode-toggle__icon {
	/* Light mode shows a crescent moon (offer: go dark). */
	background: transparent;
	box-shadow: inset -6px -2px 0 0 currentColor;
}

@media (prefers-reduced-motion: reduce) {
	.sbx-mode-toggle { transition: none; }
}

/*
 * Accessibility fixes (Lighthouse, 2026-11-10). See README → "Accessibility fixes".
 */

/*
 * "Skip to content" link: hidden until it gets keyboard focus, then shown top-left on a Surface chip.
 * Hello's own skip-link styles live in theme.css, which is switched off (Hello → Settings), so without this
 * the link stayed invisible even when focused. The focus ring comes from the a:focus-visible rule above.
 */
.skip-link.screen-reader-text:focus {
	position: fixed !important;
	top: 8px;
	left: 8px;
	z-index: 100000;
	width: auto;
	height: auto;
	padding: 12px 16px;
	clip: auto;
	clip-path: none;
	overflow: visible;
	border-radius: 4px;
	background: var(--e-global-color-surface);
	color: var(--e-global-color-text);
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
}

/* The skip link's target (<main id="content" tabindex="-1">, see speakerboxx-snippets.php) is not a control,
   so it gets no focus ring when the skip link moves focus there. */
#content.sbx-main:focus {
	outline: none;
}

/*
 * Share buttons ("framed" skin): Elementor paints the label and icon in the border colour (Field Border,
 * 4.3:1 on Background, below AA). Our build scripts set the Secondary colour to Text for them, but the
 * framed skin never uses it; this makes it do so. The border stays Field Border.
 */
.elementor-share-buttons--color-custom.elementor-share-buttons--skin-framed .elementor-share-btn.elementor-share-btn,
.elementor-share-buttons--color-custom.elementor-share-buttons--skin-framed .elementor-share-btn .elementor-share-btn__icon {
	color: var(--e-share-buttons-secondary-color, var(--e-global-color-text));
}

.elementor-share-buttons--color-custom.elementor-share-buttons--skin-framed .elementor-share-btn .elementor-share-btn__icon svg {
	fill: var(--e-share-buttons-secondary-color, var(--e-global-color-text));
}

/*
 * Loop Grid "Load more" button: it's an <a> without href, and Hello's reset.css gives those
 * "color: inherit" with a stronger selector than Site Settings' button colour, so it showed Text
 * (#F5F5F5 on red, 4.35:1; in light mode #111 on red). Back to On Primary (white, 4.75:1).
 */
.e-loop__load-more .elementor-button.elementor-button,
.e-loop__load-more .elementor-button.elementor-button:hover,
.e-loop__load-more .elementor-button.elementor-button:focus {
	color: var(--e-global-color-onprim);
}
