/* Catalogo Sfogliabile – viewer */

.igfb {
	--igfb-accent: #e75f0d;
	--igfb-ratio: 0.7071;
	--igfb-maxh: 85vh;
	--igfb-bg: #1a1a1c;
	--igfb-bg2: #262629;
	--igfb-fg: #f5f5f7;
	--igfb-muted: rgba(245, 245, 247, .58);
	--igfb-ctrl: rgba(255, 255, 255, .07);
	--igfb-ctrl-h: rgba(255, 255, 255, .14);
	--igfb-line: rgba(255, 255, 255, .1);
	--igfb-track: rgba(255, 255, 255, .16);
	--igfb-panel: rgba(24, 24, 26, .94);
	--igfb-shadow: rgba(0, 0, 0, .55);
	position: relative;
	box-sizing: border-box;
	width: 100%;
	margin: 0 auto;
	color: var(--igfb-fg);
	background: radial-gradient(120% 90% at 50% 35%, var(--igfb-bg2) 0%, var(--igfb-bg) 70%);
	border-radius: 18px;
	overflow: hidden;
	font-size: 15px;
	line-height: 1.4;
	-webkit-tap-highlight-color: transparent;
	isolation: isolate;
	outline: none;
}
.igfb *, .igfb *::before, .igfb *::after { box-sizing: border-box; }

.igfb--light, .igfb--transparent {
	--igfb-bg: #efede9;
	--igfb-bg2: #f8f7f5;
	--igfb-fg: #1d1d1f;
	--igfb-muted: rgba(29, 29, 31, .55);
	--igfb-ctrl: rgba(0, 0, 0, .045);
	--igfb-ctrl-h: rgba(0, 0, 0, .09);
	--igfb-line: rgba(0, 0, 0, .08);
	--igfb-track: rgba(0, 0, 0, .12);
	--igfb-panel: rgba(250, 249, 247, .96);
	--igfb-shadow: rgba(40, 30, 20, .28);
}
.igfb--transparent { background: transparent; border-radius: 0; }
.igfb--transparent.is-fs { background: radial-gradient(120% 90% at 50% 35%, var(--igfb-bg2) 0%, var(--igfb-bg) 70%); }

/* ------------------------------------------------------------ stage */
.igfb-stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(18px, 3.2vw, 44px) clamp(12px, 2.5vw, 32px) clamp(10px, 2vw, 24px);
	aspect-ratio: calc(var(--igfb-ratio) * 2) / 1;
	max-height: calc(var(--igfb-maxh) - 70px);
	min-height: 240px;
	touch-action: pan-y;
	user-select: none;
	-webkit-user-select: none;
}
.igfb.is-ready .igfb-stage, .igfb.is-loading .igfb-stage[style*="height"] { aspect-ratio: auto; max-height: none; }
@media (max-width: 600px) {
	.igfb-stage { aspect-ratio: var(--igfb-ratio) / 1; }
}

.igfb-book {
	position: relative;
	margin: 0 auto;
	opacity: 0;
	transition: opacity .6s ease, transform .6s cubic-bezier(.22, .7, .2, 1);
	will-change: transform;
}
.igfb.is-ready .igfb-book { opacity: 1; }

.igfb-page {
	background: #fff;
	overflow: hidden;
}
.igfb-page__inner { position: absolute; inset: 0; background: #fff; }
.igfb-page:not(.is-painted) .igfb-page__inner {
	background: linear-gradient(100deg, #f3f3f3 30%, #fafafa 50%, #f3f3f3 70%) 0 0 / 300% 100%;
	animation: igfb-shimmer 1.6s linear infinite;
}
.igfb-page img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: fill;
	pointer-events: none;
	-webkit-user-drag: none;
	user-select: none;
	max-width: none !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	margin: 0 !important;
}
.igfb-page img:not([src]) { visibility: hidden; }
.igfb-page:not(.is-sharp) img { filter: blur(.4px); }

/* soft drop shadow under the paper */
.igfb .stf__item { box-shadow: 0 22px 44px -22px var(--igfb-shadow), 0 2px 6px rgba(0, 0, 0, .12); }

/* spine shading in two-page view */
.igfb.is-landscape .igfb-page--left .igfb-page__inner::after,
.igfb.is-landscape .igfb-page--right .igfb-page__inner::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
}
.igfb.is-landscape .igfb-page--left .igfb-page__inner::after {
	background: linear-gradient(to left, rgba(0, 0, 0, .2) 0, rgba(0, 0, 0, .06) 2.5%, rgba(0, 0, 0, 0) 7%);
}
.igfb.is-landscape .igfb-page--right .igfb-page__inner::after {
	background: linear-gradient(to right, rgba(0, 0, 0, .18) 0, rgba(0, 0, 0, .05) 2.5%, rgba(255, 255, 255, 0) 7%);
}

/* placeholder & loader */
.igfb-placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity .5s ease;
	z-index: 2;
	pointer-events: none;
}
.igfb.is-ready .igfb-placeholder { opacity: 0; }
.igfb-placeholder__img {
	display: block;
	height: calc(100% - 60px) !important;
	width: auto !important;
	max-width: 46% !important;
	object-fit: contain;
	box-shadow: 0 22px 44px -22px var(--igfb-shadow);
	opacity: .9;
}
@media (max-width: 600px) { .igfb-placeholder__img { max-width: 86% !important; } }
.igfb-loader {
	position: absolute;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 2.5px solid var(--igfb-track);
	border-top-color: var(--igfb-accent);
	animation: igfb-spin .9s linear infinite;
}
.igfb-error { text-align: center; padding: 24px; pointer-events: auto; }
.igfb-error p { margin: 0 0 14px; color: var(--igfb-muted); }
.igfb-error__link, .igfb-noscript a {
	display: inline-block;
	padding: 10px 18px;
	border-radius: 999px;
	background: var(--igfb-accent);
	color: #fff !important;
	text-decoration: none !important;
	font-weight: 600;
}
.igfb-noscript { text-align: center; padding: 24px; margin: 0; }
.igfb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* side arrows (wide screens) */
.igfb-nav {
	position: absolute;
	top: 50%;
	z-index: 5;
	display: none;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin-top: -24px;
	padding: 0;
	border: 1px solid var(--igfb-line);
	border-radius: 50%;
	background: var(--igfb-ctrl);
	color: var(--igfb-fg);
	cursor: pointer;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	transition: background .2s, opacity .25s, transform .2s;
}
.igfb-nav--prev { left: 22px; }
.igfb-nav--next { right: 22px; }
.igfb.is-wide.is-ready .igfb-nav { display: flex; }
.igfb-nav:hover { background: var(--igfb-ctrl-h); transform: scale(1.06); }
.igfb-nav:disabled { opacity: 0; pointer-events: none; }
.igfb-nav svg { width: 24px; height: 24px; }

/* first-run hint */
.igfb-hint {
	position: absolute;
	left: 50%;
	bottom: 18px;
	z-index: 6;
	transform: translate(-50%, 8px);
	padding: 8px 16px;
	border-radius: 999px;
	background: rgba(20, 20, 22, .82);
	color: #fff;
	font-size: 13px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity .4s ease, transform .4s ease;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}
.igfb-hint.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ toolbar */
.igfb-bar {
	position: relative;
	z-index: 4;
	padding: 4px clamp(10px, 2.5vw, 28px) 12px;
	opacity: .35;
	transition: opacity .4s;
}
.igfb.is-ready .igfb-bar { opacity: 1; }
.igfb-bar__row {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 6px;
}
.igfb-bar__group { display: flex; align-items: center; gap: 2px; }
.igfb-bar__group--end { justify-content: flex-end; }
.igfb-bar__group--center { gap: 4px; }

.igfb .igfb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 11px;
	background: transparent;
	color: var(--igfb-fg);
	box-shadow: none;
	cursor: pointer;
	text-decoration: none;
	line-height: 1;
	transition: background .18s, color .18s, opacity .18s;
}
.igfb .igfb-btn:hover { background: var(--igfb-ctrl-h); color: var(--igfb-fg); }
.igfb .igfb-btn:focus-visible, .igfb-nav:focus-visible, .igfb-thumb:focus-visible, .igfb-toc__item:focus-visible, .igfb-tab:focus-visible {
	outline: 2px solid var(--igfb-accent);
	outline-offset: 2px;
}
.igfb .igfb-btn:focus:not(:focus-visible), .igfb-nav:focus:not(:focus-visible), .igfb .igfb-thumb:focus:not(:focus-visible), .igfb .igfb-toc__item:focus:not(:focus-visible), .igfb .igfb-tab:focus:not(:focus-visible), .igfb-zoom .igfb-btn:focus:not(:focus-visible) { outline: none; box-shadow: none; }
.igfb .igfb-btn:disabled { opacity: .3; cursor: default; background: transparent; }
.igfb .igfb-btn svg { width: 22px; height: 22px; flex: none; }
.igfb.is-sm .igfb-hide-sm { display: none; }

.igfb-counter {
	display: inline-flex;
	align-items: baseline;
	margin: 0 4px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	cursor: text;
}
.igfb .igfb-counter__input {
	width: 4ch;
	min-width: 0;
	height: 32px;
	margin: 0;
	padding: 0 4px;
	border: 1px solid transparent;
	border-radius: 8px;
	background: transparent;
	color: var(--igfb-fg);
	font: inherit;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	text-align: center;
	box-shadow: none;
	transition: border-color .2s, background .2s;
}
.igfb .igfb-counter__input:hover { background: var(--igfb-ctrl); }
.igfb .igfb-counter__input:focus { outline: none; border-color: var(--igfb-accent); background: var(--igfb-ctrl); min-width: 5ch; }
.igfb-counter__total { color: var(--igfb-muted); font-size: 14px; }

/* progress scrubber */
.igfb-progress { position: relative; height: 22px; margin: 0 6px 2px; }
.igfb .igfb-range {
	--igfb-p: 0%;
	-webkit-appearance: none;
	appearance: none;
	display: block;
	width: 100%;
	height: 22px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}
.igfb .igfb-range:focus { outline: none; }
.igfb .igfb-range::-webkit-slider-runnable-track {
	height: 3px;
	border-radius: 3px;
	background: linear-gradient(to right, var(--igfb-accent) 0, var(--igfb-accent) var(--igfb-p), var(--igfb-track) var(--igfb-p));
}
.igfb .igfb-range::-moz-range-track { height: 3px; border-radius: 3px; background: var(--igfb-track); }
.igfb .igfb-range::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--igfb-accent); }
.igfb .igfb-range::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 14px;
	height: 14px;
	margin-top: -5.5px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--igfb-accent);
	box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
	transition: transform .15s;
}
.igfb .igfb-range::-moz-range-thumb {
	width: 12px;
	height: 12px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--igfb-accent);
	box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
.igfb .igfb-range:hover::-webkit-slider-thumb, .igfb .igfb-range:active::-webkit-slider-thumb, .igfb .igfb-range:focus-visible::-webkit-slider-thumb { transform: scale(1.25); }
.igfb-bubble {
	position: absolute;
	bottom: 26px;
	padding: 4px 10px;
	border-radius: 8px;
	background: var(--igfb-fg);
	color: var(--igfb-bg);
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
	transform: translateX(-50%) translateY(4px);
	opacity: 0;
	pointer-events: none;
	transition: opacity .15s, transform .15s;
}
.igfb-bubble.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------------------------------------ panel */
.igfb-panel {
	position: absolute;
	inset: 0;
	z-index: 20;
	display: flex;
	flex-direction: column;
	background: var(--igfb-panel);
	backdrop-filter: blur(18px) saturate(1.2);
	-webkit-backdrop-filter: blur(18px) saturate(1.2);
	opacity: 0;
	transform: translateY(14px);
	transition: opacity .25s ease, transform .25s ease;
}
.igfb-panel[hidden] { display: none; }
.igfb-panel.is-open { opacity: 1; transform: none; }
.igfb-panel__head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px clamp(12px, 2.5vw, 24px);
	border-bottom: 1px solid var(--igfb-line);
}
.igfb-tabs {
	display: inline-flex;
	padding: 3px;
	border-radius: 11px;
	background: var(--igfb-ctrl);
	margin-right: auto;
}
.igfb .igfb-tab {
	margin: 0;
	padding: 7px 16px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--igfb-muted);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	box-shadow: none;
	transition: background .2s, color .2s;
}
.igfb .igfb-tab.is-active { background: var(--igfb-bg2); color: var(--igfb-fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.igfb--dark .igfb-tab.is-active { background: rgba(255, 255, 255, .14); }
.igfb .igfb-panel__dl {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border-radius: 999px;
	background: var(--igfb-accent);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: filter .2s;
}
.igfb .igfb-panel__dl:hover { filter: brightness(1.08); color: #fff; }
.igfb .igfb-panel__dl svg { width: 18px; height: 18px; }
.igfb.is-sm .igfb-panel__dl span { display: none; }
.igfb.is-sm .igfb-panel__dl { padding: 8px; }
.igfb-panel__body {
	flex: 1;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	padding: clamp(14px, 3vw, 28px);
}

.igfb-thumbs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
	gap: 22px 16px;
}
.igfb.is-sm .igfb-thumbs { grid-template-columns: repeat(3, 1fr); gap: 16px 10px; }
.igfb-thumbs[hidden], .igfb-toc[hidden] { display: none; }
.igfb .igfb-thumb {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 7px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--igfb-muted);
	font: inherit;
	font-size: 12px;
	cursor: pointer;
	box-shadow: none;
}
.igfb-thumb__img {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: var(--igfb-ratio);
	overflow: hidden;
	border-radius: 3px;
	background: linear-gradient(100deg, rgba(128, 128, 128, .14) 30%, rgba(128, 128, 128, .22) 50%, rgba(128, 128, 128, .14) 70%) 0 0 / 300% 100%;
	animation: igfb-shimmer 1.6s linear infinite;
	box-shadow: 0 6px 16px -8px var(--igfb-shadow);
	transition: transform .2s ease, box-shadow .2s;
}
.igfb-thumb__img.is-painted { background: #fff; animation: none; }
.igfb-thumb__img img { display: block; width: 100%; height: 100%; object-fit: cover; margin: 0 !important; border-radius: 0 !important; }
.igfb-thumb__img img:not([src]) { visibility: hidden; }
.igfb .igfb-thumb:hover .igfb-thumb__img { transform: translateY(-3px); }
.igfb .igfb-thumb.is-current { color: var(--igfb-fg); font-weight: 600; }
.igfb .igfb-thumb.is-current .igfb-thumb__img { box-shadow: 0 0 0 2px var(--igfb-accent), 0 8px 20px -8px var(--igfb-shadow); }

.igfb-toc {
	max-width: 640px;
	margin: 0 auto;
	padding: 0;
	list-style: none;
}
.igfb-toc li { margin: 0; padding: 0; list-style: none; }
.igfb .igfb-toc__item {
	display: flex;
	align-items: baseline;
	gap: 10px;
	width: 100%;
	margin: 0;
	padding: 14px 6px;
	border: 0;
	border-bottom: 1px solid var(--igfb-line);
	border-radius: 0;
	background: none;
	color: var(--igfb-fg);
	font: inherit;
	font-size: 16px;
	text-align: left;
	cursor: pointer;
	box-shadow: none;
	transition: color .18s, padding .18s;
}
.igfb .igfb-toc__item:hover { color: var(--igfb-accent); padding-left: 12px; }
.igfb-toc__dots { flex: 1; border-bottom: 1px dotted var(--igfb-track); transform: translateY(-4px); }
.igfb-toc__page { color: var(--igfb-muted); font-variant-numeric: tabular-nums; font-size: 14px; }

/* ------------------------------------------------------------ fullscreen */
.igfb.is-fs {
	display: flex;
	flex-direction: column;
	justify-content: center;
	width: 100%;
	height: 100%;
	max-width: none;
	border-radius: 0;
}
.igfb.is-fs-css {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	margin: 0;
	padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.igfb:fullscreen { width: 100vw; height: 100vh; }
.igfb.is-fs .igfb-stage { flex: none; }
html.igfb-lock, html.igfb-lock body { overflow: hidden !important; overscroll-behavior: none; }

/* ------------------------------------------------------------ zoom */
.igfb-zoom {
	position: fixed;
	inset: 0;
	z-index: 2147483600;
	background: rgba(14, 14, 16, .97);
	color: #f5f5f7;
	opacity: 0;
	transition: opacity .22s ease;
	outline: none;
	-webkit-tap-highlight-color: transparent;
	font-size: 15px;
}
.igfb-zoom.is-open { opacity: 1; }
.igfb-zoom__viewport {
	position: absolute;
	inset: 0;
	overflow: hidden;
	touch-action: none;
	cursor: zoom-in;
}
.igfb-zoom.is-zoomed .igfb-zoom__viewport { cursor: grab; }
.igfb-zoom__viewport.is-grabbing { cursor: grabbing; }
.igfb-zoom__content {
	position: absolute;
	display: flex;
	transform-origin: 0 0;
	will-change: transform;
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
	background: #fff;
}
.igfb-zoom__page { position: relative; flex: 1 1 0; height: 100%; overflow: hidden; }
.igfb-zoom__page canvas, .igfb-zoom__page img { display: block; width: 100% !important; height: 100% !important; max-width: none !important; margin: 0 !important; }
.igfb-zoom__bar {
	position: absolute;
	left: 50%;
	bottom: max(18px, env(safe-area-inset-bottom));
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 5px;
	border-radius: 16px;
	background: rgba(40, 40, 44, .82);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	transform: translateX(-50%);
	box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
.igfb-zoom .igfb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 11px;
	background: transparent;
	color: #f5f5f7;
	cursor: pointer;
	box-shadow: none;
	transition: background .18s, opacity .18s;
}
.igfb-zoom .igfb-btn:hover { background: rgba(255, 255, 255, .12); }
.igfb-zoom .igfb-btn:disabled { opacity: .3; cursor: default; background: transparent; }
.igfb-zoom .igfb-btn svg { width: 22px; height: 22px; }
.igfb-zoom__pct { min-width: 52px; text-align: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: rgba(245, 245, 247, .75); }
.igfb-zoom .igfb-zoom__close {
	position: absolute;
	top: max(14px, env(safe-area-inset-top));
	right: max(14px, env(safe-area-inset-right));
	background: rgba(40, 40, 44, .82);
	border-radius: 50%;
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
}
.igfb-zoom__loader {
	top: max(22px, env(safe-area-inset-top));
	left: 50%;
	margin-left: -14px;
	width: 28px;
	height: 28px;
	border-color: rgba(255, 255, 255, .15);
	border-top-color: var(--igfb-accent, #e75f0d);
	opacity: 0;
	transition: opacity .2s;
}
.igfb-zoom.is-busy .igfb-zoom__loader { opacity: 1; }

@keyframes igfb-spin { to { transform: rotate(360deg); } }
@keyframes igfb-shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

@media (prefers-reduced-motion: reduce) {
	.igfb-book, .igfb-panel, .igfb-hint { transition: none; }
	.igfb-page:not(.is-painted) .igfb-page__inner, .igfb-thumb__img { animation: none; }
}
