/* ICOON Flipbook */

.icoon-fb {
	--ifb-accent: #111;
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 0 auto;
	background: var(--ifb-bg, transparent);
	color: #1d1d1f;
	outline: none;
}
.icoon-fb *, .icoon-fb *::before, .icoon-fb *::after { box-sizing: border-box; }

/* --- palco --- */
.icoon-fb .icoon-fb-stage {
	position: relative;
	width: 100%;
	aspect-ratio: 1.414 / 1;   /* riserva lo spazio prima del caricamento; poi l'altezza la imposta il JS */
	overflow: hidden;          /* il contenitore del libro non deve mai coprire la barra o il testo attorno */
}
@media (max-width: 559px) {
	.icoon-fb .icoon-fb-stage { aspect-ratio: 0.707 / 1; }
}
.icoon-fb .icoon-fb-book {
	width: 100%;
	height: 100%;
	touch-action: pan-y;
	transition: transform .45s ease;
}
@media (prefers-reduced-motion: reduce) {
	.icoon-fb .icoon-fb-book { transition: none; }
}

/* --- segnaposto --- */
.icoon-fb .icoon-fb-placeholder {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .04);
}
.icoon-fb .icoon-fb-placeholder img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
	opacity: .85;
}
.icoon-fb .icoon-fb-spinner {
	position: absolute;
	width: 34px;
	height: 34px;
	border: 3px solid rgba(0, 0, 0, .15);
	border-top-color: var(--ifb-accent);
	border-radius: 50%;
	animation: icoon-fb-spin .8s linear infinite;
}
@keyframes icoon-fb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
	.icoon-fb .icoon-fb-spinner { animation-duration: 2.4s; }
}

/* --- pagine --- */
.icoon-fb .icoon-fb-page { background: #fff; overflow: hidden; }
.icoon-fb .icoon-fb-page canvas { display: block; width: 100%; height: 100%; }

.icoon-fb .icoon-fb-link {
	position: absolute;
	z-index: 3;
	display: block;
	background: transparent;
	cursor: pointer;
	text-decoration: none;
	border: 0;
	transition: background .15s;
}
.icoon-fb .icoon-fb-link:hover,
.icoon-fb .icoon-fb-link:focus-visible { background: rgba(0, 0, 0, .07); outline: 2px solid var(--ifb-accent); outline-offset: -2px; }

/* --- barra comandi --- */
.icoon-fb .icoon-fb-bar {
	position: relative;
	z-index: 6;
	display: flex;
	align-items: center;
	gap: 4px;
	width: max-content;
	max-width: calc(100% - 16px);
	margin: 14px auto 0;
	padding: 6px 8px;
	background: #fff;
	color: #1d1d1f;
	border-radius: 999px;
	box-shadow: 0 2px 14px rgba(0, 0, 0, .15);
	font: 500 13px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.icoon-fb:not(.is-ready) .icoon-fb-bar { visibility: hidden; }

.icoon-fb .icoon-fb-btn {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #1d1d1f;
	box-shadow: none;
	text-decoration: none;
	text-transform: none;
	letter-spacing: normal;
	line-height: 1;
	cursor: pointer;
	transition: background .15s, color .15s;
}
.icoon-fb .icoon-fb-btn:hover:not(:disabled),
.icoon-fb .icoon-fb-btn:focus-visible:not(:disabled) {
	background: var(--ifb-accent);
	color: #fff;
	outline: none;
}
.icoon-fb .icoon-fb-btn:focus-visible { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ifb-accent); }
.icoon-fb .icoon-fb-btn:disabled { opacity: .3; cursor: default; background: transparent; color: #1d1d1f; }
.icoon-fb .icoon-fb-btn svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.icoon-fb .icoon-fb-count { min-width: 76px; padding: 0 4px; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.icoon-fb .icoon-fb-range { width: clamp(70px, 16vw, 200px); margin: 0 4px; accent-color: var(--ifb-accent); }
.icoon-fb .icoon-fb-sep { flex: 0 0 1px; width: 1px; height: 20px; margin: 0 4px; background: rgba(0, 0, 0, .14); }

@media (max-width: 519px) {
	.icoon-fb .icoon-fb-range,
	.icoon-fb .icoon-fb-btn--first,
	.icoon-fb .icoon-fb-btn--last { display: none; }
	.icoon-fb .icoon-fb-count { min-width: 64px; }
}

/* --- schermo intero --- */
.icoon-fb.is-fs {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 12px;
	background: var(--ifb-bg, #161618);
}
.icoon-fb.is-fs .icoon-fb-stage { flex: 1 1 auto; min-height: 0; aspect-ratio: auto; }
.icoon-fb.is-fs .icoon-fb-bar { flex: 0 0 auto; margin-top: 10px; }
.icoon-fb.is-pseudo { position: fixed; inset: 0; z-index: 2147483000; width: auto; height: auto; }
html.icoon-fb-lock { overflow: hidden; }

/* --- ingrandimento --- */
.icoon-fb-zoom {
	position: fixed;
	inset: 0;
	z-index: 2147483001;
	display: flex;
	background: rgba(18, 18, 20, .93);
}
.icoon-fb-zoom .icoon-fb-zoom-scroll {
	flex: 1;
	display: flex;
	overflow: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	cursor: grab;
}
.icoon-fb-zoom .icoon-fb-zoom-scroll.is-drag { cursor: grabbing; user-select: none; }
.icoon-fb-zoom .icoon-fb-zoom-inner { display: flex; margin: auto; padding: 56px 20px 24px; }
.icoon-fb-zoom .icoon-fb-zoom-page {
	display: block;
	flex: 0 0 auto;
	max-width: none;
	height: auto;
	background: #fff;
	box-shadow: 0 8px 36px rgba(0, 0, 0, .55);
}
.icoon-fb-zoom .icoon-fb-btn {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #1d1d1f;
	box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
	cursor: pointer;
}
.icoon-fb-zoom .icoon-fb-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icoon-fb-zoom .icoon-fb-zoom-close { position: absolute; top: 12px; right: 14px; z-index: 2; }

/* --- errori / avvisi --- */
.icoon-fb .icoon-fb-error { padding: 28px 16px; text-align: center; }
.icoon-fb .icoon-fb-error p { margin: 0 0 8px; }
.icoon-fb .icoon-fb-error a { color: inherit; text-decoration: underline; }
.icoon-fb-notice { padding: 12px 14px; border: 1px dashed #c0c0c0; border-radius: 6px; font-size: 14px; }
.icoon-fb .icoon-fb-noscript { padding: 16px; text-align: center; }
