/* Steady Rule. The page is a day: it opens on paper in the morning and ends in ink at night. */

:root {
	--paper: #f7f0e0;
	--day: #f1ddb6;
	--ink: #121221;
	--ember: #f2662e;
	--amber: #fab84d;
	--cream: #f7f0e0;
	--muted: rgba(18, 18, 33, 0.62);
	--hair: rgba(18, 18, 33, 0.18);
	--serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
	--sans: "Avenir Next", Avenir, "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
	--gutter: clamp(20px, 5vw, 72px);
	--measure: 1180px;
}

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--serif);
	font-size: clamp(18px, 1.25vw + 13px, 21px);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* A little grain, so the sheet is paper and not a screen. */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 10;
	opacity: 0.05;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
	mix-blend-mode: multiply;
}

h1,
h2,
h3,
p,
ol,
dl,
dd,
figure,
blockquote {
	margin: 0;
}

ol {
	padding: 0;
	list-style: none;
}

a {
	color: inherit;
	text-underline-offset: 0.2em;
	text-decoration-thickness: 1px;
}

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

.label {
	font-family: var(--sans);
	font-size: 0.66rem;
	font-weight: 600;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	font-style: normal;
}

/* ── Top bar ─────────────────────────────────────────── */

.bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 22px var(--gutter);
	max-width: calc(var(--measure) + 2 * var(--gutter));
	margin: 0 auto;
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 1.25rem;
	font-weight: 500;
	letter-spacing: -0.01em;
	text-decoration: none;
}

.brand-mark {
	width: 30px;
	height: 30px;
}

.bar-note {
	color: var(--muted);
}

/* ── Morning ─────────────────────────────────────────── */

.hero {
	position: relative;
	max-width: calc(var(--measure) + 2 * var(--gutter));
	margin: 0 auto;
	padding: clamp(36px, 7vw, 96px) var(--gutter) clamp(72px, 10vw, 150px);
	overflow: clip;
}

.hero-words {
	position: relative;
	max-width: 660px;
	z-index: 1;
}

.hero-words > .label {
	color: var(--muted);
}

h1 {
	margin-top: 18px;
	font-size: clamp(2.9rem, 8.2vw, 6.4rem);
	font-weight: 500;
	line-height: 0.98;
	letter-spacing: -0.035em;
	text-wrap: balance;
}

h1 em {
	font-style: italic;
	color: var(--ember);
}

.lede {
	margin-top: 28px;
	max-width: 30ch;
	font-size: 1.32em;
	line-height: 1.32;
	text-wrap: balance;
}

/* The Measured Horizon: the sun comes up to a ruled line that crosses the whole sheet. */
.horizon {
	position: absolute;
	right: calc(var(--gutter) * -0.4);
	top: 50%;
	width: min(46vw, 560px);
	aspect-ratio: 1;
	translate: 0 -50%;
}

.sun,
.ring {
	position: absolute;
	border-radius: 50%;
}

.sun {
	inset: 15%;
	background: var(--ember);
	box-shadow: 0 0 140px 40px rgba(250, 184, 77, 0.35);
	animation: rise 1.9s cubic-bezier(0.16, 0.8, 0.2, 1) both;
}

.ring {
	inset: 1%;
	border: 1px solid var(--hair);
	animation: appear 1.6s 0.5s both;
}

.horizon .line {
	position: absolute;
	top: 50%;
	left: -7%;
	right: -100vw;
	height: 3px;
	translate: 0 -50%;
	background: var(--ink);
	transform-origin: 0 50%;
	animation: draw 1.4s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes rise {
	from {
		translate: 0 34%;
		opacity: 0;
	}
}

@keyframes appear {
	from {
		opacity: 0;
		scale: 0.94;
	}
}

@keyframes draw {
	from {
		scale: 0 1;
	}
}

.hero-words > * {
	animation: settle 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-words > :nth-child(2) {
	animation-delay: 0.12s;
}

.hero-words > :nth-child(3) {
	animation-delay: 0.24s;
}

.hero-words > :nth-child(4) {
	animation-delay: 0.36s;
}

@keyframes settle {
	from {
		opacity: 0;
		translate: 0 14px;
	}
}

/* ── The waiting list ────────────────────────────────── */

.join {
	margin-top: 40px;
	max-width: 560px;
}

.join > .label {
	display: block;
	margin-bottom: 10px;
}

.join-row {
	display: flex;
	border: 1.5px solid currentColor;
	background: rgba(255, 255, 255, 0.35);
}

.join input[type="email"] {
	flex: 1;
	min-width: 0;
	padding: 16px 18px;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 1rem;
}

.join input[type="email"]::placeholder {
	color: currentColor;
	opacity: 0.4;
}

.join input[type="email"]:focus {
	outline: none;
}

.join-row:focus-within {
	outline: 3px solid var(--ember);
	outline-offset: 2px;
}

.join button {
	padding: 16px 22px;
	border: 0;
	background: var(--ink);
	color: var(--cream);
	font-family: var(--sans);
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.2s;
	white-space: nowrap;
}

.join button:hover,
.join button:focus-visible {
	background: var(--ember);
}

.join button:disabled {
	opacity: 0.6;
	cursor: progress;
}

.trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.join-note {
	margin-top: 12px;
	font-size: 0.82em;
	color: var(--muted);
	max-width: 46ch;
}

.join[data-state="done"] .join-row {
	display: none;
}

.join[data-state="done"] .join-note {
	font-size: 1.15em;
	color: inherit;
}

.join[data-state="error"] .join-note {
	color: #a8321a;
}

/* ── A ruled line between the parts of the day ───────── */

.rule {
	height: 14px;
	margin: 0 var(--gutter);
	background-image:
		linear-gradient(to right, var(--ink) 1.5px, transparent 1.5px),
		linear-gradient(to right, var(--hair) 1px, transparent 1px);
	background-size:
		120px 14px,
		24px 7px;
	background-repeat: repeat-x;
	background-position:
		left bottom,
		left bottom;
	border-bottom: 1.5px solid var(--ink);
}

/* ── Sections ────────────────────────────────────────── */

section:not(.hero):not(.night) {
	max-width: calc(var(--measure) + 2 * var(--gutter));
	margin: 0 auto;
	padding: clamp(64px, 9vw, 130px) var(--gutter);
}

.section-head > .label {
	color: var(--ember);
}

h2 {
	margin-top: 14px;
	font-size: clamp(2rem, 4.6vw, 3.6rem);
	font-weight: 500;
	line-height: 1.05;
	letter-spacing: -0.025em;
	text-wrap: balance;
}

/* ── The three moments ───────────────────────────────── */

.moments {
	margin-top: clamp(40px, 6vw, 80px);
}

.moment {
	display: grid;
	grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1.05fr);
	gap: clamp(20px, 4vw, 64px);
	align-items: center;
	padding: clamp(28px, 4vw, 56px) 0;
	border-top: 1.5px solid var(--ink);
}

.moment:last-child {
	border-bottom: 1.5px solid var(--ink);
}

.moment-time {
	align-self: start;
	display: grid;
	gap: 6px;
}

.moment-time .label {
	color: var(--muted);
}

.hour {
	font-size: 2.1rem;
	line-height: 1;
	letter-spacing: -0.03em;
	font-variant-numeric: lining-nums tabular-nums;
}

.moment:nth-child(2) .hour {
	color: var(--ember);
}

h3 {
	font-size: clamp(1.6rem, 2.6vw, 2.2rem);
	font-weight: 500;
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.moment-words p {
	margin-top: 14px;
	max-width: 38ch;
	color: rgba(18, 18, 33, 0.82);
}

/* Etchings are black ink on white: printed onto the sheet, the white disappears. */
.etching {
	mix-blend-mode: multiply;
	width: 100%;
}

/* ── The practice, worked through ────────────────────── */

.section-lede {
	margin-top: 20px;
	max-width: 54ch;
	color: rgba(18, 18, 33, 0.82);
}

.sort-board {
	margin-top: clamp(32px, 5vw, 60px);
	border: 1.5px solid var(--ink);
	background: rgba(255, 255, 255, 0.28);
}

.worry {
	padding: clamp(22px, 3vw, 36px);
	border-bottom: 1.5px solid var(--ink);
	font-size: clamp(1.35rem, 2.6vw, 2rem);
	line-height: 1.2;
	letter-spacing: -0.015em;
	font-style: italic;
}

.worry .label {
	display: block;
	margin-bottom: 10px;
	color: var(--muted);
}

.lists {
	display: grid;
	grid-template-columns: 1fr 1fr;
}

.list {
	padding: clamp(22px, 3vw, 36px);
}

.list-not {
	border-left: 1.5px solid var(--ink);
	background: rgba(18, 18, 33, 0.05);
}

.list .label {
	color: var(--ember);
}

.list-not .label {
	color: var(--muted);
}

.list ul {
	margin: 16px 0 0;
	padding: 0;
	list-style: none;
}

.list li {
	padding: 13px 0;
	border-top: 1px solid var(--hair);
	font-size: 1.12em;
	line-height: 1.25;
}

.list-not li {
	color: var(--muted);
}

.sort-note {
	padding: 14px clamp(22px, 3vw, 36px);
	border-top: 1.5px solid var(--ink);
	font-size: 0.82em;
	color: var(--muted);
}

/* The items fall into their lists one after another, as if being sorted. */
.moves .sort-board .list li {
	opacity: 0;
	translate: 0 -14px;
}

.moves .sort-board.seen .list li {
	opacity: 1;
	translate: none;
	transition:
		opacity 0.5s ease,
		translate 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
	transition-delay: calc(0.5s + var(--i) * 0.42s);
}

/* ── Arriving on scroll ──────────────────────────────── */

.moves .arrives {
	opacity: 0;
	translate: 0 22px;
}

.moves .arrives.seen {
	opacity: 1;
	translate: none;
	transition:
		opacity 0.8s ease,
		translate 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.moves .moment.arrives .etching {
	scale: 1.04;
	transition: scale 1.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.moves .moment.arrives.seen .etching {
	scale: 1;
}

.moves .facts > .arrives:nth-child(2),
.moves .lesson-words > .arrives:nth-child(2) {
	transition-delay: 0.1s;
}

.moves .facts > .arrives:nth-child(3),
.moves .lesson-words > .arrives:nth-child(3) {
	transition-delay: 0.2s;
}

.moves .facts > .arrives:nth-child(4),
.moves .lesson-words > .arrives:nth-child(4) {
	transition-delay: 0.3s;
}

/* ── The lesson ──────────────────────────────────────── */

.lesson-grid {
	display: grid;
	grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
	gap: clamp(28px, 6vw, 96px);
	align-items: start;
	margin-top: clamp(36px, 5vw, 64px);
}

.film video {
	width: 100%;
	aspect-ratio: 9 / 16;
	background: var(--day);
	border: 1.5px solid var(--ink);
	border-radius: 170px 170px 0 0;
	object-fit: cover;
}

.film figcaption {
	margin-top: 12px;
	color: var(--muted);
}

.setup {
	font-size: clamp(1.7rem, 3.2vw, 2.6rem);
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.pages {
	display: grid;
	grid-template-columns: 1fr 1fr;
	margin-top: 26px;
	border: 1.5px solid var(--ink);
}

.page {
	padding: 22px 24px 26px;
}

.page p:last-child {
	margin-top: 12px;
	font-size: 1.15em;
	line-height: 1.3;
}

.page-fact .label {
	color: var(--muted);
}

.page-story {
	background: var(--ink);
	color: var(--cream);
}

.page-story .label {
	color: var(--ember);
}

.page-story p:last-child {
	font-style: italic;
	color: var(--amber);
}

.turn {
	margin-top: 26px;
	max-width: 44ch;
}

blockquote {
	margin-top: 34px;
	padding-left: 22px;
	border-left: 3px solid var(--ember);
}

blockquote p {
	font-size: clamp(1.4rem, 2.4vw, 1.9rem);
	line-height: 1.22;
	letter-spacing: -0.015em;
	max-width: 24ch;
	text-wrap: balance;
}

blockquote cite {
	display: block;
	margin-top: 12px;
	color: var(--muted);
}

.practice {
	margin-top: 34px;
	max-width: 46ch;
}

.practice .label {
	display: block;
	margin-bottom: 6px;
	color: var(--ember);
}

/* ── Plainly ─────────────────────────────────────────── */

.facts {
	display: grid;
	grid-template-columns: 1fr 1fr;
	margin-top: clamp(32px, 5vw, 60px);
	border-top: 1.5px solid var(--ink);
}

.facts > div {
	padding: 28px 0 30px;
	border-bottom: 1px solid var(--hair);
}

.facts > div:nth-child(odd) {
	padding-right: clamp(20px, 4vw, 56px);
	border-right: 1px solid var(--hair);
}

.facts > div:nth-child(even) {
	padding-left: clamp(20px, 4vw, 56px);
}

dt {
	font-size: 1.45em;
	line-height: 1.15;
	letter-spacing: -0.015em;
}

dd {
	margin-top: 10px;
	max-width: 40ch;
	color: rgba(18, 18, 33, 0.82);
}

/* ── Night ───────────────────────────────────────────── */

.night {
	position: relative;
	overflow: clip;
	background: var(--ink);
	color: var(--cream);
	padding: clamp(90px, 13vw, 190px) var(--gutter) clamp(80px, 11vw, 150px);
	text-align: center;
}

.night > * {
	position: relative;
}

.night .label {
	color: rgba(247, 240, 224, 0.6);
}

.ember {
	position: absolute;
	left: 50%;
	top: 0;
	width: min(900px, 130vw);
	aspect-ratio: 1;
	translate: -50% -58%;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(250, 184, 77, 0.9) 0, rgba(242, 102, 46, 0.55) 9%, rgba(242, 102, 46, 0.16) 30%, transparent 62%);
	animation: breathe 5s ease-in-out infinite;
}

@keyframes breathe {
	50% {
		opacity: 0.72;
		scale: 1.05;
	}
}

.mentor {
	max-width: 17ch;
	margin: 22px auto 0;
	font-size: clamp(2.1rem, 5.6vw, 4.4rem);
	line-height: 1.04;
	letter-spacing: -0.03em;
	text-wrap: balance;
}

/* The evening questions share one place and take turns. */
.mentor {
	display: grid;
	min-height: 3.2em;
	align-items: center;
}

.mentor span {
	grid-area: 1 / 1;
	opacity: 0;
	translate: 0 10px;
	transition:
		opacity 0.9s ease,
		translate 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.mentor span.on {
	opacity: 1;
	translate: none;
}

.mentor-note {
	max-width: 44ch;
	margin: 22px auto 0;
	font-size: 0.86em;
	color: rgba(247, 240, 224, 0.6);
}

.night .join {
	margin: 56px auto 0;
	text-align: left;
}

.night .join-row {
	background: rgba(247, 240, 224, 0.06);
}

.night .join button {
	background: var(--cream);
	color: var(--ink);
}

.night .join button:hover,
.night .join button:focus-visible {
	background: var(--ember);
	color: var(--cream);
}

.night .join-note {
	color: rgba(247, 240, 224, 0.6);
}

.night .join[data-state="done"] .join-note {
	color: var(--cream);
}

.night .join[data-state="error"] .join-note {
	color: var(--amber);
}

/* ── Foot ────────────────────────────────────────────── */

.foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 8px 24px;
	padding: 26px var(--gutter) 34px;
	background: var(--ink);
	color: rgba(247, 240, 224, 0.6);
	font-size: 0.8em;
	border-top: 1px solid rgba(247, 240, 224, 0.14);
}

/* ── After signing up, and after confirming ──────────── */

.after {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.after-main {
	flex: 1;
	width: 100%;
	max-width: 720px;
	margin: 0 auto;
	padding: clamp(20px, 5vw, 60px) var(--gutter) clamp(60px, 9vw, 110px);
}

.after-main > * {
	animation: settle 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.after-main > :nth-child(3) {
	animation-delay: 0.1s;
}

.after-main > :nth-child(n + 4) {
	animation-delay: 0.22s;
}

.after-mark {
	position: relative;
	width: 132px;
	aspect-ratio: 1;
	margin-bottom: 34px;
}

.after-mark .sun {
	inset: 15%;
	box-shadow: 0 0 60px 14px rgba(250, 184, 77, 0.35);
}

.after-mark .line {
	position: absolute;
	top: 50%;
	left: -8%;
	right: -8%;
	height: 3px;
	translate: 0 -50%;
	background: var(--ink);
	transform-origin: 0 50%;
	animation: draw 1.2s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.after-main > .label {
	color: var(--ember);
}

.after-main h1 {
	font-size: clamp(2.8rem, 9vw, 5rem);
}

.steps {
	margin-top: 36px;
	border-top: 1.5px solid var(--ink);
}

.steps li {
	display: grid;
	grid-template-columns: 34px 1fr;
	gap: 6px;
	padding: 20px 0;
	border-bottom: 1px solid var(--hair);
}

.steps .label {
	padding-top: 0.5em;
	color: var(--ember);
}

.after-watch {
	margin-top: 44px;
}

.after-watch > .label {
	color: var(--muted);
}

.after-watch .film {
	max-width: 320px;
	margin: 18px 0 0;
}

.after-lede {
	margin-top: 24px;
	max-width: 46ch;
	font-size: 1.12em;
}

.after-note {
	margin-top: 34px;
	color: var(--muted);
}

/* ── Privacy page ────────────────────────────────────── */

.prose {
	max-width: 68ch;
	margin: 0 auto;
	padding: clamp(40px, 7vw, 90px) var(--gutter) clamp(70px, 9vw, 120px);
}

.prose h1 {
	font-size: clamp(2.4rem, 6vw, 4rem);
}

.prose h2 {
	margin-top: 44px;
	font-size: 1.5em;
	letter-spacing: -0.015em;
}

.prose p,
.prose ul {
	margin-top: 14px;
}

.prose ul {
	padding-left: 1.1em;
}

/* ── Small screens ───────────────────────────────────── */

@media (max-width: 860px) {
	.bar-note {
		display: none;
	}

	.hero {
		padding-top: 12px;
	}

	.horizon {
		position: relative;
		right: auto;
		top: auto;
		translate: none;
		width: min(46vw, 200px);
		margin: 0 0 28px 6%;
	}

	.join-row {
		flex-direction: column;
	}

	.join input[type="email"] {
		border-bottom: 1.5px solid currentColor;
	}

	.moment {
		grid-template-columns: 1fr;
		gap: 16px;
	}

	.moment-time {
		grid-auto-flow: column;
		justify-content: space-between;
		align-items: baseline;
	}

	.hour {
		font-size: 1.5rem;
	}

	.lesson-grid {
		grid-template-columns: 1fr;
	}

	.film {
		max-width: 300px;
		margin: 0 auto;
	}

	.pages,
	.facts,
	.lists {
		grid-template-columns: 1fr;
	}

	.list-not {
		border-left: 0;
		border-top: 1.5px solid var(--ink);
	}

	.facts > div:nth-child(odd),
	.facts > div:nth-child(even) {
		padding-left: 0;
		padding-right: 0;
		border-right: 0;
	}
}

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

	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
	}
}
