/* Reset, typography, links, forms, tables and print: plain elements, no classes */

@layer base {
	/* Reset */
	html, body, body div, span, object, iframe,
	h1, h2, h3, h4, h5, h6, p, blockquote, pre,
	abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp,
	small, strong, sub, sup, var, b, i,
	dl, dt, dd, ol, ul, li,
	fieldset, form, label, legend,
	table, caption, tbody, tfoot, thead, tr, th, td,
	article, aside, figure, footer, header, hgroup, menu, nav, section,
	time, mark, audio, video {
		margin: 0;
		padding: 0;
		border: 0;
		outline: 0;
		font-size: 100%;
		vertical-align: baseline;
		background: transparent;
	}

	article, aside, figure, footer, header, hgroup, nav, section {
		display: block;
	}

	/* Page: 1rem = 10px */
	html {
		background: #ffffff;
		font-size: 62.5%;
		-webkit-tap-highlight-color: var(--color-tint);
		-webkit-text-size-adjust: 100%;
	}

	body {
		margin: 0;
		padding: 0;
		width: 100%;
		background-color: transparent;
		font-family: var(--font-sans);
		font-size: 1.6rem;
		line-height: var(--baseline);
		color: var(--color-text);
		-webkit-font-smoothing: antialiased;
	}

	/* Headings */
	h1, h2, h3, h4, h5, h6 {
		margin: 0;
		font-family: inherit;
		font-weight: bold;
		color: inherit;
		text-rendering: optimizelegibility;
	}

	h1 small,
	h2 small {
		font-weight: normal;
		color: var(--color-muted);
	}

	h1,
	.h1 {
		margin-bottom: calc(var(--baseline) / 2);
		font-size: 3.2rem;
		line-height: 1.2;
	}

	h2,
	.h2 {
		margin-bottom: calc(var(--baseline) / 2);
		font-size: 2.4rem;
		line-height: 1.2;
	}

	h3,
	.h3 {
		margin-bottom: calc(var(--baseline) / 1.5);
		font-size: 2.1rem;
		line-height: 1.3;
	}

	h4,
	.h4 {
		margin-bottom: var(--baseline);
		font-size: 1.8rem;
		line-height: 1.25;
	}

	h5 {
		margin-bottom: var(--baseline);
		font-size: 1.6rem;
	}

	h6 {
		margin-bottom: var(--baseline);
		font-size: 1.4rem;
		font-weight: normal;
		letter-spacing: 1px;
		text-transform: uppercase;
	}

	/* Text blocks: 18px, 16px from 768px, 18px again from 1382px */
	p, ol, ul, dl, address {
		margin-bottom: var(--baseline);
		font-family: var(--font-sans);
		font-size: 1.8rem;
		line-height: var(--baseline);

		@media (width >= 48em) {
			font-size: 1.6rem;
		}
		@media (width >= 86.375em) {
			font-size: 1.8rem;
		}
	}

	small {
		font-size: 1.4rem;
	}

	ul, ol {
		margin: 0 0 var(--baseline) calc(-1 * var(--gutter));
		padding: 0 0 0 var(--gutter);
	}

	li ul,
	li ol {
		margin: 0;
		font-size: 1.6rem;
	}

	blockquote {
		margin: 0 0 var(--baseline) calc(-1 * var(--gutter));
		padding-left: var(--gutter);
		border-left: 2px solid var(--color-rule);
		font-family: var(--font-sans);
		font-style: normal;
	}

	q {
		quotes: none;
	}

	blockquote::before, blockquote::after,
	q::before, q::after {
		content: none;
	}

	cite {
		font-style: normal;
	}

	dl, dd {
		margin-bottom: var(--baseline);
	}

	dt {
		font-weight: bold;
	}

	abbr[title] {
		border-bottom: 1px dotted var(--color-rule);
		cursor: help;
	}

	b, strong {
		font-weight: bold;
	}

	dfn {
		font-style: italic;
	}

	ins {
		background-color: var(--color-tint);
		color: var(--color-text);
		text-decoration: none;
	}

	mark {
		background-color: var(--color-tint);
		color: var(--color-text);
		font-style: italic;
		font-weight: bold;
	}

	pre, code, kbd, samp {
		font-family: var(--font-mono);
		font-size: 1.4rem;
		line-height: var(--baseline);
	}

	pre {
		white-space: pre-wrap;
		word-wrap: break-word;
	}

	sub, sup {
		position: relative;
		font-size: 1.2rem;
		line-height: 0;
		vertical-align: baseline;
	}

	sup {
		top: -0.5em;
	}

	sub {
		bottom: -0.25em;
	}

	/* Links */
	a {
		text-decoration: none;
		color: var(--color-link);

		&:visited {
			color: var(--color-link-visited);
		}
		&:hover {
			text-decoration: underline;
			color: var(--color-link-hover);
		}
		&:focus {
			outline: thin dotted;
			color: var(--color-link-focus);
		}
		&:hover,
		&:active {
			outline: 0;
		}
	}

	::selection {
		background-color: var(--color-selection-bg);
		color: var(--color-selection);
		text-shadow: none;
	}

	/* Forms */
	form {
		margin: 0 0 var(--baseline) 0;

		fieldset {
			margin-bottom: var(--baseline);
			padding: 0;
			border-width: 0;
		}

		legend {
			display: block;
			width: 100%;
			margin-bottom: calc(2 * var(--baseline));
			padding: 0;
			color: var(--color-text);
			border: 0;
			border-bottom: 1px solid var(--color-input-border);
			white-space: normal;

			small {
				font-size: 1.4rem;
				color: var(--color-muted);
			}
		}

		ul {
			list-style-type: none;
			margin: 0 0 var(--baseline) 0;
			padding: 0;
		}

		br {
			display: none;
		}
	}

	label, input, button, select, textarea {
		font-size: 1.4rem;
		vertical-align: baseline;
	}

	input, button, select, textarea {
		font-family: var(--font-sans);
		box-sizing: border-box;
	}

	label {
		display: block;
		font-weight: bold;
		color: var(--color-text);
		cursor: pointer;

		input, textarea, select {
			display: block;
		}
	}

	input, textarea, select {
		display: inline-block;
		width: 100%;
		padding: 4px;
		background-color: #ffffff;
		border: 1px solid var(--color-input-border);
		color: var(--color-text);

		&:hover {
			border-color: var(--color-input-hover);
		}
	}

	input[type="image"],
	input[type="checkbox"],
	input[type="radio"] {
		width: auto;
		height: auto;
		padding: 0;
		margin: 3px 0;
		line-height: normal;
		cursor: pointer;
		border-radius: 0;
	}

	input[type="checkbox"],
	input[type="radio"] {
		box-sizing: border-box;
		padding: 0;
	}

	input[type="image"] {
		border: 0;
		box-shadow: none;
	}

	input[type="file"] {
		width: auto;
		padding: initial;
		line-height: initial;
		border: initial;
		background-color: initial;
		box-shadow: none;
	}

	input[type="button"],
	input[type="reset"],
	input[type="submit"] {
		width: auto;
		height: auto;
		cursor: pointer;
	}

	select,
	input[type="file"] {
		height: 28px;
		line-height: 28px;
	}

	select {
		width: auto;
		background-color: #ffffff;
		font-size: 1.3rem;
	}

	select[multiple],
	select[size] {
		height: auto;
	}

	textarea {
		resize: vertical;
		height: auto;
		overflow: auto;
		vertical-align: top;
	}

	input[type="hidden"] {
		display: none;
	}

	/* Labels wrapping a radio button or checkbox (account form) */
	.radio,
	.checkbox {
		padding-left: 18px;
		font-weight: normal;
	}

	.radio input[type="radio"],
	.checkbox input[type="checkbox"] {
		float: left;
		margin-left: -18px;
	}

	input[disabled], select[disabled], textarea[disabled],
	input[readonly], select[readonly], textarea[readonly] {
		opacity: 0.5;
		cursor: not-allowed;
	}

	input:focus,
	textarea:focus {
		outline: 0;
	}

	input[type="file"]:focus,
	input[type="radio"]:focus,
	input[type="checkbox"]:focus,
	select:focus {
		box-shadow: none;
	}

	::placeholder {
		font-size: 1.4rem;
	}

	/* Tables */
	table {
		width: 100%;
		max-width: 100%;
		margin-bottom: var(--baseline);
		border-collapse: collapse;
		border-spacing: 0;
		background-color: transparent;

		th, td {
			padding: 8px;
			vertical-align: top;
			border-top: 1px solid var(--color-input-border);
			font-size: 1.4rem;
			line-height: var(--baseline);
			text-align: left;
		}

		th {
			font-weight: bold;
		}

		thead th {
			vertical-align: bottom;
		}

		colgroup + thead tr:first-child th,
		colgroup + thead tr:first-child td,
		thead:first-child tr:first-child th,
		thead:first-child tr:first-child td {
			border-top: 0;
		}

		tbody + tbody {
			border-top: 2px solid var(--color-input-border);
		}

		tbody tr:hover td,
		tbody tr:hover th {
			background-color: var(--color-row-hover);
		}
	}

	/* Print */
	@media print {
		* {
			background: transparent !important;
			color: black !important;
			box-shadow: none !important;
			text-shadow: none !important;
			filter: none !important;
		}

		@page {
			margin: 0.5cm;
		}

		h2, h3 {
			orphans: 3;
			widows: 3;
			break-after: avoid;
		}

		p {
			orphans: 3;
			widows: 3;
		}

		pre, blockquote {
			border: 1px solid #808080;
			break-inside: avoid;
		}

		abbr[title]::after {
			content: " (" attr(title) ")";
		}

		a, a:visited {
			text-decoration: underline;
		}

		a[href]::after {
			content: " (" attr(href) ")";
		}

		a[href^="javascript:"]::after,
		a[href^="#"]::after {
			content: "";
		}

		img {
			max-width: 100% !important;
			break-inside: avoid;
		}

		thead {
			display: table-header-group;
		}

		tr {
			break-inside: avoid;
		}
	}
}
