/* The Hallowbane Codex
   A single-screen tome on a lectern in the Chapel of Dawn. Pages are laid out
   in em, and the script sets the book's font size from the page height, so
   every page keeps the same composition at every size. */

/* @fonts-start */
@font-face {
	font-family: "Cinzel";
	src: url("assets/fonts/Cinzel.woff2") format("woff2");
	font-weight: 400 900;
	font-display: swap;
}
@font-face {
	font-family: "Crimson Pro";
	src: url("assets/fonts/CrimsonPro.woff2") format("woff2");
	font-weight: 200 900;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Crimson Pro";
	src: url("assets/fonts/CrimsonPro-Italic.woff2") format("woff2");
	font-weight: 200 900;
	font-style: italic;
	font-display: swap;
}
/* @fonts-end */

:root {
	color-scheme: dark;
	--void: #0a0908;
	--leather: #2a1416;
	--leather-deep: #140909;
	--parchment: #e3d5b5;
	--parchment-light: #f0e6cc;
	--ink: #2a1a12;
	--ink-soft: #55402f;
	--rubric: #8e1b1b;
	--gold: #b08a48;
	--gold-bright: #dcbc72;
	--gold-deep: #6e5026;
	--bone: #e8dcc0;
	--dim: #9b907f;
	--vampire: #a31621;
	--werewolf: #5b7c8d;
	--necromancer: #2fa88c;
	--demon: #c25a1e;
	--display: "Cinzel", "Trajan Pro", "Cormorant SC", Georgia, serif;
	--serif: "Crimson Pro", "Iowan Old Style", "Palatino Linotype", Georgia, serif;

	/* Set by the script from the viewport. */
	--pw: 520px;
	--ph: 743px;
	--fs: 17px;
	--inset: 10px;
	--shift: 0px;
	--tab-w: 30px;
	--controls-h: 76px;
}

html,
body {
	margin: 0;
	background: var(--void);
	color: var(--bone);
	font-family: var(--serif);
}

html.js,
html.js body {
	height: 100%;
	overflow: hidden;
	overscroll-behavior: none;
}

button {
	font: inherit;
	color: inherit;
}

:focus-visible {
	outline: 2px solid var(--gold-bright);
	outline-offset: 3px;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ─── The chapel around the book ─────────────────────────────────────── */

.chapel {
	position: fixed;
	inset: 0;
	background: var(--void) url("assets/img/bg-chapel.webp") center 38% / cover no-repeat;
}

.chapel::before {
	content: "";
	position: absolute;
	inset: 0;
	background:
		radial-gradient(ellipse 62% 58% at 50% 50%, rgb(10 9 8 / 0.35), rgb(10 9 8 / 0.88) 72%, rgb(10 9 8 / 0.97)),
		linear-gradient(to bottom, rgb(10 9 8 / 0.5), rgb(10 9 8 / 0.15) 35%, rgb(10 9 8 / 0.92));
}

.chapel-light {
	position: absolute;
	inset: 0;
	background:
		radial-gradient(ellipse 42% 36% at 50% 52%, rgb(255 176 59 / 0.13), transparent 72%),
		radial-gradient(circle at 6% 92%, rgb(255 150 50 / 0.2), transparent 22%),
		radial-gradient(circle at 94% 90%, rgb(255 150 50 / 0.18), transparent 20%);
	animation: flicker 7s steps(1) infinite;
}

.dust {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

@keyframes flicker {
	0% { opacity: 1; }
	7% { opacity: 0.86; }
	9% { opacity: 0.97; }
	21% { opacity: 0.9; }
	34% { opacity: 1; }
	48% { opacity: 0.88; }
	50% { opacity: 0.95; }
	63% { opacity: 0.84; }
	71% { opacity: 1; }
	86% { opacity: 0.91; }
}

/* ─── Stage and book ─────────────────────────────────────────────────── */

.stage {
	position: fixed;
	inset: 0;
	display: none;
	place-items: center;
	padding-bottom: var(--controls-h);
	touch-action: pinch-zoom;
	user-select: none;
	-webkit-user-select: none;
}

html.js .stage {
	display: grid;
}

.book {
	position: relative;
	width: calc(var(--pw) * 2);
	height: var(--ph);
	font-size: var(--fs);
	opacity: 0;
	transform: translateX(var(--shift)) translateY(2.5%) scale(0.96);
	transition:
		transform 1.5s cubic-bezier(0.45, 0.05, 0.2, 1),
		opacity 1.1s ease;
}

.book.single {
	width: var(--pw);
}

html.ready .book {
	opacity: 1;
	transform: translateX(var(--shift));
}

.book-shadow {
	position: absolute;
	left: 50%;
	top: calc(50% - var(--controls-h) / 2);
	width: calc(var(--pw) * 2.3);
	height: calc(var(--ph) * 1.08);
	translate: -50% -50%;
	background: radial-gradient(ellipse at 50% 55%, rgb(0 0 0 / 0.75), rgb(0 0 0 / 0.4) 45%, transparent 70%);
	pointer-events: none;
	opacity: 0;
	transition: opacity 1.2s ease;
}

html.ready .book-shadow {
	opacity: 1;
}

/* The rear board lies under everything on the right. */
.board-back {
	position: absolute;
	top: 0;
	left: var(--pw);
	width: var(--pw);
	height: var(--ph);
	border-radius: 2px 12px 12px 2px;
	background:
		linear-gradient(to right, rgb(0 0 0 / 0.5), transparent 6%),
		url("assets/img/leather.webp") 0 0 / 256px;
	box-shadow:
		inset 0 0 0 1px rgb(255 220 180 / 0.06),
		inset 0 0 2.5em rgb(0 0 0 / 0.7),
		0 1.2em 2.6em rgb(0 0 0 / 0.55);
}

.single .board-back {
	left: 0;
}

.spine {
	position: absolute;
	top: -0.25%;
	bottom: -0.25%;
	left: calc(var(--pw) - 0.55em);
	width: 1.1em;
	border-radius: 0.5em;
	background: linear-gradient(to right, #0c0505, #3b1a1b 45%, #4a2322 55%, #0c0505);
	opacity: 0;
	transition: opacity 0.6s ease 0.4s;
}

.book.open .spine {
	opacity: 1;
}

.single .spine {
	display: none;
}

/* ─── Leaves ─────────────────────────────────────────────────────────── */

.leaf {
	position: absolute;
	top: var(--inset);
	left: var(--pw);
	width: calc(var(--pw) - var(--inset));
	height: calc(var(--ph) - var(--inset) * 2);
	transform-origin: 0 50%;
	transform-style: preserve-3d;
}

.single .leaf {
	left: 0;
}

.leaf.board {
	top: 0;
	width: var(--pw);
	height: var(--ph);
}

.leaf.stowed {
	visibility: hidden;
}

.face {
	position: absolute;
	inset: 0;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

.face.back {
	transform: rotateY(180deg);
}

.leaf.moving .face {
	box-shadow: 0 0 1.4em rgb(0 0 0 / 0.28);
}

.sheet {
	position: absolute;
	inset: 0;
	overflow: hidden;
	border-radius: 0 3px 3px 0;
	background:
		radial-gradient(ellipse 75% 70% at 50% 48%, transparent 58%, rgb(120 78 30 / 0.3) 100%),
		var(--parchment) url("assets/img/parchment.webp") 0 0 / 34em;
	contain: layout paint;
}

.face.back .sheet {
	border-radius: 3px 0 0 3px;
	background-position: 0 0, 17em 9em;
}

/* Shadow of the gutter where the page curves into the spine. */
.sheet::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background:
		linear-gradient(to right, rgb(50 28 10 / 0.34), rgb(50 28 10 / 0.08) 5%, transparent 11%),
		linear-gradient(to left, rgb(60 40 15 / 0.14), transparent 2.5%);
}

.face.back .sheet::after {
	background:
		linear-gradient(to left, rgb(50 28 10 / 0.34), rgb(50 28 10 / 0.08) 5%, transparent 11%),
		linear-gradient(to right, rgb(60 40 15 / 0.14), transparent 2.5%);
}

.board .sheet::after {
	display: none;
}

.shade {
	position: absolute;
	inset: 0;
	pointer-events: none;
	opacity: 0;
	border-radius: inherit;
	background: linear-gradient(to right, rgb(18 9 4 / 0.72), rgb(18 9 4 / 0.28) 60%, rgb(18 9 4 / 0.12));
}

.face.back .shade {
	background: linear-gradient(to left, rgb(18 9 4 / 0.72), rgb(18 9 4 / 0.28) 60%, rgb(18 9 4 / 0.12));
}

.blank-verso {
	position: absolute;
	inset: 0;
}

/* The dog-eared corner that invites a turn. */
.curl {
	position: absolute;
	bottom: 0;
	right: 0;
	width: 0;
	height: 0;
	pointer-events: none;
	background: linear-gradient(135deg, var(--parchment-light) 0%, #d6c399 49%, rgb(40 22 8 / 0.3) 50%, rgb(40 22 8 / 0.05) 70%, transparent 100%);
	box-shadow: -0.15em -0.15em 0.4em rgb(40 20 5 / 0.18);
	border-top-left-radius: 0.4em;
	transition: width 0.25s ease, height 0.25s ease;
}

.face.back .curl {
	right: auto;
	left: 0;
	transform: scaleX(-1);
}

.board .curl {
	display: none;
}

.leaf.top-right .face.front .curl,
.leaf.top-left .face.back .curl {
	width: 1.25em;
	height: 1.25em;
}

.book.hint-next .board .curl {
	display: none;
}

.leaf.top-right .face.front .curl,
.book.hint-prev .leaf.top-left .face.back .curl {
	width: 3.2em;
	height: 3.2em;
}

.book.hint-next,
.book.hint-prev {
	cursor: pointer;
}

.book.dragging {
	cursor: grabbing;
}

/* ─── Thumb-index tabs ───────────────────────────────────────────────── */

.tab {
	position: absolute;
	top: calc(var(--tab-start) + var(--tab-index) * var(--tab-step));
	left: 100%;
	height: var(--tab-h);
	min-width: 2.2em;
	padding: 0 0.3em 0 0.4em;
	display: flex;
	align-items: center;
	gap: 0.45em;
	border: 0;
	border-radius: 0 0.45em 0.45em 0;
	background:
		linear-gradient(to right, rgb(0 0 0 / 0.5), transparent 0.6em),
		linear-gradient(to bottom, rgb(255 255 255 / 0.09), transparent 40%, rgb(0 0 0 / 0.25)),
		var(--tab-colour, #3b1a1b);
	color: var(--gold-bright);
	font-family: var(--display);
	font-weight: 700;
	font-size: 0.66em;
	letter-spacing: 0.08em;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: 0.1em 0.12em 0.3em rgb(0 0 0 / 0.45);
	transition: min-width 0.3s ease, filter 0.2s ease;
}

.face.back .tab {
	left: auto;
	right: 100%;
	flex-direction: row-reverse;
	padding: 0 0.4em 0 0.3em;
	border-radius: 0.45em 0 0 0.45em;
	background:
		linear-gradient(to left, rgb(0 0 0 / 0.5), transparent 0.6em),
		linear-gradient(to bottom, rgb(255 255 255 / 0.09), transparent 40%, rgb(0 0 0 / 0.25)),
		var(--tab-colour, #3b1a1b);
}

.tab-no {
	min-width: 1.5em;
	text-align: center;
}

.tab-name {
	max-width: 0;
	overflow: hidden;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-size: 0.86em;
	color: var(--bone);
	transition: max-width 0.35s ease;
}

.tab:hover,
.tab:focus-visible {
	filter: brightness(1.25);
}

.tab:hover .tab-name,
.tab:focus-visible .tab-name {
	max-width: 16em;
}

.tab:focus-visible {
	outline-offset: 1px;
}

.single .tab {
	display: none;
}

.tab[data-colour="blood"] { --tab-colour: #5e1313; }
.tab[data-colour="violet"] { --tab-colour: #38214b; }
.tab[data-colour="crimson"] { --tab-colour: #741019; }
.tab[data-colour="gold"] { --tab-colour: #6a4c1f; }
.tab[data-colour="green"] { --tab-colour: #1b4538; }
.tab[data-colour="ember"] { --tab-colour: #6f2e10; }
.tab[data-colour="ink"] { --tab-colour: #221a16; }
.tab[data-colour="steel"] { --tab-colour: #283a45; }

/* ─── Cover and endpaper ─────────────────────────────────────────────── */

.board .face.front .sheet {
	border-radius: 3px 0.8em 0.8em 3px;
	background:
		radial-gradient(ellipse 70% 55% at 46% 38%, rgb(130 64 52 / 0.32), transparent 72%),
		linear-gradient(to right, rgb(0 0 0 / 0.6), rgb(0 0 0 / 0) 5%, rgb(255 230 200 / 0.05) 6.5%, transparent 9%),
		url("assets/img/leather.webp") 0 0 / 256px;
	box-shadow:
		inset 0 0 0 1px rgb(255 220 180 / 0.07),
		inset 0 0 3.2em rgb(0 0 0 / 0.72);
}

.board .face.back .sheet {
	border-radius: 0.8em 3px 3px 0.8em;
	background:
		linear-gradient(to left, rgb(0 0 0 / 0.55), transparent 5%),
		url("assets/img/leather.webp") 64px 32px / 256px;
	box-shadow: inset 0 0 2.5em rgb(0 0 0 / 0.7);
}

.page-cover {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	gap: 1.1em;
	/* The title sits above the clasp, which holds the fore-edge at mid-height. */
	padding: 17% 8.5% 14% 11.5%;
}

.cover-tooling {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.cover-tooling::before,
.cover-tooling::after {
	content: "";
	position: absolute;
	inset: 5.5% 6% 5.5% 9%;
	border: 0.14em solid rgb(176 138 72 / 0.55);
	border-radius: 0.3em;
	box-shadow: 0 0 0.5em rgb(0 0 0 / 0.6), inset 0 0 0.5em rgb(0 0 0 / 0.5);
}

.cover-tooling::after {
	inset: 7.3% 7.8% 7.3% 10.8%;
	border-width: 0.06em;
	border-color: rgb(176 138 72 / 0.4);
	box-shadow: none;
}

.corner {
	position: absolute;
	width: 13%;
	aspect-ratio: 1;
	background: linear-gradient(135deg, #e7c77b, #9b7433 38%, #4d3413 75%, #2a1c0a);
	box-shadow: inset 0 0 0.3em rgb(0 0 0 / 0.5);
}

.corner.tl { top: 0; left: 0; clip-path: polygon(0 0, 100% 0, 0 100%); display: none; }
.corner.bl { bottom: 0; left: 0; clip-path: polygon(0 0, 100% 100%, 0 100%); display: none; }
.corner.tr { top: 0; right: 0; clip-path: polygon(0 0, 100% 0, 100% 100%); border-top-right-radius: 0.8em; }
.corner.br { bottom: 0; right: 0; clip-path: polygon(100% 0, 100% 100%, 0 100%); border-bottom-right-radius: 0.8em; }

.cover-title {
	position: relative;
	/* About two-thirds of the board, well inside the gilt frame. */
	width: 82%;
	height: auto;
	/* Centre the lettering, not the sword tip above it, between the ornaments. */
	translate: 0 -4.5%;
	filter: drop-shadow(0 0.12em 0.2em rgb(0 0 0 / 0.85)) drop-shadow(0 0 0.9em rgb(0 0 0 / 0.45));
}

/* Gilt tooling above and below the title. */
.cover-orn {
	position: relative;
	width: 46%;
	height: 1.3em;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 20'%3E%3Cpath d='M4 10h40M76 10h40' stroke='%23b08a48' stroke-width='1.1'/%3E%3Ccircle cx='47.5' cy='10' r='1.8' fill='%23b08a48'/%3E%3Ccircle cx='72.5' cy='10' r='1.8' fill='%23b08a48'/%3E%3Cpath d='M60 1.5l2.4 6.1 6.1 2.4-6.1 2.4L60 18.5l-2.4-6.1L51.5 10l6.1-2.4z' fill='%23b08a48'/%3E%3C/svg%3E") center / contain no-repeat;
	filter: drop-shadow(0 1px 0 rgb(0 0 0 / 0.7));
	opacity: 0.9;
}

/* A blind-tooled centrepiece: pressed into the leather, not gilt. */
.cover-centre {
	position: relative;
	flex: none;
	width: 30%;
	aspect-ratio: 100 / 120;
	margin: auto 0;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 120'%3E%3Cg fill='none' stroke='%23000' stroke-opacity='.55'%3E%3Cpath d='M50 2 98 60 50 118 2 60z' stroke-width='1.6'/%3E%3Cpath d='M50 9 92 60 50 111 8 60z' stroke-width='.8'/%3E%3C/g%3E%3Cg fill='%23000' fill-opacity='.5'%3E%3Cpath d='M36.87 52.85A16 16 0 1 0 63.13 52.85A13.5 13.5 0 1 1 36.87 52.85z'/%3E%3Cpath d='M48.6 44h2.8l-.4 40L50 90l-1-6z'/%3E%3Crect x='40' y='41.2' width='20' height='2.8' rx='1.4'/%3E%3Crect x='48.9' y='31' width='2.2' height='10.5'/%3E%3Ccircle cx='50' cy='29' r='2.4'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
	filter: drop-shadow(0 1px 0 rgb(255 225 190 / 0.1));
}

.page-cover .cover-foot {
	position: relative;
	margin: 0;
	font-family: var(--display);
	font-weight: 600;
	font-size: 0.72em;
	letter-spacing: 0.32em;
	text-transform: uppercase;
	color: var(--gold);
	text-shadow: 0 1px 0 rgb(0 0 0 / 0.8), 0 -1px 0 rgb(255 220 160 / 0.12);
	text-align: center;
}

.clasp {
	position: absolute;
	right: 0;
	top: 50%;
	width: 11%;
	height: 13%;
	translate: 0 -50%;
	border-radius: 0.5em 0 0 0.5em;
	background:
		linear-gradient(to bottom, rgb(255 255 255 / 0.07), transparent 30%, rgb(0 0 0 / 0.35)),
		url("assets/img/leather.webp") 30px 60px / 180px;
	filter: brightness(0.8);
	box-shadow: -0.2em 0 0.5em rgb(0 0 0 / 0.6);
}

.clasp-seal {
	position: absolute;
	left: -1.1em;
	top: 50%;
	width: 2.3em;
	height: 2.3em;
	translate: 0 -50%;
	border-radius: 47% 53% 50% 50% / 52% 46% 54% 48%;
	background: radial-gradient(circle at 38% 34%, #c3332c, #7d1411 55%, #4a0908);
	box-shadow: 0 0.12em 0.25em rgb(0 0 0 / 0.6), inset 0 0 0 0.28em rgb(0 0 0 / 0.18);
	transition: opacity 0.5s ease 0.1s, transform 0.6s cubic-bezier(0.3, 0, 0.6, 1);
}

.clasp-seal::after {
	content: "";
	position: absolute;
	inset: 26%;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.6 1h4.8l-1.3 8.1L21.2 7.8v8.4l-8.1-1.3 1.3 8.1H9.6l1.3-8.1-8.1 1.3V7.8l8.1 1.3z' fill='%23320404' fill-opacity='.6'/%3E%3C/svg%3E") center / contain no-repeat;
	filter: drop-shadow(0 1px 0 rgb(255 120 110 / 0.25));
}

.book.open .clasp-seal {
	opacity: 0;
	transform: translate(-0.6em, 1.4em) rotate(-38deg) scale(0.8);
}

.page-endpaper {
	position: absolute;
	inset: 2.2% 0 2.2% 3.5%;
	display: grid;
	place-items: center;
	background: #3a1417 url("assets/img/endpaper.webp") center / cover;
	box-shadow: inset 0 0 1.5em rgb(0 0 0 / 0.55), inset -0.6em 0 1em rgb(0 0 0 / 0.5);
}

.bookplate {
	width: 60%;
	padding: 1.4em 1.2em 1.3em;
	text-align: center;
	color: var(--ink);
	background: var(--parchment) url("assets/img/parchment.webp") 0 0 / 30em;
	border: 0.22em double var(--ink);
	box-shadow: 0 0.2em 0.6em rgb(0 0 0 / 0.55);
	transform: rotate(-1.4deg);
}

.bookplate p {
	margin: 0;
}

.bp-small {
	font-family: var(--display);
	font-size: 0.68em;
	letter-spacing: 0.34em;
	text-transform: uppercase;
	color: var(--rubric);
}

.bp-order {
	margin-top: 0.4em !important;
	font-family: var(--display);
	font-weight: 700;
	font-size: 1.05em;
	line-height: 1.2;
}

.bp-shelf {
	margin-top: 0.5em !important;
	font-style: italic;
	font-size: 0.82em;
	color: var(--ink-soft);
}

.bp-warn {
	margin-top: 0.8em !important;
	padding-top: 0.7em;
	border-top: 1px solid rgb(42 26 18 / 0.35);
	font-style: italic;
	font-size: 0.8em;
	line-height: 1.3;
	color: var(--rubric);
}

/* ─── Page typography ────────────────────────────────────────────────── */

.sheet > .page:not([data-kind]) {
	position: absolute;
	inset: 0;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 0.75em;
	padding: 3.2em 2.6em 3.1em;
	color: var(--ink);
	line-height: 1.42;
	font-kerning: normal;
	font-variant-numeric: oldstyle-nums proportional-nums;
}

.page p {
	margin: 0;
}

.rh {
	position: absolute;
	top: 1.35em;
	left: 2.6em;
	right: 2.6em;
	margin: 0;
	text-align: center;
	font-family: var(--display);
	font-weight: 600;
	font-size: 0.6em;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: var(--rubric);
}

.folio {
	position: absolute;
	bottom: 1.25em;
	left: 0;
	right: 0;
	margin: 0;
	text-align: center;
	font-size: 0.86em;
	color: var(--ink-soft);
	font-variant-numeric: oldstyle-nums;
}

.chapter-head {
	margin-top: 0.8em;
	text-align: center;
}

.chapter-no {
	margin: 0 0 0.45em;
	font-family: var(--display);
	font-weight: 600;
	font-size: 0.64em;
	letter-spacing: 0.34em;
	text-transform: uppercase;
	color: var(--rubric);
}

.chapter-title {
	margin: 0;
	font-family: var(--display);
	font-weight: 700;
	font-size: 1.68em;
	line-height: 1.1;
	letter-spacing: 0.03em;
	color: var(--ink);
	text-wrap: balance;
}

.chapter-title.small {
	font-size: 1.25em;
	text-align: center;
}

.chapter-title::after,
.section-mark::after {
	content: "";
	display: block;
	width: 6.2em;
	height: 0.7em;
	margin: 0.45em auto 0;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 124 14'%3E%3Cpath d='M2 7h46M76 7h46' stroke='%238e1b1b' stroke-width='1'/%3E%3Cpath d='M62 1l6 6-6 6-6-6z' fill='%238e1b1b'/%3E%3Ccircle cx='50' cy='7' r='1.6' fill='%238e1b1b'/%3E%3Ccircle cx='74' cy='7' r='1.6' fill='%238e1b1b'/%3E%3C/svg%3E") center / contain no-repeat;
}

.chapter-title.small::after,
.section-mark::after {
	width: 5em;
	font-size: 1rem;
}

.section-mark {
	margin: 0;
	text-align: center;
	font-family: var(--display);
	font-weight: 700;
	font-size: 1.05em;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ink);
}

.section-mark::after {
	width: 5.6em;
	font-size: inherit;
}

.prose p + p {
	margin-top: 0.55em;
}

.prose p {
	text-align: justify;
	hyphens: auto;
	-webkit-hyphens: auto;
	text-wrap: pretty;
}

.prose.centered p {
	text-align: center;
}

.initial::first-letter {
	float: left;
	margin: 0.1em 0.14em 0 0;
	padding: 0.1em 0.1em 0.02em;
	font-family: var(--display);
	font-weight: 700;
	font-size: 3.1em;
	line-height: 0.82;
	color: var(--gold-bright);
	background: #6d1212;
	border: 0.04em solid var(--gold);
	text-shadow: 0 0.03em 0 #3a0808;
}

.sc {
	font-family: var(--display);
	font-weight: 600;
	font-size: 0.8em;
	letter-spacing: 0.08em;
}

.fleuron {
	flex: none;
	height: 1.3em;
	margin-top: auto !important;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 20'%3E%3Cpath d='M4 10h14M42 10h14' stroke='%238e1b1b' stroke-width='1'/%3E%3Ccircle cx='21' cy='10' r='1.6' fill='%238e1b1b'/%3E%3Ccircle cx='39' cy='10' r='1.6' fill='%238e1b1b'/%3E%3Cpath d='M30 1.5l2.2 6.3 6.3 2.2-6.3 2.2L30 18.5l-2.2-6.3L21.5 10l6.3-2.2z' fill='%238e1b1b'/%3E%3C/svg%3E") center / contain no-repeat;
}

em {
	font-style: italic;
}

/* ─── Plates ─────────────────────────────────────────────────────────── */

.plate {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.65em;
	min-height: 0;
}

.plate img {
	display: block;
	width: 100%;
	min-height: 0;
	object-fit: cover;
	border: 1px solid #1b120c;
	outline: 1px solid rgb(176 138 72 / 0.8);
	outline-offset: 0.2em;
	box-shadow: 0 0.35em 0.9em rgb(50 25 5 / 0.35);
	background: #1b120c;
}

.plate figcaption,
.plate-caption {
	margin: 0;
	font-style: italic;
	font-size: 0.88em;
	line-height: 1.3;
	text-align: center;
	color: var(--ink-soft);
	text-wrap: balance;
}

.plate-no {
	margin-right: 0.45em;
	font-family: var(--display);
	font-style: normal;
	font-weight: 700;
	font-size: 0.78em;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--rubric);
}

.page-plate {
	justify-content: center;
}

.plate-tall,
.plate-map {
	flex: 1;
}

.plate-tall img,
.plate-map img {
	flex: 1;
	height: 0;
}

.plate-map img {
	object-position: 50% 40%;
}

.plate-wide img {
	aspect-ratio: 16 / 9;
	height: auto;
}

.plate-banner img {
	aspect-ratio: 2.6 / 1;
	height: auto;
	object-position: 45% 45%;
}

/* ─── Title page ─────────────────────────────────────────────────────── */

.page-title {
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 0.6em !important;
}

.tp-kicker {
	font-family: var(--display);
	font-size: 0.8em;
	letter-spacing: 0.4em;
	text-transform: uppercase;
	color: var(--ink-soft);
}

.tp-title {
	width: 100%;
	margin: 0;
}

.tp-title img {
	display: block;
	width: 100%;
	height: auto;
	filter: drop-shadow(0 0.08em 0.12em rgb(60 35 10 / 0.35));
}

.device {
	width: 5.6em;
	height: 5.6em;
	margin: 0.7em 0;
	color: var(--ink);
	opacity: 0.88;
}

.tp-account {
	max-width: 21em;
	font-style: italic;
	font-size: 1em;
	line-height: 1.45;
	text-wrap: balance;
}

.tp-imprint {
	margin-top: 1.6em !important;
	font-size: 0.86em;
	line-height: 1.6;
	color: var(--ink-soft);
}

.caps {
	font-family: var(--display);
	font-weight: 700;
	letter-spacing: 0.14em;
	color: var(--rubric);
}

.tp-year {
	font-family: var(--display);
	letter-spacing: 0.3em;
	font-size: 0.9em;
}

/* ─── Contents ───────────────────────────────────────────────────────── */

.page-contents {
	justify-content: center;
}

.toc {
	list-style: none;
	margin: 0.4em 0 0;
	padding: 0;
}

.toc a {
	display: flex;
	align-items: baseline;
	gap: 0.45em;
	padding: 0.42em 0.15em;
	color: var(--ink);
	text-decoration: none;
	border-radius: 0.2em;
}

.toc-no {
	flex: none;
	width: 2.5em;
	font-family: var(--display);
	font-weight: 700;
	font-size: 0.7em;
	letter-spacing: 0.08em;
	color: var(--rubric);
}

.toc-name {
	font-size: 1.02em;
}

.toc-dots {
	flex: 1;
	min-width: 1em;
	border-bottom: 1px dotted rgb(42 26 18 / 0.55);
	translate: 0 -0.3em;
}

.toc-folio {
	flex: none;
	min-width: 1.4em;
	text-align: right;
	font-variant-numeric: oldstyle-nums tabular-nums;
}

.toc a:hover .toc-name,
.toc a:focus-visible .toc-name {
	color: var(--rubric);
}

.rubric-note {
	margin-top: 1em !important;
	padding-top: 0.8em;
	border-top: 1px solid rgb(142 27 27 / 0.35);
	font-style: italic;
	font-size: 0.86em;
	line-height: 1.4;
	color: var(--rubric);
	text-align: center;
	text-wrap: balance;
}

/* ─── Pitch, bargain, triptych ───────────────────────────────────────── */

.page-pitch {
	justify-content: center;
	gap: 1.1em !important;
}

.capsule {
	margin: 0;
	padding: 0 0.6em;
	text-align: center;
	font-style: italic;
	font-weight: 500;
	font-size: 1.42em;
	line-height: 1.22;
	color: var(--rubric);
	text-wrap: balance;
}

.capsule p::before { content: "“"; }
.capsule p::after { content: "”"; }

.choice {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.8em;
}

.choice-card {
	padding: 0.75em 0.8em 0.8em;
	border: 1px solid currentColor;
	outline: 1px solid currentColor;
	outline-offset: -0.3em;
	text-align: center;
	background: rgb(255 250 235 / 0.28);
}

.choice-card h3 {
	margin: 0 0 0.3em;
	font-family: var(--display);
	font-weight: 700;
	font-size: 0.86em;
	letter-spacing: 0.26em;
	text-transform: uppercase;
}

.choice-card p {
	font-size: 0.9em;
	line-height: 1.35;
	color: var(--ink);
}

.choice-card.embrace {
	color: var(--rubric);
}

.choice-card.resist {
	color: var(--ink-soft);
}

.page-triptych {
	justify-content: center;
	gap: 1em !important;
}

.triptych {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.55em;
}

.triptych figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.45em;
	text-align: center;
}

.triptych img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 4;
	object-fit: cover;
	object-position: 50% 20%;
	border: 1px solid #1b120c;
	outline: 1px solid rgb(176 138 72 / 0.8);
	outline-offset: 0.18em;
	border-radius: 48% 48% 0 0 / 22% 22% 0 0;
	background: #1b120c;
}

.triptych figcaption {
	font-family: var(--display);
	font-weight: 600;
	font-size: 0.58em;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ink);
}

.tier-no {
	display: block;
	margin-bottom: 0.2em;
	font-size: 1.3em;
	color: var(--rubric);
}

/* ─── The four curses ────────────────────────────────────────────────── */

.sheet > .page.page-curse {
	align-items: center;
	text-align: center;
	gap: 0.5em;
	padding-top: 2.4em;
	--curse: var(--vampire);
}

.curse-werewolf { --curse: var(--werewolf) !important; }
.curse-necromancer { --curse: var(--necromancer) !important; }
.curse-demon { --curse: var(--demon) !important; }

.curse-kicker {
	font-family: var(--display);
	font-weight: 600;
	font-size: 0.6em;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: var(--rubric);
}

.portrait {
	position: relative;
	width: 54%;
	aspect-ratio: 1 / 1.04;
	flex: none;
	border-radius: 50% 50% 0.3em 0.3em / 36% 36% 0.3em 0.3em;
	overflow: hidden;
	background: #120b08;
	border: 1px solid #1b120c;
	box-shadow:
		0 0 0 0.2em var(--parchment),
		0 0 0 0.3em var(--curse),
		0 0 0 0.36em rgb(176 138 72 / 0.8),
		0 0.5em 1em rgb(50 25 5 / 0.35);
}

.portrait img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 30%;
	transition: opacity 0.35s ease;
}

.portrait img.fading {
	opacity: 0;
}

.tiers {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.15em 0.2em;
	margin-top: 0.35em;
}

.tiers button {
	padding: 0.45em 0.55em;
	border: 0;
	background: none;
	font-family: var(--display);
	font-weight: 600;
	font-size: 0.6em;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ink-soft);
	cursor: pointer;
	border-bottom: 0.14em solid transparent;
}

.tiers button + button::before {
	content: "›";
	margin-right: 0.75em;
	color: var(--ink-soft);
	opacity: 0.6;
}

.tiers button[aria-pressed="true"] {
	color: var(--ink);
	border-bottom-color: var(--curse);
}

.tiers button:hover {
	color: var(--curse);
}

.curse-name {
	margin: 0.1em 0 0;
	font-family: var(--display);
	font-weight: 700;
	font-size: 1.42em;
	line-height: 1.1;
	letter-spacing: 0.04em;
	color: var(--ink);
}

.curse-class {
	margin-top: -0.3em !important;
	font-style: italic;
	font-size: 0.92em;
	color: var(--curse);
	filter: brightness(0.75);
}

.vignette {
	margin: 0.1em 0 0;
	max-width: 22em;
	font-style: italic;
	font-size: 0.94em;
	line-height: 1.36;
	text-wrap: pretty;
}

.gifts {
	list-style: none;
	margin: 0.2em 0 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.6em;
	width: 88%;
}

.gifts li {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.35em;
	font-family: var(--display);
	font-weight: 600;
	font-size: 0.6em;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	line-height: 1.2;
}

.gifts img {
	width: 5.2em;
	height: 5.2em;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid #1b120c;
	box-shadow: 0 0 0 0.18em var(--parchment), 0 0 0 0.32em var(--gold-deep);
}

.trait {
	margin-top: auto !important;
	font-size: 0.88em;
	color: var(--ink-soft);
}

/* ─── Order, champions, land, hunt ───────────────────────────────────── */

.bestiary,
.grounds,
.hunt-list {
	margin: 0;
	display: grid;
	gap: 0.52em;
}

.bestiary dt,
.grounds dt,
.hunt-list dt {
	font-family: var(--display);
	font-weight: 700;
	font-size: 0.74em;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--rubric);
}

.bestiary dd,
.grounds dd,
.hunt-list dd {
	margin: 0.1em 0 0;
	line-height: 1.36;
}

.bestiary dd {
	font-size: 0.95em;
}

.bestiary div:first-child dd,
.bestiary div:nth-child(2) dd {
	font-style: italic;
}

.grounds {
	padding: 0.2em 0 0.2em 1em;
	border-left: 1px solid rgb(42 26 18 / 0.25);
	gap: 0.4em;
}

.grounds dd {
	font-size: 0.92em;
}

.grounds div {
	position: relative;
}

.grounds div::before {
	content: "";
	position: absolute;
	left: -1.3em;
	top: 0.2em;
	width: 0.55em;
	height: 0.55em;
	rotate: 45deg;
	background: var(--mark);
}

.g-vampire { --mark: var(--vampire); }
.g-werewolf { --mark: var(--werewolf); }
.g-necromancer { --mark: var(--necromancer); }
.g-demon { --mark: var(--demon); }

.page-champions {
	justify-content: center;
}

.champions {
	list-style: none;
	margin: 0.2em 0 0;
	padding: 0;
	display: grid;
	gap: 0.48em;
	counter-reset: champion;
}

.champions li {
	display: grid;
	grid-template-columns: 1.9em 1fr;
	column-gap: 0.4em;
	counter-increment: champion;
}

.champions li::before {
	content: counter(champion, upper-roman);
	grid-row: span 2;
	font-family: var(--display);
	font-weight: 700;
	font-size: 0.72em;
	color: var(--rubric);
	padding-top: 0.2em;
}

.ch-name {
	font-family: var(--display);
	font-weight: 700;
	font-size: 0.76em;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.ch-creed {
	font-style: italic;
	font-size: 0.92em;
	line-height: 1.3;
	color: var(--ink-soft);
}

/* ─── Ledger ─────────────────────────────────────────────────────────── */

.ledger-wrap {
	overflow-x: auto;
}

.ledger {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9em;
}

.ledger caption {
	caption-side: top;
	padding-bottom: 0.4em;
	font-family: var(--display);
	font-weight: 600;
	font-size: 0.66em;
	letter-spacing: 0.26em;
	text-transform: uppercase;
	color: var(--ink-soft);
	text-align: left;
}

.ledger th {
	padding: 0.3em 0.4em;
	font-family: var(--display);
	font-weight: 700;
	font-size: 0.66em;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-align: left;
	color: var(--rubric);
	border-bottom: 1.5px solid var(--ink);
}

.ledger td {
	padding: 0.34em 0.4em;
	font-style: italic;
	border-bottom: 1px solid rgb(42 26 18 / 0.28);
	font-variant-numeric: oldstyle-nums tabular-nums;
}

.ledger-voice {
	margin-top: auto !important;
	padding: 0.7em 0.4em 0;
	border-top: 1px solid rgb(42 26 18 / 0.3);
	font-family: var(--display);
	font-weight: 600;
	font-size: 0.78em;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	text-align: center;
	color: var(--ink);
}

/* ─── The dawn to come and the colophon ──────────────────────────────── */

.page-dawn {
	gap: 0.9em !important;
}

.plaques {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.8em;
	margin-top: 0.2em;
}

.plaque {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.15em;
	padding: 0.85em 0.6em 0.8em;
	color: var(--gold-bright);
	text-decoration: none;
	background:
		linear-gradient(to bottom, rgb(255 255 255 / 0.06), transparent 45%, rgb(0 0 0 / 0.3)),
		#231513;
	border: 1px solid var(--gold-deep);
	outline: 1px solid rgb(176 138 72 / 0.5);
	outline-offset: -0.35em;
	box-shadow: 0 0.25em 0.6em rgb(40 20 5 / 0.35);
	border-radius: 0.2em;
}

.plaque[href] {
	cursor: pointer;
}

.plaque[href]:hover {
	filter: brightness(1.2);
}

.pl-store {
	font-family: var(--display);
	font-weight: 700;
	font-size: 0.92em;
	letter-spacing: 0.12em;
}

.pl-os {
	font-size: 0.82em;
	color: var(--bone);
}

.pl-state {
	margin-top: 0.2em;
	font-style: italic;
	font-size: 0.74em;
	color: var(--dim);
}

.page-colophon {
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 1em !important;
}

.page-colophon .prose {
	max-width: 20em;
}

.wax {
	position: relative;
	width: 4.4em;
	height: 4.4em;
	border-radius: 47% 53% 50% 50% / 52% 46% 54% 48%;
	background: radial-gradient(circle at 38% 34%, #c3332c, #7d1411 55%, #4a0908);
	box-shadow: 0 0.2em 0.35em rgb(40 5 0 / 0.45), inset 0 0 0 0.45em rgb(0 0 0 / 0.16);
	display: grid;
	place-items: center;
	rotate: -8deg;
}

.wax span {
	font-family: var(--display);
	font-weight: 900;
	font-size: 1.7em;
	color: #5a0b0a;
	text-shadow: 0 1px 0 rgb(255 130 120 / 0.35), 0 -1px 0 rgb(0 0 0 / 0.35);
}

.explicit {
	font-family: var(--display);
	font-weight: 600;
	font-size: 0.84em;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: var(--rubric);
}

.colophon-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.6em;
}

.book-btn {
	min-height: 2.6rem;
	padding: 0.7em 1.1em;
	font-family: var(--display);
	font-weight: 700;
	font-size: 0.66em;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ink);
	background: rgb(255 250 235 / 0.3);
	border: 1px solid var(--ink);
	outline: 1px solid rgb(42 26 18 / 0.4);
	outline-offset: -0.35em;
	cursor: pointer;
}

.book-btn:hover {
	color: var(--parchment-light);
	background: var(--rubric);
	border-color: var(--rubric);
}

.imprint {
	margin-top: 0.4em !important;
	font-size: 0.8em;
	color: var(--ink-soft);
}

/* ─── Controls under the book ────────────────────────────────────────── */

.controls {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 5;
	display: none;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
	opacity: 0;
	translate: 0 12px;
	transition: opacity 0.6s ease, translate 0.6s ease;
	pointer-events: none;
}

html.js .controls {
	display: flex;
}

html.opened .controls {
	opacity: 1;
	translate: 0 0;
	pointer-events: auto;
}

.ctl {
	flex: none;
	display: inline-grid;
	place-items: center;
	min-width: 44px;
	height: 44px;
	padding: 0 14px;
	border: 1px solid rgb(201 184 150 / 0.28);
	border-radius: 22px;
	background: rgb(16 12 10 / 0.72);
	color: var(--bone);
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.ctl svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.ctl:hover {
	border-color: var(--gold);
	color: var(--gold-bright);
}

.ctl:disabled {
	opacity: 0.35;
	cursor: default;
	border-color: rgb(201 184 150 / 0.18);
	color: var(--bone);
}

.ctl-turn {
	padding: 0;
	width: 44px;
}

.ctl-contents {
	font-family: var(--display);
	font-weight: 600;
	font-size: 12px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

.ctl-sound {
	padding: 0;
	width: 44px;
}

.ctl-sound .mute,
.ctl-sound[aria-pressed="false"] .wave {
	display: none;
}

.ctl-sound[aria-pressed="false"] .mute {
	display: inline;
}

.folio-readout {
	flex: 0 1 auto;
	min-width: 0;
	width: 25em;
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	text-align: center;
	font-family: var(--display);
	font-weight: 600;
	font-size: 12px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--dim);
}

.seal-prompt {
	position: fixed;
	left: 50%;
	bottom: calc(22px + env(safe-area-inset-bottom, 0px));
	translate: -50% 0;
	z-index: 6;
	display: none;
	padding: 12px 22px;
	border: 1px solid rgb(176 138 72 / 0.4);
	border-radius: 24px;
	background: rgb(16 12 10 / 0.6);
	font-family: var(--display);
	font-weight: 600;
	font-size: 13px;
	letter-spacing: 0.32em;
	text-transform: uppercase;
	color: var(--gold-bright);
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.8s ease;
}

html.js .seal-prompt {
	display: block;
}

html.ready:not(.opened) .seal-prompt {
	opacity: 1;
	animation: breathe 2.4s ease-in-out infinite;
}

html.opened .seal-prompt {
	pointer-events: none;
	visibility: hidden;
}

@keyframes breathe {
	50% { border-color: rgb(220 188 114 / 0.8); color: #f3d892; }
}

@media (max-width: 560px) {
	.ctl-contents {
		padding: 0 12px;
		letter-spacing: 0.12em;
	}

	.folio-readout {
		width: auto;
		flex: 1;
		font-size: 11px;
		letter-spacing: 0.1em;
	}

	.ro-label {
		display: none;
	}
}

@media (max-width: 380px) {
	.ctl-contents {
		display: none;
	}
}

/* ─── Without script: a plain, readable document ─────────────────────── */

html:not(.js) body {
	background: var(--void) url("assets/img/bg-chapel.webp") center top / cover fixed;
}

html:not(.js) .chapel {
	display: none;
}

html:not(.js) .pages {
	display: grid;
	gap: 28px;
	max-width: 44rem;
	margin: 0 auto;
	padding: 32px 16px 64px;
}

html:not(.js) .page {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.8em;
	padding: 2.6em 2.2em;
	font-size: 18px;
	color: var(--ink);
	line-height: 1.45;
	background: var(--parchment) url("assets/img/parchment.webp") 0 0 / 34em;
	box-shadow: 0 10px 30px rgb(0 0 0 / 0.6);
}

html:not(.js) .page-cover {
	min-height: 32em;
	background: url("assets/img/leather.webp") 0 0 / 256px;
}

html:not(.js) .page-endpaper {
	padding: 3em;
	background: url("assets/img/endpaper.webp") center / cover;
}

html:not(.js) .plate-tall img,
html:not(.js) .plate-map img {
	height: auto;
}

html.js .pages {
	display: none;
}

/* ─── Motion preferences ─────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.chapel-light,
	html.ready:not(.opened) .seal-prompt {
		animation: none;
	}

	.book {
		transition: opacity 0.4s ease;
	}

	.dust {
		display: none;
	}
}
