/**
 * Meridian Engineering — Base
 *
 * Font faces, reset and element-level typography. Everything here is driven by
 * tokens.css; this file should contain no literal colour or size values.
 */

/* -------------------------------------------------------------------------
 * Cabin — self-hosted variable font (400–700).
 * Self-hosted rather than loaded from Google's CDN so no visitor IP is sent to
 * a third party on page load (GDPR / ePrivacy).
 * ---------------------------------------------------------------------- */
@font-face {
	font-family: "Cabin";
	font-style: normal;
	font-weight: 400 700;
	font-display: swap;
	src: url("../fonts/cabin-normal-latin.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
		U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
		U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Cabin";
	font-style: normal;
	font-weight: 400 700;
	font-display: swap;
	src: url("../fonts/cabin-normal-latin-ext.woff2") format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
		U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
		U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
		U+A720-A7FF;
}

@font-face {
	font-family: "Cabin";
	font-style: italic;
	font-weight: 400 700;
	font-display: swap;
	src: url("../fonts/cabin-italic-latin.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
		U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
		U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Cabin";
	font-style: italic;
	font-weight: 400 700;
	font-display: swap;
	src: url("../fonts/cabin-italic-latin-ext.woff2") format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
		U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
		U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
		U+A720-A7FF;
}

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* Clear the fixed header, plus a little breathing room, so anchor targets
	 * are not hidden behind it. */
	scroll-padding-top: calc(var(--md-header-total) + var(--md-space-sm));
}

body {
	margin: 0;
	background-color: var(--md-color-surface);
	color: var(--md-color-text-body);
	font-family: var(--md-font-body);
	font-size: var(--md-text-body);
	font-weight: var(--md-weight-regular);
	line-height: var(--md-leading-body);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

/* Vertical rhythm: no top margin on flow elements, space is added below. */
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd,
ul,
ol,
pre,
table {
	margin-block: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	color: var(--md-color-heading);
	font-family: var(--md-font-heading);
	font-weight: var(--md-weight-bold);
	line-height: var(--md-leading-heading);
	text-wrap: balance;
}

h1 {
	font-size: var(--md-text-h1);
	line-height: var(--md-leading-tight);
	letter-spacing: var(--md-tracking-tight);
}

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

h3 {
	font-size: var(--md-text-h3);
	font-weight: var(--md-weight-semibold);
}

h4 {
	font-size: var(--md-text-h4);
	font-weight: var(--md-weight-semibold);
}

h5 {
	font-size: var(--md-text-h5);
	font-weight: var(--md-weight-semibold);
}

h6 {
	font-size: var(--md-text-h6);
	font-weight: var(--md-weight-semibold);
}

p {
	text-wrap: pretty;
}

/* Flow spacing — anything stacked in a content area gets a consistent gap. */
:where(.md-flow, .entry-content) > * + * {
	margin-block-start: var(--md-space-md);
}

:where(.md-flow, .entry-content) > * + :where(h2, h3, h4) {
	margin-block-start: var(--md-space-xl);
}

a {
	color: var(--md-color-link);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	transition: color var(--md-transition);
}

a:hover,
a:focus {
	color: var(--md-color-link-hover);
}

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

img,
video {
	height: auto;
}

svg {
	fill: currentColor;
}

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

/* Square bullet markers — a defined brand element in the guidelines. */
ul,
ol {
	padding-inline-start: var(--md-space-md);
}

/*
 * Prose lists only. Elementor renders every widget inside .entry-content, so
 * without the exclusion below a component that legitimately uses a list — a
 * card grid, an icon row, a nav menu — would inherit prose treatment: a square
 * bullet, a 32px indent and inter-item margins.
 *
 * Any list in the md- namespace opts out. The test is wrapped in :where() so it
 * contributes no specificity, leaving these rules exactly as easy to override
 * as they were before. The two :not()s are chained rather than written as one
 * selector list for the widest browser support.
 */
:where(.md-flow, .entry-content)
	ul:where(:not([class^="md-"]):not([class*=" md-"])) {
	list-style: none;
	padding-inline-start: 0;
}

:where(.md-flow, .entry-content)
	ul:where(:not([class^="md-"]):not([class*=" md-"]))
	> li {
	position: relative;
	/* 12px — the marker is 5px, so this leaves a 7px gap to the text. */
	padding-inline-start: var(--md-space-xs);
}

:where(.md-flow, .entry-content)
	ul:where(:not([class^="md-"]):not([class*=" md-"]))
	> li
	+ li {
	margin-block-start: var(--md-space-xs);
}

:where(.md-flow, .entry-content)
	ul:where(:not([class^="md-"]):not([class*=" md-"]))
	> li::before {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	/*
	 * Centred on the first line rather than hung near its top. Half a line box
	 * less half the marker: --md-leading-body is 1.625, so 0.8125em is the middle
	 * of the line. In px rather than rem so the square stays 5px whatever the
	 * surrounding type size — a bullet that scales with its text stops reading as
	 * the same brand element.
	 */
	inset-block-start: calc(0.8125em - 2.5px);
	width: 5px;
	height: 5px;
	background-color: currentColor;
}

/*
 * Where `lh` is supported, measure the line box actually in effect instead of
 * assuming the body's 1.625 — a prose list inside tighter or looser copy then
 * centres correctly too. Same selector, so it simply wins on order.
 */
@supports (height: 1lh) {
	:where(.md-flow, .entry-content)
		ul:where(:not([class^="md-"]):not([class*=" md-"]))
		> li::before {
		inset-block-start: calc((1lh - 5px) / 2);
	}
}

li > ul,
li > ol {
	margin-block-start: var(--md-space-xs);
}

blockquote {
	padding-inline-start: var(--md-space-md);
	border-inline-start: 4px solid var(--md-blue);
	font-size: var(--md-text-lead);
}

hr {
	height: var(--md-border-width);
	margin-block: var(--md-space-xl);
	border: 0;
	background-color: var(--md-color-rule);
}

code,
kbd,
pre,
samp {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.9375em;
}

pre {
	overflow-x: auto;
	padding: var(--md-space-md);
	border-radius: var(--md-radius-md);
	background-color: var(--md-color-surface-alt);
}

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

th,
td {
	padding: var(--md-space-xs) var(--md-space-sm);
	border-bottom: var(--md-border-width) solid var(--md-color-border);
	text-align: start;
}

th {
	font-weight: var(--md-weight-semibold);
	color: var(--md-color-heading);
}

::selection {
	background-color: var(--md-blue);
	color: var(--md-white);
}

/* -------------------------------------------------------------------------
 * Focus — visible keyboard focus everywhere (WCAG 2.4.7 / 2.4.11)
 * ---------------------------------------------------------------------- */
:focus-visible {
	outline: 3px solid var(--md-color-focus);
	outline-offset: 2px;
	border-radius: var(--md-radius-sm);
}

/* Only remove the default ring where :focus-visible is supported. */
:is(a, button, input, select, textarea, summary, [tabindex]):focus:not(
		:focus-visible
	) {
	outline: none;
}

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

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