/*
 * NJF Commerce base styles.
 *
 * Colours and fonts come from the active Elementor kit (Site Settings), exposed
 * by Elementor as --e-global-color-* and --e-global-typography-* variables.
 * The --njf-* tokens below map those globals to semantic names with neutral
 * fallbacks, so the theme still looks sane before a kit is imported.
 *
 * The tokens are declared on body, not :root: Elementor scopes its global
 * variables to the body's .elementor-kit-{id} class, so a var() resolved on
 * :root would never see them.
 *
 * Kit global colour IDs used (set in Site Settings → Global Colors):
 *   primary, secondary, text, accent (system colours)
 *   njf_accent_light, njf_surface, njf_border, njf_muted, njf_dark_text, njf_success (custom colours)
 */

body {
	--njf-bg: var(--e-global-color-primary, #fff);
	--njf-fg: var(--e-global-color-text, #111);
	--njf-surface: var(--e-global-color-njf_surface, #f5f5f5);
	--njf-light: var(--e-global-color-secondary, #f7f7f7);
	--njf-fg-on-light: var(--e-global-color-njf_dark_text, #000);
	--njf-accent: var(--e-global-color-accent, #111);
	--njf-accent-light: var(--e-global-color-njf_accent_light, var(--njf-accent));
	--njf-border: var(--e-global-color-njf_border, #d4d4d4);
	--njf-muted: var(--e-global-color-njf_muted, #6b6b6b);
	--njf-success: var(--e-global-color-njf_success, #2e7d32);
	--njf-radius-card: 10px;
	--njf-radius-pill: 100px;
	--njf-focus-ring: 2px solid var(--njf-accent-light);
	--njf-transition: 200ms ease;
}

/* Visible keyboard focus everywhere, without changing mouse focus. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: var(--njf-focus-ring);
	outline-offset: 2px;
}

/* Text inputs keep their own background on hover (fixes white-on-white inputs on dark schemes). */
:where(input[type="text"], input[type="email"], input[type="search"], input[type="tel"], input[type="number"], input[type="password"]):hover {
	background-color: inherit;
}

/* Skip link (Hello provides the markup). */
.skip-link.screen-reader-text:focus {
	clip: auto;
	clip-path: none;
	height: auto;
	width: auto;
	z-index: 100000;
	padding: 12px 16px;
	background: var(--njf-bg);
	color: var(--njf-fg);
	outline: var(--njf-focus-ring);
}

/* Utility: hide visually, keep for screen readers. */
.njf-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Respect reduced motion for every NJF animation. */
@media (prefers-reduced-motion: reduce) {
	.njf-commerce *,
	.njf-commerce *::before,
	.njf-commerce *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}

/*
 * Native Elementor widgets default to the kit's "primary" colour for titles,
 * which is the page background in a dark kit. Default them to the text
 * colour instead. Selectors are (0,2,1): above Elementor's widget defaults
 * (0,2,0), below any colour set on the widget itself (0,3,0+).
 */
body .elementor-widget-heading .elementor-heading-title,
body .elementor-counter .elementor-counter-number-wrapper,
body .elementor-counter .elementor-counter-title,
body .elementor-toggle .elementor-tab-title,
body .elementor-toggle .elementor-tab-title a,
body .elementor-accordion .elementor-tab-title,
body .elementor-accordion .elementor-tab-title a,
body .elementor-tab-title a,
body .elementor-toc__header-title,
body .elementor-field-group .elementor-field-label,
body .elementor-icon-list-item .elementor-icon-list-text {
	color: var(--njf-fg);
}

body .elementor-toggle .elementor-tab-content,
body .elementor-toc__list-item-text-wrapper a,
body .elementor-toc__list-item-text-wrapper {
	color: color-mix(in srgb, var(--njf-fg) 78%, transparent);
}

body .elementor-toggle .elementor-tab-title,
body .elementor-toggle .elementor-tab-content {
	border-color: var(--njf-border);
}

body .elementor-toggle .elementor-toggle-icon {
	color: var(--njf-fg);
}

body .elementor-toc {
	border-color: var(--njf-border);
	background: transparent;
}

body .elementor-toc__header {
	border-color: var(--njf-border);
	background: transparent;
}

body .elementor-field-group .elementor-field-textual {
	border-color: var(--njf-border);
	background: transparent;
	color: var(--njf-fg);
}

/* Button widgets without their own colours: the kit's light button (white on dark, as the source theme). */
body .elementor-widget-button .elementor-button {
	background-color: var(--njf-fg);
	color: var(--njf-bg);
}

body .elementor-widget-button .elementor-button:hover,
body .elementor-widget-button .elementor-button:focus-visible {
	background-color: var(--njf-accent);
	color: #fff;
}

/* Converted content pages. */
.njf-page .njf-page-title .elementor-heading-title {
	font-size: clamp(28px, 3.2vw, 44px);
	font-weight: 800;
	line-height: 1.1;
	text-transform: uppercase;
}

.njf-eyebrow .elementor-heading-title {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--njf-muted);
}

body .njf-eyebrow .elementor-heading-title {
	color: color-mix(in srgb, var(--njf-fg) 62%, transparent);
}

.njf-page .elementor-widget-text-editor {
	line-height: 1.7;
}

.njf-page--policy .elementor-widget-text-editor h2,
.njf-page--policy .elementor-widget-text-editor h3 {
	margin: 1.6em 0 0.5em;
	scroll-margin-top: calc(var(--njf-announcement-height, 0px) + 24px);
	color: var(--njf-fg);
}

.njf-page--policy .elementor-widget-text-editor a,
.njf-page .elementor-widget-text-editor a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Rows of linked images (old carousels): swipe sideways. */
.njf-scroll-row.e-con {
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: thin;
}

.njf-scroll-row.e-con > .elementor-widget {
	flex: 0 0 min(320px, 78%);
	scroll-snap-align: start;
}
