/* ==========================================================================
   Wildform — landing page
   ========================================================================== */

@font-face {
	font-family: "Geist Variable";
	src: url("../fonts/geist-latin-wght-normal.woff2") format("woff2");
	font-weight: 100 900;
	font-display: swap;
}
@font-face {
	font-family: "Geist Mono Variable";
	src: url("../fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
	font-weight: 100 900;
	font-display: swap;
}

/* --- Tokens ------------------------------------------------------------- */

:root {
	/* B. Wildform green (default) */
	--bg: #eef0ea;
	--ink: #10291c;
	--ink-2: #45564b;
	--ink-3: #5a675d;
	--line: rgb(16 41 28 / 0.14);
	--accent: #c4f542;
	--accent-ink: #10291c;
	/* Botanical / mineral supporting tones, used by the experiments */
	--moss: #4f6b3a;
	--sage: #a9b79a;
	--lichen: #d5dcc4;
	--stone: #9b978c;
	--clay: #b88a6a;

	--sans: "Geist Variable", system-ui, -apple-system, "Segoe UI", sans-serif;
	--mono: "Geist Mono Variable", ui-monospace, "SF Mono", Menlo, monospace;
	--wf-display: var(--sans);
	--wf-display-weight: 640;
	--wf-display-tracking: -0.055em;

	--gutter: clamp(16px, 2.4vw, 40px);
	--ease-out: cubic-bezier(0.22, 1, 0.36, 1);
	--ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

	color-scheme: light;
}

.palette-mono {
	/* A. Minimal monochrome */
	--bg: #f3f1ec;
	--ink: #151513;
	--ink-2: #4c4b46;
	--ink-3: #66645e;
	--line: rgb(21 21 19 / 0.14);
	--accent: #ff5b22;
	--accent-ink: #151513;
	--moss: #3d3c38;
	--sage: #a19e95;
	--lichen: #d9d6cd;
	--stone: #8d8a82;
	--clay: #b07c5c;
}

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

*, *::before, *::after { box-sizing: border-box; }

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

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--sans);
	font-size: 15px;
	line-height: 1.45;
	font-synthesis: none;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

p, h1, h2, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: inherit; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
	outline: 2px solid var(--ink);
	outline-offset: 3px;
	border-radius: 2px;
}

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

/* Small mono type shared by the contact overlay's labels */
.contact__title,
.contact__count,
.step__num,
.contact__kbd {
	font-family: var(--mono);
	font-size: 11.5px;
	line-height: 1.3;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-weight: 450;
}

/* --- Page grid ---------------------------------------------------------- */

/* Three rows: equal space above and below keeps the wordmark on the true
   optical centre; the bottom row holds the services line and the button. */
.page {
	position: relative;
	z-index: 2;
	min-height: 100vh;
	min-height: 100svh;
	display: grid;
	grid-template-rows: 1fr auto 1fr;
	padding: var(--gutter);
	padding-top: max(var(--gutter), env(safe-area-inset-top));
	padding-bottom: max(calc(var(--gutter) * 1.25), env(safe-area-inset-bottom));
}

/* --- Wordmark ----------------------------------------------------------- */

.hero {
	grid-row: 2;
	min-width: 0;
	/* Nudge slightly above centre: the eye reads true centre as low. */
	transform: translateY(-3vh);
}

.wordmark {
	position: relative;
	/* Set by JS to fit the available width exactly; this is the no-JS fallback. */
	--wf-size: 18vw;
}

.wordmark__text {
	font: inherit;
	margin: 0;
}

.wordmark__glyphs {
	display: flex;
	flex-wrap: nowrap;
	justify-content: center;
	font-family: var(--wf-display);
	font-weight: var(--wf-display-weight);
	font-size: var(--wf-size);
	letter-spacing: var(--wf-display-tracking);
	line-height: 0.8;
	white-space: nowrap;
	font-kerning: normal;
	user-select: none;
	-webkit-user-select: none;
}

.glyph {
	display: inline-block;
	position: relative;
	/* Pair kerning is measured in JS and applied here, since each glyph is its own box. */
	margin-inline-end: var(--kern, 0px);
	transform: translate3d(var(--dx, 0px), var(--dy, 0px), 0);
	transition: transform 0.9s var(--ease-out);
}
/* Trailing tracking would push the word off-centre. */
.glyph:last-child { letter-spacing: 0; }

.wordmark__break { display: none; }

/* Entrance: letters rise out of their own baseline, once. */
.js .glyph {
	animation: glyph-in 1.2s var(--ease-out) both;
	animation-delay: calc(0.15s + var(--i) * 0.055s);
}
@keyframes glyph-in {
	from { clip-path: inset(0 -20% 100% -20%); translate: 0 0.2em; }
	to   { clip-path: inset(-30% -30% -30% -30%); translate: 0 0; }
}

/* Invisible keyboard/touch targets laid over each glyph by JS */
.wordmark__keys { display: none; }
.js .wordmark__keys { display: block; }
.key {
	position: absolute;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	cursor: crosshair;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}
.key:focus-visible {
	outline: 1px solid var(--ink);
	outline-offset: 4px;
	border-radius: 0;
}

/* --- Bottom: services + contact ----------------------------------------- */

.bottom {
	grid-row: 3;
	align-self: end;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: clamp(20px, 3.4vh, 32px);
	text-align: center;
}

.services {
	max-width: 46ch;
	font-size: 13px;
	line-height: 1.65;
	letter-spacing: 0.002em;
	color: var(--ink-2);
	text-wrap: balance;
	font-feature-settings: "ss01" 1;
}
.services__item { white-space: nowrap; }
.services__sep { color: var(--ink-3); padding-inline-end: 0.1em; }

.cta {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	padding: 0 22px 0 18px;
	border: 1px solid var(--ink);
	border-radius: 999px;
	background: transparent;
	font-family: var(--mono);
	font-size: 11.5px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-weight: 500;
	cursor: pointer;
	overflow: hidden;
	isolation: isolate;
}
/* The dot is the seed: on hover it grows to fill the button. */
.cta::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--accent);
	box-shadow: 0 0 0 1px var(--ink);
	flex: none;
}
.cta::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--accent);
	clip-path: circle(3.5px at 21.5px 50%);
	opacity: 0;
	transition: clip-path 0.6s var(--ease-out), opacity 0.2s;
}
.cta:hover::after,
.cta:focus-visible::after {
	opacity: 1;
	clip-path: circle(140% at 21.5px 50%);
}
.cta:active { transform: scale(0.98); }

/* Short, wide viewports (laptops with toolbars, landscape tablets) */
@media (min-width: 761px) and (max-height: 620px) {
	.page { grid-template-rows: 0.6fr auto 1fr; }
	.hero { transform: none; }
	.bottom { gap: 14px; }
}

/* --- Stage canvases ----------------------------------------------------- */

.stage {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}
.stage--back { z-index: 1; }
.stage--front { z-index: 3; }
.no-js .stage { display: none; }

/* --- Contact overlay ---------------------------------------------------- */

.contact {
	position: fixed;
	inset: 0;
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: var(--bg);
	color: var(--ink);
	overscroll-behavior: contain;
}
.contact::backdrop { background: var(--bg); }

/* After LET'S TALK the letters lie in a pile behind a translucent form. */
.is-fallen .contact { background: color-mix(in srgb, var(--bg) 80%, transparent); }
.is-fallen .contact::backdrop { background: transparent; }
.is-fallen .contact[open] { animation-name: contact-in-soft; }
@keyframes contact-in-soft {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: none; }
}
/* The entrance plays once per visit; it must never replay after a rebuild. */
.has-entered .glyph { animation: none; }
.is-physics .glyph {
	animation: none;
	transition: none;
	will-change: transform;
}
.bottom { transition: opacity 0.4s var(--ease-out); }
.is-fallen .bottom { opacity: 0; }
.contact[open] { animation: contact-in 0.55s var(--ease-out) both; }
.contact.is-closing { animation: contact-out 0.35s var(--ease-in-out) both; }
@keyframes contact-in {
	from { opacity: 0; clip-path: inset(0 0 0 100% round 0); }
	to   { opacity: 1; clip-path: inset(0 0 0 0); }
}
@keyframes contact-out {
	from { opacity: 1; }
	to   { opacity: 0; }
}

.contact__inner {
	min-height: 100%;
	display: grid;
	grid-template-rows: auto auto 1fr auto;
	padding: var(--gutter);
	padding-top: max(var(--gutter), env(safe-area-inset-top));
	padding-bottom: max(var(--gutter), env(safe-area-inset-bottom));
}

.contact__bar {
	display: grid;
	grid-template-columns: 1fr auto auto;
	align-items: center;
	gap: 20px;
	min-height: 44px;
}
.contact__title {
	font-family: var(--mono);
	font-size: 11.5px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}
.contact__count { color: var(--ink-2); }
.contact__close {
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	border: 1px solid var(--ink);
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	transition: background 0.3s var(--ease-out), transform 0.5s var(--ease-out);
}
.contact__close svg { width: 16px; height: 16px; }
.contact__close:hover { background: var(--accent); transform: rotate(90deg); }

.contact__progress {
	height: 1px;
	margin-top: 14px;
	background: var(--line);
}
.contact__progress span {
	display: block;
	height: 100%;
	width: 100%;
	background: var(--ink);
	transform-origin: left;
	transform: scaleX(var(--p, 0.333));
	transition: transform 0.6s var(--ease-out);
}

.contact__form,
.contact__done {
	align-self: center;
	width: min(100%, 880px);
	margin-inline: auto;
	padding-block: clamp(32px, 8vh, 96px);
}

.step { border: 0; margin: 0; padding: 0; min-width: 0; }
.step[hidden] { display: none; }
.step.is-entering { animation: step-in 0.6s var(--ease-out) both; }
.step.is-entering-back { animation: step-in-back 0.6s var(--ease-out) both; }
@keyframes step-in {
	from { opacity: 0; transform: translateY(28px); }
	to   { opacity: 1; transform: none; }
}
@keyframes step-in-back {
	from { opacity: 0; transform: translateY(-28px); }
	to   { opacity: 1; transform: none; }
}

.step__num { color: var(--ink-3); margin-bottom: 18px; }
.step__q {
	display: block;
	font-family: var(--wf-display);
	font-weight: 560;
	font-size: clamp(32px, 5.4vw, 72px);
	line-height: 1;
	letter-spacing: -0.045em;
	text-wrap: balance;
}
.step__hint {
	margin-top: 14px;
	color: var(--ink-2);
	font-size: 15px;
}

.step__input {
	display: block;
	width: 100%;
	margin-top: clamp(24px, 4vh, 44px);
	padding: 10px 0 12px;
	border: 0;
	border-bottom: 1px solid var(--ink);
	border-radius: 0;
	background: transparent;
	color: var(--ink);
	font-family: var(--sans);
	font-size: clamp(22px, 2.6vw, 34px);
	line-height: 1.25;
	letter-spacing: -0.02em;
	caret-color: var(--ink);
	transition: border-color 0.3s;
	resize: vertical;
}
textarea.step__input { min-height: 3.9em; }
.step__input:focus { outline: none; box-shadow: 0 2px 0 0 var(--ink); }
.step__input:focus-visible { outline: none; }
.step__input[aria-invalid="true"] { border-bottom-color: #a3261b; box-shadow: 0 2px 0 0 #a3261b; }

.step__error {
	min-height: 1.5em;
	margin-top: 10px;
	color: #a3261b;
	font-size: 14px;
}

.hp {
	position: absolute !important;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.contact__actions {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 18px;
	flex-wrap: wrap;
}
.contact__kbd { color: var(--ink-3); margin-left: 8px; }

.btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	padding: 0 22px;
	border-radius: 999px;
	border: 1px solid var(--ink);
	font-family: var(--mono);
	font-size: 12px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.3s var(--ease-out), color 0.3s var(--ease-out), opacity 0.3s;
}
.btn svg { width: 14px; height: 14px; }
.btn[hidden] { display: none; }
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--accent); }
.btn[aria-busy="true"] { opacity: 0.6; cursor: progress; }

.contact__status {
	margin-top: 16px;
	min-height: 1.5em;
	color: var(--ink-2);
	font-size: 14px;
}
.contact__status.is-error { color: #a3261b; }

.contact__done:focus { outline: none; }
.done__title {
	font-family: var(--wf-display);
	font-weight: 560;
	font-size: clamp(36px, 6.4vw, 92px);
	line-height: 0.98;
	letter-spacing: -0.05em;
	text-wrap: balance;
	animation: step-in 0.8s var(--ease-out) both;
}
.done__body {
	margin: 22px 0 32px;
	max-width: 44ch;
	color: var(--ink-2);
	font-size: 17px;
	animation: step-in 0.8s 0.12s var(--ease-out) both;
}

.contact__privacy {
	font-size: 13px;
	color: var(--ink-2);
	max-width: 62ch;
}
.contact__privacy summary {
	cursor: pointer;
	display: inline-block;
	min-height: 24px;
	text-decoration: underline;
	text-decoration-color: var(--line);
	text-underline-offset: 4px;
}
.contact__privacy summary::-webkit-details-marker { display: none; }
.contact__privacy p { margin-top: 8px; }

html.has-dialog { overflow: hidden; }

.noscript {
	position: fixed;
	left: var(--gutter);
	bottom: 6px;
	z-index: 5;
	font-size: 13px;
}

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 760px) {
	.page { grid-template-rows: 1fr auto 1fr; }
	.hero { transform: translateY(-2vh); }

	/* WILD / FORM: two confident rows rather than one thin line. */
	.wordmark__glyphs {
		flex-wrap: wrap;
		line-height: 0.84;
	}
	.wordmark__break { display: block; flex-basis: 100%; height: 0; }
	.glyph[data-glyph="3"] { letter-spacing: 0; }

	.services { font-size: 12.5px; max-width: 42ch; }

	.contact__kbd { display: none; }
	.contact__form, .contact__done { padding-block: 32px; align-self: start; }
}

@media (prefers-reduced-motion: reduce) {
	/* Zero, not 0.01ms: a non-zero duration on transition-property: all would
	   still animate font-size changes and break the wordmark's fit measurement. */
	*, *::before, *::after {
		animation: none !important;
		transition-duration: 0s !important;
	}
	.glyph { transform: none; }
	.js .glyph { animation: none; }
}

@media (forced-colors: active) {
	.stage { display: none; }
}

/* --- Plain pages (index.php) -------------------------------------------- */

.plain__wrap { padding: var(--gutter); max-width: 760px; }
.plain__main { padding-block: 10vh; }
.prose h1 {
	font-family: var(--wf-display);
	font-weight: 600;
	font-size: clamp(36px, 6vw, 72px);
	letter-spacing: -0.045em;
	line-height: 1;
	margin-bottom: 32px;
}
.prose p, .prose li { font-size: 17px; line-height: 1.6; margin-bottom: 1em; max-width: 64ch; }
.prose h2 { font-size: 22px; letter-spacing: -0.02em; margin: 2em 0 0.6em; }
