body {
	margin: 0;
	font-family: Georgia, serif;
	background-color: #e3c08f;  /* fallback colour while the texture loads */
	background-image: url("sand_texture2.png");
	background-repeat: repeat;
}

.story {
	box-sizing: border-box;
	width: calc(100% - 32px);
	max-width: 1200px;  /* same text width as the original story.html */
	margin: 0 auto 80px;
	padding: clamp(24px, 5vw, 60px) 25px;
	font-size: 1.4rem;
	line-height: 1.7;
	color: #1c140d;
	border-radius: 6px;
	transition: background-color 0.3s, box-shadow 0.3s;
}

/* Optional stone tablet behind the text, toggled with the Stone tablet button */
.paper .story {
	position: relative;
	max-width: calc(1150px + 2 * clamp(44px, 7vw, 80px));  /* room for the runes, same text width as without the tablet */
	padding-left: clamp(44px, 7vw, 80px);
	padding-right: clamp(44px, 7vw, 80px);
	color: #241c15;
	background-color: #d8d1c4;
	background-image:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35  0 0 0 0 .3  0 0 0 0 .25  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url%28%23n%29'/%3E%3C/svg%3E"),
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='b'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3  0 0 0 0 .27  0 0 0 0 .22  0 0 0 .35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url%28%23b%29'/%3E%3C/svg%3E"),
		linear-gradient(160deg, rgba(255, 255, 255, 0.25), rgba(0, 0, 0, 0.08));
	border-radius: 4px;
	box-shadow:
		inset 2px 2px 3px rgba(255, 255, 255, 0.5),
		inset -3px -3px 6px rgba(0, 0, 0, 0.18),
		0 6px 24px rgba(0, 0, 0, 0.3);
}

/* Carved runes running down both edges of the tablet */
.paper .story::before,
.paper .story::after {
	content: "";
	position: absolute;
	top: clamp(24px, 5vw, 60px);
	bottom: clamp(24px, 5vw, 60px);
	width: 20px;
	background-repeat: repeat-y;
	pointer-events: none;
}

/* The rune images are generated by desert.js, with the odd story word spelled out */
.paper .story::before {
	left: clamp(12px, 2.5vw, 30px);
	background-image: var(--runes-left);
}

.paper .story::after {
	right: clamp(12px, 2.5vw, 30px);
	background-image: var(--runes-right);
}

.story p {
	margin: 0 0 1.4em;
	text-align: left;
}

.hero {
	text-align: center;
	padding: 80px 20px 40px;
}

.scene-break {
	text-align: center;
	margin: 3rem 0;
	font-size: 1.5rem;
	letter-spacing: .4rem;
}

#sand {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 5;
}

.ambience-controls {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 10;
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
}

.ambience-toggle {
	font: inherit;
	font-size: 1rem;
	color: #2b2118;
	background: rgba(250, 244, 232, 0.92);
	border: 1px solid rgba(43, 33, 24, 0.25);
	border-radius: 999px;
	padding: 10px 16px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
	cursor: pointer;
}

.ambience-toggle:hover {
	background: rgba(255, 250, 240, 1);
}

.ambience-toggle:focus-visible {
	outline: 2px solid #2b2118;
	outline-offset: 2px;
}

/* Keep the three buttons on one row on phones */
@media (max-width: 600px) {
	.ambience-controls {
		left: 8px;
		right: 8px;
		bottom: 8px;
		gap: 6px;
		flex-wrap: nowrap;
		justify-content: center;
	}

	.ambience-toggle {
		font-size: 0.8rem;
		padding: 7px 10px;
		white-space: nowrap;
	}
}
