/*
 * GHOSTBuyer. One stylesheet for every page, served as written: the build
 * copies it untouched, because the Worker's own pages (the 404 and the form's
 * no-JavaScript reply, src/routes/contact.ts) link it by this exact name.
 *
 * GHOSTBuyer shows a company its own sales process the way its buyers see it,
 * so the site is set like a plain account rather than a pitch: strong type
 * on paper, centred, numbered sections, and one colour, kept for the place a
 * buyer is lost. The one picture is a buying path, drawn on the home page and
 * set as words beneath it.
 */

@font-face {
	font-family: "Inter Tight";
	src: url("/fonts/inter-tight-latin.woff2") format("woff2");
	font-weight: 300 700;
	font-style: normal;
	font-display: swap;
}

:root {
	--paper: #f3f1ec;
	--raised: #fbfaf7;
	--ink: #141414;
	--muted: #57564f;
	--line: rgb(20 20 20 / 14%);
	--line-strong: rgb(20 20 20 / 32%);
	/* The one colour on the page, kept for the place a buyer is lost. */
	--signal: #c23b22;
	--on-signal: #ffffff;

	--gutter: clamp(1rem, 5vw, 5rem);
	--radius: 4px;

	--step-display: clamp(2.4rem, 7.4vw, 6.25rem);
	--step-statement: clamp(1.5rem, 3.2vw, 2.4rem);
	--step-lead: clamp(1.2rem, 2vw, 1.6rem);
	--step-body: clamp(1.0625rem, 1.2vw, 1.125rem);
	--step-fine: 0.8125rem;

	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--paper: #0f0f10;
		--raised: #18181a;
		--ink: #ecebe7;
		--muted: #a6a59f;
		--line: rgb(236 235 231 / 14%);
		--line-strong: rgb(236 235 231 / 34%);
		--signal: #ff7d61;
		--on-signal: #141414;
	}
}

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

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: "Inter Tight", system-ui, -apple-system, sans-serif;
	font-size: var(--step-body);
	font-weight: 400;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	/* `clip`, not `hidden`, so no scroll container is created. */
	overflow-x: clip;
}

a {
	color: inherit;
}

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

.skip {
	position: absolute;
	inset-inline-start: 1rem;
	inset-block-start: -4rem;
	z-index: 10;
	padding: 0.6rem 1rem;
	background: var(--ink);
	color: var(--paper);
	text-decoration: none;
	font-size: var(--step-fine);
}

.skip:focus {
	inset-block-start: 1rem;
}

/* Layout ------------------------------------------------------------------ */

.shell {
	width: 100%;
	max-width: 76rem;
	margin-inline: auto;
	padding-inline: var(--gutter);
}

h1,
h2,
h3 {
	margin: 0;
	font-weight: 600;
	letter-spacing: -0.035em;
	line-height: 1.02;
	text-wrap: balance;
}

strong {
	font-weight: 600;
}

/* The mark ----------------------------------------------------------------
 *
 * A path walked round into a G, ending where the buyer stands. The favicon
 * (icon.svg) draws the same shape on a dark tile.
 */

.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	text-decoration: none;
}

.brand__mark {
	inline-size: 1.9rem;
	block-size: 1.9rem;
	flex: none;
}

.brand__trail {
	fill: none;
	stroke: currentColor;
	stroke-width: 2.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.brand__dot {
	fill: var(--signal);
}

/* GHOST in outline, Buyer solid: the buyer you never see. */
.brand__word {
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.brand__ghost {
	color: transparent;
	-webkit-text-stroke: 1px var(--ink);
	letter-spacing: 0.02em;
}

/* Masthead ---------------------------------------------------------------- */

.masthead {
	padding-block: clamp(1rem, 2.5vw, 1.75rem);
}

.masthead__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 1rem 2rem;
}

@media (min-width: 48rem) {
	.masthead__inner {
		justify-content: space-between;
	}
}

.nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.5rem 1.4rem;
}

.nav__link {
	font-size: var(--step-fine);
	font-weight: 500;
	text-decoration: underline;
	text-decoration-color: transparent;
	text-underline-offset: 0.35em;
	transition: text-decoration-color 0.25s ease;
}

.nav__link:hover,
.nav__link[aria-current="page"] {
	text-decoration-color: currentColor;
}

.pill {
	padding: 0.5rem 1rem;
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	font-size: var(--step-fine);
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	transition: border-color 0.3s ease;
}

.pill:hover,
.pill[aria-current="page"] {
	border-color: var(--ink);
}

/* Hero -------------------------------------------------------------------- */

.hero {
	padding-block: clamp(2.5rem, 9vh, 6rem) 0;
	text-align: center;
}

.status {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	margin: 0 0 clamp(1.5rem, 4vh, 2.5rem);
	padding: 0.35rem 0.85rem 0.35rem 0.7rem;
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	font-size: var(--step-fine);
	font-weight: 500;
	letter-spacing: 0.02em;
}

.status__dot {
	inline-size: 0.5rem;
	block-size: 0.5rem;
	border-radius: 50%;
	background: var(--signal);
}

.display {
	max-width: 16ch;
	margin-inline: auto;
	font-size: var(--step-display);
	font-weight: 600;
	line-height: 1;
	letter-spacing: -0.045em;
}

.lede {
	margin: clamp(1.5rem, 4vh, 2.25rem) auto 0;
	max-width: 44ch;
	font-size: var(--step-lead);
	line-height: 1.45;
	letter-spacing: -0.015em;
	color: var(--muted);
	text-wrap: pretty;
}

.lede strong {
	color: var(--ink);
}

.hero__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 1rem 1.75rem;
	margin: clamp(1.75rem, 4vh, 2.5rem) 0 0;
}

/* The journey ------------------------------------------------------------
 *
 * A buying path set as words. The step where the buyer was lost is marked in
 * the page's one colour, and every step after it fades, because nobody got
 * that far. On a phone it is a track under the doorways: one node per step,
 * joined by a solid line that fades after the lost step. From a tablet up it
 * is a row of words.
 */

.journey {
	padding-block: clamp(1.5rem, 4vh, 2.25rem);
	border-block: 1px solid var(--line);
}

.journey__steps {
	margin: 0;
	padding: 0;
	list-style: none;
}

.journey__step {
	font-weight: 500;
	line-height: 1.2;
}

.journey__step--lost {
	color: var(--signal);
}

/* Only the name is struck through: a flex item passes the line to its children. */
.journey__step--lost .journey__name {
	text-decoration: line-through;
	text-decoration-thickness: 2px;
}

.journey__note {
	font-size: var(--step-fine);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.journey__step--after {
	color: var(--line-strong);
}

/* The note hangs under the lost step rather than pushing the path apart. */
.journey__step--lost {
	position: relative;
}

.journey__note {
	position: absolute;
	inset-block-start: calc(100% + 0.6rem);
	white-space: nowrap;
}

@media (max-width: 47.99rem) {
	.journey {
		padding-block-end: 3.25rem;
	}

	.journey__steps {
		display: grid;
		grid-template-columns: repeat(5, minmax(0, 1fr));
		column-gap: 0.3rem;
	}

	.journey__step {
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 0.65rem;
		font-size: 0.8125rem;
		letter-spacing: -0.01em;
		text-align: center;
		text-wrap: balance;
	}

	/* The node. Drawn, not written, so a screen reader hears only the steps. */
	.journey__step::before {
		content: "";
		position: relative;
		z-index: 1;
		inline-size: 0.75rem;
		block-size: 0.75rem;
		border: 2px solid currentColor;
		border-radius: 50%;
		background: currentColor;
	}

	/* Nobody reached it: an empty node. */
	.journey__step--after::before {
		background: var(--paper);
	}

	/* The line on to the next step, faded once the buyer is gone. */
	.journey__step:not(:last-child)::after {
		content: "";
		position: absolute;
		inset-block-start: calc(0.375rem - 1px);
		inset-inline-start: 50%;
		inline-size: calc(100% + 0.3rem);
		block-size: 2px;
		background: var(--ink);
	}

	.journey__step--lost:not(:last-child)::after {
		background: var(--line-strong);
	}

	.journey__step--lost .journey__note {
		inset-inline-start: 50%;
		transform: translateX(-50%);
	}
}

@media (min-width: 48rem) {
	.journey {
		padding-block-end: clamp(2.75rem, 6vh, 3.5rem);
	}

	.journey__steps {
		display: flex;
		flex-wrap: wrap;
		align-items: flex-start;
		justify-content: center;
		gap: 0.75rem 1.25rem;
	}

	.journey__step {
		display: flex;
		align-items: baseline;
		gap: 0.25rem 0.75rem;
		font-size: var(--step-lead);
		letter-spacing: -0.02em;
	}

	/* The separator is drawn, not written, so a screen reader hears only the steps. */
	.journey__step + .journey__step::before {
		content: "\203A" / "";
		color: var(--line-strong);
		font-weight: 400;
		margin-inline-end: 0.25rem;
	}

	.journey__note {
		inset-inline-start: 1.5rem;
	}
}

/* Steps ------------------------------------------------------------------- */

.step {
	padding-block: clamp(4rem, 12vh, 8rem) 0;
}

.step__inner {
	display: grid;
	justify-items: center;
	gap: 1.5rem;
	text-align: center;
}

.step + .step .step__inner {
	padding-block-start: clamp(4rem, 12vh, 8rem);
	border-block-start: 1px solid var(--line);
}

.step__label {
	font-size: var(--step-fine);
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	line-height: 1.6;
	color: var(--muted);
}

.step__no {
	color: var(--ink);
	margin-inline-end: 0.5rem;
}

.step__body {
	width: 100%;
	min-width: 0;
}

.step__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 1rem 1.75rem;
	margin: clamp(1.75rem, 4vh, 2.5rem) 0 0;
}

.statement {
	margin: 0 auto;
	max-width: 26ch;
	font-size: var(--step-statement);
	font-weight: 500;
	letter-spacing: -0.03em;
	line-height: 1.18;
	text-wrap: balance;
}

.prose {
	margin: clamp(1.25rem, 3vh, 1.75rem) auto 0;
	max-width: 52ch;
	color: var(--muted);
	text-wrap: pretty;
}

/* On Why buyers leave: what changes, set apart from what is felt. */
.prose--answer {
	color: var(--ink);
	font-weight: 500;
}

/* Cards ------------------------------------------------------------------- */

.panel {
	background: var(--raised);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.cards {
	display: grid;
	/* Three across or one above another; never two and a stray. */
	grid-template-columns: minmax(0, 1fr);
	gap: 1rem;
	margin: clamp(2rem, 5vh, 3rem) 0 0;
	padding: 0;
	list-style: none;
	isolation: isolate;
}

.card {
	position: relative;
	padding: clamp(1.5rem, 2.5vw, 2rem);
	background: var(--raised);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

@media (min-width: 64rem) {
	.cards {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* The ghost outline: a double of the card, standing just behind it. */
.card::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	transform: translate(0, 0);
	transition: transform 0.4s ease;
}

.card:hover::after {
	transform: translate(0.45rem, 0.45rem);
}

.card__title {
	font-size: var(--step-lead);
	font-weight: 600;
	letter-spacing: -0.025em;
	line-height: 1.15;
}

.card__body {
	margin: 0.85rem 0 0;
	color: var(--muted);
	text-wrap: pretty;
}

/* Facts ------------------------------------------------------------------- */

.facts {
	display: grid;
	text-align: center;
	grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
	gap: 1.25rem 2rem;
	margin: clamp(2rem, 5vh, 3rem) 0 0;
	padding-block-start: 1.5rem;
	border-block-start: 1px solid var(--line);
}

.fact {
	margin: 0;
}

.fact dt {
	font-size: var(--step-fine);
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--muted);
}

.fact dd {
	margin: 0.4rem 0 0;
}

/* Controls ---------------------------------------------------------------- */

.action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.95rem 1.6rem;
	border: 1px solid var(--ink);
	border-radius: 999px;
	background: var(--ink);
	color: var(--paper);
	font: inherit;
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: -0.01em;
	text-decoration: none;
	cursor: pointer;
	transition:
		background-color 0.25s ease,
		border-color 0.25s ease,
		color 0.25s ease;
}

.action:hover {
	background: var(--signal);
	border-color: var(--signal);
	color: var(--on-signal);
}

.action:disabled {
	opacity: 0.5;
	cursor: progress;
}

.link {
	font-weight: 500;
	text-decoration: underline;
	text-decoration-color: var(--line-strong);
	text-underline-offset: 0.3em;
	transition: text-decoration-color 0.25s ease;
}

.link:hover {
	text-decoration-color: var(--ink);
}

/* The form ---------------------------------------------------------------- */

.form {
	max-inline-size: 44rem;
	margin: clamp(2rem, 5vh, 3rem) auto 0;
	/* The form sits centred; what is typed into it reads from the left. */
	text-align: start;
	padding: clamp(1.25rem, 3.5vw, 2.5rem);
}

.form__row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
	gap: 0 1.25rem;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin: 0 0 1.25rem;
}

.field__label {
	font-size: 0.875rem;
	font-weight: 600;
}

.field__hint {
	font-size: var(--step-fine);
	color: var(--muted);
}

.field__input {
	width: 100%;
	padding: 0.85rem 1rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	background: var(--paper);
	color: var(--ink);
	font: inherit;
	transition: border-color 0.25s ease;
}

.field__input:hover {
	border-color: var(--ink);
}

.field__input:focus-visible {
	outline: 2px solid var(--signal);
	outline-offset: 1px;
	border-color: var(--ink);
}

.field__input--area {
	min-block-size: 7rem;
	line-height: 1.55;
	resize: vertical;
}

/*
 * The decoy. Off-screen rather than display: none, because a robot that fills
 * forms in tends to check for the latter and not the former. Hidden from
 * assistive technology and skipped by the tab key, so nobody meets it.
 */
.decoy {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.form__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1.25rem;
	margin-block-start: 0.5rem;
}

.form__status {
	margin: 0;
	font-size: 0.875rem;
	color: var(--muted);
}

.form__status[data-state="error"] {
	color: var(--signal);
	font-weight: 500;
}

.form__note {
	margin: 1.5rem 0 0;
	padding-block-start: 1.25rem;
	border-block-start: 1px solid var(--line);
	font-size: var(--step-fine);
	color: var(--muted);
}

.form__note a {
	color: var(--ink);
	text-underline-offset: 0.25em;
}

/* The confirmation that takes the form's place once a request is sent. */
.sent {
	max-inline-size: 44rem;
	margin: clamp(2rem, 5vh, 3rem) auto 0;
	text-align: center;
	padding: clamp(1.5rem, 4vw, 2.5rem);
	border-color: var(--line-strong);
}

.sent__mark {
	margin: 0;
	font-size: var(--step-statement);
	font-weight: 600;
	letter-spacing: -0.03em;
	line-height: 1.1;
}

.sent__note {
	margin: 0.75rem 0 0;
	color: var(--muted);
}

/* Footer ------------------------------------------------------------------ */

.footer {
	margin-block-start: clamp(5rem, 14vh, 9rem);
	padding-block: 2rem;
	border-block-start: 1px solid var(--line);
}

.footer__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1rem;
	text-align: center;
}

.footer__nav {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem 1.4rem;
	font-size: var(--step-fine);
	font-weight: 500;
}

.footer__nav a {
	text-decoration: underline;
	text-decoration-color: var(--line-strong);
	text-underline-offset: 0.3em;
}

.footer__nav a:hover,
.footer__nav a[aria-current="page"] {
	text-decoration-color: currentColor;
}

.footer__brand,
.footer__legal {
	margin: 0;
}

.footer__legal {
	font-size: var(--step-fine);
	color: var(--muted);
}

.footer__legal a {
	color: var(--ink);
	text-underline-offset: 0.25em;
}

/* The stage ----------------------------------------------------------------
 *
 * The home page's picture. Written by the server as a still with the buying
 * path set as words beneath it, which is all a visitor without WebGL or with
 * reduced motion sees. Once the scene is running the stage grows taller and
 * its frame holds still while the visitor scrolls through it, so scrolling
 * is what walks the ghost down the path (web/src/scene/).
 */

.stage {
	margin: clamp(2.5rem, 7vh, 4.5rem) 0 0;
}

.stage__view {
	position: relative;
	inline-size: min(100%, 76rem, calc(64svh * 16 / 9));
	aspect-ratio: 16 / 9;
	margin-inline: auto;
}

.stage__still img {
	display: block;
	inline-size: 100%;
	block-size: auto;
}

.stage__still.is-hidden {
	visibility: hidden;
}

/* The scene, laid over the still it replaces. */
.stage__canvas {
	position: absolute;
	inset: 0;
}

.stage--moving {
	block-size: 230svh;
}

.stage--moving .stage__frame {
	position: sticky;
	inset-block-start: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: clamp(1rem, 3vh, 2rem);
	min-block-size: 100svh;
}

/* Pages other than home ---------------------------------------------------- */

.hero--page .display {
	max-width: 18ch;
}

.enquiry {
	padding-block: clamp(3.5rem, 10vh, 6rem) 0;
	text-align: center;
}

.enquiry .step__label {
	margin-block-end: 0;
}

.close {
	margin-block-start: clamp(4rem, 12vh, 8rem);
	padding-block-start: clamp(4rem, 12vh, 8rem);
	border-block-start: 1px solid var(--line);
	text-align: center;
}

.close .statement {
	font-weight: 600;
}

/* A page of its own: the 404, and the no-JavaScript form reply. ----------- */

.notice {
	min-block-size: 100svh;
	display: flex;
	flex-direction: column;
}

.notice__main {
	flex: 1;
	display: flex;
	align-items: center;
	padding-block: 3rem 6rem;
	text-align: center;
}

.notice__main .display {
	font-size: clamp(2.6rem, 8vw, 5.5rem);
}

.notice__main .lede {
	max-width: 36ch;
}

.notice__main .action {
	margin-block-start: 2rem;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	.card::after,
	.action,
	.pill,
	.link,
	.nav__link,
	.field__input {
		transition: none;
	}
}
