html {
	text-size-adjust: none;
}

input,
button,
textarea,
select {
	font-family: inherit;
	font-size: inherit;
}



/* Global defaults */

body {
	line-height: 1.5;
	text-decoration-skip-ink: auto;
	font-optical-sizing: auto;
	font-variant-ligatures: common-ligatures no-discretionary-ligatures no-historical-ligatures contextual;
	font-kerning: normal;
}

button, input, label {
	line-height: 1.1;
}

/* Headings */

h1, h2, h3, h4, h5, h6 {
	line-height: 1.1;
	font-size-adjust: 0.514;
	font-variant-numeric: lining-nums;
	text-wrap: balance;
}

h1 {
	/* font-variant-ligatures: discretionary-ligatures; */
	font-size-adjust: 0.521; /* check if this changes with an optical sizing axis */
}

h1.uppercase {
	font-variant-caps: titling-caps;
}

h1 {
	font-size: var(--step-4);
}
h2 {
	font-size: var(--step-2);
}
h3 {
	font-size: var(--step-1);
}


/* Block spacing */

.flow {
	--flow-space: 1.5rem;
}

.flow * > * + * {
	margin-block-start: var(--flow-space, 1rem);
}



/* OpenType utility classes */

.dlig           { font-variant-ligatures: discretionary-ligatures; }
.hlig           { font-variant-ligatures: historical-ligatures; }
.dlig.hlig      { font-variant-ligatures: discretionary-ligatures historical-ligatures; }
.pnum           { font-variant-numeric: proportional-nums; }
.tnum           { font-variant-numeric: tabular-nums;    }
.lnum           { font-variant-numeric: lining-nums; }
.onum           { font-variant-numeric: oldstyle-nums; }
.zero           { font-variant-numeric: slashed-zero; }
.pnum.zero      { font-variant-numeric: proportional-nums slashed-zero; }
.tnum.zero      { font-variant-numeric: tabular-nums slashed-zero; }
.onum.zero      { font-variant-numeric: oldstyle-nums slashed-zero; }
.lnum.zero      { font-variant-numeric: lining-nums slashed-zero; }
.tnum.lnum.zero { font-variant-numeric: tabular-nums lining-nums slashed-zero; }
.frac           { font-variant-numeric: diagonal-fractions; }
.afrc           { font-variant-numeric: stacked-fractions; }
.ordn           { font-variant-numeric: ordinal; }
.smcp           { font-variant-caps: small-caps; }
.hist           { font-variant-alternates: historical-forms; }

.ss01           { font-variant-alternates: styleset(cursive); }
.ss02           { font-variant-alternates: styleset(swoopy); }

.cv01           { font-variant-alternates: character-variant(ampersand); }
.cv02           { font-variant-alternates: character-variant(capital-q); }

.salt1          { font-variant-alternates: stylistic(two-story-g); }
.salt2          { font-variant-alternates: stylistic(straight-y); }

.swsh1          { font-variant-alternates: swash(swishy); }
.swsh2          { font-variant-alternates: swash(flowing); }

.ornm1          { font-variant-alternates: ornaments(clover); }
.ornm2          { font-variant-alternates: ornaments(fleuron); }

.nalt1          { font-variant-alternates: annotation(circled); }
.nalt2          { font-variant-alternates: annotation(boxed); }


:root {
	--opentype-case: off;
	--opentype-sinf: off;
}

.case { --opentype-case: on; }
.sinf { --opentype-sinf: on; }

* {
	font-feature-settings: "case" var(--opentype-case, off), "sinf" var(--opentype-sinf, off);
}


/* Generic helper classes */

.centered {
	text-align: center;
	text-wrap: balance;
}

.uppercase {
	text-transform: uppercase;
	--opentype-case: on;
}

.smallcaps {
	font-variant-caps: all-small-caps;
	font-variant-numeric: oldstyle-nums;
}


/* Prose styling defaults */

.prose {
	text-wrap: pretty;
	font-variant-numeric: oldstyle-nums proportional-nums;
	font-size-adjust: 0.507;
}

strong, b, th {
	font-weight: bold;
	font-size-adjust: 0.514; /* Check for the different weights you may be using */
}


/* Sup and sub */

@supports ( font-variant-position: sub ) {
	sub, .sub {
		vertical-align: baseline;
		font-size: 100%;
		line-height: inherit;
		font-variant-position: sub;
	}
}
@supports ( font-variant-position: super ) {
	sup, .sup {
		vertical-align: baseline;
		font-size: 100%;
		line-height: inherit;
		font-variant-position: super;
	}
}

.chemical {
	--opentype-sinf: on;
}

/* Tables, times and maths */

td, math, time[datetime*=":"] {
	font-variant-numeric: tabular-nums lining-nums slashed-zero;
}


/* Quotes */

/* :lang(en) > * { quotes: '“' '”' '‘' '’'  ; } /* “Generic English ‘style’” */
:lang(fr) > * { quotes: '«\00202F' '\00202F»' '“' '”'; } /* « French “style” » */
:lang(en-GB) > * { quotes: '‘' '’' '“' '”' ; } /* ‘British “style”’ */

q::before { content: open-quote }
q::after  { content: close-quote }

.quoted p:first-of-type::before {
	content: '“';
}
.quoted p:last-of-type::after  {
	content: '”';
}

.quoted p:first-of-type::before {
	margin-inline-start: -0.87ch;
}
.quoted p {
	hanging-punctuation: first last;
}
@supports(hanging-punctuation: first last) {
	.quoted p:first-of-type::before {
		margin-inline-start: 0;
	}
}


/* Hyphenation - Remember to set lang */

.prose {
	hyphens: auto;
	hyphenate-limit-chars: 7 4 3;
	hyphenate-limit-lines: 2;
	hyphenate-limit-zone: 8%;
	hyphenate-limit-last: always;
}

.prose pre, .prose code, .prose var, .prose samp, .prose kbd,
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
	-webkit-hyphens: manual;
	hyphens: manual;
}


/* Dark mode and inverted text */

:root {
	--vf-grad: 0;
}

@media (prefers-color-scheme: dark) {
	:root {
		--vf-grad: -100; /* Grade is font-specific. */
	}
}

.inverted {
	--vf-grad: -100;
}

* {
	font-variation-settings: "GRAD" var(--vf-grad, 0);
}


