/* Reset, element typography and global utilities. Nothing component specific. */

*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--masthead-height) + var(--space-2));
}

body {
	background-color: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-text);
	font-size: var(--font-4);
	font-weight: var(--weight-regular);
	line-height: var(--leading);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-wrap: pretty;
}

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

img,
video {
	height: auto;
}

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

button {
	cursor: pointer;
}

/* ---- Headings ---- */

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

h1 { font-size: var(--font-8); }
h2 { font-size: var(--font-7); }
h3 { font-size: var(--font-6); }
h4 { font-size: var(--font-5); }

h5,
h6 {
	font-family: var(--font-text);
	font-size: var(--font-4);
	font-weight: var(--weight-semi);
	letter-spacing: 0;
}

/* ---- Flow ---- */

:is(p, ul, ol, dl, blockquote, figure, table, h1, h2, h3, h4, h5, h6) {
	margin-block-end: var(--space-2);
}

:is(p, ul, ol, dl, blockquote, figure, table, h1, h2, h3, h4, h5, h6):last-child {
	margin-block-end: 0;
}

:is(h2, h3, h4) {
	margin-block-start: var(--space-4);
}

:is(h2, h3, h4):first-child {
	margin-block-start: 0;
}

ul,
ol {
	padding-inline-start: 1.25em;
}

li + li {
	margin-block-start: var(--space-05);
}

/* Lists that lay out their own items use gap; the prose margin would push them out of line. */
:is(.is-layout-list, .card-grid, .price-grid, .gallery__grid, .masthead__list, .drawer__list, .site-footer__list, .rules__list, .contact-list) > li + li {
	margin-block-start: 0;
}

strong,
b {
	font-weight: var(--weight-semi);
}

hr {
	border: 0;
	border-block-start: var(--border-hairline) solid var(--color-border);
	margin-block: var(--space-4);
}

/* ---- Links ---- */

a {
	color: var(--color-link);
	text-decoration-thickness: max(0.06em, var(--border-hairline));
	text-underline-offset: 0.18em;
	transition: color var(--duration) var(--ease);
}

a:hover,
a:focus-visible {
	color: var(--color-link-hover);
	text-decoration-thickness: 0.1em;
}

/* One focus rule, with no radius: the outline traces whatever shape the element already has. */
:focus-visible {
	outline: var(--focus-width) solid var(--focus-color);
	outline-offset: var(--focus-offset);
}

.skip-link {
	position: absolute;
	inset-block-start: var(--space-1);
	inset-inline-start: var(--space-1);
	z-index: calc(var(--z-dialog) + 1);
	padding: var(--space-1) var(--space-2);
	background: var(--tst-ink);
	color: var(--tst-white);
	transform: translateY(-200%);
}

.skip-link:focus {
	transform: none;
	color: var(--tst-white);
}

/* ---- Layout ---- */

.container {
	width: 100%;
	max-width: calc(var(--container) + var(--gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.container--narrow {
	max-width: calc(var(--container-narrow) + var(--gutter) * 2);
}

.section {
	padding-block: var(--section-y);
}

.section--band {
	background-color: var(--color-bg-band);
}

.section--card {
	background-color: var(--color-bg-card);
}

.section--tight {
	padding-block: var(--section-y-tight);
}

.section--flush-top {
	padding-block-start: 0;
}

.section--flush-bottom {
	padding-block-end: 0;
}

.section__head {
	max-width: var(--measure);
	margin-block-end: var(--space-4);
}

.section__head--center {
	margin-inline: auto;
	text-align: center;
}

.measure {
	max-width: var(--measure);
}

/* ---- Text utilities ---- */

.lede {
	font-size: var(--font-5);
	line-height: var(--leading-snug);
	font-weight: var(--weight-light);
}

.muted {
	color: var(--color-text-muted);
}

.eyebrow,
.label {
	font-family: var(--font-text);
	font-size: var(--font-1);
	font-weight: var(--weight-medium);
	letter-spacing: var(--tracking-label);
	text-transform: uppercase;
	line-height: var(--leading-snug);
}

.eyebrow {
	margin-block-end: var(--space-1);
	color: var(--color-text-muted);
}

.visually-hidden,
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---- Motion guard, last ---- */

@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;
	}
}
