/* ============================================================
   BASE — reset, document, typography, a11y utilities
   ============================================================ */

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

* { margin: 0; }

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

body {
	font-family: var(--font-body);
	font-size: var(--text-base);
	line-height: var(--leading-body);
	color: var(--text);
	background-color: var(--bg);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	overflow-x: hidden;
}

/* Paper grain — subtle feTurbulence texture over everything (non-interactive) */
body::after {
	content: "";
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	pointer-events: none;
	opacity: 0.035;
	mix-blend-mode: multiply;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}
/* Keep the homepage photographs free of the full-screen grain layer. */
body.home-page::after { display: none; }
@media (prefers-reduced-motion: no-preference) {
	::selection { background: var(--color-clay-tint, #F2E2D4); color: var(--color-clay); }
}

img, svg, video { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

/* ---------- Typography ---------- */

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-display);
	font-weight: 480;
	font-variation-settings: "opsz" 100, "SOFT" 30, "WONK" 0;
	line-height: var(--leading-tight);
	letter-spacing: -0.015em;
	text-wrap: balance;
}

/* Fraunces italic accents — the personality layer */
h1 em, h2 em, h3 em, .section-title em, .hero-title em {
	font-style: italic;
	font-weight: 420;
	font-variation-settings: "opsz" 100, "SOFT" 50, "WONK" 1;
	letter-spacing: -0.02em;
}

/* Handwritten note accent (used sparingly) */
.hand {
	font-family: var(--font-hand);
	font-weight: 500;
	font-size: 1.35em;
	line-height: 1.1;
	letter-spacing: 0;
	text-transform: none;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); font-family: var(--font-body); font-weight: 600; }

p { max-width: 68ch; }
strong { font-weight: 600; }

.display {
	font-family: var(--font-display);
	font-size: var(--text-hero);
	line-height: var(--leading-none);
	letter-spacing: var(--tracking-tight);
	font-weight: 400;
}

.eyebrow {
	font-family: var(--font-mono);
	font-size: var(--text-xs);
	font-weight: 500;
	letter-spacing: var(--tracking-caps);
	text-transform: uppercase;
	color: var(--accent);
	display: inline-flex;
	align-items: center;
	gap: var(--space-2xs);
}
.eyebrow::before {
	content: "";
	inline-size: 1.75rem;
	block-size: 2px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 2'%3E%3Cpath d='M0 1.2 Q 7 0.2 14 1 T 28 1' fill='none' stroke='currentColor' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
	background-size: 100% 100%;
	background-repeat: no-repeat;
	opacity: 0.75;
}
.eyebrow--plain::before { content: none; }
.on-dark .eyebrow { color: var(--color-amber); }

.lead {
	font-size: var(--text-lg);
	line-height: var(--leading-snug);
	color: var(--text-soft);
	max-width: 56ch;
}
.on-dark .lead { color: var(--text-on-dark-mute); }

.section-title {
	font-size: var(--text-3xl);
	max-width: 20ch;
}
.section-intro {
	font-size: var(--text-lg);
	color: var(--text-soft);
	max-width: 52ch;
	margin-block-start: var(--space-sm);
}
.on-dark .section-intro { color: var(--text-on-dark-mute); }

.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }

blockquote {
	font-family: var(--font-display);
	font-size: var(--text-xl);
	line-height: var(--leading-snug);
	font-style: italic;
}

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

.container {
	inline-size: min(100% - 2 * var(--gutter), var(--container));
	margin-inline: auto;
}
.container--wide { inline-size: min(100% - 2 * var(--gutter), var(--container-wide)); }
.container--narrow { inline-size: min(100% - 2 * var(--gutter), var(--container-narrow)); }

/* overflow-x clip keeps floating/spinning decor inside the viewport on
 * narrow screens without creating a scroll container (sticky-safe). */
.section { padding-block: var(--section-y); position: relative; overflow-x: clip; }
.section--flush-top { padding-block-start: 0; }
.section--dark { background: var(--bg-dark); color: var(--text-on-dark); }
.section--sunken { background: var(--bg-sunken); }
.section--raised { background: var(--bg-raised); }

.section-head { margin-block-end: var(--space-2xl); }
@media (max-width: 640px) { .section-head { margin-block-end: var(--space-xl); } }
.section-head--center { text-align: center; }
.section-head--center .section-title,
.section-head--center .section-intro { margin-inline: auto; }
.section-head .eyebrow { margin-block-end: var(--space-sm); }

.grid { display: grid; gap: var(--space-lg); }
.flow > * + * { margin-block-start: var(--flow-space, var(--space-md)); }

/* ---------- Accessibility ---------- */

.visually-hidden {
	position: absolute !important;
	inline-size: 1px; block-size: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	inset-block-start: -100%;
	inset-inline-start: var(--space-sm);
	z-index: var(--z-toast);
	background: var(--color-clay);
	color: var(--color-parchment);
	padding: var(--space-xs) var(--space-md);
	border-radius: var(--radius-sm);
	transition: inset-block-start var(--dur-fast) var(--ease-out);
}
.skip-link:focus { inset-block-start: var(--space-sm); color: var(--color-parchment); }

:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
	border-radius: var(--radius-xs);
}
.section--dark :focus-visible,
.on-dark :focus-visible { box-shadow: var(--focus-ring-dark); }

/* ---------- Selection & scrollbar ---------- */

::selection { background: var(--color-clay); color: var(--color-parchment); }

::-webkit-scrollbar { inline-size: 10px; }
::-webkit-scrollbar-track { background: var(--bg-sunken); }
::-webkit-scrollbar-thumb { background: var(--color-moss-soft); border-radius: var(--radius-full); }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
