/* ==========================================================================
   Agency Core — design tokens and the handful of components Elementor
   should not own. Layout stays in Elementor; identity lives here.
   ========================================================================== */

:root {
	/* --- Colour ------------------------------------------------------
	   Contrast ratios measured against --paper.
	   ink 17.5:1 · muted 5.1:1 · accent-ink 5.7:1 · accent 3.5:1
	   --accent is DECORATIVE ONLY: rules, marks, underlines, large display
	   type. It fails AA for body copy. Use --accent-ink for coloured text. */
	--paper:        #FAF9F6;
	--paper-sunk:   #F2F0EA;
	--ink:          #14140F;
	--ink-soft:     #3A3A33;
	--muted:        #6B6B63;
	--line:         #E2DFD6;
	--accent:       #E4572E;
	--accent-ink:   #B23A16;

	/* --- Type -------------------------------------------------------- */
	--font-display: "Archivo", "Archivo Fallback", "Helvetica Neue", Arial, sans-serif;
	--font-text:    "Source Sans 3", "Source Sans Fallback", system-ui, -apple-system, sans-serif;
	--font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

	/* Scale retuned for a grotesque. Archivo at 700 carries far more visual
	   weight than a serif at the same size, so the display ceiling comes down
	   from 88px to 72px and the tracking goes tighter. Same optical presence,
	   less bludgeon. */
	--step-display: clamp(2.50rem, 1.70rem + 3.6vw, 4.5rem);
	--step-h2:      clamp(1.875rem, 1.35rem + 2.2vw, 2.875rem);
	--step-h3:      clamp(1.25rem, 1.10rem + 0.70vw, 1.5rem);
	--step-lead:    clamp(1.0625rem, 1.00rem + 0.35vw, 1.1875rem);
	--step-body:    1.09375rem;
	--step-small:   0.875rem;
	--step-eyebrow: 0.75rem;

	/* --- Space ------------------------------------------------------- */
	--s-1: 0.25rem;  --s-2: 0.5rem;   --s-3: 0.75rem;  --s-4: 1rem;
	--s-5: 1.5rem;   --s-6: 2rem;     --s-7: 3rem;     --s-8: 4rem;
	--section: clamp(4.5rem, 3rem + 7vw, 9rem);
	--gutter:  clamp(1.25rem, 5vw, 2.5rem);
	--measure: 65ch;

	/* --- Motion ------------------------------------------------------ */
	--ease: cubic-bezier(0.22, 1, 0.36, 1);
	--dur:  520ms;
	--reveal-delay: 0ms;
}

/* Metric-matched fallbacks so swapping in the real face does not shift layout.
   NOTE: these overrides are approximate. Tune them with a fallback-font
   generator once the woff2 files are in place, then re-measure CLS. */
@font-face {
	font-family: "Archivo Fallback";
	src: local("Helvetica Neue"), local("Arial");
	size-adjust: 101%;
	ascent-override: 92%;
	descent-override: 24%;
	line-gap-override: 0%;
}
@font-face {
	font-family: "Source Sans Fallback";
	src: local("Helvetica Neue"), local("Arial");
	size-adjust: 97%;
	ascent-override: 98%;
	descent-override: 27%;
	line-gap-override: 0%;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

html { -webkit-text-size-adjust: 100%; }

body {
	background: var(--paper);
	color: var(--ink-soft);
	font-family: var(--font-text);
	font-size: var(--step-body);
	line-height: 1.65;
	font-synthesis-weight: none;
	text-rendering: optimizeLegibility;
}

h1, h2, h3, .agency-display {
	font-family: var(--font-display);
	color: var(--ink);
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -0.03em;
	text-wrap: balance;
}

h1 { font-size: var(--step-display); letter-spacing: -0.038em; }
h2 { font-size: var(--step-h2); }
h3 { font-size: var(--step-h3); font-weight: 600; line-height: 1.25; letter-spacing: -0.015em; }

p { text-wrap: pretty; }
p, li { max-width: var(--measure); }

.agency-lead {
	font-size: var(--step-lead);
	line-height: 1.55;
	color: var(--muted);
}

.agency-eyebrow {
	font-family: var(--font-mono);
	font-size: var(--step-eyebrow);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--muted);
	font-weight: 500;
}

/* --------------------------------------------------------------------------
   Accessibility — non-negotiable
   -------------------------------------------------------------------------- */

/* One visible focus style, everywhere, that survives every Elementor widget. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--accent-ink);
	outline-offset: 2px;
	border-radius: 2px;
}

.skip-link {
	position: absolute;
	left: var(--s-4);
	top: var(--s-4);
	z-index: 999;
	padding: var(--s-3) var(--s-5);
	background: var(--ink);
	color: var(--paper);
	text-decoration: none;
	transform: translateY(-200%);
	transition: transform 160ms var(--ease);
}
.skip-link:focus { transform: translateY(0); }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0);
	white-space: nowrap; border: 0;
}

/* Minimum 44x44 tap target on anything interactive in the header/footer. */
.agency-header a,
.agency-footer a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;   /* Tap target, without forcing single-line text. */
}

/* --------------------------------------------------------------------------
   Motion — reveal on scroll
   Only applies when JS is present. Without .has-js nothing is ever hidden.
   -------------------------------------------------------------------------- */

.has-js .js-reveal {
	opacity: 0;
	transform: translateY(18px);
	transition:
		opacity   var(--dur) var(--ease) var(--reveal-delay),
		transform var(--dur) var(--ease) var(--reveal-delay);
	will-change: opacity, transform;
}
.has-js .js-reveal.is-revealed {
	opacity: 1;
	transform: none;
	will-change: auto;
}

/* Nothing above the fold animates. Mark hero elements with .no-reveal. */
.has-js .js-reveal.no-reveal { opacity: 1; transform: none; transition: none; }

@media (prefers-reduced-motion: reduce) {
	.has-js .js-reveal,
	.has-js .js-reveal.is-revealed {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}
	*, *::before, *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.agency-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: color-mix(in srgb, var(--paper) 88%, transparent);
	backdrop-filter: saturate(1.4) blur(10px);
	border-bottom: 1px solid transparent;
	transition: border-color 220ms var(--ease), box-shadow 220ms var(--ease);
}
.agency-header.is-stuck {
	border-bottom-color: var(--line);
	box-shadow: 0 1px 24px rgba(20, 20, 15, 0.06);
}

/* --------------------------------------------------------------------------
   Buttons
   Primary is ink, not accent: 17:1 contrast, and it reads more editorial.
   Accent is reserved for hover and marks.
   -------------------------------------------------------------------------- */

.agency-btn {
	display: inline-flex;
	align-items: center;
	gap: var(--s-2);
	min-height: 48px;
	padding: 0 var(--s-6);
	font-family: var(--font-text);
	font-size: var(--step-body);
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	border: 1px solid var(--ink);
	border-radius: 2px;
	background: var(--ink);
	color: var(--paper);
	cursor: pointer;
	transition: background 200ms var(--ease), border-color 200ms var(--ease), transform 200ms var(--ease);
}
.agency-btn:hover {
	background: var(--accent-ink);   /* white on #B23A16 = 5.98:1 */
	border-color: var(--accent-ink);
	transform: translateY(-1px);
}
.agency-btn--ghost {
	background: transparent;
	color: var(--ink);
	border-color: var(--line);
}
.agency-btn--ghost:hover {
	background: transparent;
	color: var(--accent-ink);
	border-color: var(--accent-ink);
}
@media (prefers-reduced-motion: reduce) {
	.agency-btn:hover { transform: none; }
}

/* --------------------------------------------------------------------------
   Metrics — the three numbers on every case study
   -------------------------------------------------------------------------- */

.agency-metrics {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--s-6);
	margin: var(--s-7) 0;
	padding: var(--s-6) 0;
	border-top: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
}
@media (min-width: 40em) {
	.agency-metrics { grid-template-columns: repeat(3, 1fr); gap: var(--s-5); }
}
.agency-metrics__item { min-width: 0; }
.agency-metrics__value {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: clamp(2.25rem, 1.5rem + 3.2vw, 3.5rem);
	line-height: 1;
	color: var(--ink);
	letter-spacing: -0.04em;
	font-variant-numeric: tabular-nums lining-nums;
}
.agency-metrics__label {
	margin: var(--s-3) 0 0;
	font-family: var(--font-mono);
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--muted);
	line-height: 1.45;
	max-width: 24ch;
}

/* --------------------------------------------------------------------------
   Project link
   -------------------------------------------------------------------------- */

.agency-project-link {
	color: var(--accent-ink);
	text-decoration: underline;
	text-underline-offset: 0.2em;
	text-decoration-thickness: 1px;
}
.agency-project-link:hover { text-decoration-thickness: 2px; }

/* --------------------------------------------------------------------------
   Chat launcher (facade — the vendor script loads on click)
   -------------------------------------------------------------------------- */

.agency-chat {
	position: fixed;
	right: max(var(--s-5), env(safe-area-inset-right));
	bottom: max(var(--s-5), env(safe-area-inset-bottom));
	z-index: 200;
	display: inline-flex;
	align-items: center;
	gap: var(--s-2);
	min-height: 52px;
	padding: 0 var(--s-5);
	border: 0;
	border-radius: 999px;
	background: var(--ink);
	color: var(--paper);
	font-family: var(--font-text);
	font-size: var(--step-small);
	font-weight: 500;
	cursor: pointer;
	box-shadow: 0 6px 28px rgba(20, 20, 15, 0.18);
	transition: background 200ms var(--ease), transform 200ms var(--ease);
}
.agency-chat:hover { background: var(--accent-ink); transform: translateY(-2px); }
.agency-chat.is-loading { opacity: 0.7; cursor: progress; }
.agency-chat__icon { flex: none; }
@media (max-width: 30em) {
	.agency-chat__label { display: none; }   /* Icon only on small screens. */
	.agency-chat { padding: 0; width: 52px; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
	.agency-chat:hover { transform: none; }
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.agency-section { padding-block: var(--section); }
.agency-wrap    { width: min(100% - (var(--gutter) * 2), 1200px); margin-inline: auto; }
.agency-rule    { border: 0; border-top: 1px solid var(--line); margin-block: var(--s-7); }
.agency-mark    { background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 32%, transparent) 0); }
