/**handles:saytar-campaign-book**/
/* Campaign book — sequential spine-fold flip-book with mid-turn text reveal
   Rendered by [campaign_book] in inc/campaign-book.php
   Behaviour (z-index, turn state) is driven by assets/js/campaign-book.js */

.fbook {
	--fb-accent: #2bb3e0;
	--fb-paper: #faf8f4;
	position: relative;
	width: 1000px;
	max-width: 100%;
	margin: 0 auto;
	padding: 0 0 56px;
	box-sizing: border-box;
}

.fbook__stage {
	position: relative;
	height: 540px;
	perspective: 2200px;
}

.fbook__pages {
	position: absolute;
	inset: 0;
	transform-style: preserve-3d;
}

.fbook__page {
	position: absolute;
	inset: 0;
	display: grid;
	grid-template-columns: 1fr 1fr;
	transform-style: preserve-3d;
	box-shadow: 0 18px 50px rgba(16, 24, 40, 0.08);
	border-radius: 14px;
}

.fbook__half {
	position: relative;
	height: 100%;
}

.fbook__zone {
	cursor: pointer;
}

.fbook__half--left {
	background: #fff;
	border: 1px solid #e6ebf1;
	border-right: none;
	border-radius: 14px 0 0 14px;
}

.fbook__inner {
	height: 100%;
	padding: 64px 56px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.fbook__half--right {
	transform-style: preserve-3d;
}

.fbook__leaf {
	position: absolute;
	inset: 0;
	transform-origin: left center; /* spine hinge */
	transform: rotateY(0deg);
	transition: transform 1s ease;
	transform-style: preserve-3d;
}

.fbook__page.is-turned .fbook__leaf {
	transform: rotateY(-180deg);
}

.fbook__face {
	position: absolute;
	inset: 0;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	border: 1px solid #e6ebf1;
	overflow: hidden;
}

.fbook__face--front {
	background: #eef2f7;
	border-left: none;
	border-radius: 0 14px 14px 0;
}

.fbook__face--front img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Back face carries the NEXT page text; pre-rotated 180deg so it reads
   correctly once the leaf passes the midpoint of the fold. */
.fbook__face--back {
	transform: rotateY(180deg);
	background: var(--fb-paper);
	border-right: none;
	border-radius: 14px 0 0 14px;
}

.fbook__face--back .fbook__inner {
	padding: 64px 56px;
}

/* Soft spine shadow down the centre */
.fbook__page::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 26px;
	transform: translateX(-50%);
	background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.08) 50%, rgba(0, 0, 0, 0) 100%);
	pointer-events: none;
	z-index: 4;
}

/* Text styling */
.fbook__pre {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--fb-accent);
	margin-bottom: 18px;
}

.fbook__head {
	margin: 0 0 22px;
	font-size: 34px;
	font-weight: 600;
	line-height: 1.2;
	color: #1a202c;
}

.fbook__desc {
	margin: 0;
	font-size: 16px;
	font-style: italic;
	line-height: 1.65;
	color: #6b7280;
}

.fbook__accent {
	display: block;
	width: 48px;
	height: 4px;
	border-radius: 2px;
	background: var(--fb-accent);
	margin-top: 40px;
}

/* Footer: counter + progress */
.fbook__footer {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	margin-top: 22px;
}

.fbook__counter {
	font-size: 15px;
	color: #4a5568;
}

.fbook__counter .fbook__current {
	font-weight: 800;
	color: #1a202c;
}

.fbook__counter .fbook__of {
	color: #a0aec0;
}

.fbook__progress {
	width: 340px;
	max-width: 70%;
	height: 6px;
	background: #e6ebf1;
	border-radius: 999px;
	overflow: hidden;
}

.fbook__progress-fill {
	height: 100%;
	width: 0%;
	border-radius: 999px;
	background: linear-gradient(90deg, #f5c542, #f0a921);
	transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================================
   MOBILE: swipeable card slider (one page at a time).
   The 3D fold is desktop-only; on phones each page becomes a flat
   card — text on top, image below — and the user swipes/taps between
   pages. The counter + progress bar are reused as-is. All desktop
   rules above this query are untouched.
   ============================================================ */
@media (max-width: 820px) {

	.fbook {
		padding: 0 0 48px;
	}

	/* Kill the 3D context. */
	.fbook__stage {
		height: auto;
		perspective: none;
		overflow: hidden; /* clip the off-screen slides */
	}

	/* The pages container becomes the sliding viewport. */
	.fbook__pages {
		position: relative;
		inset: auto;
		transform-style: flat;
		min-height: 460px;
	}

	/* Each page is a flat, single-column card stacked in one cell so
	   only the active one is visible; others slide out horizontally. */
	.fbook__page {
		position: absolute;
		inset: 0;
		display: flex;
		flex-direction: column;
		grid-template-columns: none;
		margin: 0;
		border-radius: 14px;
		overflow: hidden;
		background: #fff;
		border: 1px solid #e6ebf1;
		opacity: 0;
		transform: translateX(40px);
		transition: transform 0.4s ease, opacity 0.4s ease;
		pointer-events: none;
	}
	.fbook__page.is-active {
		position: relative;
		opacity: 1;
		transform: translateX(0);
		pointer-events: auto;
		z-index: 2 !important;
	}
	/* Already-seen pages slide off to the left. */
	.fbook__page.is-turned {
		transform: translateX(-40px);
	}

	/* No spine shadow on mobile. */
	.fbook__page::after { display: none; }

	/* TEXT ON TOP: the left half (text) comes first in source, so it
	   naturally sits on top in the column. Reset its desktop framing. */
	.fbook__half--left {
		order: 1;
		border: none;
		border-radius: 0;
		background: transparent;
	}
	.fbook__half--left .fbook__inner {
		height: auto;
		padding: 30px 26px 22px;
		text-align: left !important;
	}

	/* IMAGE BELOW: the right half holds the leaf/front face. Flatten it. */
	.fbook__half--right {
		order: 2;
		transform-style: flat;
	}
	.fbook__leaf {
		position: relative;
		inset: auto;
		transform: none !important;
		transition: none;
		transform-style: flat;
	}
	.fbook__face {
		position: relative;
		inset: auto;
		border: none;
		border-radius: 0;
		backface-visibility: visible;
		-webkit-backface-visibility: visible;
	}
	/* The back face (next page's text) is desktop-only; hide on mobile. */
	.fbook__face--back { display: none; }

	.fbook__face--front {
		background: #eef2f7;
		border-radius: 0;
	}
	.fbook__face--front img {
		width: 100%;
		height: 240px;
		object-fit: cover;
		display: block;
	}

	/* Text sizing for narrow screens. */
	.fbook__head { font-size: 24px; margin-bottom: 14px; }
	.fbook__desc { font-size: 15px; }
	.fbook__accent { margin-top: 24px; }

	/* Footer counter + progress stay; nudge spacing. */
	.fbook__footer { margin-top: 18px; }

	/* Hint that the area is swipeable. */
	.fbook__stage { touch-action: pan-y; cursor: grab; }
}