/* ==========================================================================
   Gaddi PDF Carousel — stile sobrio, integrato con il tema Astra.
   Classi prefissate `gpc-` per evitare collisioni.
   ========================================================================== */

/* L'attributo HTML [hidden] ha priorità CSS inferiore a display:flex/inline-flex,
   quindi serve un override esplicito per nascondere correttamente frecce/dots. */
.gpc-nav[hidden],
.gpc-dots[hidden] {
	display: none !important;
}

.gpc-section {
	padding: clamp(2rem, 5vw, 3.5rem) 0;
	color: var(--ast-global-color-3, #333);
}

.gpc-header {
	text-align: center;
	margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.gpc-title {
	margin: 0 0 0.5rem;
	font-size: clamp(1.5rem, 3vw, 2rem);
	font-weight: 700;
	color: var(--ast-global-color-2, #1a1a1a);
	letter-spacing: -0.01em;
}

.gpc-subtitle {
	margin: 0;
	font-size: 1rem;
	color: var(--ast-global-color-3, #555);
	opacity: 0.85;
}

/* ---------- Carosello ----------------------------------------------------- */

.gpc-carousel {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.gpc-viewport {
	flex: 1 1 auto;
	overflow: hidden;
	/* Nasconde la scrollbar nativa su tutti i browser */
	scrollbar-width: none;
	-ms-overflow-style: none;
}
.gpc-viewport::-webkit-scrollbar {
	display: none;
}

.gpc-track {
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0.5rem 0;
	gap: 1rem;
	transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
	will-change: transform;
	/* touch: lasciamo al JS il compito di traslarlo, qui solo setup */
	touch-action: pan-y;
}

.gpc-slide {
	flex: 0 0 100%;
	min-width: 0;
}

@media (min-width: 600px) {
	.gpc-slide {
		flex: 0 0 calc((100% - 1rem) / 2);
	}
}

@media (min-width: 900px) {
	.gpc-slide {
		flex: 0 0 calc((100% - 2rem) / 3);
	}
}

@media (min-width: 1200px) {
	.gpc-slide {
		flex: 0 0 calc((100% - 3rem) / 4);
	}
}

/* ---------- Card ---------------------------------------------------------- */

.gpc-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 12px;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.gpc-card:hover,
.gpc-card:focus-visible {
	transform: translateY(-3px);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
	border-color: rgba(0, 0, 0, 0.15);
	outline: none;
}

.gpc-card__media {
	position: relative;
	aspect-ratio: 4 / 3;
	background: #f4f4f5;
	overflow: hidden;
}

.gpc-card__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
	transition: transform 0.4s ease;
}

.gpc-card:hover .gpc-card__img {
	transform: scale(1.03);
}

/* Canvas per rendering client-side via PDF.js (quando manca thumb server-side) */
.gpc-card__canvas {
	display: block;
	width: 100%;
	height: 100%;
	background: #f4f4f5;
	/* viene mostrato sopra il placeholder mentre PDF.js renderizza */
	position: absolute;
	inset: 0;
	z-index: 2;
	opacity: 0;
	transition: opacity 0.3s ease-in-out;
}

.gpc-card__canvas.is-loaded {
	opacity: 1;
}

.gpc-card__canvas.is-error {
	display: none;
}

.gpc-card__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	color: #71717a;
	background: linear-gradient(135deg, #f4f4f5 0%, #e4e4e7 100%);
	z-index: 1;
}

.gpc-card__placeholder-icon {
	display: block;
	width: 44px;
	height: 54px;
	background: #fff;
	border: 2px solid currentColor;
	border-radius: 4px 4px 4px 0;
	position: relative;
	opacity: 0.55;
}

.gpc-card__placeholder-icon::before {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	width: 14px;
	height: 14px;
	background: linear-gradient(225deg, transparent 50%, currentColor 50%);
	border-radius: 0 4px 0 0;
}

.gpc-card__placeholder-icon::after {
	content: "";
	position: absolute;
	bottom: 8px;
	left: 6px;
	right: 6px;
	height: 2px;
	background: currentColor;
	opacity: 0.4;
	box-shadow:
		0 6px 0 0 currentColor,
		0 12px 0 0 currentColor;
}

.gpc-card__placeholder-text {
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	opacity: 0.85;
}

.gpc-card__body {
	padding: 0.875rem 1rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.gpc-card__title {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.3;
	color: var(--ast-global-color-2, #1a1a1a);
	/* Limito a 2 righe */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.gpc-card__cta {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.85rem;
	font-weight: 500;
	color: var(--ast-global-color-0, var(--ast-global-color-1, #2563eb));
}

.gpc-card:hover .gpc-card__cta,
.gpc-card:focus-visible .gpc-card__cta {
	text-decoration: underline;
}

/* ---------- Frecce di navigazione ---------------------------------------- */

.gpc-nav {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 999px;
	background: #fff;
	color: var(--ast-global-color-2, #1a1a1a);
	cursor: pointer;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.gpc-nav:hover:not(:disabled),
.gpc-nav:focus-visible:not(:disabled) {
	background: var(--ast-global-color-0, var(--ast-global-color-1, #2563eb));
	color: #fff;
	border-color: transparent;
	outline: none;
}

.gpc-nav:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

@media (max-width: 600px) {
	.gpc-nav {
		position: absolute;
		top: 35%;
		transform: translateY(-50%);
		z-index: 2;
		background: rgba(255, 255, 255, 0.92);
		backdrop-filter: blur(4px);
	}
	.gpc-nav--prev {
		left: 0.5rem;
	}
	.gpc-nav--next {
		right: 0.5rem;
	}
}

/* ---------- Dot indicator ------------------------------------------------ */

.gpc-dots {
	display: flex;
	justify-content: center;
	gap: 0.5rem;
	margin-top: 1.25rem;
}

.gpc-dot {
	width: 8px;
	height: 8px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.2);
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.2s ease, width 0.2s ease;
}

.gpc-dot:hover,
.gpc-dot:focus-visible {
	background: rgba(0, 0, 0, 0.45);
	outline: none;
}

.gpc-dot.is-active {
	background: var(--ast-global-color-0, var(--ast-global-color-1, #2563eb));
	width: 24px;
}

/* ---------- Reduced motion ----------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.gpc-track,
	.gpc-card,
	.gpc-card__img,
	.gpc-nav,
	.gpc-dot {
		transition: none !important;
	}
	.gpc-card:hover {
		transform: none;
	}
}

/* ---------- Stato vuoto (nessun PDF trovato) ----------------------------- */

.gpc-section--empty {
	text-align: center;
	color: var(--ast-global-color-3, #555);
	font-style: italic;
}
