/*
 * Sovereign — design tokens and shared components.
 * Every block stylesheet is written against these variables.
 */

:root {
	/* Grounds */
	--sov-ink: #16130f;
	--sov-ink-deep: #100e0b;
	--sov-ink-raised: #1d1a15;
	--sov-sand: #ece0ca;
	--sov-sand-hover: #e3d5b9;
	--sov-sand-media: #d8cbb2;

	/* Text on dark */
	--sov-cream: #f5ead8;
	--sov-cream-bright: #f7f1e4;
	--sov-body-dark: #e4d9c6;
	--sov-muted-dark: #c2b6a1;
	--sov-label-dark: #9c9384;
	--sov-faint-dark: #7d766b;

	/* Text on sand */
	--sov-text-sand: #201e1d;
	--sov-body-sand: #4a443b;
	--sov-label-sand: #5d564b;
	--sov-link-sand: #8a5a1c;

	/* Accents */
	--sov-terracotta: #c67139;
	--sov-sage: #7a8a5e;
	--sov-amber: #e0a44f;
	--sov-signal: #5fe0a4;

	/* Hairlines */
	--sov-line-dark-10: rgba(245, 234, 216, 0.1);
	--sov-line-dark-12: rgba(245, 234, 216, 0.12);
	--sov-line-dark-14: rgba(245, 234, 216, 0.14);
	--sov-line-dark-16: rgba(245, 234, 216, 0.16);
	--sov-line-dark-18: rgba(245, 234, 216, 0.18);
	--sov-line-dark-22: rgba(245, 234, 216, 0.22);
	--sov-line-dark-30: rgba(245, 234, 216, 0.3);
	--sov-line-dark-35: rgba(245, 234, 216, 0.35);
	--sov-line-dark-45: rgba(245, 234, 216, 0.45);
	--sov-line-sand: rgba(32, 30, 29, 0.2);
	--sov-line-sand-25: rgba(32, 30, 29, 0.25);

	/* Type */
	--sov-font-sans: "Archivo", system-ui, sans-serif;
	--sov-font-mono: "IBM Plex Mono", monospace;

	/* Space */
	--sov-pad-x: clamp(20px, 4vw, 56px);
	--sov-pad-y: clamp(64px, 8vw, 112px);
	--sov-pad-y-image: clamp(48px, 6vw, 96px);
	--sov-pad-hero-top: clamp(190px, 20vw, 240px);
	--sov-header-h: 84px;

	/* Motion */
	--sov-ease: cubic-bezier(0.16, 1, 0.3, 1);
	--sov-dur-nav: 300ms;
	--sov-dur-button: 400ms;
	--sov-dur-header: 500ms;
	--sov-dur-reveal: 600ms;
}

/* Colour sets. A block picks one; everything inside reads the --c-* variables. */
.is-dark {
	--c-bg: var(--sov-ink);
	--c-text: var(--sov-cream);
	--c-body: var(--sov-body-dark);
	--c-label: var(--sov-label-dark);
	--c-muted: var(--sov-label-dark);
	--c-line: var(--sov-line-dark-22);
	--c-line-soft: var(--sov-line-dark-12);
	--c-line-section: var(--sov-line-dark-12);
	--c-row-hover: rgba(245, 234, 216, 0.04);
	--c-media: var(--sov-ink-deep);
	background: var(--c-bg);
	color: var(--c-text);
}

.is-sand {
	--c-bg: var(--sov-sand);
	--c-text: var(--sov-text-sand);
	--c-body: var(--sov-body-sand);
	--c-label: var(--sov-label-sand);
	--c-muted: var(--sov-label-sand);
	--c-line: var(--sov-line-sand);
	--c-line-soft: var(--sov-line-sand);
	--c-line-section: var(--sov-line-sand);
	--c-row-hover: var(--sov-sand-hover);
	--c-media: var(--sov-ink-deep);
	background: var(--c-bg);
	color: var(--c-text);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--sov-ink);
	color: var(--sov-cream);
	font-family: var(--sov-font-sans);
	line-height: normal;
}

:where(img, video, iframe) {
	display: block;
	max-width: 100%;
}

:where(img) {
	height: auto;
}

:where(a) {
	color: inherit;
	text-decoration: none;
}

:where(a):hover {
	opacity: 0.7;
}

:where(h1, h2, h3, h4, p, figure, blockquote) {
	margin: 0;
}

:where(button) {
	font: inherit;
	color: inherit;
}

::selection {
	background: var(--sov-terracotta);
	color: var(--sov-cream);
}

:focus-visible {
	outline: 2px solid var(--sov-amber);
	outline-offset: 2px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.skip-link:focus {
	position: fixed !important;
	top: 12px;
	left: 12px;
	z-index: 100;
	width: auto;
	height: auto;
	margin: 0;
	padding: 14px 20px;
	clip: auto;
	background: var(--sov-cream);
	color: var(--sov-ink);
	font-size: 15px;
	font-weight: 500;
}

.site-main {
	display: block;
	min-height: 60vh;
}

/* ---------- Shared components ---------- */

:where(.sov-section) {
	padding: var(--sov-pad-y) var(--sov-pad-x);
}

:where(.sov-label) {
	font-family: var(--sov-font-mono);
	font-size: 12px;
	font-weight: 400;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--c-label, var(--sov-label-dark));
}

:where(.sov-rule) {
	display: block;
	width: 28px;
	height: 1px;
	background: var(--sov-terracotta);
}

:where(.sov-rule--sage) {
	background: var(--sov-sage);
}

:where(.sov-labelset) {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

:where(.sov-btn) {
	display: inline-block;
	background: var(--sov-cream);
	color: var(--sov-ink);
	font-size: 15px;
	font-weight: 500;
	line-height: normal;
	padding: 17px 26px;
	text-align: center;
	border: 0;
	cursor: pointer;
	transition: opacity var(--sov-dur-button) var(--sov-ease);
}

:where(.sov-btn):hover {
	opacity: 0.7;
}

:where(.sov-btn--outline) {
	background: transparent;
	color: var(--sov-cream);
	border: 1px solid var(--sov-line-dark-45);
}

:where(.sov-note) {
	font-family: var(--sov-font-mono);
	font-size: 12px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--sov-label-dark);
}

:where(.sov-media) {
	position: relative;
	overflow: hidden;
	background: var(--sov-ink-deep);
}

:where(.sov-media) > img,
:where(.sov-media) > video,
:where(.sov-media) > picture img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

:where(.sov-caption) {
	font-family: var(--sov-font-mono);
	font-size: 11px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--c-label, var(--sov-label-dark));
}

/* Rich text written by editors (prose, text + image). */
.sov-richtext {
	display: flex;
	flex-direction: column;
	gap: inherit;
}

.sov-richtext > * {
	margin: 0;
}

.sov-richtext p,
.sov-richtext li {
	font-size: 17px;
	line-height: 1.75;
	color: var(--c-body);
	text-wrap: pretty;
}

.sov-richtext ul,
.sov-richtext ol {
	padding-left: 1.2em;
}

.sov-richtext a {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

/* Dash list used under text + image copy. */
:where(.sov-dashlist) {
	display: flex;
	flex-direction: column;
	margin: 6px 0 0;
	padding: 0;
	list-style: none;
}

:where(.sov-dashlist) li {
	display: grid;
	grid-template-columns: 28px 1fr;
	gap: 8px;
	padding: 14px 0;
	border-top: 1px solid var(--c-line-soft);
	font-size: 16px;
}

:where(.sov-dashlist) li::before {
	content: "—";
	color: var(--sov-terracotta);
}

/* Label | content split used across the site. */
:where(.sov-split) {
	display: grid;
	grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
	gap: clamp(32px, 5vw, 80px);
	align-items: start;
}

/* The fluid "label spans one, content spans two" grid. */
:where(.sov-flow) {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
	gap: clamp(32px, 5vw, 80px);
	align-items: start;
}

:where(.sov-flow) > :where(.sov-flow__main) {
	grid-column: span 2;
	min-width: 0;
}

:where(.has-top-rule) {
	border-top: 1px solid var(--c-line-section);
}

@media (max-width: 760px) {
	:where(.sov-split) {
		grid-template-columns: minmax(0, 1fr);
	}

	:where(.sov-flow) > :where(.sov-flow__main) {
		grid-column: 1 / -1;
	}
}

/* Editor-only notice for blocks that render nothing until filled in. */
.sov-editor-empty {
	padding: 28px var(--sov-pad-x);
	border: 1px dashed var(--sov-line-dark-35);
	background: var(--sov-ink);
	color: var(--sov-body-dark);
	font-family: var(--sov-font-mono);
	font-size: 12px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* Where the design sets text-wrap: pretty. Everything else wraps normally, as designed. */
.sov-prose__heading,
.sov-prose__lead,
.sov-prose__quote p,
.sov-text-image__heading,
.sov-hero-split__h1,
.sov-hero-text__h1,
.sov-split-panel__heading,
.sov-cards--stacked .sov-cards__heading,
.sov-statement__heading,
.sov-big-statement__heading,
.site-footer__cta-heading,
.sov-reading__title,
.sov-reading__intro,
.sov-reading__content p {
	text-wrap: pretty;
}

/* A label that doubles as the section heading. */
h2.sov-labelset,
.sov-labelset--heading {
	font: inherit;
	letter-spacing: normal;
}
