/* ==========================================================================
   WooCommerce overrides
   Loaded by inc/enqueue.php only when WooCommerce is active.

   WooCommerce ships its own purple (#7f54b3) on every button, badge and
   notice. Left alone it appears on each new site and has to be re-fixed by
   hand, per site, in Elementor. This file removes that default once and
   drives it from the site's own tokens instead.

   How it resolves, in order:
     1. --brand / --accent etc.        Elementor V4 kit variables, or a
                                       brand's colors.css from pixid-assets
     2. --e-global-color-*             Elementor V3 kit globals (legacy kits)
     3. a neutral literal              so an unbranded site is never purple

   A site that names its tokens differently only needs to redefine the
   --pixid-wc-* aliases below; nothing further in this file changes.

   Specificity note: WooCommerce's button rules land at (0,3,1) because the
   :where(body:not(...)) wrapper contributes nothing. The selectors here are
   deliberately heavier so they win without !important.
   ========================================================================== */

:root {
	--pixid-wc-accent:       var(--brand, var(--e-global-color-accent, #1f2933));
	--pixid-wc-accent-fg:    var(--brand-fg, #ffffff);
	--pixid-wc-accent-hover: var(--brand-bright, var(--accent-hover, var(--e-global-color-primary, #111820)));
	--pixid-wc-muted:        var(--border-strong, #8a8a8a);
	--pixid-wc-surface:      var(--surface, #ffffff);
	--pixid-wc-fg:           var(--fg, #1f2933);
	--pixid-wc-focus:        var(--focus, var(--pixid-wc-accent));
	--pixid-wc-radius:       var(--pixid-radius, 3px);
}

/* --------------------------------------------------------------------------
   Buttons — the main offender. Covers the add-to-cart button, cart and
   checkout actions, and the generic .button WooCommerce sprays everywhere.
   -------------------------------------------------------------------------- */

.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce input.button.alt,
.woocommerce button.single_add_to_cart_button.button.alt {
	background-color: var(--pixid-wc-accent);
	color: var(--pixid-wc-accent-fg);
	border: 0;
	border-radius: var(--pixid-wc-radius);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-decoration: none;
}

.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover,
.woocommerce input.button.alt:hover,
.woocommerce button.single_add_to_cart_button.button.alt:hover {
	background-color: var(--pixid-wc-accent-hover);
	color: var(--pixid-wc-accent-fg);
}

/* Visible keyboard focus. WooCommerce ships none, which fails WCAG 2.4.7. */
.woocommerce a.button:focus-visible,
.woocommerce button.button:focus-visible,
.woocommerce input.button:focus-visible,
.woocommerce button.single_add_to_cart_button.button.alt:focus-visible {
	outline: 3px solid var(--pixid-wc-focus);
	outline-offset: 3px;
}

.woocommerce a.button.disabled,
.woocommerce button.button.disabled,
.woocommerce button.button:disabled,
.woocommerce button.single_add_to_cart_button.button.alt.disabled {
	background-color: var(--pixid-wc-muted);
	color: var(--pixid-wc-surface);
	opacity: 1; /* WooCommerce's 0.5 opacity drops contrast below AA */
}

/* --------------------------------------------------------------------------
   Sale badge — purple by default.
   -------------------------------------------------------------------------- */

.woocommerce span.onsale {
	background-color: var(--pixid-wc-accent);
	color: var(--pixid-wc-accent-fg);
	border-radius: var(--pixid-wc-radius);
}

/* --------------------------------------------------------------------------
   Notices — the left border carries WooCommerce's palette.
   -------------------------------------------------------------------------- */

.woocommerce .woocommerce-message,
.woocommerce .woocommerce-info {
	border-top-color: var(--pixid-wc-accent);
}

.woocommerce .woocommerce-message::before,
.woocommerce .woocommerce-info::before {
	color: var(--pixid-wc-accent);
}

.woocommerce .woocommerce-error {
	border-top-color: var(--danger, #b81f1f);
}

.woocommerce .woocommerce-error::before {
	color: var(--danger, #b81f1f);
}

/* --------------------------------------------------------------------------
   Price — inherits body colour rather than WooCommerce's grey.
   -------------------------------------------------------------------------- */

.woocommerce div.product p.price,
.woocommerce div.product span.price {
	color: var(--pixid-wc-fg);
}
