/* ============================================================
 * BOOK CLUB — front end
 * ============================================================ */

.bc-root {
	--bc-rest: -32deg;
	box-sizing: border-box;
	width: 100%;
}
.bc-root *,
.bc-root *::before,
.bc-root *::after {
	box-sizing: border-box;
}

/* ---- Back button (matches the galleries: a plain black arrow) ---- */
.bc-back {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0 0 24px;
	padding: 6px;
	color: #000;
	background: none;
	border: 0;
	cursor: pointer;
	line-height: 0;
	transition: opacity 0.15s ease;
}
.bc-back:hover {
	opacity: 0.55;
}
.bc-back svg {
	display: block;
}

/* ---- Shelf grid: responsive. Columns fit the screen and never squish below a
 *      book's width; on wide screens they cap at per_row and center. ---- */
.bc-shelf {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(var(--bc-col, 170px), 100%), 1fr));
	column-gap: var(--bc-gap, 46px);
	row-gap: calc(var(--bc-gap, 46px) * 1.15);
	align-items: end;
	justify-items: center;
	max-width: calc(var(--bc-cols, 5) * var(--bc-col, 170px) + (var(--bc-cols, 5) - 1) * var(--bc-gap, 46px));
	margin: 0 auto;
}

.bc-scene {
	perspective: 1300px;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

/* ---- A single 3D book ---- */
.bc-book {
	position: relative;
	transform-style: preserve-3d;
	transform: rotateY(var(--bc-rest));
	transform-origin: center;
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
	cursor: pointer;
}
.bc-book:hover {
	transform: rotateY(0deg);
}

/* Alignment: left instead of centered */
.bc-align-left .bc-shelf {
	margin: 0;
	justify-items: start;
}

/* Rest showing the front cover (instead of the page edge) */
.bc-rest-cover {
	--bc-rest: 0deg;
}
.bc-rest-cover .bc-book {
	transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bc-rest-cover .bc-book:hover {
	transform: translateY(-8px) rotateY(0deg);
}

.bc-face {
	position: absolute;
	top: 0;
}

.bc-cover {
	left: 0;
	width: 100%;
	height: 100%;
	transform: translateZ(calc(var(--bc-d, 16px) / 2));
	border-radius: 2px;
	background: #e8e5dd;
	overflow: hidden;
}
.bc-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* The fore-edge (stacked page side) — its width is the book's thickness */
.bc-pages {
	left: calc(50% - var(--bc-d, 16px) / 2);
	width: var(--bc-d, 16px);
	height: 100%;
	transform: rotateY(90deg) translateZ(var(--bc-hw, 50px));
	background: repeating-linear-gradient(
		to right,
		#efece4,
		#efece4 1px,
		#d6d2c5 1px,
		#d6d2c5 2px
	);
	border-radius: 0 2px 2px 0;
}

@media (max-width: 600px) {
	.bc-shelf {
		grid-template-columns: repeat(var(--bc-mcols, 2), minmax(0, 1fr));
		max-width: none;
		column-gap: 16px;
		row-gap: 26px;
	}
	.bc-scene {
		min-width: 0;
	}
}

/* ============================================================
 * Lightbox
 * ============================================================ */
.bc-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(15, 15, 17, 0.62);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s ease;
	font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
.bc-lb.bc-on {
	opacity: 1;
	visibility: visible;
}
.bc-lb-close {
	position: absolute;
	top: 16px;
	right: 22px;
	font: 26px/1 ui-monospace, Menlo, monospace;
	color: #fff;
	background: none;
	border: 0;
	cursor: pointer;
	opacity: 0.85;
	padding: 4px 8px;
}
.bc-lb-close:hover {
	opacity: 1;
}

/* ---- Desktop: open-book spread. Two equal flex halves are always the same
 *      height and meet flush at the gutter. The inside cover sits flat at rest and
 *      only swings on open via a one-shot animation that always lands perfectly
 *      flat — so it can never settle foreshortened. ---- */
.bc-spread {
	display: flex;
	align-items: stretch;
	height: min(70vh, 500px);
	width: calc(min(70vh, 500px) * 1.4);
	perspective: 2200px;
	transform: scale(0.93);
	opacity: 0;
	transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.4s ease;
}
.bc-lb.bc-on .bc-spread {
	transform: scale(1);
	opacity: 1;
}

.bc-leaf,
.bc-rpage {
	flex: 0 0 50%;
	min-width: 0;
}
.bc-rpage {
	background: #f5f2ea;
	border-radius: 0 5px 5px 0;
	box-shadow: inset 18px 0 30px -22px rgba(0, 0, 0, 0.36);
	padding: 34px 30px;
	display: flex;
	flex-direction: column;
	overflow: auto;
}
.bc-leaf {
	background: #ece7dc;
	border-radius: 5px 0 0 5px;
	box-shadow: inset -18px 0 30px -22px rgba(0, 0, 0, 0.32);
	transform-origin: right center;
	transform: rotateY(0deg);
	backface-visibility: hidden;
}
.bc-lb.bc-on .bc-leaf {
	animation: bc-leaf-open 0.85s cubic-bezier(0.33, 0.66, 0.2, 1) both;
}
@keyframes bc-leaf-open {
	from {
		transform: rotateY(-26deg);
	}
	to {
		transform: rotateY(0deg);
	}
}

.bc-lb .bc-t {
	font: 700 21px/1.2 ui-monospace, Menlo, monospace;
	color: #1a1a1a;
	margin: 0 0 6px;
}
.bc-lb .bc-a {
	font: 13px/1.4 ui-monospace, Menlo, monospace;
	color: #6a6a6a;
	margin: 0 0 3px;
}
.bc-lb .bc-m {
	font: 11px/1.4 ui-monospace, Menlo, monospace;
	color: #9a9a9a;
	letter-spacing: 0.5px;
	margin: 0 0 16px;
}
.bc-lb .bc-syn {
	font: 12.5px/1.65 ui-monospace, Menlo, monospace;
	color: #2c2c2c;
	margin: 0 0 18px;
	flex: 1;
}
.bc-lb .bc-link {
	font: 12px/1.4 ui-monospace, Menlo, monospace;
	color: #1a1a1a;
	text-decoration: underline;
	text-underline-offset: 3px;
	display: inline-block;
}

/* ---- Mobile: a clean card (the open-book metaphor doesn't fit narrow screens) ---- */
.bc-card {
	display: none;
}
@media (max-width: 680px) {
	.bc-spread {
		display: none;
	}
	.bc-card {
		display: flex;
		flex-direction: column;
		width: min(88vw, 360px);
		max-height: 86vh;
		overflow: auto;
		background: #ffffff;
		border-radius: 8px;
		transform: scale(0.95);
		opacity: 0;
		transition: transform 0.4s ease, opacity 0.35s ease;
	}
	.bc-lb.bc-on .bc-card {
		transform: scale(1);
		opacity: 1;
	}
	.bc-card .bc-ctop {
		padding: 34px 26px 24px;
		display: flex;
		justify-content: center;
		background: #ffffff;
		border-radius: 8px 8px 0 0;
	}
	.bc-card .bc-ctop img {
		height: 230px;
		width: auto;
		max-width: 70%;
		border-radius: 3px;
		box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22);
	}
	.bc-card .bc-cbody {
		padding: 0 26px 28px;
		text-align: center;
	}
}
