/**
 * Design tokens.
 *
 * Fluid values are derived from the two Phase 0 reference breakpoints
 * (390px mobile / 1440px desktop) using the standard clamp() interpolation
 * formula, not hardcoded per-breakpoint overrides:
 *
 *   slope = (maxSize - minSize) / (maxViewport - minViewport)
 *   intersect = minSize - slope * minViewport
 *   preferred = intersect + (slope * 100)vw
 *
 * Direction C: Funnel Display, Funnel Sans and Geist Mono, self-hosted in
 * fonts/c/ and declared in fonts/c/fonts.css. Every font-family in the theme resolves through
 * --font-display / --font-body, so the face is swappable from here alone.
 */

:root {
	/* ---- Color: Direction C, the living campaign (A · Pasteboard) ----
	   The working file as the website: near-white paper for reading, cobalt
	   for the file itself (hero, close), a grey pasteboard where work is laid
	   out, a blue tint that leads back into cobalt. One accent, the selection
	   blue. Contrast on --color-bg (#F7F8FA): fg 17.6:1, --dim 9.9:1,
	   --faint 4.9:1, accent 6.3:1. */
	--color-bg: #f7f8fa;
	--color-bg-elevated: #ffffff;
	--color-fg: #121318;
	--color-fg-soft: #2a2d35;
	--color-fg-dim: #3e424c;
	--color-fg-faint: #636874;
	--color-line: #d5d8e0;
	--color-line-strong: #b9bec9;
	--color-accent: #2443ff;
	--color-accent-contrast: #ffffff;

	/* The three named grounds of Direction C, beside paper. */
	--color-blue: #2443ff;
	--color-blue-deep: #1b33d9;
	--color-blue-ink: #1427a8;
	--color-blue-soft: #dce2ff;
	--color-blue-tint: #eef1ff;
	--color-paste: #e4e6eb;

	/* Direction B's three format colours collapse into Direction C's one
	   accent: kinds of work are named, never colour-coded. Kept as tokens so
	   every rule that used them follows. 6.3:1 on paper. */
	--color-format-pink: #2443ff;
	--color-format-pink-soft: #2443ff;
	--color-format-tangerine: #2443ff;
	--color-format-tangerine-soft: #2443ff;
	--color-format-blue: #2443ff;
	--color-label: #3e424c;

	/* ---- Light surface ----
	   Project Content's "light" ground, for creative built for a white page.
	   On Direction C's paper it is the raised white panel. */
	--color-surface-light: #ffffff;
	--color-surface-light-raised: #ffffff;
	--color-fg-on-light: #121318;
	--color-fg-on-light-dim: #3e424c;
	--color-line-on-light: #d5d8e0;

	/* ---- Type: Funnel Display / Funnel Sans, Geist Mono (fonts/c/fonts.css) ----
	   Statements in Funnel Display, reading and interface in Funnel Sans
	   (one family's display and text cuts), Geist Mono only for sizes,
	   coordinates and file names. */
	--font-display: "Funnel Display", "Funnel Sans", system-ui, sans-serif;
	--font-body: "Funnel Sans", system-ui, sans-serif;
	--font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

	/* ---- Fluid gutter: 39px @390 -> --gutter-max on large screens ----
	   The ceiling is a token of its own so Site Settings → Layout can raise or
	   lower it without touching the responsive slope. The min and the vw term
	   are unchanged, so small screens keep their existing behaviour until the
	   configured ceiling drops below what the slope already produces there.
	   Deliberately rem, not px: the gutter still scales with a reader's root
	   font-size preference. inc/theme-settings.php converts the admin's px
	   value to rem so the setting reads in px without changing that. */
	--gutter-max: 7.5rem;
	/* Direction C: A's margins, 16px on a phone to 36px. Site Settings →
	   Layout's gutter value still applies, as the ceiling. */
	--gutter: min(clamp(1rem, 2.4vw, 2.25rem), var(--gutter-max));

	/* ---- Fluid type scale ---- */
	/* Hero display headline: 44px @390 -> 144px @1440 (oversized, above project-title scale) */
	--size-hero: clamp(2.75rem, 0.429rem + 9.524vw, 8.25rem);
	/* Direction C's hero statement: A's scale, 8.6vw between 52px and 144px. */
	--size-hero-b: clamp(3.25rem, 8.6vw, 9rem);
	/* Below 900px the hero is one column: 52px on a phone, 90px at most. */
	--size-hero-b-narrow: clamp(3.25rem, 13vw, 5.625rem);
	/* Project / work title: 40px @390 -> 96px @1440 (measured reference scale).
	   Deliberately single-purpose: this drives .project-section__title, so the
	   work always outranks a supporting section heading. Section headings use
	   --size-section below — re-overloading this token flattens that hierarchy
	   back to where a project title and a section heading were both 96px. */
	--size-h1: clamp(2.5rem, 1.2rem + 5.333vw, 6rem);
	/* Supporting section heading: 40px @390 -> 86px @1440. One clear step below
	   --size-h1 at desktop and converging on it at mobile, where 40px is already
	   the floor for both — so the desktop reduction tapers away on phones rather
	   than needing a breakpoint override. */
	--size-section: clamp(2.375rem, 4.8vw, 4.75rem);
	/* Secondary heading (work intro, company transition) */
	--size-h2: clamp(1.75rem, 1.19rem + 2.286vw, 3.25rem);
	/* Hero supporting copy: 18px @390 -> 32px @1440 */
	--size-body-lg: clamp(1.125rem, 0.8rem + 1.333vw, 2rem);
	--size-body: clamp(1rem, 0.89rem + 0.457vw, 1.25rem);
	--size-small: clamp(0.8125rem, 0.76rem + 0.229vw, 0.9375rem);
	/* CTA / eyebrow label */
	--size-label: clamp(0.75rem, 0.694rem + 0.229vw, 0.9rem);
	/* The smallest text there is: mono captions, tags, format bars, Play
	   controls. A floor, not a scale step — 13px
	   (below). Direction C sets 13px everywhere: mono labels are never smaller. */
	--size-micro: 0.8125rem;

	/* ---- Spacing ---- */
	--space-2xs: 0.5rem;
	--space-xs: 1rem;
	--space-sm: 1.5rem;
	--space-md: 2.5rem;
	--space-lg: clamp(2rem, 1.5rem + 1.6vw, 3rem);
	/* Section padding: 72px on phones -> 128px at 1440px. Major groups need
	   more breathing room than related content within one, so only this token
	   grows; card gaps and heading-to-copy spacing stay on --space-lg and
	   below, and the editor's reduced (--space-lg) and none (0) settings are
	   untouched. Adjacent sections each contribute their own padding. */
	--space-xl: clamp(4.5rem, 2.5rem + 6.2vw, 8rem);

	/* Direction C's rhythm: between groups, a group's head to its content,
	   and related things inside a group. */
	--group: clamp(6rem, 9vw, 10rem);
	--head: clamp(2.25rem, 4vw, 4rem);
	--near: clamp(1.25rem, 2vw, 2rem);

	/* ---- Layout ---- */
	/* Informational content stops growing above the 1440 reference width: at a
	   1440px viewport .container's usable inner width is already 1200px, so this
	   ceiling freezes that composition and sends every additional pixel to the
	   outer margin instead of into the grid. Deliberately a fixed px value, not a
	   clamp — it is a ceiling, not a fluid slope. Every ch-based text measure on
	   the site fits inside 1200px, so no copy is clipped by it. */
	--content-max: 1440px;
	/* The wide container, for Project Content's Media Layout. Its only job is
	   arithmetic: four 300px creatives with the standard --space-md gap between
	   them need 4 × 300 + 3 × 40 = 1320px of usable width, and a 3/12 column of
	   a W-wide grid is W/4 − 0.75 × gap. At 1840 that column is 430px, so four
	   300×600s sit across a large desktop with room around each rather than
	   pressed against their neighbours.

	   Derived from --content-max rather than fixed, so lowering the content
	   ceiling in Site Settings → Layout narrows this in step and the
	   relationship between the two containers survives. */
	--content-max-wide: calc(var(--content-max) + 400px);
	/* The fixed header's height: the logo's line box plus its padding, the
	   same expression header.css sizes it with. Page heads clear it. */
	--header-h: calc(clamp(1.125rem, 1rem + 0.6vw, 1.5rem) * 1.5 + 2 * var(--space-sm));
	/* Direction C's working objects are flat white panels on a ground, with
	   no frame line: the ground is the edge. */
	--frame-bg: var(--color-bg-elevated);
	--frame-border: transparent;
	--frame-shadow: none;
	--radius-pill: 999px;
	--radius-sm: 4px;

	/* ---- Motion ---- */
	--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
	--duration-fast: 240ms;
	--duration-base: 480ms;
	--duration-slow: 800ms;

	color-scheme: light;
}

@media (max-width: 640px) {
	:root {
		--size-micro: 0.8125rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	:root {
		--duration-fast: 1ms;
		--duration-base: 1ms;
		--duration-slow: 1ms;
	}
}
