/* ==========================================================================
   Base — reset, document, typography, forms, texture
   --------------------------------------------------------------------------
   A deliberately small reset. We normalise box sizing, margins and media, and
   then set real typographic defaults rather than stripping everything back to
   browser-unstyled and rebuilding it with utilities.
   ========================================================================== */

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--af-header-h) + 1.5rem);
}

body {
	margin: 0;
	background-color: var(--af-bg);
	color: var(--af-ink);
	font-family: var(--af-font-ui);
	font-size: var(--af-text-base);
	line-height: var(--af-leading-normal);
	font-weight: 450;
	letter-spacing: var(--af-track-normal);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow-x: hidden;
	font-variant-numeric: tabular-nums;
}

/* Paper tooth over the whole document. Fixed so it does not scroll with
   content, which would read as a pattern instead of a surface. */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: var(--af-z-grain);
	background-image: var(--af-grain);
	opacity: var(--af-grain-opacity);
	pointer-events: none;
	mix-blend-mode: multiply;
}

body.af-locked {
	overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
	margin: 0;
	font-family: var(--af-font-display);
	font-weight: 600;
	line-height: var(--af-leading-tight);
	letter-spacing: var(--af-track-display);
	color: var(--af-ink);
	/* Fraunces is a variable face — dial the optical size and softness so
	   headings stay warm rather than bookish. */
	font-variation-settings: "SOFT" 40, "WONK" 1;
	text-wrap: balance;
}

h1 { font-size: var(--af-text-4xl); }
h2 { font-size: var(--af-text-3xl); }
h3 { font-size: var(--af-text-2xl); }
h4 { font-size: var(--af-text-xl); }
h5 { font-size: var(--af-text-lg); }
h6 {
	font-family: var(--af-font-ui);
	font-size: var(--af-text-xs);
	font-weight: 700;
	letter-spacing: var(--af-track-caps);
	text-transform: uppercase;
}

p {
	margin: 0 0 1em;
	text-wrap: pretty;
}

p:last-child {
	margin-bottom: 0;
}

a {
	color: var(--af-cocoa-700);
	text-decoration-color: color-mix(in srgb, var(--af-cocoa-700) 35%, transparent);
	text-decoration-thickness: 1.5px;
	text-underline-offset: 0.18em;
	transition: color var(--af-dur-fast) var(--af-ease-out),
		text-decoration-color var(--af-dur-fast) var(--af-ease-out);
}

a:hover {
	color: var(--af-terracotta-dark);
	text-decoration-color: currentColor;
}

strong, b {
	font-weight: 700;
}

em {
	font-style: italic;
}

small {
	font-size: var(--af-text-sm);
}

img, svg, video, canvas, picture {
	display: block;
	max-width: 100%;
	height: auto;
}

svg {
	flex-shrink: 0;
}

ul, ol {
	margin: 0 0 1em;
	padding-left: 1.25em;
}

li + li {
	margin-top: 0.35em;
}

blockquote {
	margin: 0;
	padding-left: var(--af-space-5);
	border-left: 3px solid var(--af-caramel);
	font-family: var(--af-font-display);
	font-size: var(--af-text-lg);
	font-style: italic;
	color: var(--af-ink-soft);
}

hr {
	height: 1px;
	margin: var(--af-space-8) 0;
	border: 0;
	background: var(--af-line);
}

code, kbd, pre {
	font-family: ui-monospace, "SF Mono", Menlo, monospace;
	font-size: 0.9em;
}

table {
	width: 100%;
	border-collapse: collapse;
}

/* --- Selection and focus ------------------------------------------------ */

::selection {
	background: var(--af-caramel-soft);
	color: var(--af-espresso);
}

:focus {
	outline: none;
}

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

/* --- Forms -------------------------------------------------------------- */

button, input, select, textarea, optgroup {
	font: inherit;
	color: inherit;
	margin: 0;
}

button {
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	color: inherit;
}

button:disabled {
	cursor: not-allowed;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="url"],
select,
textarea {
	width: 100%;
	padding: 0.8rem 1rem;
	background: var(--af-white);
	border: 1.5px solid var(--af-line);
	border-radius: var(--af-r-md);
	font-size: var(--af-text-md);
	line-height: 1.4;
	color: var(--af-ink);
	transition: border-color var(--af-dur-fast) var(--af-ease-out),
		box-shadow var(--af-dur-fast) var(--af-ease-out),
		background-color var(--af-dur-fast) var(--af-ease-out);
	appearance: none;
}

textarea {
	min-height: 8rem;
	resize: vertical;
	line-height: var(--af-leading-normal);
}

input::placeholder,
textarea::placeholder {
	color: var(--af-ink-faint);
}

input:hover,
select:hover,
textarea:hover {
	border-color: var(--af-line-strong);
}

input:focus,
select:focus,
textarea:focus {
	outline: none;
	border-color: var(--af-terracotta);
	box-shadow: 0 0 0 4px var(--af-terracotta-soft);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
	border-color: var(--af-chili);
}

input[aria-invalid="true"]:focus,
textarea[aria-invalid="true"]:focus {
	box-shadow: 0 0 0 4px var(--af-chili-soft);
}

/* Kill the spinner on quantity and OTP fields — they are driven by buttons. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
	appearance: none;
	margin: 0;
}

input[type="number"] {
	-moz-appearance: textfield;
}

select {
	padding-right: 2.5rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235f4739' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5.5 9 6.5 6.5L18.5 9'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 1rem center;
	cursor: pointer;
}

label {
	display: block;
	margin-bottom: 0.375rem;
	font-size: var(--af-text-sm);
	font-weight: 600;
	color: var(--af-ink-soft);
}

fieldset {
	margin: 0;
	padding: 0;
	border: 0;
}

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

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

.af-skip {
	position: absolute;
	top: 0;
	left: 50%;
	z-index: var(--af-z-toast);
	transform: translate(-50%, -110%);
	padding: 0.75rem 1.5rem;
	background: var(--af-cocoa-900);
	color: var(--af-cream);
	font-size: var(--af-text-sm);
	font-weight: 600;
	border-radius: 0 0 var(--af-r-md) var(--af-r-md);
	text-decoration: none;
	transition: transform var(--af-dur) var(--af-ease-out);
}

.af-skip:focus-visible {
	transform: translate(-50%, 0);
	color: var(--af-cream);
}

/* --- Prose (page content from the block editor) ------------------------- */

.af-prose {
	font-size: var(--af-text-md);
	line-height: var(--af-leading-relaxed);
	color: var(--af-ink-soft);
}

.af-prose > * + * {
	margin-top: 1.1em;
}

.af-prose h2 {
	margin-top: 2.2em;
	font-size: var(--af-text-2xl);
	color: var(--af-ink);
}

.af-prose h3 {
	margin-top: 1.8em;
	font-size: var(--af-text-xl);
	color: var(--af-ink);
}

.af-prose h2 + *,
.af-prose h3 + * {
	margin-top: 0.7em;
}

.af-prose ul,
.af-prose ol {
	padding-left: 1.1em;
}

.af-prose li::marker {
	color: var(--af-clay-400);
}

.af-prose a {
	font-weight: 600;
}

.af-prose img {
	border-radius: var(--af-r-lg);
	box-shadow: var(--af-shadow-md);
}

/* The first paragraph of a page reads as a lede. */
.af-prose > p:first-child {
	font-size: var(--af-text-lg);
	color: var(--af-ink);
}

/* --- Print -------------------------------------------------------------- */

@media print {
	body::before,
	.af-header,
	.af-footer,
	.af-dock,
	.af-cartbar {
		display: none !important;
	}
}
