@property --inkmix {
	syntax: "<number>";
	inherits: true;
	initial-value: 0;
}

:root {
	--washi: #f2eee6;
	--twilight: #3e5560;
	--sumi: #1a1a18;
	--mist: #bdb6a8;
	--pine: #4a4a3f;
	--firefly: #d8e37a;
	--hanko: #c23b22;
	--river: #0f1619;
	--moon: #dcd6c6;
	--mincho: "Shippori Mincho", "Hiragino Mincho ProN", serif;
	--gothic: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif;
	--night: 0;
	--still: 0;
	--inkmix: 0;
	--ink: color-mix(in oklab, var(--sumi), var(--moon) calc(var(--inkmix) * 100%));
	--quiet: color-mix(in oklab, #8a8476, #9aa7a3 calc(var(--inkmix) * 100%));
	--chrome-font: var(--gothic);
	--chrome-fg: var(--ink);
	--chrome-bg: color-mix(in oklab, rgba(242, 238, 230, 0.7), rgba(15, 22, 25, 0.7) calc(var(--inkmix) * 100%));
	--chrome-line: color-mix(in oklab, rgba(26, 26, 24, 0.25), rgba(220, 214, 198, 0.25) calc(var(--inkmix) * 100%));
	transition: --inkmix 1.4s ease;
}

/* Text flips once at dusk instead of passing through grey on grey. */
:root.is-night {
	--inkmix: 1;
}

html {
	background: color-mix(
		in oklab,
		color-mix(in oklab, var(--washi), var(--twilight) calc(min(1, var(--night) * 1.8) * 100%)),
		var(--river) calc(max(0, var(--night) * 1.8 - 0.8) * 100%)
	);
	color: var(--ink);
}

body {
	font-family: var(--gothic);
	font-weight: 400;
	font-size: 15px;
	line-height: 1.9;
	letter-spacing: 0.02em;
}

::selection {
	background: rgba(216, 227, 122, 0.4);
}

/* Kozo fibres: long soft strands over a faint cloud, multiplied into the paper by day. */
.washi {
	position: fixed;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	background:
		url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='480' height='480'><filter id='f' x='0' y='0' width='100%25' height='100%25'><feTurbulence type='fractalNoise' baseFrequency='.0125 .05' numOctaves='3' seed='11' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .55  0 0 0 0 .52  0 0 0 0 .45  0 0 0 -1.2 .74'/></filter><rect width='100%' height='100%' filter='url(%23f)'/></svg>"),
		url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='700' height='700'><filter id='c' x='0' y='0' width='100%25' height='100%25'><feTurbulence type='fractalNoise' baseFrequency='.0043' numOctaves='4' seed='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .6  0 0 0 0 .57  0 0 0 0 .5  0 0 0 .35 -.05'/></filter><rect width='100%' height='100%' filter='url(%23c)'/></svg>");
	mix-blend-mode: multiply;
	opacity: calc(0.6 - var(--night) * 0.48);
}

.room-world {
	z-index: 0;
}

.flies {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	z-index: 3;
	pointer-events: none;
	mix-blend-mode: screen;
}

/* Two banks of mist drifting at different speeds. */
.mist {
	position: fixed;
	inset: -10vh -20vw;
	z-index: 1;
	pointer-events: none;
	opacity: calc(0.62 - var(--night) * 0.58);
}

.mist i {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: calc(100% + 1200px);
	background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1200' height='800'><filter id='m' x='0' y='0' width='100%25' height='100%25'><feTurbulence type='fractalNoise' baseFrequency='.0016 .004' numOctaves='4' seed='21' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .95  0 0 0 0 .94  0 0 0 0 .91  0 0 0 2.4 -1.25'/></filter><rect width='100%' height='100%' filter='url(%23m)'/></svg>") 0 0 / 1200px 800px;
	will-change: transform;
	animation: mist-drift 90s linear infinite;
}

.mist i + i {
	width: calc(100% + 1700px);
	background-size: 1700px 1100px;
	opacity: 0.7;
	animation: mist-drift-wide 140s linear infinite reverse;
}

.lite .mist i + i {
	display: none;
}

.lite .mist i {
	animation: none;
}

@media (prefers-reduced-motion: reduce) {
	.mist i,
	.mist i + i {
		animation: none;
	}
}

@keyframes mist-drift {
	to {
		transform: translateX(-1200px);
	}
}

@keyframes mist-drift-wide {
	to {
		transform: translateX(-1700px);
	}
}

.room-main {
	z-index: 2;
}

section {
	position: relative;
}

.eyebrow {
	margin: 0 0 2rem;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.24em;
	text-transform: uppercase;
	color: var(--quiet);
}

/* Arrival: almost nothing, placed low and to the left. */
.arrival {
	height: 135vh;
}

.glyph {
	position: absolute;
	top: 6vh;
	right: 9vw;
	margin: 0;
	font-family: var(--mincho);
	font-weight: 400;
	font-size: min(68vh, 44vw);
	line-height: 1;
	color: var(--mist);
	opacity: 0.32;
	writing-mode: vertical-rl;
	user-select: none;
}

.glyph:not(.in) {
	opacity: 0;
	transform: none;
	filter: blur(18px);
}

.arrival-text {
	position: absolute;
	left: 9vw;
	top: 54vh;
	max-width: 40rem;
}

.arrival h1 {
	margin: 0;
	font-family: var(--mincho);
	font-weight: 500;
	font-size: clamp(64px, 9vw, 168px);
	line-height: 1;
	letter-spacing: -0.01em;
}

.hint {
	position: absolute;
	left: 9vw;
	bottom: 38vh;
	margin: 0;
	font-size: 12px;
	letter-spacing: 0.12em;
	color: var(--quiet);
}

/* The screen: start inside one pine, pull back to the whole screen. */
.screen {
	height: 380vh;
}

.screen-stage {
	position: sticky;
	top: 0;
	height: 100vh;
	overflow: hidden;
	display: grid;
	place-items: center;
}

.screen-figure {
	margin: 0;
	width: min(92vw, 190vh);
	transform-origin: 38% 40%;
	will-change: transform;
}

.screen-figure img {
	width: 100%;
	height: auto;
	mix-blend-mode: multiply;
	filter: contrast(1.04) saturate(0.85);
}

.screen-caption {
	position: absolute;
	left: 9vw;
	bottom: 6vh;
	margin: 0;
	font-family: var(--mincho);
	font-size: 14px;
	color: var(--pine);
	opacity: var(--cap, 0);
}

.garden {
	min-height: 200vh;
	padding-top: 30vh;
}

.still {
	margin: 0;
}

.still img {
	width: 100%;
	height: auto;
	filter: saturate(0.55) contrast(0.95);
}

.still figcaption,
.print figcaption {
	margin-top: 1rem;
	font-family: var(--mincho);
	font-size: 15px;
	line-height: 1.6;
	display: grid;
	gap: 0.3rem;
}

.still small {
	font-family: var(--gothic);
	font-size: 11px;
	color: var(--quiet);
}

.s1 {
	width: min(30vw, 460px);
	margin-left: 12vw;
}

.s2 {
	width: min(22vw, 340px);
	margin: 34vh 0 0 62vw;
}

.evening {
	min-height: 170vh;
	padding-top: 25vh;
	display: grid;
	justify-items: center;
	align-content: start;
	gap: 22vh;
}

.print {
	margin: 0;
	width: min(60vw, 920px);
}

.print img {
	width: 100%;
	height: auto;
	box-shadow: 0 0 0 1px rgba(220, 214, 198, 0.08), 0 40px 120px rgba(0, 0, 0, 0.5);
}

.print:not(.in) {
	filter: brightness(0.15);
}

.print figcaption {
	color: var(--quiet);
	font-size: 13px;
}

.dusk-line {
	margin: 0;
	font-family: var(--mincho);
	font-size: clamp(20px, 1.8vw, 30px);
}

.still-point {
	height: 160vh;
	display: grid;
	align-content: center;
	justify-items: center;
	text-align: center;
	gap: 1.5rem;
}

.stay {
	margin: 0;
	font-family: var(--mincho);
	font-weight: 500;
	font-size: clamp(56px, 8vw, 150px);
	line-height: 1;
	opacity: calc(0.35 + var(--still) * 0.65);
}

.coherence {
	margin: 2rem 0 0;
	font-size: 11px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--quiet);
	font-variant-numeric: tabular-nums;
}

.colophon {
	min-height: 120vh;
	padding: 20vh 9vw 10vh;
}

.colophon > div {
	max-width: 44rem;
}

.credits {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 12px;
	line-height: 1.8;
	color: var(--quiet);
}

.credits a {
	color: var(--ink);
}

.nav {
	margin-top: 5rem;
	padding-top: 1.5rem;
	border-top: 1px solid color-mix(in oklab, transparent, var(--quiet) 40%);
	font-size: 14px;
}

/* The seal. Hidden until the fireflies first agree, then pressed once and left there. */
.hanko {
	position: fixed;
	left: 6vw;
	bottom: 9vh;
	z-index: 40;
	display: flex;
	align-items: flex-end;
	gap: 1.2rem;
	pointer-events: none;
	opacity: 0;
	transform: scale(1.5) rotate(-3deg);
	transform-origin: 46px 46px;
}

.hanko svg {
	width: 92px;
	height: 92px;
	flex: none;
}

.hanko .seal {
	fill: var(--hanko);
}

.hanko text {
	font-family: var(--mincho);
	font-weight: 800;
	font-size: 62px;
	fill: #000;
}

.hanko-note {
	margin: 0;
	font-size: 11px;
	line-height: 1.7;
	letter-spacing: 0.1em;
	color: var(--quiet);
	opacity: 0;
	transition: opacity 1.6s 0.8s;
}

.hanko.stamped {
	opacity: 0.94;
	transform: scale(1) rotate(-3deg);
	transition: transform 0.22s cubic-bezier(0.5, 0, 0.9, 0.6), opacity 0.12s;
}

.hanko.stamped .hanko-note {
	opacity: 1;
}

@media (max-width: 900px) {
	.s1,
	.s2 {
		width: 70vw;
		margin-left: 12vw;
	}
	.print {
		width: 88vw;
	}
}
