/* Feuilleteur de l'ebook (assets/js/ebook.js) : pages A4 (900 × 1273) qui tournent en 3D autour de la reliure. */
.ms-fb { --fb-page: min(420px, 40vw); --fb-ratio: 1273 / 900; --fb-turn: .9s; position: relative; }
.ms-fb__stage { display: flex; justify-content: center; padding: 10px 0 34px; }
.ms-fb__book {
	position: relative;
	width: calc(var(--fb-page) * 2);
	aspect-ratio: calc(2 * 900 / 1273);
	perspective: 2600px; /* sur le livre : ses feuilles tournent en vraie perspective */
	filter: drop-shadow(0 16px 20px rgba(27, 34, 51, .28)); /* une seule ombre, qui suit la page qui tourne */
	transition: transform var(--fb-turn) cubic-bezier(.645, .045, .355, 1);
	cursor: pointer;
	touch-action: pan-y;
	user-select: none;
}
/* Livre fermé : la couverture seule, centrée. */
.ms-fb:not(.is-open):not(.is-single) .ms-fb__book { transform: translateX(-25%); }

.ms-fb__sheet {
	position: absolute;
	top: 0;
	left: 50%;
	width: 50%;
	height: 100%;
	transform-origin: left center;
	transform-style: preserve-3d;
	transition: transform var(--fb-turn) cubic-bezier(.645, .045, .355, 1);
}
.ms-fb__sheet.is-turned { transform: rotateY(-180deg); }
.ms-fb__face {
	position: absolute;
	inset: 0;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	background: #F5EEE2;
	overflow: hidden;
}
.ms-fb__face--front { border-radius: 0 4px 4px 0; }
.ms-fb__face--back { transform: rotateY(180deg); border-radius: 4px 0 0 4px; }
.ms-fb__face > * { width: 100%; height: 100%; margin: 0; }
.ms-fb__face img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
/* Creux de la reliure, et ombre qui passe sur la page pendant qu'elle tourne. */
.ms-fb__face::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.ms-fb__face--front::after { background: linear-gradient(90deg, rgba(0, 0, 0, .16), rgba(0, 0, 0, .04) 4%, transparent 9%); }
.ms-fb__face--back::after { background: linear-gradient(270deg, rgba(0, 0, 0, .16), rgba(0, 0, 0, .04) 4%, transparent 9%); }
.ms-fb__sheet.is-turning .ms-fb__face::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background: linear-gradient(90deg, rgba(27, 34, 51, .22), rgba(255, 255, 255, .12) 60%, rgba(27, 34, 51, .1));
	animation: ms-fb-shade var(--fb-turn) ease-in-out both;
}
@keyframes ms-fb-shade { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }

/* Dernière page : l'invitation à recevoir le livre. */
.ms-fb__end { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 12%; background: #1B2233; color: #fff; text-align: left; }
.ms-fb__end b { font-family: var(--ms-cond); font-style: italic; font-weight: 900; text-transform: uppercase; font-size: clamp(30px, 3.2vw, 46px); line-height: .92; }
.ms-fb__end b em { color: var(--ms-accent); font-style: italic; }
.ms-fb__end p { margin: 0; color: #C9CBD6; font-size: 16px; line-height: 1.5; }
.ms-fb__end ul { margin: 0; padding: 0 0 0 18px; color: #fff; font-size: 15px; line-height: 1.7; }
.ms-fb__end .ms-btn { align-self: flex-start; margin-top: 8px; }

.ms-fb__nav { display: flex; align-items: center; justify-content: center; gap: 18px; }
.ms-fb__nav button {
	width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--ms-line); background: #fff;
	color: var(--ms-ink); font-size: 20px; line-height: 1; cursor: pointer;
}
.ms-fb__nav button:hover:not(:disabled) { border-color: var(--ms-ink); }
.ms-fb__nav button:disabled { opacity: .35; cursor: default; }
.ms-fb__status { min-width: 120px; text-align: center; font-size: 14px; color: var(--ms-muted); font-variant-numeric: tabular-nums; }

/* Sans JavaScript : les pages en simple liste qui défile. */
.ms-fb:not(.is-ready) .ms-fb__stage, .ms-fb:not(.is-ready) .ms-fb__nav { display: none; }
.ms-fb__pages { display: flex; gap: 16px; overflow-x: auto; }
.ms-fb__pages > * { flex: 0 0 min(300px, 78vw); aspect-ratio: 900 / 1273; }
.ms-fb.is-ready .ms-fb__pages { display: none; }

/* Téléphone : une page à la fois, qui tourne vers la gauche. */
.ms-fb.is-single { --fb-page: min(340px, calc(100vw - 48px)); }
.ms-fb.is-single .ms-fb__book { perspective: 1600px; }
/* La page tournée disparaît passé la tranche (pas de verso en simple page). */
.ms-fb.is-single .ms-fb__face--back { display: none; }
.ms-fb.is-single .ms-fb__book { width: var(--fb-page); aspect-ratio: 900 / 1273; }
.ms-fb.is-single .ms-fb__sheet { left: 0; width: 100%; }
.ms-fb.is-single .ms-fb__face--front { border-radius: 4px; }
.ms-fb.is-single .ms-fb__face--front::after { background: linear-gradient(90deg, rgba(0, 0, 0, .1), transparent 5%); }
.ms-fb.is-single .ms-fb__end b { font-size: 34px; }

@media (prefers-reduced-motion: reduce) {
	.ms-fb { --fb-turn: 0s; }
}
