/* ==========================================================================
   layout.css — page shell, table of contents, footer
   ========================================================================== */

.shell {
	width: 100%;
	max-width: var(--shell);
	margin-inline: auto;
	padding-inline: clamp(1.25rem, 6vw, 3.5rem);
	position: relative;
	z-index: 1;
}

/* --- Header / table of contents ------------------------------------------ */

.masthead {
	padding-block: 1.75rem 1.25rem;
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: baseline;
	justify-content: space-between;
	border-bottom: 1px solid var(--rule);
}

.masthead__name {
	font-family: var(--display);
	font-size: var(--t-md);
	letter-spacing: 0.06em;
	text-decoration: none;
}

.masthead__name em {
	font-style: italic;
	color: var(--rose);
}

.contents {
	display: flex;
	gap: clamp(1rem, 3vw, 2rem);
	align-items: baseline;
}

.contents a {
	text-decoration: none;
	color: var(--muted);
	font-size: var(--t-sm);
	display: inline-flex;
	align-items: baseline;
	gap: 0.4rem;
	padding-block: 0.25rem;
}

.contents a:hover {
	color: var(--parchment);
}

.contents a[aria-current="page"] {
	color: var(--parchment);
	box-shadow: inset 0 -1px 0 var(--rose);
}

.contents .numeral {
	font-family: var(--display);
	font-style: italic;
	color: var(--gilt);
	font-size: var(--t-xs);
}

/* --- Main ---------------------------------------------------------------- */

.page {
	flex: 1;
	padding-block: clamp(2.5rem, 7vw, 4.5rem) var(--chapter-gap);
}

/* Chapter opener shared by the interior pages */
.chapter-head {
	max-width: 44rem;
	margin-bottom: 2.75rem;
}

.chapter-head h1 {
	font-size: clamp(2.2rem, 5.5vw, 3.4rem);
	margin-bottom: 1rem;
}

/* Two-column reading layout: story on the left, Discord plate on the right */
.spread {
	display: grid;
	grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
	gap: clamp(2rem, 5vw, 3.5rem);
	align-items: start;
}

.spread__aside {
	position: sticky;
	top: 1.5rem;
	display: grid;
	gap: 1rem;
}

.rule {
	border: 0;
	border-top: 1px solid var(--rule);
	margin-block: var(--chapter-gap) 0;
}

/* --- Footer -------------------------------------------------------------- */

.colophon {
	border-top: 1px solid var(--rule);
	padding-block: 1.5rem 2.25rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.5rem;
	justify-content: space-between;
	align-items: center;
	color: var(--muted);
	font-size: var(--t-sm);
	position: relative;
	z-index: 1;
}

.colophon a {
	color: var(--muted);
}

.colophon__views {
	font-family: var(--display);
	font-style: italic;
}

@media (max-width: 860px) {
	.spread {
		grid-template-columns: 1fr;
	}
	.spread__aside {
		position: static;
	}
}

@media (max-width: 560px) {
	.masthead {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.5rem;
	}
	.contents {
		flex-wrap: wrap;
		gap: 0.75rem 1.1rem;
	}
}
