/**
 * HUEGO Design Token Enforcement Layer.
 *
 * Loaded after normal frontend plugin styles. The scope is deliberately limited
 * to visual primitives (type, controls, buttons, focus, notices) and never
 * changes structural layout. HUEGO-native controls opt out through huego-* classes.
 */

body.huego-token-enforcement {
	font-family: var(--huego-font-family);
	color: var(--huego-color-text);
}

/* Any third-party UI still inherits HUEGO typography. */
body.huego-token-enforcement :where(
	.elementor,
	.woocommerce,
	.fluentform,
	.ff_form_instance,
	.wp-block-group,
	.wp-block-columns,
	.wp-site-blocks,
	[class*="plugin-"]
) {
	font-family: var(--huego-font-family);
}

/* Common form controls: intentionally presentation-only, no width/layout rules. */
body.huego-token-enforcement :where(
	input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]),
	select,
	textarea
):not([class*="huego-"]) {
	font-family: var(--huego-font-family) !important;
	color: var(--huego-color-text) !important;
	background-color: var(--huego-color-surface) !important;
	border-color: var(--huego-color-border) !important;
	border-radius: var(--huego-radius-md) !important;
	transition: border-color var(--huego-transition-fast), box-shadow var(--huego-transition-fast), background-color var(--huego-transition-fast) !important;
}

body.huego-token-enforcement :where(
	input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]),
	select,
	textarea
):not([class*="huego-"]):focus {
	border-color: var(--huego-color-focus) !important;
	box-shadow: 0 0 0 3px var(--huego-color-focus-ring) !important;
	outline: 0 !important;
}

/* Generic plugin/page-builder buttons. HUEGO-native button classes keep their own semantic variants. */
body.huego-token-enforcement :where(
	button,
	input[type="submit"],
	input[type="button"],
	input[type="reset"],
	a.button,
	.wp-element-button,
	.ff-btn-submit
):not([class*="huego-"]) {
	font-family: var(--huego-font-family) !important;
	font-size: var(--huego-font-size-button) !important;
	font-weight: var(--huego-font-weight-semibold) !important;
	line-height: var(--huego-line-height-button) !important;
	color: var(--huego-color-white) !important;
	background-color: var(--huego-color-primary) !important;
	border-color: var(--huego-color-primary) !important;
	border-radius: var(--huego-radius-md) !important;
	transition: color var(--huego-transition-fast), background-color var(--huego-transition-fast), border-color var(--huego-transition-fast), box-shadow var(--huego-transition-fast) !important;
}

body.huego-token-enforcement :where(
	button,
	input[type="submit"],
	input[type="button"],
	input[type="reset"],
	a.button,
	.wp-element-button,
	.ff-btn-submit
):not([class*="huego-"]):hover {
	color: var(--huego-color-white) !important;
	background-color: var(--huego-color-primary-hover) !important;
	border-color: var(--huego-color-primary-hover) !important;
}

body.huego-token-enforcement :where(
	button,
	input[type="submit"],
	input[type="button"],
	input[type="reset"],
	a.button,
	.wp-element-button,
	.ff-btn-submit
):not([class*="huego-"]):focus-visible {
	outline: 0 !important;
	box-shadow: 0 0 0 3px var(--huego-color-focus-ring) !important;
}

/* Elementor Free keeps authored semantic variants, but its global typography/shape are HUEGO-owned. */
body.huego-token-enforcement .elementor-button {
	font-family: var(--huego-font-family) !important;
	font-size: var(--huego-font-size-button) !important;
	font-weight: var(--huego-font-weight-semibold) !important;
	border-radius: var(--huego-radius-md) !important;
}

/* Elementor Global Colors/Typography are aliases, never a second source of truth. */
body.huego-token-enforcement[class*="elementor-kit-"] {
	--e-global-color-primary: var(--huego-color-primary) !important;
	--e-global-color-secondary: var(--huego-color-secondary) !important;
	--e-global-color-text: var(--huego-color-text) !important;
	--e-global-color-accent: var(--huego-color-accent) !important;
	--e-global-typography-primary-font-family: var(--huego-font-family) !important;
	--e-global-typography-secondary-font-family: var(--huego-font-family) !important;
	--e-global-typography-text-font-family: var(--huego-font-family) !important;
	--e-global-typography-accent-font-family: var(--huego-font-family) !important;
}

/* Current integration adapters. These remain token-only; business/structural CSS stays with each integration. */
body.huego-token-enforcement :where(.fluentform, .ff_form_instance) :where(.ff-el-input--label label, .ff-el-form-control) {
	font-family: var(--huego-font-family) !important;
}

body.huego-token-enforcement :where(.woocommerce-message, .woocommerce-info) {
	color: var(--huego-color-primary) !important;
	background: var(--huego-color-primary-soft) !important;
	border-color: var(--huego-color-primary) !important;
	border-radius: var(--huego-radius-md) !important;
}

body.huego-token-enforcement :where(.woocommerce-error, .ff-errors-in-stack, .error) {
	border-color: var(--huego-color-error) !important;
}

/* Disabled primitives follow one canonical token family. */
body.huego-token-enforcement :where(button, input, select, textarea):disabled {
	color: var(--huego-color-disabled-text) !important;
	background-color: var(--huego-color-disabled-bg) !important;
	border-color: var(--huego-color-border) !important;
	cursor: not-allowed;
}

/* HUEGO Quick Order uses Secondary/Accent semantics while Fluent Forms owns the fields. */
body.huego-token-enforcement .huego-qo-modal :where(input[type="submit"], button[type="submit"], .ff-btn-submit) {
	color: var(--huego-color-white) !important;
	background-color: var(--huego-color-secondary) !important;
	border-color: var(--huego-color-secondary) !important;
}
body.huego-token-enforcement .huego-qo-modal :where(input[type="submit"], button[type="submit"], .ff-btn-submit):hover {
	background-color: var(--huego-color-accent) !important;
	border-color: var(--huego-color-accent) !important;
}
