/*
 * NexAli World: base layer.
 *
 * 1. Fonts   2. Tokens   3. Reset   4. Typography   5. Layout   6. Text utilities   7. Reduced motion
 *
 * Components are in components.css, section and page rules in home.css and pages.css.
 * Naming: classes nx-block__element--modifier, states is-*, JavaScript hooks data-nx-* (main.js).
 * Colours outside the palette are the palette at an opacity, e.g. rgba(22, 59, 115, .55) is --nx-navy at 55%.
 */

/* 1. Fonts ---------------------------------------------------------------------
 * Latin subsets of the variable fonts, self-hosted (see ../fonts/OFL.txt) and
 * preloaded by inc/assets.php. Inter carries the text, Playfair Display h1-h3 and big numbers.
 */
@font-face {
	font-family: 'Inter';
	font-style: normal;
	font-weight: 400 600;
	font-display: swap;
	src: url('../fonts/inter-latin.woff2') format('woff2');
}

@font-face {
	font-family: 'Playfair Display';
	font-style: normal;
	font-weight: 600 700;
	font-display: swap;
	src: url('../fonts/playfair-display-latin.woff2') format('woff2');
}

/* 2. Tokens -------------------------------------------------------------------- */
:root {
	/* Palette */
	--nx-bg: #0A1A33;                        /* page background */
	--nx-bg-2: #0E2447;                      /* alternate section background */
	--nx-navy: #163B73;                      /* cards, panels, brand surfaces */
	--nx-indigo: #4C5FD7;                    /* accents, link underlines */
	--nx-focus: #7F8DEB;                     /* focus rings: 3:1 or more on every dark surface; light surfaces set it to --nx-indigo */
	--nx-gold: #C6A85B;                      /* primary actions, eyebrows, highlights */
	--nx-gold-2: #E3C987;                    /* end of the gold gradient, hover */
	--nx-ivory: #F7F4EC;                     /* headings and strong text on dark */
	--nx-ivory-70: rgba(247,244,236,.72);    /* body text on dark */
	--nx-charcoal: #1F2430;                  /* text on light and gold surfaces */
	--nx-line: rgba(247,244,236,.10);        /* borders, dividers */

	/* Type */
	--nx-font-display: 'Playfair Display', Georgia, serif;
	--nx-font-body: Inter, system-ui, sans-serif;
	--nx-text-display: clamp(2.75rem, 2rem + 3vw, 5rem);       /* 44-80px: h1, hero title */
	--nx-text-h2: clamp(2rem, 1.5rem + 2vw, 3.5rem);           /* 32-56px */
	--nx-text-h3: clamp(1.375rem, 1.2rem + .6vw, 1.75rem);     /* 22-28px */
	--nx-text-lead: clamp(1.0625rem, 1rem + .4vw, 1.25rem);    /* 17-20px */
	--nx-text-body: clamp(1rem, .95rem + .25vw, 1.125rem);     /* 16-18px */
	--nx-text-small: .875rem;                                  /* 14px */
	--nx-text-eyebrow: clamp(.75rem, .72rem + .1vw, .8125rem); /* 12-13px */
	--nx-measure: 68ch;                                        /* longest line of running text */

	/* Layout: an 8px spacing scale, named by multiples of 8 */
	--nx-container: 1200px;
	--nx-gutter: 16px;          /* smallest side gutter (phones) */
	--nx-radius: 16px;          /* cards, panels, media */
	--nx-radius-pill: 999px;    /* buttons, pills */
	--nx-space-1: .5rem;
	--nx-space-2: 1rem;
	--nx-space-3: 1.5rem;
	--nx-space-4: 2rem;
	--nx-space-6: 3rem;
	--nx-space-8: 4rem;

	/* Depth and motion */
	--nx-shadow: 0 1px 2px rgba(0,0,0,.2), 0 24px 48px -24px rgba(0,0,0,.6);
	--nx-ease: cubic-bezier(.2, .7, .2, 1);
}

/* 3. Reset --------------------------------------------------------------------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

/* scrollbar-gutter: the space of the scrollbar stays reserved while the open drawer stops
 * the page scrolling, so nothing shifts sideways. */
html {
	color-scheme: dark;
	scrollbar-gutter: stable;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

/* While the drawer is open the reserved gutter takes the backdrop's shade
 * (rgba(5, 13, 26, .6) over --nx-bg), not a lighter strip beside it. */
html.is-drawer-open {
	background-color: rgb(7, 18, 36);
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

body {
	margin: 0;
	background: var(--nx-bg);
	color: var(--nx-ivory-70);
	font-family: var(--nx-font-body);
	font-size: var(--nx-text-body);
	line-height: 1.6;
	overflow-wrap: break-word;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd {
	margin: 0;
}

/* Theme lists (any nx- class) start bare; lists in post content keep their bullets. */
:where(ul[class*="nx-"], ol[class*="nx-"]) {
	margin: 0;
	padding: 0;
	list-style: none;
}

img,
video {
	max-width: 100%;
	height: auto;
}

img,
svg,
video {
	vertical-align: middle;
}

svg {
	max-width: 100%;
}

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

button:not(:disabled) {
	cursor: pointer;
}

/* Elements with a display rule still hide when given the hidden attribute (load more relies on it). */
[hidden] {
	display: none !important;
}

::selection {
	background: var(--nx-gold);
	color: var(--nx-charcoal);
}

/* 4. Typography ------------------------------------------------------------------ */
h1, h2, h3 {
	color: var(--nx-ivory);
	font-family: var(--nx-font-display);
	font-weight: 600;
	line-height: 1.12;
	letter-spacing: -.01em;
	text-wrap: balance;
}

h1 {
	font-size: var(--nx-text-display);
	line-height: 1.05;
}

h2 {
	font-size: var(--nx-text-h2);
}

h3 {
	font-size: var(--nx-text-h3);
	line-height: 1.25;
}

/* Small headings stay in Inter: Playfair is for h1-h3 and display numbers. */
h4, h5, h6 {
	color: var(--nx-ivory);
	font-family: var(--nx-font-body);
	font-weight: 600;
	line-height: 1.35;
}

h4 {
	font-size: 1.125rem;
}

h5, h6 {
	font-size: 1rem;
}

p {
	text-wrap: pretty;
}

b,
strong {
	font-weight: 600;
}

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

/* Links in running text: ivory with an indigo underline. :where() keeps this easy to override. */
:where(a) {
	color: var(--nx-ivory);
	text-decoration-line: underline;
	text-decoration-color: var(--nx-indigo);
	text-decoration-thickness: 1px;
	text-underline-offset: .2em;
	transition: color .2s ease, text-decoration-color .2s ease;
}

:where(a):hover {
	color: var(--nx-gold-2);
	text-decoration-color: currentColor;
}

:focus-visible {
	outline: 2px solid var(--nx-focus);
	outline-offset: 3px;
}

hr {
	margin: 0;
	border: 0;
	border-top: 1px solid var(--nx-line);
}

/* 5. Layout ---------------------------------------------------------------------- */

/* 1200px of content, and at least a 16px gutter each side (up to 32px on wider screens). */
.nx-container {
	width: min(100% - 2 * clamp(var(--nx-gutter), 4vw, 2rem), var(--nx-container));
	margin-inline: auto;
}

/* 64px of vertical padding on phones up to 160px on wide screens. */
.nx-section {
	padding: clamp(4rem, 3rem + 5vw, 10rem) 0;
}

.nx-section--alt {
	background: var(--nx-bg-2);
}

/* Equal columns: one under 720px; .nx-grid-4 has two up to 1024px. */
.nx-grid-2,
.nx-grid-3,
.nx-grid-4 {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(var(--nx-space-2), .5rem + 1.5vw, var(--nx-space-4));
}

@media (min-width: 720px) {
	.nx-grid-2,
	.nx-grid-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.nx-grid-3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.nx-grid-4 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* 6. Text utilities ---------------------------------------------------------------- */

/* Small gold capitals above a heading. */
.nx-eyebrow {
	display: inline-block;
	color: var(--nx-gold);
	font-family: var(--nx-font-body);
	font-size: var(--nx-text-eyebrow);
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: .18em;
	text-transform: uppercase;
}

/* The paragraph under a section heading. */
.nx-lead {
	max-width: var(--nx-measure);
	color: var(--nx-ivory-70);
	font-size: var(--nx-text-lead);
	line-height: 1.6;
}

/* Read by screen readers, not shown. */
.nx-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Inline SVG icons from nexali_icon() / NexAli Core: sized to the text, drawn in its colour. */
.nx-icon {
	flex-shrink: 0;
	width: 1.25em;
	height: 1.25em;
}

/* 7. Reduced motion ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
		transition-delay: 0s !important;
		scroll-behavior: auto !important;
	}
}
