/* Porch Labs: a day on the porch, told as a graphic novel.
   Fonts: Shantell Sans (lettering) and Bangers (sound effects), both SIL OFL; see assets/fonts. */
@font-face {
	font-family: "Shantell Sans";
	src: url("assets/fonts/shantellsans-latin.woff2") format("woff2");
	font-weight: 300 800;
	font-display: swap;
}
@font-face {
	font-family: "Shantell Sans";
	src: url("assets/fonts/shantellsans-italic-latin.woff2") format("woff2");
	font-weight: 300 800;
	font-style: italic;
	font-display: swap;
}
@font-face {
	font-family: "Bangers";
	src: url("assets/fonts/bangers-latin.woff2") format("woff2");
	font-weight: 400;
	font-display: swap;
}

:root {
	--ink: #1d1b16;
	--paper: #fbf4e4;
	--cream: #f7efdc;
	--yellow: #ffd84d;
	--clay: #c8623a;
	--clay-dark: #9d4524;
	--moss: #5b7a3a;
	--night-ink: #f4ecd6;
	--line: 4px;
	--shadow: 6px 6px 0 var(--ink);
	--day: 1;
	--night: 0;
}
:root[data-time="night"] {
	--day: 0;
	--night: 1;
}

* {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	color: var(--ink);
	font-family: "Shantell Sans", "Comic Sans MS", system-ui, sans-serif;
	font-size: 1.1rem;
	line-height: 1.55;
	font-variation-settings: "INFM" 20;
	/* A day passing as you scroll: afternoon, golden hour, late day, dusk, night. */
	background-color: #10142b;
	background-image:
		radial-gradient(rgba(29, 27, 22, 0.07) 1px, transparent 1.3px),
		linear-gradient(180deg, #f7efdc 0%, #f7efdc 20%, #f4ddb0 34%, #efc79c 50%, #c99690 62%, #7a5a7a 72%, #2f2f57 81%, #161b38 88%, #10142b 100%);
	background-size: 10px 10px, 100% 100%;
}

strong {
	font-weight: 750;
}

a {
	color: inherit;
}

.skip-link {
	position: absolute;
	left: -999px;
}
.skip-link:focus {
	left: 16px;
	top: 16px;
	z-index: 30;
	background: var(--yellow);
	padding: 8px 12px;
	border: var(--line) solid var(--ink);
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

:focus-visible {
	outline: 4px dashed var(--clay);
	outline-offset: 4px;
}

/* ---------- Masthead ---------- */

.masthead {
	display: flex;
	align-items: center;
	gap: 14px 20px;
	flex-wrap: wrap;
	max-width: 1200px;
	margin: 0 auto;
	padding: 16px;
}
.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--ink);
	cursor: pointer;
	font: inherit;
}
.brand-mark {
	width: 56px;
	height: 56px;
	transform-origin: 50% 85%;
	transition: transform 0.2s ease;
}
.brand:hover .brand-mark {
	transform: rotate(-4deg) scale(1.05);
}
.brand-name {
	font-size: 1.7rem;
	font-weight: 800;
	font-variation-settings: "INFM" 70;
	letter-spacing: -0.01em;
}
.nav {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 18px;
	margin-left: auto;
	font-weight: 650;
}
.nav a {
	text-decoration: none;
	border-bottom: 3px solid transparent;
}
.nav a:hover {
	border-bottom-color: var(--clay);
}
.time-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 14px;
	border: 3px solid var(--ink);
	border-radius: 999px;
	background: var(--paper);
	box-shadow: 3px 3px 0 var(--ink);
	color: var(--ink);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}
.time-toggle-icon {
	width: 18px;
	height: 18px;
	border: 3px solid var(--ink);
	border-radius: 50%;
	background: #2a3566;
	box-shadow: inset -5px -3px 0 #f4ecc8;
}
:root[data-time="night"] .time-toggle-icon {
	background: #ffcf4a;
	box-shadow: none;
}

/* ---------- Panels, captions, buttons ---------- */

.panel {
	position: relative;
	background: var(--paper);
	border: var(--line) solid var(--ink);
	border-radius: 4px;
	box-shadow: var(--shadow);
	padding: 20px;
}
.panel.dotted {
	background-color: #fff3cf;
	background-image: radial-gradient(rgba(200, 98, 58, 0.2) 1.5px, transparent 2px);
	background-size: 9px 9px;
}
.tilt-left {
	transform: rotate(-0.7deg);
}
.tilt-right {
	transform: rotate(0.8deg);
}

.caption {
	display: inline-block;
	margin: 0;
	background: var(--yellow);
	border: 3px solid var(--ink);
	padding: 3px 12px 4px;
	font-size: 0.95rem;
	font-weight: 750;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-variation-settings: "INFM" 60;
	box-shadow: 3px 3px 0 var(--ink);
}

.btn {
	display: inline-block;
	padding: 10px 18px;
	border: 3px solid var(--ink);
	border-radius: 10px;
	background: var(--paper);
	box-shadow: 4px 4px 0 var(--ink);
	color: var(--ink);
	font-size: 1.1rem;
	font-weight: 750;
	font-variation-settings: "INFM" 60;
	text-decoration: none;
	transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover {
	transform: translate(-2px, -2px) rotate(-1deg);
	box-shadow: 6px 6px 0 var(--ink);
}
.btn:active {
	transform: translate(3px, 3px);
	box-shadow: 1px 1px 0 var(--ink);
}
.btn-primary {
	background: var(--clay);
	color: #fffaf0;
}

.sfx,
.pop-word {
	font-family: "Bangers", Impact, "Arial Black", sans-serif;
	letter-spacing: 0.05em;
	color: var(--yellow);
	-webkit-text-stroke: 1.5px var(--ink);
	text-shadow: 3px 3px 0 var(--ink);
	white-space: nowrap;
	pointer-events: none;
}

/* ---------- Hero: the porch ---------- */

.hero {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 16px;
	display: grid;
	gap: 18px;
}
.hero > * {
	min-width: 0;
}
.scene-panel {
	padding: 0;
	overflow: hidden;
	aspect-ratio: 16 / 9;
	min-height: 420px;
	touch-action: pan-y;
	background: #2b3a4a;
}
.stage {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
}
.plate {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
}
.plate-night,
.night-layer {
	opacity: var(--night);
	transition: opacity 1.2s ease;
}
.plate-layer {
	position: absolute;
	display: block;
}
.layer-chair { left: 78.516%; top: 42.969%; width: 21.484%; height: 54.688%; }
.layer-lantern { left: 81.38%; top: 0; width: 6.51%; height: 28.32%; }
.stage.gl-ready .plate-layer {
	visibility: hidden;
}
.scene-gl {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: none;
}
.stage.gl-ready .scene-gl {
	display: block;
}
.stage.gl-ready .plate {
	visibility: hidden;
}
.critters {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}
.hotspot {
	position: absolute;
	border: 0;
	padding: 0;
	background: transparent;
	cursor: pointer;
}
.hotspot:focus {
	outline: none;
}
.hotspot:focus-visible {
	outline: 3px dashed rgba(255, 216, 77, 0.9);
	outline-offset: 2px;
}
.porch-light {
	left: 81.2%;
	top: 0;
	width: 6.6%;
	height: 28.4%;
}
.rocking-chair {
	left: 79.5%;
	top: 44%;
	width: 20.5%;
	height: 52%;
}
/* Without WebGL, hovering the lantern brightens the art a touch instead. */
.stage:not(.gl-ready):has(.porch-light:hover) .plate {
	filter: brightness(1.06);
	transition: filter 0.5s ease;
}

/* On wide screens the titles ride on the painting; on phones they sit above it. */
.hero-scene {
	position: relative;
	min-width: 0;
}
.hero-titles {
	position: absolute;
	z-index: 2;
	top: 18px;
	left: 18px;
	display: grid;
	justify-items: start;
	gap: 12px;
	max-width: min(560px, calc(100% - 36px));
	pointer-events: none;
}
.hero-titles > * {
	pointer-events: auto;
}
.title-box {
	max-width: 100%;
	background: var(--paper);
	border: var(--line) solid var(--ink);
	box-shadow: var(--shadow);
	padding: 10px 20px 12px;
	transform: rotate(-1.2deg);
}
.title-box h1 {
	margin: 0;
	font-size: clamp(1.9rem, 4.6vw, 3.4rem);
	line-height: 1;
	font-weight: 800;
	font-variation-settings: "INFM" 70;
	letter-spacing: 0.01em;
	text-transform: uppercase;
	color: var(--clay);
	text-shadow: 2px 2px 0 rgba(29, 27, 22, 0.18);
}
.sfx-hint {
	position: absolute;
	right: 10%;
	top: 31%;
	font-size: 1.35rem;
	transform: rotate(7deg);
	animation: bob 3s ease-in-out infinite;
	transition: opacity 0.4s ease;
}
.sfx-hint.is-hidden {
	opacity: 0;
}

.caption-strip {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px 24px;
	transform: rotate(0.3deg);
}
.caption-strip p {
	flex: 1 1 320px;
	min-width: 0;
	margin: 0;
	font-size: 1.15rem;
}
.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

/* ---------- Chapters ---------- */

.chapter {
	max-width: 1200px;
	margin: 88px auto 0;
	padding: 0 16px;
}
.chapter-head {
	display: grid;
	justify-items: start;
	gap: 6px;
	margin-bottom: 20px;
}
.chapter-number {
	margin: 0;
	font-weight: 750;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	font-size: 0.9rem;
	color: var(--clay-dark);
}
.chapter-title {
	margin: 0;
	font-size: clamp(2.2rem, 6vw, 3.6rem);
	line-height: 1;
	font-weight: 800;
	font-variation-settings: "INFM" 100;
	letter-spacing: -0.02em;
}
.chapter-dusk .chapter-number,
.chapter-night .chapter-number {
	color: #ffc98f;
}
.chapter-dusk .chapter-title,
.chapter-night .chapter-title {
	color: var(--night-ink);
	text-shadow: 3px 3px 0 var(--ink);
}

.art-panel {
	padding: 0;
	overflow: hidden;
}
.art-frame {
	position: relative;
	line-height: 0;
}
.art-frame img {
	display: block;
	width: 100%;
	height: auto;
}
.ambience {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

/* The bench */
.bench-spot {
	position: absolute;
	padding: 0;
	border: 0;
	border-radius: 18px;
	background: transparent;
	cursor: pointer;
	transition: background-color 0.4s ease, box-shadow 0.4s ease;
}
.bench-spot::before {
	content: "";
	position: absolute;
	inset: -6%;
	border-radius: 50%;
	background: radial-gradient(closest-side, rgba(255, 214, 130, 0.45), rgba(255, 214, 130, 0));
	opacity: 0;
	transition: opacity 0.5s ease;
	mix-blend-mode: screen;
}
.bench-spot:hover::before,
.bench-spot:focus-visible::before,
.bench-spot[aria-expanded="true"]::before {
	opacity: 1;
}
.bench-spot > span:first-child {
	position: absolute;
	left: 50%;
	top: -14px;
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	transform: translateX(-50%) rotate(-4deg);
	border: 3px solid var(--ink);
	border-radius: 50%;
	background: var(--yellow);
	box-shadow: 3px 3px 0 var(--ink);
	color: var(--ink);
	font: 800 1.1rem/1 "Shantell Sans", sans-serif;
	line-height: 1;
	animation: nudge 3.2s ease-in-out infinite;
}
.bench-spot:nth-of-type(2) > span:first-child { animation-delay: 0.4s; }
.bench-spot:nth-of-type(3) > span:first-child { animation-delay: 0.8s; }
.bench-spot:nth-of-type(4) > span:first-child { animation-delay: 1.2s; }
.bench-spot[aria-expanded="true"] > span:first-child {
	background: var(--clay);
	color: #fffaf0;
	animation: none;
}
.bench-spot[data-note="family"] { left: 1%; top: 46%; width: 25.5%; height: 26%; }
.bench-spot[data-note="meals"] { left: 28.5%; top: 53%; width: 20.5%; height: 22%; }
.bench-spot[data-note="omarchy"] { left: 46.5%; top: 45%; width: 28%; height: 26%; }
.bench-spot[data-note="land"] { left: 75%; top: 47%; width: 24%; height: 27%; }

.bench-note {
	z-index: 1;
	position: absolute;
	left: 18px;
	top: 18px;
	width: min(340px, 33%);
	padding: 14px 16px 16px;
	background: var(--paper);
	border: var(--line) solid var(--ink);
	box-shadow: var(--shadow);
	line-height: 1.45;
	transform: rotate(0.8deg);
}
.bench-note .caption {
	margin-bottom: 8px;
}
.bench-note-title {
	margin: 4px 0 4px;
	font-size: 1.45rem;
	font-weight: 800;
	font-variation-settings: "INFM" 90;
	line-height: 1.1;
}
.bench-note-body {
	margin: 0;
}
.bench-note.is-fresh {
	animation: pop-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.experiment-kinds {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 20px;
	margin: 28px 0 0;
	padding: 0;
	list-style: none;
}
.experiment-kinds p {
	margin: 10px 0 0;
}
.experiment-kinds .caption {
	margin: 0;
}

/* What we care about: captions ride on each panel of the page */
.value-captions {
	margin: 0;
	padding: 0;
	list-style: none;
}
.value {
	position: absolute;
	max-width: 40%;
	padding: 8px 12px 10px;
	background: var(--paper);
	border: 3px solid var(--ink);
	box-shadow: 4px 4px 0 var(--ink);
	font-size: 0.98rem;
	line-height: 1.4;
}
.value strong {
	display: block;
	font-size: 1.35rem;
	font-weight: 800;
	font-variation-settings: "INFM" 100;
	color: var(--clay-dark);
	line-height: 1.1;
}
.value-1 { left: 3%; top: 4%; transform: rotate(-1deg); }
.value-2 { left: 54%; top: 4%; transform: rotate(0.8deg); }
.value-3 { left: 3%; top: 53%; transform: rotate(0.6deg); }
.value-4 { left: 54%; bottom: 5%; transform: rotate(-0.8deg); }

/* The ball flies in front of the caption boxes, breaking the frame like a comic would. */
#catch-canvas {
	z-index: 2;
}
.catch-button {
	z-index: 3;
	position: absolute;
	left: 1.1%;
	top: 1.1%;
	width: 48%;
	height: 47.2%;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}
.catch-button:focus {
	outline: none;
}
.catch-button:focus-visible {
	outline: 3px dashed var(--clay);
	outline-offset: -6px;
}

/* How things grow: one caption per tall panel */
.growth-captions {
	position: absolute;
	left: 1.5%;
	right: 1.5%;
	bottom: 3.5%;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 3.2%;
	margin: 0;
	padding: 0;
	list-style: none;
}
.growth-captions li {
	padding: 8px 10px 10px;
	background: var(--paper);
	border: 3px solid var(--ink);
	box-shadow: 4px 4px 0 var(--ink);
	font-size: 0.95rem;
	line-height: 1.35;
}
.growth-captions li:nth-child(odd) { transform: rotate(-0.8deg); }
.growth-captions li:nth-child(even) { transform: rotate(0.7deg); }
.step {
	display: inline-grid;
	place-items: center;
	width: 28px;
	height: 28px;
	margin-right: 4px;
	border: 2px solid var(--ink);
	border-radius: 50%;
	background: var(--yellow);
	font-weight: 800;
	font-size: 0.95rem;
	vertical-align: middle;
}

/* Pull up a chair */
.contact-scene .bubble {
	position: absolute;
	left: 4%;
	top: 10%;
	max-width: 44%;
	padding: 22px 26px 20px;
	background: var(--paper);
	border: var(--line) solid var(--ink);
	border-radius: 36px;
	box-shadow: var(--shadow);
	text-align: center;
}
.contact-scene .bubble::after {
	content: "";
	position: absolute;
	right: -34px;
	bottom: 26%;
	border: 18px solid transparent;
	border-left: 30px solid var(--ink);
	border-right: 0;
}
.bubble-text {
	margin: 0 0 6px;
	font-size: clamp(1.3rem, 2.6vw, 2rem);
	font-weight: 800;
	font-variation-settings: "INFM" 100;
	line-height: 1.12;
}
.bubble-small {
	margin: 0 0 14px;
}
.bubble-sign {
	margin: 12px 0 0;
	font-style: italic;
	font-weight: 600;
}

.footer {
	max-width: 1200px;
	margin: 64px auto 0;
	padding: 20px 16px 48px;
	color: var(--night-ink);
	text-align: center;
}
.footer p {
	margin: 4px 0;
}
.footer-small {
	font-size: 0.9rem;
	opacity: 0.75;
}

/* ---------- Logo toy ---------- */

.boom-bit {
	position: fixed;
	z-index: 20;
	width: 14px;
	height: 14px;
	border: 2px solid var(--ink);
	border-radius: 50%;
	pointer-events: none;
}
.pop-word {
	position: fixed;
	z-index: 21;
	font-size: 1.8rem;
}

@keyframes bob {
	50% { transform: rotate(5deg) translateY(-6px); }
}
@keyframes nudge {
	0%, 80%, 100% { transform: translateX(-50%) rotate(-4deg) scale(1); }
	88% { transform: translateX(-50%) rotate(6deg) scale(1.12); }
	94% { transform: translateX(-50%) rotate(-2deg) scale(1.02); }
}
@keyframes pop-in {
	from { transform: rotate(0.8deg) scale(0.9); opacity: 0.4; }
	to { transform: rotate(0.8deg) scale(1); opacity: 1; }
}

/* ---------- Small screens: captions stack under the art ---------- */

@media (max-width: 760px) {
	.scene-panel {
		aspect-ratio: 3 / 2;
		min-height: 0;
	}
	.hero-titles {
		position: static;
		max-width: none;
		margin-bottom: 16px;
		gap: 10px;
	}
	.title-box {
		padding: 8px 14px 10px;
	}
	.sfx-hint {
		right: 3%;
		top: 30%;
		font-size: 0.95rem;
	}
	.nav {
		margin-left: 0;
		order: 3;
		width: 100%;
	}
	.bench-note,
	.contact-scene .bubble {
		position: static;
		width: auto;
		max-width: none;
		margin: 14px;
		transform: none;
	}
	.contact-scene .bubble::after {
		display: none;
	}
	.value,
	.growth-captions {
		position: static;
		max-width: none;
		transform: none;
	}
	.value-captions {
		display: grid;
		gap: 12px;
		padding: 14px;
	}
	.value {
		transform: none !important;
	}
	.growth-captions {
		grid-template-columns: 1fr;
		gap: 10px;
		padding: 14px;
	}
	.growth-captions li {
		transform: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation: none !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ---------- Panels settle in as you read (only when JS is running) ---------- */

.reveal-ready .chapter-head,
.reveal-ready .chapter .panel {
	opacity: 0;
}
.reveal-ready .chapter-head.in-view,
.reveal-ready .chapter .panel.in-view {
	opacity: 1;
	animation: panel-in 0.7s cubic-bezier(0.2, 0.8, 0.25, 1.15) both;
}
.reveal-ready .experiment-kinds .panel.in-view:nth-child(2) { animation-delay: 0.08s; }
.reveal-ready .experiment-kinds .panel.in-view:nth-child(3) { animation-delay: 0.16s; }
@keyframes panel-in {
	from {
		opacity: 0;
		translate: 0 28px;
		rotate: -1.2deg;
	}
	to {
		opacity: 1;
		translate: 0 0;
		rotate: 0deg;
	}
}

@media print {
	.reveal-ready .chapter-head,
	.reveal-ready .chapter .panel {
		opacity: 1 !important;
		animation: none !important;
	}
}
