/*
  Global styles

  Low-specificity, global styles that apply to the whole
  project: https://cube.fyi/css.html
*/
html {
	interpolate-size: allow-keywords;
	scroll-behavior: smooth;
}

body {
	--color-dark: var(--color-off-black);
	--color-light: var(--color-off-white);
	--color-primary: var(--color-lime-green);
	--font-base: "ivypresto-text", "Times New Roman", Times, serif;

	background: var(--color-light);
	color: var(--color-dark);
	font-size: var(--size-step-0);
	font-family: var(--font-base);
	line-height: var(--leading-standard);
	font-weight: 300;
	font-size-adjust: from-font;
	margin: 0;
	overscroll-behavior: none;
}

:is(h1, h2, h3, h4) {
	text-wrap: balance;
	font-weight: 400;
	word-break: keep-all;
	font-family: "Fields", Georgia, "Times New Roman", Times, serif;
}

h1 {
	line-height: 1.125;
	font-size: var(--size-step-5);
	max-width: 35ch;
}

h2 {
	line-height: 1;
	font-size: var(--size-step-4);
	max-width: 35ch;
}

h3 {
	line-height: 1.25;
	font-size: var(--size-step-3);
	max-width: 35ch;
}

:is(h4, h5, h6) {
	font-size: var(--size-step-3);
}

small {
	font-size: var(--size-step-0);
}

p {
	text-wrap: pretty;
}

ins {
	text-decoration: none;
	background: var(--color-primary);
	color: var(--color-dark);
	padding-inline: 0.3em;
}

:is(code, kbd, samp) {
	font-family: var(--font-mono);
	padding: 0.2em 0.2em 0.05em 0.2em;
	hyphens: none;
	tab-size: 2;
	text-align: left;
	word-spacing: normal;
	word-break: normal;
	word-wrap: normal;
	box-decoration-break: clone;
}

/* This is quite a new property, so we want code styles to at least, not be huge or tiny */
@supports not (font-size-adjust: from-font) {
	:is(code, kbd, samp) {
		font-size: 0.8em;
	}
}

pre:has(code) {
	width: max-content;
	max-width: 100%;
	overflow-x: auto;
}

pre code {
	border: none;
	background: none;
	padding: 0;
}

kbd {
	border: 1px solid;
	padding-block-end: 0.1em;
}

var {
	font-style: normal;
	font-weight: var(--font-medium);
}

q {
	font-style: italic;
}

ul:not([class]) {
	padding-inline-start: 1.7ch;
	list-style-type: disc;
}

ul:not([class]) > li {
	padding-inline-start: var(--space-xs);
}

ul ::marker {
	font-size: 0.8lh;
}

ol ::marker {
	font-size: 1em;
	font-weight: var(--font-bold);
}

/* Lists with classes and roles will be out of standard flow, so remove the default spacing */
[role="list"][class],
[role="tablist"][class] {
	margin-block: 0;
	padding: 0;
}

dt {
	font-weight: var(--font-medium);
}

dt + dd {
	margin-block-start: var(--space-xs);
}

dd + dt {
	margin-block-start: var(--space-s);
}

dd {
	margin-inline-start: 1.5ch;
}

blockquote {
	margin-inline: 0;
	color: var(--color-light);
}

blockquote footer {
	margin-block-start: var(--space-s);
	color: var(--color-primary);
	font-size: var(--size-step-0);
}

blockquote q {
	font-style: normal;
}

:is(video, iframe[src*="youtube"], iframe[src*="vimeo"]) {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16/9;
}

img {
	height: auto;
	max-width: 100%;
	display: block;
}

figcaption {
	padding-block-start: 0.5em;
	font-size: var(--size-step-0);
	font-family: monospace;
}

table {
	border: var(--stroke);
	border-collapse: collapse;
	width: 100%;
}

th {
	text-align: left;
	font-weight: var(--font-bold);
}

thead th {
	padding-block: var(--space-s);
}

td,
th {
	padding: var(--space-xs) var(--space-s);
}

th:not(:only-of-type) {
	border-block-end: var(--stroke);
}

th:only-of-type {
	border-inline-end: var(--stroke);
}

:is(th, td) ~ :is(th, td) {
	border-inline-start: var(--stroke);
}

tr + tr :is(th, td) {
	border-block-start: var(--stroke);
}

caption {
	caption-side: bottom;
	margin-block-start: var(--space-s);
}

a:not([class]):hover {
	text-underline-offset: 0.2lh;
}

:is(h1, h2, h3, h4) a:not([class]) {
	text-decoration-thickness: 0.1ex;
	text-underline-offset: 0.2ex;
}

:is(h1, h2, h3, h4) a:not([class]):hover {
	text-underline-offset: 0.3ex;
}

:focus {
	outline: none;
}

:focus-visible {
	outline: 2px solid var(--focus-color, currentColor);
	outline-offset: var(--focus-offset, 0.2lh);
}

/* Firefox is the only browser that doesn't outline the whole element unless you make it display: inline-block. That in itself causes multiple flow issues so we can detect it, using its own vendor prefix and reduce focus offset
*/
@supports (-moz-appearance: none) {
	:root {
		--focus-offset: 0.08em;
	}
}

:target {
	scroll-margin-block: 5lh;
}

::selection {
	color: var(--color-dark);
	background: var(--color-light);
}

hr {
	border: none;
	border-block-start: var(--stroke);
	margin-block: var(--flow-space, var(--space-xl));
}

svg:not([class]) {
	width: auto;
	height: 1lh;
}

svg {
	flex-shrink: 0;
}

svg[role="img"][width][height] {
	width: revert;
	height: revert;
	background: var(--color-light);
	padding: var(--space-xs);
}

/* There's a .flow composition, but this prevents forms from having to have that applied where markup is harder to control in certain systems. It still uses the --flow-space variables though to make managing space easier */
/* form > * + * {
	margin-top: var(--flow-space, 1rem);
}

:is(input, select, textarea) {
	accent-color: var(--color-primary);
}

:is(
		input:not([type="checkbox"], [type="radio"], [type="color"]),
		select,
		textarea
	) {
	padding: 0.5em 0.8em;
	border-radius: var(--radius-xs);
	border: var(--stroke-solid);
	background: var(--color-dark-glare);
	color: var(--color-dark);
	width: 100%;

	/* Firefox — for some reason — adds opacity to placeholders */
/*
	&::placeholder {
		color: var(--color-mid);
		opacity: 1;
	}
}

label {
	line-height: var(--leading-fine);
	font-weight: var(--font-medium);
}

label::after {
	content: "\A";
	white-space: pre;
}

/* Usually label wraps checkbox and radio buttons, so we give ourselves more layout and text-flow control with flex */
label:has(input) {
	display: flex;
	align-items: baseline;
	gap: var(--space-s);
	font-weight: var(--font-normal);
}

label:has(input) + label:has(input) {
	--flow-spce: var(--space-s-m);
}
*/

/* Slightly adjusts the vertical position of the check/radio */
/* 
label:has(input) input {
	transform: translateY(-0.1ex);
}

input:disabled {
	background: var(--color-mid);
}

input:disabled,
label input:disabled + * {
	cursor: not-allowed;
}

fieldset {
	border: var(--stroke);
	padding: var(--space-s);
} */

legend {
	font-weight: var(--font-medium);
	padding-inline: var(--space-xs);
}

summary {
	font-weight: var(--font-bold);
	cursor: pointer;
}

details[open] summary {
	margin-block-end: var(--space-s);
}

body .wp-block-navigation__responsive-container-open:not(.always-shown) {
	display: block !important;
}
body
	.wp-block-navigation__responsive-container:not(.hidden-by-default):not(
		.is-menu-open
	) {
	display: none !important;
}

@media (min-width: 700px) {
	body .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: none !important;
	}
	body
		.wp-block-navigation__responsive-container:not(.hidden-by-default):not(
			.is-menu-open
		) {
		display: block !important;
	}
}
