/*
 * The WordPress commerce pages (cart, checkout, account, login) in the store's own colours.
 * Enqueued by inc/woocommerce/woo-tokens.php on those pages only, on every store.
 *
 * Tokens only: every colour below is one of the store's palette slugs, so one file gives
 * Safety its orange and Polo its green. No colour is written here except the fallbacks,
 * which are theme.json's own defaults for a store whose palette is missing a slug.
 *
 * WHY :root AND NOT A SELECTOR PER ELEMENT. The legacy checkout (src/scss) and
 * WooCommerce's own sheet colour these pages through custom properties declared on :root
 * (--saved-money-text, --primary-text, --wc-red, --wc-primary ...). Re-pointing the
 * property moves every rule that reads it, including ones on markup shown later (an error
 * notice, a validation message), which a per-element override would miss. The floor's
 * palette rule (B-008) resolves var() against :root too, so it reads what a buyer sees.
 *
 * Item 15 of TT-6892, Michael 33:23: "I do not ever want any input field without a
 * border." The border is on the INPUT, not on a wrapper around it: the old wrapper was
 * 1px, pale, and 17px wider than the field, so the field itself read as borderless.
 */

:root {
	--st-wt-fg: var(--wp--preset--color--ti-fg, #0a0a0a);
	--st-wt-bg: var(--wp--preset--color--ti-bg, #ffffff);
	--st-wt-panel: var(--wp--preset--color--ti-bg-alt, #f5f5f5);
	--st-wt-accent: var(--wp--preset--color--ti-accent, #0a0a0a);
	--st-wt-muted: var(--wp--preset--color--ti-accent-secondary, #6b6b6b);
	--st-wt-line: var(--wp--preset--color--ti-line, #d4d4d4);
	--st-wt-field: color-mix(in srgb, var(--st-wt-fg) 45%, var(--st-wt-bg));

	/* The legacy checkout's own properties (src/scss/vars/base). */
	--primary-text: var(--st-wt-fg);
	--dark-blue-700: var(--st-wt-fg);
	--saved-money-text: var(--st-wt-fg);
	--other-light-blue-500: var(--st-wt-accent);
	--success-500: var(--st-wt-accent);
	--danger-500: var(--st-wt-accent);
	--blue-500: var(--st-wt-accent);
	--e-global-color-primary: var(--st-wt-fg);
	--e-global-color-6823dc0: var(--st-wt-fg);
	--text-brand: var(--st-wt-accent);

	/* WooCommerce's own properties (woocommerce.css :root). */
	--woocommerce: var(--st-wt-accent);
	--wc-primary: var(--st-wt-accent);
	--wc-primary-text: var(--st-wt-bg);
	--wc-secondary: var(--st-wt-panel);
	--wc-secondary-text: var(--st-wt-fg);
	--wc-red: var(--st-wt-accent);
	--wc-green: var(--st-wt-accent);
	--wc-blue: var(--st-wt-fg);
	--wc-orange: var(--st-wt-accent);
	--wc-highlight: var(--st-wt-fg);
	--wc-destructive: var(--st-wt-accent);
	--wc-subtext: var(--st-wt-muted);
	--wc-form-border-color: var(--st-wt-field);
}

/* ── Every field bordered at rest, on the field itself ───────────────────────── */

body.woocommerce-page form .input-text,
body.woocommerce-page form input[type="text"],
body.woocommerce-page form input[type="email"],
body.woocommerce-page form input[type="tel"],
body.woocommerce-page form input[type="password"],
body.woocommerce-page form input[type="number"],
body.woocommerce-page form input[type="search"],
body.woocommerce-page form select,
body.woocommerce-page form textarea,
body.woocommerce-page .select2-container .select2-selection {
	border: 1px solid var(--st-wt-field) !important;
	border-radius: var(--st-radius, 2px) !important;
	background-color: var(--st-wt-bg) !important;
	color: var(--st-wt-fg);
}

body.woocommerce-page form .input-text:focus,
body.woocommerce-page form select:focus,
body.woocommerce-page form textarea:focus {
	border-color: var(--st-wt-accent) !important;
	outline: 2px solid color-mix(in srgb, var(--st-wt-accent) 35%, transparent);
	outline-offset: 0;
}

/* The pale wrapper that used to stand in for the border. */
body.woocommerce-page form .form-row.input._border,
body.woocommerce-page form .form-row .woocommerce-input-wrapper {
	border: 0 !important;
	box-shadow: none !important;
	background: transparent !important;
}

/*
 * The field fills the box the wrapper drew, and pads its own text. The legacy
 * checkout inset the input 16px inside the wrapper with no padding of its own
 * (10px 0) and floats the label at 16px, so once the border moved onto the input
 * the label sat ON it and the field stood 16px in from its heading (seen live,
 * 2026-11-20). Measured after: input flush with the wrapper, label 16px inside.
 */
body.woocommerce-page form .form-row .woocommerce-input-wrapper {
	display: block;
	width: 100%;
	margin: 0 !important;
	padding: 0 !important;
}

body.woocommerce-page form .form-row.input .input__area,
body.woocommerce-page form .form-row.input .woocommerce-input-wrapper > .input-text {
	box-sizing: border-box;
	width: 100% !important;
	margin: 0 !important;
	padding-left: 16px !important;
	padding-right: 16px !important;
}

/* ── The colours a buyer sees ────────────────────────────────────────────────── */

body.woocommerce-page .required,
body.woocommerce-page abbr.required {
	color: var(--st-wt-accent) !important;
}

body.woocommerce-page .woocommerce-message,
body.woocommerce-page .woocommerce-info,
body.woocommerce-page .woocommerce-error {
	background: var(--st-wt-panel) !important;
	color: var(--st-wt-fg) !important;
	border: 1px solid var(--st-wt-line) !important;
	border-left: 4px solid var(--st-wt-accent) !important;
	outline: 0 !important;
}

body.woocommerce-page .woocommerce-message *,
body.woocommerce-page .woocommerce-info *,
body.woocommerce-page .woocommerce-error * {
	color: inherit;
}

body.woocommerce-page .woocommerce-message .button,
body.woocommerce-page .woocommerce-message a.button {
	background: transparent !important;
	color: var(--st-wt-fg) !important;
	border: 1px solid var(--st-wt-fg) !important;
}

/* The order summary's discount pill and price. */
body.woocommerce-page .order-savings span,
body.woocommerce-page .order-savings bdi {
	background: var(--st-wt-panel) !important;
	color: var(--st-wt-fg) !important;
}
