/* Catalogo sfogliabile: catalogo.html?c=<slug> (collegato dalle schede in prodotti.html). */

.cat-message {
	padding: 3rem 1rem;
	text-align: center;
	font-size: 1.2rem;
}

/* ---------------------------------------------------------- Sfogliabile */

.cat-viewer {
	--cat-bar-h: 4.5rem;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	padding-top: var(--cat-nav-h, 100px);
	background: #f4f2ef;
}

.cat-viewer:fullscreen {
	padding-top: 0;
}

.cat-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.6rem 1rem;
	min-height: var(--cat-bar-h);
	padding: 0.6rem 3%;
}

.cat-bar h1 {
	margin: 0;
	font-family: "Titan One", sans-serif;
	font-size: calc(20px + (34 - 20) * ((100vw - 300px) / (1920 - 300)));
	color: #000;
}

.cat-tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem;
}

.cat-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.6rem;
	height: 2.6rem;
	padding: 0 0.9rem;
	border: 0;
	border-radius: 5rem;
	background: #360707;
	color: #fff;
	font-family: "Titan One", sans-serif;
	font-size: 0.95rem;
	cursor: pointer;
	transition: background-color 0.3s;
}

.cat-btn:hover,
.cat-btn:focus-visible {
	background: #e52421;
	color: #fff;
}

.cat-pages {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0 0.6rem;
	font-weight: 600;
}

.cat-pages input {
	width: 4.2rem;
	height: 2.4rem;
	padding: 0 0.4rem;
	border: 2px solid #360707;
	border-radius: 0.8rem;
	text-align: center;
	font: inherit;
}

.cat-stage {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 3% 1.5rem;
}

/* Altezza disponibile: schermo meno navbar e barra strumenti. */
.cat-book {
	width: 100%;
	height: calc(100vh - var(--cat-nav-h, 100px) - var(--cat-bar-h) - 1.5rem);
	min-height: 260px;
	margin: 0 auto;
}

.cat-viewer:fullscreen .cat-book {
	height: calc(100vh - var(--cat-bar-h) - 1.5rem);
}

.cat-page {
	background: #fff;
}

.cat-page-inner {
	position: relative;
	width: 100%;
	height: 100%;
}

.cat-page-inner img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	user-select: none;
	pointer-events: none;
}

.cat-link {
	position: absolute;
	z-index: 2;
	border-radius: 4px;
	transition: background-color 0.2s;
}

.cat-link:hover {
	background-color: rgba(229, 36, 33, 0.15);
	box-shadow: inset 0 0 0 2px rgba(229, 36, 33, 0.5);
}

.cat-error .cat-tools {
	display: none;
}

/* Miniature */
.cat-overlay {
	position: fixed;
	inset: 0;
	z-index: 1040;
	display: flex;
	flex-direction: column;
	background: rgba(20, 8, 8, 0.92);
	color: #fff;
}

.cat-overlay[hidden] {
	display: none;
}

.cat-overlay-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.6rem;
	padding: 0.8rem 3%;
	font-family: "Titan One", sans-serif;
}

.cat-overlay .cat-btn {
	background: #fff;
	color: #360707;
}

.cat-overlay .cat-btn:hover {
	background: #e52421;
	color: #fff;
}

.cat-thumbs-list {
	flex: 1;
	overflow-y: auto;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 1rem;
	padding: 0 3% 2rem;
}

.cat-thumb {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.3rem;
	padding: 0;
	border: 0;
	background: none;
	color: #fff;
	cursor: pointer;
}

.cat-thumb img {
	width: 100%;
	aspect-ratio: 1414 / 1000;
	object-fit: contain;
	border-radius: 0.4rem;
	background: #fff;
	transition: transform 0.2s;
}

.cat-thumb:hover img,
.cat-thumb:focus-visible img {
	transform: scale(1.04);
	box-shadow: 0 0 0 3px #e52421;
}

/* Zoom */
.cat-zoom-scroll {
	flex: 1;
	overflow: auto;
	text-align: center;
	cursor: grab;
	-webkit-overflow-scrolling: touch;
}

.cat-zoom-scroll img {
	max-width: none;
	width: 2000px;
	height: auto;
	background: #fff;
}

.cat-zoom-fit .cat-zoom-scroll img {
	width: auto;
	max-width: 100%;
	max-height: 100%;
}

/* Istruzioni */
.cat-help {
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.cat-help-box {
	width: 100%;
	max-width: 640px;
	max-height: 100%;
	overflow-y: auto;
	padding: 1.6rem 2rem 1.2rem;
	border-radius: 2rem;
	background: #fff;
	color: #000;
	box-shadow: 0 20px 50px #00000066;
}

.cat-help-box h2 {
	margin: 0 0 0.8rem;
	font-family: "Titan One", sans-serif;
	font-size: calc(22px + (32 - 22) * ((100vw - 300px) / (1920 - 300)));
	text-align: center;
}

.cat-help-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cat-help-list li {
	display: flex;
	align-items: flex-start;
	gap: 0.9rem;
	padding: 0.4rem 0;
	border-bottom: 1px solid #eee;
	line-height: 1.3;
}

.cat-help-list strong {
	display: block;
	font-family: "Titan One", sans-serif;
	font-weight: 400;
	color: #360707;
}

.cat-help-icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.1rem;
	width: 2.3rem;
	height: 2.3rem;
	border-radius: 5rem;
	background: #360707;
	color: #fff;
	font-family: "Titan One", sans-serif;
	font-size: 0.9rem;
}

.cat-help-note {
	margin: 1rem 0;
	color: #686868;
	text-align: center;
	font-size: 0.95rem;
}

.cat-overlay .cat-help-ok {
	padding: 0 1.8rem;
	background: #e52421;
	color: #fff;
}

.cat-overlay .cat-help-ok:hover,
.cat-overlay .cat-help-ok:focus-visible {
	background: #360707;
	color: #fff;
}

body.cat-noscroll {
	overflow: hidden;
}

@media only screen and (max-width: 767px) {
	.cat-bar {
		justify-content: center;
		text-align: center;
	}

	.cat-viewer {
		--cat-bar-h: 7rem;
	}

	.cat-btn-label {
		display: none;
	}

	.cat-stage {
		padding-left: 0;
		padding-right: 0;
	}

	.cat-zoom-scroll img {
		width: 1400px;
	}
}
