/* ==========================================================================
   HITPDF Categorie — griglia delle sezioni
   Caricata solo sulle pagine indicate in hitpdf_cats_pages().
   Stessa famiglia di token della scheda articolo: per cambiare palette o
   proporzioni si tocca solo il blocco qui sotto.
   ========================================================================== */

.hitpdf-cats {
	--hit-pink: #EA9EE4;
	--hit-magenta: #FE17D8;
	--hit-surface: #131118;
	--hit-surface-2: #1d1a24;
	--hit-border: rgba(255, 255, 255, 0.09);
	--hit-text: #ece9f0;
	--hit-muted: #8f8b99;

	--hit-radius: 12px;

	/* >>> LARGHEZZA MINIMA DI UN RIQUADRO <<< */
	--hit-card: clamp(140px, 20vw, 210px);
	/* >>> PROPORZIONE DELLA CORNICE (3/4 = verticale, 1 = quadrata) <<< */
	--hit-card-ratio: 3 / 4;

	--hit-gap: clamp(0.75rem, 2vw, 1.5rem);
	--hit-max: 1200px;

	display: block;
	width: 100%;
	max-width: var(--hit-max);
	margin-inline: auto;
	padding-block: clamp(1rem, 3vw, 2rem);
	color: var(--hit-text);
}

/* .entry-content con is-layout-constrained restringe i figli: qui serve la
   larghezza piena del nostro container. */
.entry-content .hitpdf-cats {
	max-width: var(--hit-max);
}

/* ---- Griglia ---- */
.hitpdf-cats__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(var(--hit-card), 1fr));
	gap: var(--hit-gap);

	margin: 0;
	padding: 0;
	list-style: none;
}

.hitpdf-cats__item {
	margin: 0;
	padding: 0;
	list-style: none;
	min-width: 0;
}

/* ---- Riquadro ---- */
.hitpdf-cat {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;

	text-decoration: none !important;
	color: inherit;
	transition: transform 0.18s ease;
}

.hitpdf-cat:hover,
.hitpdf-cat:focus-visible {
	text-decoration: none;
	transform: translateY(-3px);
}

/* ---- Cornice a proporzione costante ---- */
.hitpdf-cat__frame {
	position: relative;
	display: block;
	aspect-ratio: var(--hit-card-ratio);

	border: 1px solid var(--hit-border);
	border-radius: var(--hit-radius);
	background: var(--hit-surface-2);
	overflow: hidden;

	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.hitpdf-cat:hover .hitpdf-cat__frame,
.hitpdf-cat:focus-visible .hitpdf-cat__frame {
	border-color: var(--hit-magenta);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.hitpdf-cat:focus-visible {
	outline: none;
}

.hitpdf-cat:focus-visible .hitpdf-cat__frame {
	outline: 2px solid var(--hit-pink);
	outline-offset: 2px;
}

/* Riempimento: la stessa immagine, sfocata. Regge sia le copertine verticali
   sia i banner orizzontali senza deformare nulla. */
.hitpdf-cat__backdrop {
	position: absolute;
	inset: -8%;
	background-size: cover;
	background-position: center;
	filter: blur(22px) saturate(1.6) brightness(0.5);
	transform: scale(1.1);
}

/* Selettore stretto: il tema (e il CSS della scheda) impongono regole su img
   che altrimenti si mangerebbero height e object-fit. */
.hitpdf-cats .hitpdf-cat__img {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	object-fit: contain;
	margin: 0;
	border-radius: 0;
}

/* Categoria ancora senza articoli: iniziale su fondo scuro. */
.hitpdf-cat__empty {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;

	font-family: 'Agency FB', 'Arial Narrow', Arial, sans-serif;
	font-size: clamp(2.5rem, 6vw, 4rem);
	line-height: 1;
	color: var(--hit-muted);
	background: var(--hit-surface);
}

/* ---- Testo ---- */
.hitpdf-cat__body {
	display: block;
	min-width: 0;
	text-align: center;
}

.hitpdf-cat__name {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;

	font-family: 'Agency FB', 'Arial Narrow', Arial, sans-serif;
	font-size: 1.15rem;
	letter-spacing: 0.5px;
	line-height: 1.2;
	text-transform: uppercase;
	color: var(--hit-text);
	transition: color 0.18s ease;
}

.hitpdf-cat:hover .hitpdf-cat__name,
.hitpdf-cat:focus-visible .hitpdf-cat__name {
	color: var(--hit-magenta);
}

.hitpdf-cat__count {
	display: block;
	margin-top: 0.15rem;
	font-size: 0.78rem;
	letter-spacing: 0.3px;
	color: var(--hit-muted);
}

/* ---- Schermi stretti: due colonne piene invece di riquadri minuscoli ---- */
@media (max-width: 480px) {
	.hitpdf-cats {
		--hit-card: 130px;
	}

	.hitpdf-cat__name {
		font-size: 1rem;
	}
}

/* ---- Chi preferisce meno movimento ---- */
@media (prefers-reduced-motion: reduce) {
	.hitpdf-cat,
	.hitpdf-cat__frame,
	.hitpdf-cat__name {
		transition: none;
	}

	.hitpdf-cat:hover,
	.hitpdf-cat:focus-visible {
		transform: none;
	}
}
