.affiliate-card-list {
	display: flex;
	flex-direction: column;
	gap: 1.2rem;
	margin: 1.5rem 0 2.2rem 0;
}

/* Mobile fix: make main content full-width on search/category pages */
@media (max-width: 959px) {
	body.search .layout.layout--no-sidebar.container,
	body.category .layout.layout--no-sidebar.container,
	body.archive .layout.layout--no-sidebar.container {
		width: 100% !important;
		max-width: 100% !important;
		margin: 0 !important;
		padding-left: 0.6rem !important;
		padding-right: 0.6rem !important;
		box-sizing: border-box !important;
	}

	body.search #main-content.layout__main,
	body.category #main-content.layout__main,
	body.archive #main-content.layout__main {
		width: 100% !important;
		max-width: 100% !important;
		padding-left: 0 !important;
		padding-right: 0 !important;
		box-sizing: border-box !important;
	}
}
/* Card grid */
.post-grid {
	display: grid;
	gap: 1.15rem;
	grid-template-columns: repeat(2, 1fr);
	justify-content: center;
}

.post-grid > * {
	justify-self: center;
}

/* Featured card: occupa lo spazio di due colonne su schermi medi/grandi */
@media (min-width: 641px) {
	/* Forza una sola colonna per tutte le pagine che mostrano la sidebar (inclusa la home) */
	.layout--with-sidebar .post-grid,
	body.home .latest-posts-container .post-grid,
	body.home .post-grid,
	.home-custom .post-grid {
		grid-template-columns: 1fr !important;
		gap: 1.15rem;
	}

	.layout--with-sidebar .post-grid > *,
	body.home .latest-posts-container .post-grid > *,
	body.home .post-grid > *,
	.home-custom .post-grid > * {
		justify-self: stretch !important;
		width: 100% !important;
		max-width: none !important;
	}

	.post-grid .post-card--featured {
		grid-column: 1 / -1;
		max-width: none !important;
		width: 100% !important;
		min-height: clamp(140px, 22vw, 180px) !important; /* più spaziosa, max 180px */
		/* migliora il rendering: posizionare il contenuto in alto */
		align-self: start;
	}

	/* Altezza uniforme e ancora più compatta per tutte le card nelle pagine con sidebar e sulla home */
	.layout--with-sidebar .post-grid .post-card,
	body.home .post-grid .post-card,
	.home-custom .post-grid .post-card {
		min-height: clamp(140px, 22vw, 180px) !important; /* max 180px */
		height: auto !important;
		max-height: none !important;
	} 
}

.post-card {
	position: relative;
	display: flex;
	width: 100% !important;
	max-width: 640px;
	min-height: clamp(300px, 44vw, 340px);
	border-radius: clamp(10px, 1vw, 14px);
	overflow: hidden;
	color: rgba(12, 32, 58, 0.92);
	background-color: #333 !important; /* grigio scuro quando non in focus */
	box-shadow: 0 16px 32px -24px rgba(15, 23, 42, 0.45);
	transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.3s ease, color 0.3s ease;
	cursor: pointer;
	isolation: isolate;
}

/* Pseudo-elemento che mostra l'immagine solo nella parte superiore della card */
.post-card::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 48px; /* ridotto: meno spazio occupato dall'area immagine */
	background-image: var(--card-bg-url, url('../images/audio-bg.jpg')) !important;
	background-size: contain !important;
	background-repeat: no-repeat !important;
	background-position: center top !important;
	z-index: 0;
}

/* Pseudo-elemento per il logo sopra l'immagine */
.post-card::after {
	content: "";
	position: absolute;
	top: 0%;
	left: 50%;
	transform: translateX(-50%);
	width: 36px; /* ridotto per ridurre l'occupazione verticale */
	height: 36px;
	background-image: url('../images/logo.png') !important;
	background-size: contain !important;
	background-repeat: no-repeat !important;
	background-position: center !important;
	z-index: 3;
}

/* Rimuove la vecchia placeholder (non usata) */
.placeholder-img {
	display: none !important;
	background: none !important;
}

/* Forza override: elimina solo lo sfondo da immagini/placeholder che coprirebbero il pseudo-elemento (non toccare altri elementi testuali come 'pro/contro') */
.post-card img,
.post-card .post-card-img,
.post-card .post-card-image-link,
.post-card .post-card-image-link img {
	background-image: none !important;
	background-color: transparent !important;
}

/* Nascondi immagini che contengono 'logo' o che sono impostate come post-card-img */
.post-card img[src*="logo" i],
.post-card img[src*="Logo" i],
.post-card .post-card-img {
	display: none !important;
}

/* Assicura che lo pseudo-elemento venga mostrato correttamente (sopra qualsiasi sfondo) */
.post-card::before {
	background-image: var(--card-bg-url, url('../images/audio-bg.jpg')) !important;
	background-size: cover !important;
	background-repeat: no-repeat !important;
	background-position: center top !important;
	z-index: 0;
}

/* Assicura che il contenuto sia sopra l'immagine */
.post-card .post-card__body {
	position: relative;
	z-index: 2;
	/* Padding superiore ridotto: 18px */
	padding-top: 18px !important;
	padding-bottom: 0 !important;
	padding-left: 10px !important;
	padding-right: 10px !important;
	margin-right: 0 !important;
	height: auto !important;
	justify-content: flex-start !important;
}

/* Caso più specifico per sovrascrivere altre regole (serie di selettori usati nel tema) */
.latest-posts-section .latest-posts-container .post-card__body,
.post-grid .post-card__body,
.post-card .post-card__body {
	/* Forziamo il padding-top desiderato e disabilitiamo il posizionamento assoluto ereditato */
	position: relative !important;
	top: auto !important;
	bottom: auto !important;
	/* padding-top è gestito solo da 960px in su per evitare spostamenti su mobile */
	padding-bottom: 0 !important;
	padding-left: 10px !important;
	padding-right: 10px !important;
	margin-right: 0 !important;
	height: auto !important;
	justify-content: flex-start !important;
	align-items: flex-start !important;
	width: 100% !important; /* occupa tutta la larghezza del genitore */
	box-sizing: border-box !important; /* account per i 10px laterali */
} 

/* Rimuoviamo padding laterale dal contenitore e lo gestiamo nella body per uniformità */
.post-card .post-card-content {
	padding-left: 0 !important;
	padding-right: 0 !important;
}

/* Override specifico per elementi con style inline */
.post-card__body[style],
.post-card .post-card__body[style] {
	padding-left: 10px !important;
	padding-right: 10px !important;
	margin-right: 0 !important;
	width: 100% !important;
	box-sizing: border-box !important;
}

/* Target ancora più specifico per gli elementi con style inline (garantisce override) */
.post-card__body[style],
.post-card .post-card__body[style] {
	padding-left: 10px !important;
	padding-right: 10px !important;
	margin-right: 0 !important;
}

/* Assicura che il contenuto sia sopra l'immagine e posizionato sotto l'area immagine */
.post-card .post-card-content {
	position: relative;
	z-index: 2;
	/* Default (mobile): mantieni padding generoso per i dispositivi piccoli */
	padding: calc(56px + 0.5rem) clamp(1rem, 3vw, 1.4rem) clamp(1rem, 3vw, 1.4rem);
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	background-color: #f5f5f5;
}

@media (min-width: 960px) {
	/* Desktop: compattiamo lo spazio sopra il contenuto */
	.post-card .post-card-content {
		padding: calc(36px + 0.3rem) clamp(1rem, 3vw, 1.4rem) clamp(1rem, 3vw, 1.4rem);
	}
}


/* Rimuove qualsiasi sfondo grigio dietro immagini o logo nelle card */
.post-card .post-card-image-link,
.post-card .post-card-image-link img,
.post-card .post-card-img {
	background-color: transparent !important;
}


/* Assicura che il contenuto sia sopra l'immagine */
.post-card .post-card__body {
	position: relative;
	z-index: 2;
	padding-top: 0.8rem;
}

.post-card:hover,
.post-card:focus-within {
	transform: translateY(-4px);
	box-shadow: 0 18px 36px -20px rgba(15, 23, 42, 0.45);
}

.post-card__link {
	position: relative;
	z-index: 2;
	display: block;
	height: 100%;
	width: 100%;
	text-decoration: none;
	color: inherit;
}

.post-card__body {
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	gap: clamp(0.65rem, 2vw, 0.9rem);
	height: 100%;
	padding: clamp(1rem, 3vw, 1.4rem);
}

.post-card__title {
	margin: 0;

/* Affiliate Product Card Styles */
.affiliate-card {
	position: relative;
	display: flex;
	flex-direction: row;
	align-items: stretch;
	width: min(100%, 540px);
	max-width: 540px;
	min-height: 160px;
	border-radius: clamp(10px, 1vw, 14px);
	overflow: hidden;
	background: linear-gradient(90deg, #f7fafc 60%, #e0e7ef 100%);
	box-shadow: 0 8px 24px -12px rgba(15, 23, 42, 0.18);
	margin: 1.2rem auto;
	transition: box-shadow 0.18s, transform 0.18s;
}
.affiliate-card:hover,
.affiliate-card:focus-within {
	box-shadow: 0 12px 32px -10px rgba(15, 23, 42, 0.22);
	transform: translateY(-2px) scale(1.012);
}
.affiliate-card__thumb {
	flex: 0 0 140px;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.1rem 0.7rem 1.1rem 1.1rem;
}
.affiliate-card__thumb img {
	max-width: 110px;
	max-height: 110px;
	border-radius: 8px;
	box-shadow: 0 2px 8px -2px rgba(15,23,42,0.10);
}
.affiliate-card__body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 0.5rem;
	padding: 1.1rem 1.2rem;
	flex: 1 1 auto;
}
.affiliate-card__title {
	font-size: 1.13rem;
	font-weight: 700;
	margin: 0 0 0.15em 0;
	color: #1a2a3a;
}
.affiliate-card__brand {
	font-size: 0.98rem;
	color: #3b4a5a;
	margin-bottom: 0.1em;
}
.affiliate-card__desc {
	font-size: 0.97rem;
	color: #2d3a4a;
	margin: 0.2em 0 0.5em 0;
}
.affiliate-card__price {
	font-size: 1.08rem;
	font-weight: 600;
	color: #0a7a2a;
	margin-bottom: 0.3em;
}
.affiliate-card__cta {
	display: inline-block;
	margin-top: 0.4em;
	padding: 0.5em 1.2em;
	background: #1a4aff;
	color: #fff !important;
	border-radius: 6px;
	font-weight: 600;
	font-size: 1rem;
	text-decoration: none;
	box-shadow: 0 2px 8px -2px rgba(26,74,255,0.10);
	transition: background 0.16s, box-shadow 0.16s;
}
.affiliate-card__cta:hover,
.affiliate-card__cta:focus {
	background: #0d2a8a;
	color: #fff;
	box-shadow: 0 4px 16px -4px rgba(26,74,255,0.16);
}
	font-size: clamp(1.15rem, 2.4vw, 1.45rem);
	line-height: 1.25;
	font-weight: 700;
	max-width: 100%;
	text-transform: none;
	word-break: break-word;
}

.post-card__excerpt {
	margin: 0;
	font-size: clamp(0.9rem, 2vw, 1rem);
	line-height: 1.55;
	color: rgba(27, 46, 78, 0.78);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 8;
	line-clamp: 8;
	overflow: hidden;
	text-overflow: ellipsis;
}

.post-card__more {
	display: inline-flex;
	align-items: center;
	margin-left: 0.35rem;
	font-size: 0.85em;
	font-weight: 600;
	color: var(--color-primary);
	text-transform: uppercase;
}

.post-card__link:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(12, 32, 58, 0.2);
	border-radius: clamp(8px, 1vw, 12px);
}

@media (min-width: 641px) and (max-width: 1024px) {
	/* Tablet: two columns and sidebar below cards */
	.post-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 1.15rem;
	}

	.post-card {
		max-width: none;
		width: 100% !important;
		min-height: clamp(260px, 38vw, 320px);
	}

	/* Stack posts and sidebar vertically and center */
	.latest-posts-container {
		flex-direction: column !important;
		align-items: center;
		gap: 1.5rem;
	}

	.latest-posts-container .post-grid {
		width: 100%;
	}
}

/* ---------------------------------------------------------------------------
   Desktop: Ensure post cards can grow with wrapped titles (CSS-only override)
   This block enforces auto heights on desktop and prevents grid rows/cards
   from being constrained by earlier rules or !important declarations.
   Targets are specific to minimize collateral changes.
   --------------------------------------------------------------------------- */
@media (min-width: 960px) {
	/* Let grid rows size to content */
	.post-grid {
		grid-auto-rows: auto !important;
	}

	/* Ensure article post-cards are not constrained */
	#primary .post-grid article.post-card,
	#main .post-grid article.post-card,
	body.home .post-grid article.post-card,
	.layout--with-sidebar .post-grid article.post-card,
	.post-grid article.post-card {
		min-height: 0 !important;
		height: auto !important;
		max-height: none !important;
		display: flex !important;
		align-items: stretch !important;
	}

	/* Ensure the body inside the card sizes to its content */
	#primary .post-grid article.post-card .post-card__body,
	#main .post-grid article.post-card .post-card__body,
	body.home .post-grid article.post-card .post-card__body,
	.layout--with-sidebar .post-grid article.post-card .post-card__body,
	.post-card .post-card__body {
		height: auto !important;
		min-height: 0 !important;
		padding-top: 0.8rem !important;
		align-items: flex-start !important;
		overflow: visible !important;
		transform: none !important;
	}

	/* Allow titles to wrap and expand the card */
	.post-card__title {
		white-space: normal !important;
		word-break: break-word !important;
	}
}

	/* Sidebar becomes full-width block under posts; match container width for proper alignment */
	.latest-posts-container .home-sidebar {
		flex: none !important;
		width: 100% !important;
		max-width: 100% !important;
		margin: 0 auto !important;
		box-sizing: border-box !important;
	}
}

@media (max-width: 640px) {
	.post-grid {
		grid-template-columns: 1fr;
		width: 100%;
		gap: 1rem;
	}

	.post-card {
		min-height: clamp(220px, 52vw, 280px);
		width: 100% !important; /* fill container to align with hero */
		max-width: 100% !important;
		box-sizing: border-box !important;
	}

	/* Stack posts and sidebar; sidebar full-width under posts */
	.latest-posts-container {
		flex-direction: column !important;
		align-items: center;
		gap: 1rem;
	}

	.latest-posts-container .post-grid {
		width: 100%;
		max-width: 100% !important;
		box-sizing: border-box !important;
	}

	.latest-posts-container .home-sidebar {
		width: 100% !important;
		max-width: 100% !important;
		margin: 0 auto !important;
		box-sizing: border-box !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.post-card {
		transition-duration: 0.001ms !important;
		animation-duration: 0.001ms !important;
		transform: none !important;
	}
}

/* Stili per rendere le card delle categorie uguali a quelle della home */
.post-card-content .post-title a,
.post-card-content .read-more-link {
	color: #fff !important;
	transition: color 0.3s ease;
}

.post-card:hover .post-card-content .post-cat {
	color: #000080 !important;
}

.post-card:hover {
	background-color: #c0c0c0 !important;
}

.post-card:hover .post-card-content .post-date,
.post-card:hover .post-card-content .post-excerpt {
	color: #000 !important;
}

.post-card:hover .post-card-content .post-title a,
.post-card:hover .post-card-content .read-more-link {
	color: #000 !important;
}

.post-card .post-card-content .post-title a:hover,
.post-card .post-card-content .read-more-link:hover {
	color: #007bff !important;
}

.post-date {
	white-space: nowrap;
}

/* Final override: assicurati che, nelle pagine che mostrano la sidebar e nella home custom, le card rimangano compatte */
@media (min-width: 641px) {
	/* Target strutture usate dalla home e dalla sezione latest-posts */
	.home-custom .latest-posts-container .post-grid .post-card,
	.latest-posts-container .post-grid .post-card,
	.home-custom .post-grid .post-card,
	.post-grid .post-card[style],
	.post-grid article.post-card.post-card--featured[style] {
			min-height: clamp(140px, 22vw, 180px) !important;
			max-height: 180px !important;
			height: auto !important;

	}
}

/* Applicazioni specifiche solo da 960px in su per evitare effetti su mobile */
@media (min-width: 960px) {
	.latest-posts-section .latest-posts-container .post-card__body,
	.post-grid .post-card__body,
	.post-card .post-card__body {
		padding-top: 0px !important; /* desktop: zero padding */
		transform: translateY(-8px) !important; /* solleva visivamente il contenuto */
	}

	.home-custom .latest-posts-container .post-grid .post-card,
	.latest-posts-container .post-grid .post-card,
	.home-custom .post-grid .post-card,
	.post-grid .post-card[style],
	.post-grid article.post-card.post-card--featured[style] {
		overflow: visible !important; /* evita clipping solo su desktop */
	}

	/* Assicura che le card si adattino in altezza quando il testo va a capo */
	.post-card {
		height: auto !important;
		min-height: 0 !important;
	}

	.post-card .post-card__body {
		height: auto !important;
		overflow: visible !important;
		padding-bottom: 0 !important;
	}

	.post-grid {
		grid-auto-rows: auto !important;
	}
}  

/* Override molto specifico (last-resort) per forzare padding-top:0 su desktop
   Questo contrasta regole con stesso livello di importanza presenti in style.css */
@media (min-width: 960px) {
	/* ID-based selectors hanno maggiore specificità e vincono anche se style.css è caricato dopo */
	#primary .post-grid article.post-card .post-card__body,
	#main .post-grid article.post-card .post-card__body,
	body.home .post-grid article.post-card .post-card__body,
	body.home-custom .post-grid article.post-card .post-card__body,
	.latest-posts-section .latest-posts-container .post-grid article.post-card .post-card__body {
		padding-top: 0 !important;
		transform: translateY(-8px) !important;
		/* specifiche addizionali per garantire adattamento */
		height: auto !important;
		overflow: visible !important;
	}
}
