/* Paragraph */

p {
	margin-top: 1rem;
}

/* Headings */

h1,
h2,
h3,
h4,
h5,
h6 {
	line-height: 1.2;
}

h2,
h3,
h4,
h5,
h6 {
	font-weight: var(--font-weight-bold);
	letter-spacing: -0.02em;
	margin-top: 3rem;
}

h1 {
	font-size: 2em;
	font-weight: normal;
	margin-top: 6rem;
}

h1:first-of-type {
	margin-top: 0;
}

h2 {
	font-size: 1.5em;
}

h3 {
	font-size: 1.25em;
}

h4,
h5,
h6 {
	font-size: 1em;
}

/* Lists */

ul,
ol {
	padding: 0;
	margin: 1rem 0 0 2rem;
}

li {
	margin: 0.5rem 0 0;
}

li ul,
li ol {
	margin-left: 1rem;
}

ol li {
	padding-left: 1rem;
}

/* Tables */

table {
	border-collapse: collapse;
	margin-top: 1rem;
	width: 100%;
}

th {
	text-align: left;
}

th,
td {
	padding: 0.25em 1em 0.25em 0;
	vertical-align: top;
}

thead th {
	border-bottom: 3px solid var(--color-gray-9);
}

th,
td {
	border-bottom: 1px solid var(--color-gray-5);
}

.striped tr:nth-child(even):not([style*="display: none"]) {
	background-color: var(--color-gray-1);
}

.tableResponsive {
	background-image:
		linear-gradient(to right, var(--color-gray-0), var(--color-gray-0)),
		linear-gradient(to left, var(--color-gray-0), var(--color-gray-0)),
		linear-gradient(to right, rgba(200, 200, 200, 0.5), rgba(255, 255, 255, 0)),
		linear-gradient(to left, rgba(200, 200, 200, 0.5), rgba(255, 255, 255, 0));
	/* Shadows */
	/* Shadow covers */
	background-position:
		left center,
		right center,
		left center,
		right center;
	background-repeat: no-repeat;
	background-color: var(--color-gray-0);
	background-size:
		15px 100%,
		15px 100%,
		15px 100%,
		15px 100%;
	background-attachment: local, local, scroll, scroll;
	overflow: auto;
}

.tableResponsive table {
	min-width: 30em;
}

/* Forms */

.formContainer {
	background-color: var(--color-gray-2);
	margin-top: 2rem;
	padding: 1rem;
}

form {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr 1fr;
	gap: 0.5rem;
	max-width: 60rem;
	margin: 0 auto;
}

.formElement1-4,
.formElement2-4,
.formElement3-4,
.formElement4-4 {
	margin-top: 0;
	grid-column: span 4;
}

fieldset {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	grid-column: span 4;
	margin: 0;
	padding: 0 1rem 1rem;
}

input,
textarea {
	border: 1px solid var(--color-gray-6);
	border-radius: 4px;
	box-shadow: 0 0.5rem 1rem var(--color-gray-0);
	padding: 0.25em 0.5em;
	width: 100%;
}

input:not([type="checkbox"]):not([type="radio"]) {
	min-height: 2.5rem;
}

@media screen and (min-width: 60rem) {
	input,
	textarea {
		border-radius: 6px;
	}
}

input:focus,
textarea:focus {
	border-color: transparent;
	outline-offset: 0;
}

input[type="radio"] {
	width: auto;
}

select {
	min-height: 2rem;
	padding: 0.25em 0.5em;
}

label {
	margin-bottom: 0.25rem;
}

button {
	background-color: var(--color-one);
	border: 0;
	border-radius: 4px;
	box-shadow: inset -3px -3px 2px
		hsl(var(--color-one-h), var(--color-one-s), calc(var(--color-one-l) * 0.5));
	color: var(--color-gray-0);
	cursor: pointer;
	padding: 0.75rem 1rem;
}

@media screen and (min-width: 60rem) {
	button {
		padding: 0.75rem;
	}
}

button.green {
	background-color: var(--color-three);
	box-shadow: inset -3px -3px 2px
		hsl(var(--color-three-h), var(--color-three-s), calc(var(--color-three-l) * 0.5));
}

@media screen and (min-width: 60rem) {
	button {
		border-radius: 6px;
	}
}

button:active {
	background-color: hsl(var(--color-one-h), var(--color-one-s), calc(var(--color-one-l) * 0.8));
	box-shadow: inset 2px 2px 4px
		hsl(var(--color-one-h), var(--color-one-s), calc(var(--color-one-l) * 0.5));
}

button.green:active {
	background-color: hsl(
		var(--color-three-h),
		var(--color-three-s),
		calc(var(--color-three-l) * 0.8)
	);
	box-shadow: inset 2px 2px 4px
		hsl(var(--color-three-h), var(--color-three-s), calc(var(--color-three-l) * 0.5));
}

button:has(.btn-icon) {
	display: flex;
	align-items: center;
}

button .btn-icon {
	align-items: center;
	display: flex;
}

button .btn-icon svg {
	height: 1.2em;
	margin-right: 0.25rem;
	width: auto;
}

.control {
	display: inline-block;
	margin-right: 1em;
}

h3.formElement4-4 {
	margin-top: 2rem;
}

@media screen and (max-width: 50rem) {
	label {
		font-size: 1rem;
	}
}

@media screen and (min-width: 50rem) {
	.formContainer {
		margin-top: 4rem;
		padding: 2rem;
	}

	form {
		gap: 1rem;
	}

	.formElement1-4 {
		grid-column: span 1;
	}

	.formElement2-4 {
		grid-column: span 2;
	}

	.formElement3-4 {
		grid-column: span 3;
	}

	.formElement4-4 {
		grid-column: span 4;
	}

	fieldset {
		grid-column: span 2;
	}
}

/* Custom and accessible checkbox and radio buttons*/

/*style wrapper to give some space*/
.radioChoices {
	align-items: center;
	display: flex;
	flex-direction: row;
	min-height: 2.5rem;
}

.radioWrapper,
.checkboxWrapper {
	position: relative;
}

.radioWrapper {
	display: inline-block;
	margin-right: 1em;
}

/*style label to give some more space*/
.radioWrapper label,
.checkboxWrapper input + label {
	display: block;
	padding: 0 0 0 1.5em;
}

/*style and hide original checkbox*/
.radioWrapper input,
.checkboxWrapper input {
	height: 0.5em;
	left: 0;
	opacity: 0;
	position: absolute;
	top: 0;
	width: 0.5em;
}

/*position new box*/
.radioWrapper input + label::before,
.checkboxWrapper input + label::before {
	background-color: var(--color-gray-0);
	border: 1px solid var(--color-gray-7);
	content: "";
	height: 1.1em;
	left: 0;
	position: absolute;
	top: 0.15em;
	width: 1.1em;
}

.radioWrapper input + label::before {
	border-radius: 50%;
}

/*position new box*/
.checkboxWrapper input + label::before {
	border-radius: 3px;
}

/*radio pseudo element styles*/
.radioWrapper input + label::after {
	color: var(--color-gray-0);
	content: "";
	opacity: 0;
	border: 0.3em solid;
	border-radius: 50%;
	position: absolute;
	left: 0.25em;
	top: 0.42em;
	transition: opacity 0.2s ease-in-out;
}

/*svg background styles*/
.checkboxWrapper input + label::after {
	content: "";
	opacity: 0;
	background-image: url(/check.svg);
	background-repeat: no-repeat;
	height: 0.7em;
	width: 0.7em;
	position: absolute;
	left: 0.2em;
	top: 0.35em;
	transition: opacity 0.2s ease-in-out;
}

.radioWrapper input:checked + label::before,
.checkboxWrapper input:checked + label::before {
	border-color: var(--color-one);
	background-color: var(--color-one);
}

/*reveal check for 'on' state*/
.radioWrapper input:checked + label::after,
.checkboxWrapper input:checked + label::after {
	opacity: 1;
}

/*focus styles*/
.radioWrapper input:focus + label::before,
.checkboxWrapper input:focus + label::before {
	box-shadow: 0 0 0 3px hsl(var(--color-one-h), var(--color-one-s), 75%);
	outline: 2px solid transparent; /* For Windows high contrast mode. */
}

/* Media */

iframe {
	margin-top: 1rem;
}

figure {
	margin-top: 2rem;
}

figcaption {
	font-style: italic;
	margin-top: 0.5em;
}

@media screen and (min-width: 60rem) {
	figcaption {
		font-size: 0.75em;
	}
}

p:has(picture + picture) {
	display: grid;
	gap: 2rem;
	margin: 2rem calc(-50vw + 50%) 4rem;
	padding-left: 0;
	width: 100vw;
}

@media (min-width: 350px) {
	p:has(picture + picture) {
		grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	}
}

/* Callouts */

.callout {
	background: var(--callout-bg, var(--color-gray-2));
	border-left: 5px solid var(--callout-border-color, var(--color-gray-8));
	color: var(--callout-color, var(--color-gray-9));
	padding: 0.75rem 0.75rem 0.75rem 1rem;
	position: relative;
	margin-top: 1rem;
}

.callout.info {
	--callout-bg: hsl(var(--color-two-h), var(--color-two-s), 90%);
	--callout-border-color: hsl(var(--color-two-h), var(--color-two-s), 40%);
	--callout-color: hsl(var(--color-two-h), var(--color-two-s), 40%);
}

.callout p:first-child {
	margin-top: 0;
}

/* Links */

a {
	color: inherit;
	text-decoration: underline solid #eb5b33;
	text-decoration-thickness: 3px;
	text-underline-offset: 0.2em;
}

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

*:focus {
	outline: 3px solid var(--color-one);
	outline-offset: 0.2rem;
}

a:focus {
	color: var(--color-one);
	text-decoration: none;
}

*:focus:not(:focus-visible) {
	outline: none;
}

@media screen and (min-width: 60rem) {
	a.outline {
		border: 3px solid var(--color-one);
		color: var(--color-one);
		padding: 0.4em;
		text-decoration: none;
	}
	a.outline:hover,
	a.outline:focus {
		background: var(--color-one);
		color: var(--color-gray-0);
	}
}

/* Other inline elements */

small {
	font-size: 0.75em;
}

strong {
	font-weight: 700;
}
