/* ==========================================================================
   NAGI — reset, elements, typography
   ========================================================================== */

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* Anchor targets clear the fixed header. */
	scroll-padding-top: calc(var(--nagi-header-h) + var(--nagi-space-3));
}

body {
	margin: 0;
	background-color: var(--nagi-paper);
	color: var(--nagi-text-dark);
	font-family: var(--nagi-f-body);
	font-size: var(--nagi-t-body);
	line-height: var(--nagi-lh-body);
	font-weight: 400;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	overflow-x: hidden;
}

/* Locked while a drawer or modal owns the screen. */
body.nagi-scroll-locked {
	overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
	margin: 0;
	font-family: var(--nagi-f-display);
	font-weight: 400;
	line-height: var(--nagi-lh-display);
	letter-spacing: var(--nagi-ls-display);
	font-variation-settings: "SOFT" 20, "WONK" 0;
	text-wrap: balance;
}

h1 { font-size: var(--nagi-t-h1); font-variation-settings: "opsz" 96, "SOFT" 20, "WONK" 0; }
h2 { font-size: var(--nagi-t-h2); font-variation-settings: "opsz" 72, "SOFT" 20, "WONK" 0; }
h3 { font-size: var(--nagi-t-h3); font-variation-settings: "opsz" 60, "SOFT" 20, "WONK" 0; }
h4 { font-size: 1.15rem; }
h5, h6 { font-size: 1rem; }

p {
	margin: 0 0 var(--nagi-space-3);
	text-wrap: pretty;
}

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

a {
	color: inherit;
	text-decoration: none;
	transition: color var(--nagi-dur-s) var(--nagi-ease);
}

.nagi-prose a {
	text-decoration: underline;
	text-underline-offset: 0.18em;
	text-decoration-thickness: 1px;
	text-decoration-color: var(--nagi-red-deep);
}

.nagi-prose a:hover {
	color: var(--nagi-red-deep);
}

strong, b { font-weight: 600; }

ul, ol {
	margin: 0 0 var(--nagi-space-3);
	padding-left: 1.15em;
}

li { margin-bottom: var(--nagi-space-1); }

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

svg { fill: currentColor; }

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

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

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

hr {
	border: 0;
	height: 1px;
	background: var(--nagi-surface-rule, rgba(31, 31, 31, 0.14));
	margin: var(--nagi-space-5) 0;
}

blockquote {
	margin: 0;
}

::selection {
	background: var(--nagi-red);
	color: var(--nagi-on-red);
}

/* --------------------------------------------------------------------------
   Focus. Visible, brand red, and never removed.
   -------------------------------------------------------------------------- */

:focus {
	outline: none;
}

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

/* --------------------------------------------------------------------------
   Utility type
   -------------------------------------------------------------------------- */

.nagi-mono,
.nagi-eyebrow,
.nagi-node__label,
.nagi-numeral {
	font-family: var(--nagi-f-mono);
	font-size: var(--nagi-t-micro);
	letter-spacing: var(--nagi-ls-mono);
	text-transform: uppercase;
	font-weight: 400;
	line-height: 1.4;
}

.nagi-eyebrow {
	margin: 0 0 var(--nagi-space-3);
	color: var(--nagi-surface-accent, var(--nagi-red-deep));
}

.nagi-numeral {
	color: var(--nagi-surface-mute, var(--nagi-text-mute));
}

.nagi-lede {
	font-size: 1.0625rem;
	color: var(--nagi-surface-mute, var(--nagi-text-mute));
	max-width: 52ch;
}

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

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

.nagi-skip-link {
	position: absolute;
	top: -100%;
	left: var(--nagi-space-3);
	z-index: calc(var(--nagi-z-toast) + 1);
	padding: var(--nagi-space-2) var(--nagi-space-4);
	background: var(--nagi-ink);
	color: var(--nagi-text-light);
	font-family: var(--nagi-f-mono);
	font-size: var(--nagi-t-micro);
	letter-spacing: var(--nagi-ls-mono);
	text-transform: uppercase;
	border-bottom: 1px solid var(--nagi-red);
}

.nagi-skip-link:focus {
	top: 0;
}

[hidden] {
	display: none !important;
}

/* --------------------------------------------------------------------------
   Images
   -------------------------------------------------------------------------- */

.nagi-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Every image frame owns its ratio so nothing reflows on load. */
.nagi-frame {
	position: relative;
	overflow: hidden;
	background: var(--nagi-ink);
	aspect-ratio: 4 / 5;
}

.nagi-frame--hero  { aspect-ratio: 16 / 9; }
.nagi-frame--wide  { aspect-ratio: 3 / 2; }
.nagi-frame--square { aspect-ratio: 1 / 1; }

/* Low-quality placeholder fades out when the real file decodes. */
.nagi-img--placeholder {
	object-fit: cover;
}
