/* --brand comes from the admin, set in the page head. Fonts are self-hosted (SIL OFL). */
@font-face {
	font-family: 'Manrope';
	src: url('/assets/fonts/manrope.woff2') format('woff2');
	font-weight: 200 800;
	font-display: swap;
}

@font-face {
	font-family: 'Poppins';
	src: url('/assets/fonts/poppins-400.woff2') format('woff2');
	font-weight: 400;
	font-display: swap;
}

@font-face {
	font-family: 'Poppins';
	src: url('/assets/fonts/poppins-500.woff2') format('woff2');
	font-weight: 500;
	font-display: swap;
}

@font-face {
	font-family: 'Poppins';
	src: url('/assets/fonts/poppins-600.woff2') format('woff2');
	font-weight: 600;
	font-display: swap;
}

:root {
	--bg: #f5f5f5;
	--surface: #ffffff;
	--text: #141414;
	--muted: #5e5e5e;
	--line: #e3e3e3;
	--ink: #111111;
	--error: #b3261e;
	--radius: 22px;
	--shadow: 0 24px 60px -32px rgb(0 0 0 / 0.3);
	--headings: 'Manrope', 'Helvetica Neue', Arial, sans-serif;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

[hidden] {
	display: none !important;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: 'Poppins', 'Helvetica Neue', Arial, sans-serif;
	font-size: 16px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

h1,
h2 {
	font-family: var(--headings);
	font-weight: 500;
	letter-spacing: -0.02em;
	line-height: 1.15;
}

h1 {
	margin: 0 0 16px;
	font-size: clamp(2rem, 4.2vw, 2.9rem);
}

h2 {
	margin: 32px 0 10px;
	font-size: 1.45rem;
}

a {
	color: inherit;
	text-underline-offset: 3px;
}

img {
	display: block;
	max-width: 100%;
	height: auto;
}

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

.small {
	color: var(--muted);
	font-size: 0.85rem;
	line-height: 1.55;
}

.eyebrow {
	margin: 0 0 10px;
	color: var(--brand);
	font-size: 0.8rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.test-banner {
	margin: 0;
	padding: 6px 16px;
	background: var(--ink);
	color: #ffffff;
	font-size: 0.8rem;
	text-align: center;
}

/* Header */
.site-header {
	position: sticky;
	top: 0;
	z-index: 10;
	border-bottom: 1px solid var(--line);
	background: rgb(255 255 255 / 0.94);
	backdrop-filter: blur(10px);
}

.header-inner {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 28px;
	max-width: 1180px;
	margin: 0 auto;
	padding: 12px 20px;
}

.site-logo {
	font-family: var(--headings);
	font-size: 1.3rem;
	font-weight: 600;
	text-decoration: none;
}

.site-logo img {
	width: auto;
	height: 46px;
}

.site-nav {
	display: flex;
	justify-content: center;
	gap: 6px 28px;
	font-size: 0.95rem;
	white-space: nowrap;
}

.site-nav a {
	padding: 6px 0;
	text-decoration: none;
}

.site-nav a:hover,
.site-nav .is-active {
	text-decoration: underline;
	text-decoration-thickness: 1.5px;
}

.cart-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 6px 18px;
	border: 1.5px solid var(--ink);
	border-radius: 999px;
	font-size: 0.95rem;
	text-decoration: none;
}

.cart-link:hover {
	background: var(--ink);
	color: #ffffff;
}

.cart-count {
	min-width: 22px;
	padding: 0 7px;
	border-radius: 11px;
	background: var(--brand);
	color: #ffffff;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 22px;
	text-align: center;
}

/* Page frame */
.site-main {
	min-height: 60vh;
	padding: 40px 20px 88px;
}

.site-main > * {
	max-width: 1180px;
	margin-inline: auto;
}

.panel {
	padding: clamp(24px, 4vw, 48px);
	border-radius: var(--radius);
	background: var(--surface);
}

.narrow-page {
	max-width: 780px;
}

.message {
	max-width: 640px;
	text-align: center;
}

.message h1 {
	font-size: clamp(1.7rem, 3.4vw, 2.3rem);
}

.success-mark {
	display: grid;
	place-items: center;
	width: 60px;
	height: 60px;
	margin: 0 auto 18px;
	border-radius: 50%;
	background: var(--brand);
	color: #ffffff;
	font-size: 1.6rem;
}

/* Footer */
.site-footer {
	border-top: 1px solid var(--line);
	background: var(--surface);
}

.footer-inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 20px 32px;
	max-width: 1180px;
	margin: 0 auto;
	padding: 36px 20px;
	font-size: 0.9rem;
}

.footer-brand {
	display: grid;
}

.footer-brand strong {
	font-family: var(--headings);
	font-size: 1.1rem;
	font-weight: 600;
}

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

.footer-links {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 22px;
}

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

/* Buttons and forms */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 11px 28px;
	border: 1.5px solid var(--ink);
	border-radius: 999px;
	background: transparent;
	color: var(--ink);
	font: inherit;
	font-weight: 500;
	text-decoration: none;
	cursor: pointer;
	transition:
		background 0.15s,
		color 0.15s;
}

.btn-primary {
	background: var(--ink);
	color: #ffffff;
}

.btn-primary:hover {
	background: #333333;
}

.btn-outline:hover {
	background: var(--ink);
	color: #ffffff;
}

.btn-block {
	width: 100%;
	min-height: 54px;
}

.btn:disabled {
	opacity: 0.55;
	cursor: wait;
}

.link-button {
	padding: 0;
	border: 0;
	background: none;
	color: var(--muted);
	font: inherit;
	font-size: 0.85rem;
	text-decoration: underline;
	cursor: pointer;
}

.field {
	display: grid;
	gap: 6px;
	font-size: 0.9rem;
	font-weight: 500;
}

.field input,
.field select {
	width: 100%;
	min-height: 48px;
	padding: 10px 14px;
	border: 1px solid #c9c9c9;
	border-radius: 12px;
	background: var(--surface);
	color: var(--text);
	font: inherit;
	font-size: 1rem;
	font-weight: 400;
}

.check {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	font-size: 0.9rem;
	line-height: 1.55;
}

.check input {
	flex: none;
	width: 20px;
	height: 20px;
	margin: 1px 0 0;
	accent-color: var(--ink);
}

.stack {
	display: grid;
	gap: 18px;
}

.form-error {
	margin: 0;
	padding: 10px 14px;
	border-radius: 12px;
	background: #fbeaea;
	color: var(--error);
	font-size: 0.9rem;
}

.honeypot {
	position: absolute;
	left: -9999px;
}

.cover-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 2 / 3;
	padding: 14px;
	border-radius: 12px;
	background: var(--brand);
	color: #ffffff;
	font-family: var(--headings);
	font-size: 1.2rem;
	line-height: 1.25;
	text-align: center;
}

/* Home */
.site-main > .hero {
	position: relative;
	max-width: none;
	margin: -40px -20px 0;
	padding: 76px 20px 136px;
	background:
		radial-gradient(120% 150% at 12% 0%, rgb(255 255 255 / 0.16), transparent 55%),
		radial-gradient(90% 120% at 100% 100%, rgb(0 0 0 / 0.28), transparent 60%),
		var(--brand);
	color: #ffffff;
	text-align: center;
}

.hero-inner {
	max-width: 760px;
	margin: 0 auto;
}

.hero .eyebrow {
	color: rgb(255 255 255 / 0.85);
}

.hero h1 {
	margin: 0;
	font-size: clamp(2.1rem, 5vw, 3.5rem);
}

.wave {
	position: absolute;
	right: 0;
	bottom: -1px;
	left: 0;
	width: 100%;
	height: 64px;
	fill: var(--bg);
}

.books {
	position: relative;
	display: grid;
	gap: 32px;
	margin-top: -84px;
}

.book-feature {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
	align-items: center;
	overflow: hidden;
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow);
}

.book-feature-image {
	padding: 28px;
}

.book-feature-image img {
	width: 100%;
	max-height: 520px;
	object-fit: contain;
}

.book-feature-text {
	padding: 48px 56px 48px 12px;
}

.book-feature-text h2 {
	margin: 0 0 14px;
	font-size: clamp(1.7rem, 3vw, 2.3rem);
}

.book-feature-text h2 a {
	text-decoration: none;
}

.teaser {
	margin: 0 0 22px;
	white-space: pre-line;
	color: var(--muted);
	font-size: 1.05rem;
}

.edition-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 28px;
	padding: 0;
	list-style: none;
}

.edition-chips li {
	padding: 6px 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	font-size: 0.88rem;
}

.edition-chips b {
	margin-left: 4px;
	font-weight: 600;
}

/* Book page: CSS shows only the checked edition's pictures and panel. */
.book:not(:has(#edition-hardcover:checked)) [data-edition='hardcover'],
.book:not(:has(#edition-softcover:checked)) [data-edition='softcover'],
.book:not(:has(#edition-ebook:checked)) [data-edition='ebook'] {
	display: none;
}

.book {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
	align-items: start;
	gap: 56px;
}

.gallery {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.gallery img {
	width: 100%;
	border-radius: var(--radius);
	background: var(--surface);
}

.gallery img:first-child,
.gallery img:last-child:nth-child(even) {
	grid-column: 1 / -1;
}

.book-info h1 {
	margin-bottom: 8px;
}

.edition-picker {
	display: grid;
	grid-auto-columns: minmax(0, 1fr);
	grid-auto-flow: column;
	gap: 10px;
	margin: 24px 0 22px;
	padding: 0;
	border: 0;
}

.edition-picker legend {
	margin-bottom: 10px;
	padding: 0;
	color: var(--muted);
	font-size: 0.78rem;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.edition-picker label {
	position: relative;
	display: grid;
	padding: 12px 16px;
	border: 1.5px solid var(--line);
	border-radius: 16px;
	background: var(--surface);
	cursor: pointer;
	transition: border-color 0.15s;
}

.edition-picker label:hover {
	border-color: #9a9a9a;
}

.edition-picker label:has(input:checked) {
	border-color: var(--ink);
	box-shadow: inset 0 0 0 1px var(--ink);
}

.edition-picker label:has(input:focus-visible) {
	outline: 2px solid var(--brand);
	outline-offset: 2px;
}

.edition-picker input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.edition-picker span {
	color: var(--muted);
	font-size: 0.85rem;
}

.edition-picker b {
	font-size: 1.15rem;
	font-weight: 600;
}

.edition-single {
	margin: 20px 0 8px;
	font-weight: 500;
}

.facts {
	margin: 0 0 22px;
	padding: 0;
	border-top: 1px solid var(--line);
	list-style: none;
	font-size: 0.92rem;
}

.facts li {
	display: grid;
	grid-template-columns: 8.5rem 1fr;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var(--line);
}

.facts span {
	color: var(--muted);
}

.facts .fact-note {
	display: block;
	color: var(--muted);
}

.added-note {
	margin: 10px 0 0;
	font-size: 0.9rem;
	text-align: center;
}

.book-info > .small {
	margin: 14px 0 0;
}

.prose {
	margin-top: 40px;
	padding-top: 8px;
	border-top: 1px solid var(--line);
}

.prose p {
	margin: 0 0 16px;
}

.prose a {
	color: var(--brand);
}

.panel.prose {
	margin-top: 0;
	border-top: 0;
}

.panel.prose h1 {
	margin-bottom: 8px;
}

.table-wrap {
	margin-bottom: 20px;
	overflow-x: auto;
}

.zones {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.zones th,
.zones td {
	padding: 12px 10px 12px 0;
	border-bottom: 1px solid var(--line);
	text-align: left;
	white-space: nowrap;
}

.zones th {
	color: var(--muted);
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* Cart */
.cart-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 400px;
	align-items: start;
	gap: 32px;
}

.cart-lines {
	display: grid;
	gap: 12px;
}

.cart-line {
	display: grid;
	grid-template-columns: 76px 1fr auto;
	gap: 16px;
	padding: 16px;
	border-radius: 18px;
	background: var(--surface);
}

.cart-thumb {
	width: 76px;
	height: 76px;
	padding: 0;
	border-radius: 10px;
	object-fit: contain;
}

.cart-line-info {
	display: grid;
	gap: 2px;
	align-content: start;
	min-width: 0;
}

.cart-line-info strong {
	font-weight: 500;
	line-height: 1.35;
}

.cart-line-side {
	display: grid;
	gap: 8px;
	align-content: space-between;
	justify-items: end;
}

.price {
	font-weight: 600;
	white-space: nowrap;
}

.qty {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-top: 8px;
}

.qty span {
	min-width: 30px;
	text-align: center;
}

.qty button {
	width: 36px;
	height: 36px;
	border: 1px solid #c9c9c9;
	border-radius: 50%;
	background: var(--surface);
	color: var(--text);
	font-size: 1.1rem;
	cursor: pointer;
}

.qty button:disabled {
	opacity: 0.4;
	cursor: default;
}

.checkout {
	position: sticky;
	top: 96px;
	display: grid;
	gap: 16px;
}

.checkout h2 {
	margin: 0;
	font-size: 1.3rem;
}

.checkout .small {
	margin: 0;
}

.totals {
	margin: 0;
	padding: 12px 0;
	border-top: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
}

.totals > div {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 3px 0;
}

.totals dt {
	color: var(--muted);
}

.totals dd {
	margin: 0;
	text-align: right;
}

.totals .total {
	margin-top: 6px;
	font-size: 1.15rem;
	font-weight: 600;
}

.totals .total dt {
	color: var(--text);
}

.downloads {
	display: grid;
	gap: 10px;
	max-width: 420px;
	margin: 24px auto;
}

/* Tablet and phone */
@media (max-width: 920px) {
	.header-inner {
		grid-template-columns: 1fr auto;
		gap: 4px 16px;
		padding-bottom: 6px;
	}

	.site-nav {
		grid-column: 1 / -1;
		order: 3;
		justify-content: flex-start;
		margin: 0 -20px;
		padding: 0 20px;
		overflow-x: auto;
		scrollbar-width: none;
	}

	.book,
	.book-feature,
	.cart-layout {
		grid-template-columns: minmax(0, 1fr);
	}

	.book {
		gap: 28px;
	}

	.book-feature-text {
		padding: 0 28px 32px;
	}

	.checkout {
		position: static;
	}
}

@media (max-width: 600px) {
	.site-main {
		padding-top: 24px;
	}

	.site-main > .hero {
		margin-top: -24px;
		padding: 48px 20px 120px;
	}

	.site-logo img {
		height: 38px;
	}

	/* Swipe through the pictures. */
	.gallery {
		display: flex;
		gap: 12px;
		margin: 0 -20px;
		padding: 0 20px;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
	}

	.gallery img {
		flex: 0 0 86%;
		scroll-snap-align: center;
	}

	.gallery img:only-child {
		flex-basis: 100%;
	}

	.book-feature-image {
		padding: 20px 20px 4px;
	}

	.book-feature-text {
		padding: 0 22px 28px;
	}

	.facts li {
		grid-template-columns: 7rem 1fr;
	}

	.edition-picker {
		gap: 8px;
	}

	.edition-picker label {
		padding: 10px 12px;
	}

	.edition-picker b {
		font-size: 1rem;
	}

	.hero h1 {
		font-size: 1.9rem;
	}

	.site-nav {
		gap: 20px;
	}

	.zones {
		font-size: 0.85rem;
	}

	.zones th {
		white-space: normal;
	}

	.cart-line {
		grid-template-columns: 60px 1fr auto;
		gap: 12px;
	}

	.cart-thumb {
		width: 60px;
		height: 60px;
	}

	.footer-inner {
		flex-direction: column;
		align-items: flex-start;
	}
}
