/**
 * Storefront design tokens: the one place every storefront stylesheet
 * (wix-frontend.css, wix-book.css, wix-events.css, wix-apps.css and each
 * app's own file) takes its colours, radii, spacing, shadows, focus ring and
 * motion from. A dependency of `wixhc-frontend` and `wixhc-events`.
 *
 * Theme-aware by default: colours come from the active theme's theme.json
 * palette (--wp--preset--color--base / contrast / primary) when it has one,
 * otherwise from a calm neutral palette (near-black ink and buttons on white).
 * Borders, tints and muted text are mixed from the text colour, so they read
 * on light and dark themes alike.
 *
 * Overriding: set any --wixhc-* token on `.wixhc-root` (every widget's root
 * element), `.wixhc-events` or a more specific selector, e.g.
 *   .wixhc-root, .wixhc-events { --wixhc-brand: #0b5cad; --wixhc-radius-l: 4px; }
 * The tokens are also declared on those roots (with zero specificity, via
 * :where) so they pick up a block's own palette (section styles) there.
 *
 * Backward compatibility: the storefront's earlier names still work when a
 * site sets them anywhere above or on a widget: --pw-brand, --pw-brand-dark,
 * --pw-brand-soft, --pw-accent, --pw-ink, --pw-muted, --pw-surface,
 * --pw-bg-soft, --pw-border, --pw-shadow, --pw-radius (old storefront skin),
 * --wixhc-ev-accent, --wixhc-ev-border, --wixhc-ev-muted, --wixhc-ev-soft,
 * --wixhc-ev-radius, --wixhc-events-accent (events), --wixhc-line,
 * --wixhc-soft, --wixhc-radius (gift cards, plans). Rules use only --wixhc-*.
 *
 * @package Headless_Connect_For_Wix
 */

:root,
:where(.wixhc-root, .wixhc-hero, .wixhc-contact, .wixhc-drawer, .wixhc-book, .wixhc-events, .wixhc-events-bar-wrap, .wixhc-native, .wixhc-shop, .wixhc-paywall, .wixhc-plan-confirm, .wixhc-access, .wixhc-loginbar, .wixhc-cart-toggle, .wixhc-stars-summary, .wixhc-lightbox) {
	/* ---- colour ---- */
	--wixhc-brand: var(--pw-brand, var(--wixhc-ev-accent, var(--wixhc-events-accent, var(--wp--preset--color--primary, var(--wp--preset--color--contrast, #1e1e1e)))));
	--wixhc-on-brand: var(--wp--preset--color--base, #ffffff);
	--wixhc-brand-hover: var(--pw-brand-dark, var(--wixhc-brand));
	--wixhc-brand-soft: var(--pw-brand-soft, rgba(128, 128, 128, 0.12));
	--wixhc-accent: var(--pw-accent, var(--wixhc-brand));
	--wixhc-ink: var(--pw-ink, var(--wp--preset--color--contrast, #1e1e1e));
	--wixhc-surface: var(--pw-surface, var(--wp--preset--color--base, #ffffff));
	--wixhc-surface-alt: var(--pw-bg-soft, var(--wixhc-soft, var(--wixhc-ev-soft, rgba(128, 128, 128, 0.08))));
	--wixhc-muted: var(--pw-muted, var(--wixhc-ev-muted, currentColor));
	--wixhc-border: var(--pw-border, var(--wixhc-line, var(--wixhc-ev-border, rgba(128, 128, 128, 0.3))));
	--wixhc-border-strong: rgba(128, 128, 128, 0.65);
	--wixhc-success: #16733a;
	--wixhc-danger: #b3261e;
	--wixhc-warning: #8a5a00;
	--wixhc-success-soft: rgba(22, 115, 58, 0.08);
	--wixhc-danger-soft: rgba(179, 38, 30, 0.1);
	--wixhc-warning-soft: rgba(138, 90, 0, 0.12);
	--wixhc-overlay: rgba(0, 0, 0, 0.45);
	--wixhc-focus: var(--wp--preset--color--contrast, #2271b1);

	/* ---- shape ---- */
	--wixhc-radius-s: 4px;
	--wixhc-radius-m: var(--wixhc-radius, 8px);
	--wixhc-radius-l: var(--pw-radius, var(--wixhc-ev-radius, 12px));
	--wixhc-radius-pill: 999px;
	--wixhc-radius-control: var(--wixhc-radius-m);
	--wixhc-control-h: 44px;
	--wixhc-control-h-s: 36px;

	/* ---- elevation ---- */
	--wixhc-shadow-s: 0 1px 2px rgba(0, 0, 0, 0.05);
	--wixhc-shadow: var(--pw-shadow, 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.08));
	--wixhc-shadow-l: 0 16px 48px rgba(0, 0, 0, 0.2);

	/* ---- spacing (4 px scale) ---- */
	--wixhc-space-1: 4px;
	--wixhc-space-2: 8px;
	--wixhc-space-3: 12px;
	--wixhc-space-4: 16px;
	--wixhc-space-5: 24px;
	--wixhc-space-6: 32px;
	--wixhc-space-7: 48px;

	/* ---- type ---- */
	--wixhc-font: inherit;
	--wixhc-font-size-s: 0.875em;
	--wixhc-font-size-xs: 0.8em;
	--wixhc-weight-strong: 600;

	/* ---- motion ---- */
	--wixhc-duration: 160ms;
	--wixhc-ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* Modern browsers: tints and muted text mixed from the colour in use, so they
   follow the theme (and dark sections) instead of fixed greys. Muted text is
   72% of the text colour: 6:1 for near-black on white, AA on any palette
   whose own body text is AA. */
@supports (color: color-mix(in srgb, red 50%, blue)) {
	:root,
	:where(.wixhc-root, .wixhc-hero, .wixhc-contact, .wixhc-drawer, .wixhc-book, .wixhc-events, .wixhc-events-bar-wrap, .wixhc-native, .wixhc-shop, .wixhc-paywall, .wixhc-plan-confirm, .wixhc-access, .wixhc-loginbar, .wixhc-cart-toggle, .wixhc-stars-summary, .wixhc-lightbox) {
		--wixhc-brand-hover: var(--pw-brand-dark, color-mix(in srgb, var(--wixhc-brand) 84%, var(--wixhc-on-brand)));
		--wixhc-brand-soft: var(--pw-brand-soft, color-mix(in srgb, var(--wixhc-brand) 9%, transparent));
		--wixhc-surface-alt: var(--pw-bg-soft, var(--wixhc-soft, var(--wixhc-ev-soft, color-mix(in srgb, currentColor 5%, transparent))));
		--wixhc-muted: var(--pw-muted, var(--wixhc-ev-muted, color-mix(in srgb, currentColor 72%, transparent)));
		--wixhc-border: var(--pw-border, var(--wixhc-line, var(--wixhc-ev-border, color-mix(in srgb, currentColor 15%, transparent))));
		--wixhc-border-strong: color-mix(in srgb, currentColor 42%, transparent);
	}
}

/* ---------- shared focus ring (keyboard focus on every control) ----------
   A 2 px ring in the theme's text colour (blue without a theme palette),
   2 px clear of the control so it shows on filled buttons too. */
.wixhc-root :where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.wixhc-hero :where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.wixhc-contact :where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.wixhc-drawer :where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.wixhc-book :where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.wixhc-events :where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.wixhc-events-bar-wrap :where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.wixhc-native :where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.wixhc-shop :where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.wixhc-paywall :where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.wixhc-plan-confirm :where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.wixhc-access :where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.wixhc-loginbar :where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible,
.wixhc-cart-toggle:focus-visible,
a.wixhc-stars-summary:focus-visible {
	outline: 2px solid var(--wixhc-focus);
	outline-offset: 2px;
}

/* ---------- reduced motion: no slides, lifts, pulses or zooms ---------- */
@media (prefers-reduced-motion: reduce) {
	:where(.wixhc-root, .wixhc-hero, .wixhc-contact, .wixhc-drawer-overlay, .wixhc-book, .wixhc-events, .wixhc-native, .wixhc-shop, .wixhc-lightbox, .wixhc-loginbar),
	:where(.wixhc-root, .wixhc-hero, .wixhc-contact, .wixhc-drawer-overlay, .wixhc-book, .wixhc-events, .wixhc-native, .wixhc-shop, .wixhc-lightbox, .wixhc-loginbar) *,
	:where(.wixhc-root, .wixhc-hero, .wixhc-contact, .wixhc-drawer-overlay, .wixhc-book, .wixhc-events, .wixhc-native, .wixhc-shop, .wixhc-lightbox, .wixhc-loginbar) *::before,
	:where(.wixhc-root, .wixhc-hero, .wixhc-contact, .wixhc-drawer-overlay, .wixhc-book, .wixhc-events, .wixhc-native, .wixhc-shop, .wixhc-lightbox, .wixhc-loginbar) *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
