/*
 * Stylesheet reading order
 *
 * 1. Reset: predictable element sizing and default spacing.
 * 2. Base: shared colours, typography and keyboard focus.
 * 3. Layout: page-wide containers and section arrangement.
 * 4. Components: navigation, captures, feature cards and status.
 * 5. Responsive: narrower viewports and reduced-motion preferences.
 *
 * Layer order makes overrides explicit. Keep component-specific adjustments
 * in their matching layer; place viewport overrides in the final layer.
 */

@layer reset, base, layout, components, responsive;
/* 1. Reset — normalise browser defaults used by this page. */
@layer reset {
	*,
	*::before,
	*::after {
		box-sizing: border-box;
	}

	body,
	h1,
	h2,
	h3,
	p,
	figure {
		margin: 0;
	}

	img {
		display: block;
		max-width: 100%;
		height: auto;
	}

	a {
		color: inherit;
	}
}

/* 2. Base — change the theme tokens here to restyle the entire site. */
@layer base {
	:root {
		color-scheme: dark;
		--bg: #111311;
		--surface: #191c18;
		--line: #34382f;
		--text: #eeeee6;
		--muted: #acb1a4;
		--accent: #d6b77b;
		--mono: ui-monospace, "Cascadia Code", "DejaVu Sans Mono", monospace;
	}

	html {
		scroll-behavior: smooth;
		scroll-padding-top: 2rem;
	}

	body {
		background: var(--bg);
		color: var(--text);
		font-family: Arial, Helvetica, sans-serif;
		font-size: 1rem;
		line-height: 1.65;
	}

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

	a {
		text-decoration-thickness: 1px;
		text-underline-offset: 0.3em;
	}

	a:focus-visible {
		outline: 2px solid var(--accent);
		outline-offset: 6px;
	}

	h1,
	h2,
	h3 {
		line-height: 1.1;
		font-weight: 500;
		text-wrap: balance;
	}

	h1 {
		font-size: clamp(3.6rem, 8.8vw, 8rem);
		letter-spacing: -0.065em;
	}

	h1 em {
		font-family: Georgia, "Times New Roman", serif;
		font-weight: 400;
		color: var(--accent);
		letter-spacing: -0.045em;
	}

	h2 {
		font-size: clamp(2.15rem, 4vw, 3.65rem);
		letter-spacing: -0.045em;
	}

	h3 {
		font-size: 1.35rem;
		letter-spacing: -0.02em;
	}

	p {
		color: var(--muted);
	}

	.lead {
		color: var(--text);
		font-size: 1.35rem;
		line-height: 1.55;
	}
}

/* 3. Layout — follow the HTML sequence from header through footer. */
@layer layout {
	.wrap {
		width: min(1280px, calc(100% - 6rem));
		margin-inline: auto;
	}

	/* Header and navigation. */
	.site-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 2rem;
		min-height: 100px;
		border-bottom: 1px solid var(--line);
	}

	nav {
		display: flex;
		gap: 2rem;
		flex-wrap: wrap;
	}

	/* Opening copy and primary capture. */
	.hero {
		padding-top: 4.5rem;
	}

	.hero .eyebrow {
		display: flex;
		gap: 1.5rem;
		margin-bottom: 1.8rem;
	}

	.hero-bottom {
		display: flex;
		justify-content: space-between;
		align-items: end;
		gap: 2rem;
		margin-block: 2rem 3.5rem;
	}

	.hero-bottom p {
		max-width: 38rem;
		font-size: 1.2rem;
	}

	/* Shared spacing and the two-column narrative sections. */
	.section {
		padding-block: 6rem;
	}

	.intro,
	.development {
		display: grid;
		grid-template-columns: 1fr 1.1fr;
		gap: 6rem;
	}

	.intro-copy p + p,
	.development p + p {
		margin-top: 1.3rem;
	}

	/* Three feature columns become a single list on narrow screens. */
	.features {
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		border-block: 1px solid var(--line);
	}

	.features article {
		padding: 2.5rem 2.3rem;
	}

	.features article:first-child {
		padding-left: 0;
	}

	.features article:last-child {
		padding-right: 0;
	}

	.features article + article {
		border-left: 1px solid var(--line);
	}

	/* Screenshot gallery. */
	.section-heading {
		display: flex;
		justify-content: space-between;
		gap: 2rem;
		align-items: end;
		margin-bottom: 2.5rem;
	}

	.capture-grid {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 2rem;
	}

	/* Development section and closing footer. */
	.development {
		border-top: 1px solid var(--line);
	}

	footer {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 2rem;
		padding-block: 2rem;
		border-top: 1px solid var(--line);
	}
}

/* 4. Components — presentation within the page-level layout. */
@layer components {
	/* Reveal the skip link only when it receives keyboard focus. */
	.skip {
		position: absolute;
		top: -5rem;
		left: 1rem;
		padding: 1rem;
		background: var(--accent);
		color: var(--bg);
		z-index: 10;
	}

	.skip:focus {
		top: 1rem;
	}

	.brand {
		display: flex;
		align-items: center;
		gap: 0.8rem;
		text-decoration: none;
		font-family: var(--mono);
		font-size: 0.875rem;
		font-weight: 700;
		letter-spacing: 0.07em;
		white-space: nowrap;
	}

	.mark {
		color: var(--accent);
		font-size: 2rem;
		line-height: 1;
	}

	nav a,
	footer > a:last-child {
		font-size: 0.875rem;
		text-decoration: none;
		color: var(--muted);
	}

	nav a:hover,
	footer > a:hover {
		color: var(--text);
	}

	.eyebrow,
	.feature-index {
		font-family: var(--mono);
		font-size: 0.8125rem;
		letter-spacing: 0.1em;
		color: var(--accent);
	}

	.eyebrow {
		margin-bottom: 1.3rem;
	}

	.hero .eyebrow span + span {
		border-left: 1px solid var(--line);
		padding-left: 1.5rem;
		color: var(--muted);
	}

	/* Main call to action. */
	.button {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-height: 50px;
		padding: 0.85rem 1.4rem;
		background: var(--accent);
		color: #171a14;
		text-decoration: none;
		font-size: 0.875rem;
		font-weight: 700;
		flex-shrink: 0;
	}

	.button:hover {
		background: #e8cd99;
	}

	/* Terminal frame and full-size capture links. */
	.hero-capture {
		border: 1px solid var(--line);
		background: #090b09;
	}

	.terminal-bar {
		display: flex;
		justify-content: space-between;
		gap: 1rem;
		padding: 0.9rem 1.25rem;
		font-family: var(--mono);
		font-size: 0.75rem;
		letter-spacing: 0.04em;
		color: #d1d5cb;
		border-bottom: 1px solid var(--line);
		background: var(--surface);
	}

	.muted {
		color: var(--muted);
	}

	.hero-capture img {
		width: 100%;
	}

	.hero-capture figcaption {
		display: flex;
		justify-content: space-between;
		gap: 1rem;
		padding: 1rem 1.25rem;
		border-top: 1px solid var(--line);
		font-family: var(--mono);
		font-size: 0.75rem;
		color: var(--muted);
	}

	.features h3 {
		margin-block: 1.4rem 0.85rem;
	}

	.features p {
		max-width: 24rem;
	}

	.capture-grid img {
		border: 1px solid var(--line);
		width: 100%;
		background: #090b09;
		transition: border-color 0.2s;
	}

	.capture-grid a:hover img {
		border-color: var(--accent);
	}

	.capture-grid figcaption {
		display: flex;
		gap: 1.2rem;
		padding-top: 1.4rem;
	}

	.capture-number {
		color: var(--accent);
		font: 0.8125rem var(--mono);
		padding-top: 0.3rem;
	}

	.capture-grid h3 {
		margin-bottom: 0.55rem;
	}

	.capture-grid p {
		font-size: 0.9375rem;
	}

	/* Development status remains readable without relying on colour. */
	.status {
		display: flex;
		justify-content: space-between;
		align-items: center;
		gap: 1rem;
		margin-top: 2rem;
		padding: 1.2rem 0;
		border-block: 1px solid var(--line);
		font: 0.8125rem var(--mono);
	}

	.status span {
		color: var(--muted);
	}

	.status strong {
		color: var(--accent);
		font-weight: 400;
	}

	footer p {
		font-size: 0.875rem;
	}
}

/* 5. Responsive — retain reading order when columns stack. */
@layer responsive {
	@media (max-width: 900px) {
		.wrap {
			width: calc(100% - 3rem);
		}

		.intro,
		.development {
			gap: 3rem;
		}

		.hero-bottom {
			align-items: start;
			flex-direction: column;
		}

		.features article {
			padding-inline: 1.4rem;
		}

		nav {
			gap: 1.1rem;
		}

		.section-heading {
			align-items: start;
			flex-direction: column;
		}

		footer p {
			display: none;
		}
	}

	@media (max-width: 620px) {
		.wrap {
			width: calc(100% - 2rem);
		}

		.site-header {
			align-items: start;
			flex-direction: column;
			justify-content: center;
			gap: 1.1rem;
			padding-block: 1.5rem;
		}

		nav {
			gap: 1.3rem;
		}

		.hero {
			padding-top: 3rem;
		}

		.hero .eyebrow {
			font-size: 0.75rem;
			gap: 0.8rem;
		}

		.hero .eyebrow span + span {
			padding-left: 0.8rem;
		}

		.hero-bottom {
			margin-bottom: 2rem;
		}

		.terminal-bar {
			font-size: 0.75rem;
			padding: 0.7rem;
		}

		.terminal-bar > span:last-child,
		.terminal-bar .muted {
			display: none;
		}

		.hero-capture figcaption {
			flex-direction: column;
			gap: 0.25rem;
			padding: 0.8rem;
		}

		.section {
			padding-block: 3.5rem;
		}

		.intro,
		.development,
		.capture-grid,
		.features {
			grid-template-columns: 1fr;
			gap: 2rem;
		}

		.features {
			gap: 0;
		}

		.features article,
		.features article:first-child,
		.features article:last-child {
			padding: 2rem 0;
		}

		.features article + article {
			border-left: 0;
			border-top: 1px solid var(--line);
		}

		.capture-grid {
			gap: 2.5rem;
		}

		footer {
			align-items: start;
			flex-direction: column;
			gap: 1rem;
		}
	}

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

		* {
			transition: none !important;
		}
	}
}

