/* Farid Books Carousel — scoped prefixes .fbc-* */

.fbc-heading {
	margin: 0 0 1rem;
	font-size: clamp(1.25rem, 2.5vw, 1.75rem);
	text-align: center;
}

.fbc-empty {
	padding: 1.5rem;
	text-align: center;
	color: #555;
	border: 1px dashed #ccc;
	border-radius: 0;
}

.fbc-carousel {
	/* Référence : bandeau horizontal, vignettes sans interstice, même hauteur, coins droits */
	--fbc-strip-height: clamp(300px, 22vw, 470px);
	--fbc-frame: #174a38;
	/* WebKit + RTL : le défilement horizontal par scrollLeft est fiable en LTR */
	direction: ltr;
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin-inline: auto;
	padding: 0;
	margin-block: 1.5rem 2rem;
	border: 1px solid var(--fbc-frame);
	border-radius: 0;
	background: transparent;
}

.fbc-carousel__toolbar {
	pointer-events: none;
	position: absolute;
	inset-block: clamp(0.65rem, 2vw, 1.25rem);
	inset-inline: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	z-index: 2;
	padding-inline: 4px;
}

/* Carousel arrows use same visual style as modal navigation. */
.fbc-carousel__btn {
	pointer-events: auto;
	position: relative;
	display: grid;
	place-items: center;
	min-width: 42px;
	width: clamp(42px, 4.8vw, 56px);
	height: clamp(42px, 4.8vw, 56px);
	border-radius: 0;
	border: 0;
	background: rgba(20, 20, 20, 0.6);
	color: #fff;
	font-size: clamp(2rem, 4vw, 2.8rem);
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
	transition: background 0.15s ease;
}

.fbc-carousel__btn:hover,
.fbc-carousel__btn:focus-visible {
	background: rgba(10, 10, 10, 0.82);
	outline: 2px solid rgba(255, 255, 255, 0.9);
	outline-offset: 2px;
}

.fbc-carousel__btn > span {
	display: block;
	transform: translateY(-0.08em);
}

.fbc-carousel__viewport {
	/* scroll : meilleure prise en charge du scroll programmatique (Safari / WebKit) */
	overflow-x: scroll;
	overflow-y: hidden;
	box-sizing: border-box;
	width: 100%;
	max-height: min(92vh, calc(var(--fbc-strip-height) + 5.5rem));
	/* Dans une colonne flex/grid, permet au scroll horizontal d’être calculé au lieu du contenu “cassé”. */
	min-width: 0;
	max-width: 100%;
	scroll-snap-type: none; /* évite blocage avec scrollLeft continu (anciennement mandatory) */
	scrollbar-width: none;
	-ms-overflow-style: none;
	scroll-behavior: auto;
	-webkit-overflow-scrolling: touch;
	/* Empêche le navigateur de convertir le geste en scroll vertical de la page. */
	touch-action: none;
	overscroll-behavior: contain;
	cursor: grab;
	border-radius: 0;
	outline-offset: -1px;
}

.fbc-carousel__viewport::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}

.fbc-carousel__viewport.fbc-waapi-autoplay {
	overflow-x: hidden !important;
	-webkit-overflow-scrolling: auto;
	isolation: isolate;
}

.fbc-carousel__viewport.fbc-waapi-autoplay .fbc-carousel__track {
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

/* touch-action ne s’hérite pas : appliquer sur les cibles réelles du doigt. */
.fbc-carousel__track,
.fbc-carousel__track .fbc-book,
.fbc-carousel__track .fbc-cover-hit,
.fbc-carousel__track .fbc-cover-img {
	touch-action: none;
}

.fbc-carousel__viewport:active {
	cursor: grabbing;
}

.fbc-carousel__track {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: flex-start;
	gap: 4px; /* espacement demandé entre couvertures */
	/* Marge visuelle à gauche : le 1er livre commence 50px à droite du bord du viewport (scrollLeft 0). */
	padding: 0;
	padding-inline-start: 0px; /* position de départ du 1er livre */
	transform-origin: 0 50%;
	/*
	 * Indispensable pour scrollWidth dans Divi/colonnes : sinon le rail prend parfois
	 * uniquement la largeur du viewport (maxScroll = 0 → autoplay inactif alors que les flèches peuvent “bouger”).
	 */
	width: max-content;
	min-width: 100%;
	box-sizing: border-box;
}

.fbc-book {
	position: relative;
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	flex-wrap: nowrap;
	align-items: center;
	gap: 8px;
	width: max-content;
	max-width: min(100%, calc(100vw - 16px));
	box-sizing: border-box;
	padding: 0 0 6px;
	margin: 0;
	border-radius: 0;
	background: transparent;
	border: none;
	box-shadow: none;
	scroll-snap-align: start;
}

/*
 * Titres hors écran (toujours accessibles avec lecteur d'écran là où ils sont encore exposés dans l'arbre du document).
 */
.fbc-carousel .fbc-book__title {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.fbc-book__cover {
	flex: 0 0 auto;
	margin: 0;
	padding: 0;
	line-height: 0;
	background: transparent;
	border-radius: 0;
	overflow: hidden;
	max-height: 470px;
	width: max-content;
	max-width: 100%;
}

.fbc-cover-hit {
	display: block;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	line-height: 0;
	border-radius: 0;
	cursor: grab;
	max-width: 100%;
	font: inherit;
	color: inherit;
	text-align: inherit;
}

.fbc-cover-hit:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.95);
	outline-offset: 2px;
}

.fbc-cover-img {
	height: var(--fbc-strip-height);
	max-height: 470px;
	width: auto;
	max-width: 100%;
	object-fit: contain;
	vertical-align: top;
	display: block;
	pointer-events: none;
}

/* Colonne CTA : ligne 1 = Acheter + Extrait, ligne 2 = 4e de couverture */
.fbc-book__cta-stack {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 4px;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

.fbc-book__cta-row {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: stretch;
	justify-content: stretch;
	gap: 2px;
	width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

.fbc-book__cta-row--bottom > .fbc-cta,
.fbc-book__cta-row--bottom > .fbc-cta--disabled {
	flex: 1 1 100%;
	width: 100%;
	min-width: 0;
}

.fbc-cta {
	appearance: none;
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 0;
	min-width: 0;
	padding: 0.42rem 0.18rem;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: #f59f00;
	color: #fff;
	font-family: inherit;
	font-size: clamp(0.52rem, 0.95vw, 0.68rem);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.fbc-cta:hover,
.fbc-cta:focus-visible {
	background: #e08e00;
	color: #fff;
	outline: 2px solid rgba(255, 255, 255, 0.95);
	outline-offset: 2px;
}

.fbc-cta--disabled {
	opacity: 0.42;
	cursor: not-allowed;
	pointer-events: none;
}

.fbc-carousel__viewport.fbc-touch-capture,
.fbc-carousel__viewport.fbc-is-dragging {
	cursor: grabbing;
	user-select: none;
	touch-action: none;
	-webkit-user-select: none;
}

/* Boutons / liens : conserver le comportement tactile natif. */
.fbc-book__cta-stack,
.fbc-book__cta-stack * {
	touch-action: manipulation;
}

@media (prefers-reduced-motion: reduce) {
	.fbc-carousel__btn,
	.fbc-cta {
		transition: none;
	}
}

/* Modal */
.fbc-modal[hidden] {
	display: none;
}

.fbc-modal:not([hidden]) {
	display: flex;
	flex-direction: column;
	position: fixed;
	inset: 0;
	min-height: 100vh;
	min-height: 100dvh;
	/* Force absolute top layer over theme blocks/headers/popups. */
	z-index: 2147483647 !important;
	isolation: isolate;
}

.fbc-modal__backdrop {
	position: absolute;
	inset: 0;
	z-index: 1 !important;
	background: rgba(15, 20, 30, 0.72);
	cursor: pointer;
}

.fbc-modal__dialog {
	position: relative;
	z-index: 2 !important;
	box-sizing: border-box;
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: center;
	padding: clamp(0.5rem, 2vw, 1.25rem);
	pointer-events: none;
}

.fbc-modal__panel {
	pointer-events: auto;
	position: relative;
	z-index: 3 !important;
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
}

.fbc-modal__panel[hidden] {
	display: none !important;
}

.fbc-modal__close {
	pointer-events: auto;
	position: fixed;
	top: 1rem;
	right: 1rem;
	z-index: 4 !important;
	width: clamp(42px, 4.8vw, 56px);
	height: clamp(42px, 4.8vw, 56px);
	display: grid;
	place-items: center;
	font-size: clamp(2rem, 4vw, 2.8rem);
	line-height: 1;
	background: rgba(20, 20, 20, 0.6);
	color: #fff;
	border: 0;
	border-radius: 0;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.fbc-modal__close:hover,
.fbc-modal__close:focus-visible {
	background: rgba(10, 10, 10, 0.82);
	outline: 2px solid rgba(255, 255, 255, 0.9);
	outline-offset: 2px;
}

.fbc-modal__figure {
	margin: 0;
	pointer-events: auto;
	position: relative;
	z-index: 3 !important;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 100vw;
	min-height: 0;
	box-sizing: border-box;
}

.fbc-modal__media {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: clamp(1rem, 3vw, 2rem);
	width: 100%;
	max-width: 100vw;
	box-sizing: border-box;
	padding-inline: clamp(0.5rem, 2vw, 1.25rem);
}

.fbc-modal__img {
	box-sizing: border-box;
	max-width: 100vw;
	max-height: min(100vh, 980px);
	max-height: min(100dvh, 980px);
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
	flex: 0 1 auto;
	border-radius: 0;
	box-shadow:
		0 20px 60px rgba(0, 0, 0, 0.45),
		0 4px 12px rgba(0, 0, 0, 0.2);
	background: #111;
}

.fbc-modal__panel--excerpt {
	align-items: center;
	justify-content: center;
	padding-inline: clamp(0.75rem, 3vw, 2rem);
}

.fbc-modal__page {
	box-sizing: border-box;
	width: 100%;
	max-width: min(42rem, calc(100vw - 2.5rem));
	max-height: min(85vh, 900px);
	max-height: min(85dvh, 900px);
	overflow: auto;
	margin: 0 auto;
	padding: clamp(1.25rem, 3vw, 2.25rem) clamp(1.25rem, 3vw, 2.5rem);
	background: #fff;
	color: #111;
	border-radius: 0;
	box-shadow:
		0 20px 60px rgba(0, 0, 0, 0.45),
		0 2px 8px rgba(0, 0, 0, 0.12);
	font-family: Georgia, 'Times New Roman', Times, serif;
	font-size: clamp(0.95rem, 1.35vw, 1.1rem);
	line-height: 1.65;
	text-align: left;
}

.fbc-modal__excerpt-text {
	margin: 0;
	word-break: break-word;
	color: #000;
}

.fbc-modal__excerpt-text > *:first-child {
	margin-top: 0;
}

.fbc-modal__excerpt-text p {
	margin: 0 0 0.75em;
	line-height: inherit;
}

.fbc-modal__excerpt-text p:last-child {
	margin-bottom: 0;
}

.fbc-modal__excerpt-text ul,
.fbc-modal__excerpt-text ol {
	margin: 0 0 0.75em;
	padding-left: 1.35em;
}

.fbc-modal__excerpt-text li {
	margin: 0.2em 0;
}

.fbc-modal__excerpt-text h1,
.fbc-modal__excerpt-text h2,
.fbc-modal__excerpt-text h3,
.fbc-modal__excerpt-text h4 {
	font-family: inherit;
	font-size: 1.15em;
	font-weight: 700;
	margin: 0.85em 0 0.4em;
	color: #000;
}

.fbc-modal__excerpt-text h1:first-child,
.fbc-modal__excerpt-text h2:first-child,
.fbc-modal__excerpt-text h3:first-child,
.fbc-modal__excerpt-text h4:first-child {
	margin-top: 0;
}

.fbc-modal__excerpt-text blockquote {
	margin: 0 0 0.75em;
	padding-left: 1em;
	border-left: 3px solid #ccc;
	color: #222;
}

.fbc-modal__excerpt-text a {
	color: #0a5f73;
	text-decoration: underline;
}

.fbc-modal__excerpt-text strong,
.fbc-modal__excerpt-text b {
	font-weight: 700;
}

.fbc-modal__excerpt-text em,
.fbc-modal__excerpt-text i {
	font-style: italic;
}

.fbc-modal .visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

body.fbc-modal-open {
	overflow: hidden;
}

/* Ensure page content is never painted above the open modal in aggressive themes. */
body.fbc-modal-open .fbc-modal:not([hidden]) {
	position: fixed !important;
	inset: 0 !important;
}
