:root {
	color-scheme: light;
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--page-width: 76rem;
	--article-width: 46rem;
	--wide-section-width: 62rem;
	--note-width: 14.5rem;
	--ink: #172033;
	--muted-ink: #586174;
	--page-background: #F5F2EA;
	--paper: #FFFDF8;
	--panel: #ECE8DC;
	--accent: #314F8F;
	--accent-dark: #233A6B;
	--border: #D5CFC1;
	--note-background: #ECE8DC;
	--shadow: 0 0.8rem 2.2rem rgb(36 42 55 / 0.12);

	/* Main appearance controls. */
	/* --tutorial-h1-size: clamp(2.6rem, 7vw, 4.6rem); */
	/* --tutorial-h2-size: clamp(1.75rem, 7vw, 2.35rem); */
	--tutorial-h1-size: clamp(2.6rem, 5.5vw, 4.6rem);
	--tutorial-h2-size: clamp(1.75rem, 3vw, 2.35rem);
}

* {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--page-background);
	color: var(--ink);
	font-size: 1.04rem;
	line-height: 1.7;
}

a {
	color: var(--accent);
}

a:hover {
	color: var(--accent-dark);
}

.site-header {
	border-bottom: 1px solid rgb(213 207 193 / 0.9);
	background: rgb(245 242 234 / 0.96);
}

.header-content {
	width: min(calc(100% - 2rem), var(--page-width));
	min-height: 4.5rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2rem;
	margin-inline: auto;
}

.site-name {
	color: var(--ink);
	font-size: 1.15rem;
	font-weight: 750;
	letter-spacing: 0.01em;
	text-decoration: none;
}

nav {
	display: flex;
	flex-wrap: wrap;
	gap: 1.4rem;
}

nav a {
	color: var(--muted-ink);
	font-size: 0.92rem;
	font-weight: 650;
	text-decoration: none;
}

main,
.tutorial-page {
	padding: clamp(2.5rem, 7vw, 5rem) 1rem clamp(4rem, 9vw, 7rem);
}

.tutorial,
.tutorial-heading,
.tutorial-section {
	width: min(100%, var(--article-width));
	margin-inline: auto;
}

.tutorial-header,
.tutorial-heading {
	margin-bottom: clamp(3rem, 8vw, 5rem);
}

.eyebrow {
	margin: 0 0 0.6rem;
	color: var(--accent);
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

h1,
h2,
h3,
p {
	text-wrap: pretty;
}

h1 {
	max-width: 14ch;
	margin: 0;
	font-size: var(--tutorial-h1-size);
	line-height: 1.02;
	letter-spacing: -0.045em;
}

h2 {
	margin: 0 0 1rem;
	font-size: var(--tutorial-h2-size);
	line-height: 1.15;
	letter-spacing: -0.025em;
}

h3 {
	margin: 0;
	font-size: 1.08rem;
	line-height: 1.35;
}

p {
	margin-block: 1rem;
}

.dek,
.tutorial-summary {
	max-width: 38rem;
	margin: 1.4rem 0 0;
	color: var(--muted-ink);
	font-size: clamp(1.12rem, 2.2vw, 1.3rem);
	line-height: 1.55;
}

.follow-along,
.primary-action,
.play-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 3rem;
	border-radius: 999px;
	padding: 0.65rem 1.15rem;
	background: var(--accent);
	color: white;
	font-weight: 750;
	text-decoration: none;
}

.follow-along,
.primary-action {
	margin-top: 1.6rem;
}

.follow-along:hover,
.primary-action:hover,
.play-link:hover {
	background: var(--accent-dark);
	color: white;
}

a:focus-visible {
	outline: 3px solid #87A8E6;
	outline-offset: 3px;
}

.tutorial > section,
.tutorial-section {
	position: relative;
	margin-top: clamp(4rem, 9vw, 6.5rem);
}

.tutorial-section {
	margin-bottom: 0;
}

.tutorial > section::before,
.tutorial-section::before {
	content: "";
	display: block;
	width: 4rem;
	margin-bottom: 2rem;
	border-top: 1px solid var(--border);
}

figure,
.tutorial-figure {
	margin: 2rem 0 2.4rem;
}

figure img,
.tutorial-figure img {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid #2D3442;
	background: #11151E;
	box-shadow: 0 0 0 0.35rem #11151E, var(--shadow);
}

figcaption {
	margin-top: 0.85rem;
	color: var(--muted-ink);
	font-size: 0.9rem;
	line-height: 1.45;
	text-align: center;
}

.side-note,
.sidenote {
	margin: 1.5rem 0 2rem;
	border-left: 0.3rem solid var(--accent);
	padding: 1rem 1.15rem;
	background: var(--note-background);
	font-size: 0.94rem;
	line-height: 1.55;
}

.side-note p,
.sidenote p {
	margin: 0.35rem 0 0;
	color: var(--muted-ink);
}

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

.playful-note {
	font-style: italic;
}

.key-point,
.recap-grid article {
	border: 1px solid var(--border);
	border-radius: 0.8rem;
	padding: 1.3rem 1.4rem;
	background: var(--paper);
}

.key-point {
	margin-top: 2.5rem;
}

.key-point p,
.recap-grid p {
	margin-bottom: 0;
	color: var(--muted-ink);
}

.control-list {
	display: grid;
	gap: 1rem;
	margin-top: 1.8rem;
}

.control-list > section {
	border-top: 1px solid var(--border);
	padding-top: 1.15rem;
}

.control-list > section:first-child {
	border-top: 0;
	padding-top: 0;
}

.control-list p {
	margin-bottom: 0;
}

.final-note {
	margin-top: 2rem;
}

.tutorial-recap {
	width: min(100%, var(--wide-section-width));
	margin: clamp(4rem, 9vw, 6.5rem) auto 0;
}

.recap-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1rem;
	margin-top: 1.8rem;
}

.recap-grid h3 {
	margin-top: 0;
}

.tutorial-footer,
.tutorial-complete {
	width: min(100%, var(--wide-section-width));
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	margin: clamp(4rem, 9vw, 6rem) auto 0;
	border-radius: 1rem;
	padding: 1.4rem;
	background: var(--ink);
	color: white;
}

.tutorial-footer p,
.tutorial-complete p,
.tutorial-complete h2 {
	margin-block: 0.35rem;
}

.tutorial-footer p,
.tutorial-complete h2 {
	font-weight: 700;
}

.tutorial-footer .play-link,
.tutorial-complete .play-link {
	flex: 0 0 auto;
	background: white;
	color: var(--ink);
}

.tutorial-footer .play-link:hover,
.tutorial-complete .play-link:hover {
	background: #E9EDF6;
	color: var(--ink);
}

.site-footer,
body > footer {
	border-top: 1px solid var(--border);
	padding: 2rem 1rem;
	color: var(--muted-ink);
	font-size: 0.9rem;
	text-align: center;
}

.site-footer p,
body > footer p {
	margin: 0;
}

@media (min-width: 68rem) {
	.side-note,
	.sidenote {
		position: absolute;
		left: calc(100% + 2.5rem);
		width: var(--note-width);
		margin: 0;
	}

	#starting-puzzle + p + .side-note {
		top: 4.5rem;
	}

	#first-move + p + .side-note {
		top: 5rem;
	}

	.final-note {
		top: 5rem;
	}

	.step-copy .sidenote {
		top: 2.2rem;
	}

	.figure-note {
		top: auto;
		bottom: 2rem;
	}
}

@media (max-width: 50rem) {
	.recap-grid {
		grid-template-columns: 1fr;
	}

	.tutorial-footer,
	.tutorial-complete {
		align-items: flex-start;
		flex-direction: column;
	}
}

@media (max-width: 600px) {
	.header-content {
		min-height: auto;
		align-items: flex-start;
		flex-direction: column;
		padding-block: 0.9rem;
	}

	nav {
		gap: 0.5rem 1rem;
	}

	main,
	.tutorial-page {
		padding-top: 2.8rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}
