/*
 * Church Plugins 2026: design tokens as --cp-* custom properties.
 *
 * This file is loaded FIRST on every page, so it also declares the cascade layer order.
 * Values come from theme.json (WordPress prints them as --wp--preset--* / --wp--custom--*).
 * The literal after each comma is only a fallback for contexts without global styles.
 * To change a token: edit theme.json, then update the fallback here. Never invent a colour.
 */
@layer reset, tokens, base, components, sections, utilities;

/* Metric-matched local fallback so the Poppins swap does not shift layout (CLS). */
@font-face {
	font-family: "Poppins Fallback";
	src: local("Arial");
	size-adjust: 112.1%;
	ascent-override: 93.62%;
	descent-override: 31.21%;
	line-gap-override: 8.92%;
}

@layer tokens {
	:root {
		/* Colour. Teal is a FILL: put charcoal text on it, never white. Links use teal-ink. */
		--cp-teal: var(--wp--preset--color--teal, #5AC1A7);
		--cp-teal-dark: var(--wp--preset--color--teal-dark, #2F8F78);
		--cp-teal-ink: var(--wp--preset--color--teal-ink, #1F6E5B);
		--cp-charcoal: var(--wp--preset--color--charcoal, #1E2329);
		--cp-grey-2: var(--wp--preset--color--grey-2, #5B636B);
		--cp-grey: var(--wp--preset--color--grey, #F2F4F5);
		--cp-line: var(--wp--preset--color--line, #E3E6E8);
		--cp-white: var(--wp--preset--color--white, #FFFFFF);

		/* Type */
		--cp-font-head: var(--wp--preset--font-family--heading, Poppins, "Poppins Fallback", system-ui, sans-serif);
		--cp-font-body: var(--wp--preset--font-family--body, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
		--cp-text-sm: var(--wp--preset--font-size--small, 14px);
		--cp-text-base: var(--wp--preset--font-size--base, clamp(16px, 15px + 0.27vw, 18px));
		--cp-text-md: var(--wp--preset--font-size--md, clamp(18px, 17px + 0.27vw, 20px));
		--cp-text-lg: var(--wp--preset--font-size--lg, clamp(20px, 17.3px + 0.68vw, 25px));
		--cp-text-xl: var(--wp--preset--font-size--xl, clamp(25px, 21.8px + 0.82vw, 31px));
		--cp-text-xxl: var(--wp--preset--font-size--xxl, clamp(31px, 26.7px + 1.1vw, 39px));
		--cp-text-display: var(--wp--preset--font-size--display, clamp(36px, 27.5px + 2.2vw, 52px));

		/* Space: 8px grid (same names as the playbook --s1..--s12) */
		--cp-s-half: var(--wp--preset--spacing--half, 4px);
		--cp-s1: var(--wp--preset--spacing--1, 8px);
		--cp-s2: var(--wp--preset--spacing--2, 16px);
		--cp-s3: var(--wp--preset--spacing--3, 24px);
		--cp-s4: var(--wp--preset--spacing--4, 32px);
		--cp-s5: var(--wp--preset--spacing--5, 40px);
		--cp-s6: var(--wp--preset--spacing--6, 48px);
		--cp-s8: var(--wp--preset--spacing--8, 64px);
		--cp-s10: var(--wp--preset--spacing--10, 80px);
		--cp-s12: var(--wp--preset--spacing--12, 96px);

		/* Layout */
		--cp-maxw: var(--wp--style--global--wide-size, 1120px);
		--cp-prose: var(--wp--style--global--content-size, 680px);
		--cp-gutter: var(--wp--custom--gutter, clamp(16px, 4.1vw, 24px));

		/* Shape */
		--cp-radius: var(--wp--custom--radius, 16px);
		--cp-radius-sm: var(--wp--custom--radius-sm, 8px);
		--cp-radius-pill: var(--wp--custom--radius-pill, 999px);
		--cp-shadow: 0 12px 32px rgba(16, 24, 40, 0.10);
		--cp-shadow-lg: 0 24px 48px rgba(16, 24, 40, 0.16);

		/* Interaction */
		--cp-tap: 44px;          /* minimum tap target */
		--cp-btn-h: 48px;        /* button height: 48 on phones ... */
		--cp-focus: 2px solid var(--cp-charcoal);
		--cp-focus-offset: 2px;
		--cp-ease: 150ms ease;
	}

	@media (min-width: 782px) {
		:root { --cp-btn-h: 52px; } /* ... 52 on larger screens */
	}
}
