/* ==========================================================================
   DORIC · Reset, elements, typography, accessibility, motion primitives
   ========================================================================== */

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--d-header-h) + var(--d-s6));
	background: var(--d-bg);
}

body {
	margin: 0;
	background: var(--d-bg);
	color: var(--d-text);
	font-family: var(--d-font-ui);
	font-size: var(--d-fs-body);
	line-height: var(--d-lh-body);
	font-weight: 400;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	font-synthesis-weight: none;
	overflow-x: clip;
}

/* Reserve the bottom navigation so it can never cover content. */
@media (max-width: 767px) {
	body { padding-bottom: calc(var(--d-bottomnav-h) + var(--d-bottomnav-gap) * 2 + env(safe-area-inset-bottom, 0px)); }
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4, p, figure, blockquote, ul, ol, dl { margin: 0; }
ul, ol { padding: 0; list-style: none; }

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

a { color: inherit; text-decoration: none; }

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

input, textarea, select { font: inherit; color: inherit; }

svg { flex: none; }

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

hr { border: 0; border-top: var(--d-hairline) solid var(--d-border); margin: 0; }

/* ── Type roles ─────────────────────────────────────────────────────────── */

.d-display-xl,
.d-display-l,
.d-h1,
.d-h2,
.d-h3 {
	font-family: var(--d-font-display);
	font-weight: 400;
	letter-spacing: var(--d-ls-display);
	line-height: var(--d-lh-heading);
	text-wrap: balance;
}

.d-display-xl { font-size: var(--d-fs-display-xl); line-height: var(--d-lh-tight); }
.d-display-l  { font-size: var(--d-fs-display-l); line-height: 1.06; }
.d-h1         { font-size: var(--d-fs-h1); }
.d-h2         { font-size: var(--d-fs-h2); }
.d-h3         { font-size: var(--d-fs-h3); }

/*
 * The tracked micro-label. The whole hierarchy depends on the distance
 * between this and the display sizes — never let an intermediate size creep
 * in and soften the contrast.
 */
.d-label {
	font-family: var(--d-font-ui);
	font-size: var(--d-fs-label);
	font-weight: 500;
	letter-spacing: var(--d-ls-label);
	line-height: 1.4;
	text-transform: uppercase;
	color: var(--d-text-muted);
}

.d-label--accent { color: var(--d-accent); }

.d-body { font-size: var(--d-fs-body); color: var(--d-text-2); max-width: var(--d-measure); }
.d-body-muted { font-size: var(--d-fs-body); color: var(--d-text-muted); max-width: var(--d-measure); }
.d-body-l { font-size: var(--d-fs-body-l); color: var(--d-text-2); max-width: var(--d-measure); }

.d-meta {
	font-size: var(--d-fs-micro);
	letter-spacing: var(--d-ls-label);
	text-transform: uppercase;
	color: var(--d-text-muted);
}

.d-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ── Accessibility ──────────────────────────────────────────────────────── */

.d-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.d-skip {
	position: fixed;
	top: var(--d-s3);
	left: var(--d-s3);
	z-index: 999;
	padding: var(--d-s3) var(--d-s5);
	background: var(--d-ivory);
	color: var(--d-text-inverse);
	font-size: var(--d-fs-label);
	font-weight: 500;
	letter-spacing: var(--d-ls-label);
	text-transform: uppercase;
	transform: translateY(-200%);
	transition: transform var(--d-dur-base) var(--d-ease-out);
}

/* :focus, not :focus-visible — the skip link must appear on any focus. */
.d-skip:focus { transform: none; }

:where(a, button, input, textarea, select, [tabindex]):focus-visible {
	outline: 2px solid var(--d-focus);
	outline-offset: 2px;
}

/* Inverse sections need the ring to stay visible on ivory. */
.d-on-ivory :where(a, button, input):focus-visible { outline-color: var(--d-brown); }

/* ── Reveal system ──────────────────────────────────────────────────────── */

/*
 * Hidden only when JavaScript has confirmed it is running. Two independent
 * failsafes bring content back: the observer marks each element, and a timer
 * on <html> reveals everything if the observer never ran at all.
 */
.js [data-reveal] {
	opacity: 0;
	transform: translate3d(0, 22px, 0);
	transition:
		opacity var(--d-dur-reveal) var(--d-ease-cine),
		transform var(--d-dur-reveal) var(--d-ease-cine);
	transition-delay: calc(var(--d-reveal-i, 0) * 70ms);
}

.js [data-reveal].is-revealed { opacity: 1; transform: none; }

/*
 * Failsafe. Applies only when the observer never armed itself — a script error,
 * a blocked file, no IntersectionObserver. If the observer IS running, this
 * does nothing, so scroll reveals below the fold still animate normally.
 */
.is-reveal-failsafe:not(.is-reveal-armed) [data-reveal] {
	opacity: 1;
	transform: none;
}

/* ── Hero staging ───────────────────────────────────────────────────────── */

.js [data-hero-step] {
	opacity: 0;
	transform: translate3d(0, 16px, 0);
	transition:
		opacity var(--d-dur-hero) var(--d-ease-cine),
		transform var(--d-dur-hero) var(--d-ease-cine);
}

.js [data-hero-step="1"],
.js [data-hero-step="2"] { transform: none; }

.is-hero-ready [data-hero-step] { opacity: 1; transform: none; }

.is-hero-ready [data-hero-step="1"] { transition-delay: 0ms; }
.is-hero-ready [data-hero-step="2"] { transition-delay: 320ms; transition-duration: 1200ms; }
.is-hero-ready [data-hero-step="3"] { transition-delay: 780ms; }
.is-hero-ready [data-hero-step="4"] { transition-delay: 980ms; }
.is-hero-ready [data-hero-step="5"] { transition-delay: 1160ms; }
.is-hero-ready [data-hero-step="6"] { transition-delay: 1340ms; }

/* ── Reduced motion ─────────────────────────────────────────────────────── */

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

	*, *::before, *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
		transition-delay: 0ms !important;
		scroll-behavior: auto !important;
	}

	.js [data-reveal],
	.js [data-hero-step] { opacity: 1; transform: none; }
}
