/**
 * CCL MH Customizer — list thumbs 16:9 + text aligned to image height.
 *
 * smart mode:
 * - landscape / ~16:9 → object-fit: contain (immagine intera)
 * - immagini più alte → object-fit: cover + center (box 16:9)
 */

.ccl-mh-customizer .mh-posts-list-item {
	display: flex;
	align-items: flex-start;
	gap: 0;
}

.ccl-mh-customizer .mh-posts-list-thumb {
	float: none;
	flex: 0 0 auto;
	width: 260px;
	max-width: 38%;
	margin: 0 18px 0 0;
}

.ccl-mh-customizer .mh-posts-list-thumb a.mh-thumb-icon {
	display: block;
	aspect-ratio: 16 / 9;
	width: 100%;
	background: transparent;
	overflow: hidden;
	line-height: 0;
}

.ccl-mh-customizer .mh-posts-list-thumb img {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: var(--ccl-mh-thumb-fit, contain);
	object-position: center center;
	display: block;
}

.ccl-mh-thumb-smart .mh-posts-list-thumb img,
.ccl-mh-thumb-smart .mh-posts-large-thumb img,
.ccl-mh-thumb-smart .mh-custom-posts-thumb-xl img,
.ccl-mh-thumb-smart .mh-custom-posts-thumb img {
	object-fit: contain;
}

.ccl-mh-thumb-smart .ccl-mh-thumb-tall img,
.ccl-mh-thumb-smart img.ccl-mh-img-tall {
	object-fit: cover;
	object-position: center center;
}

.ccl-mh-customizer .mh-posts-list-content {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 0;
}

.ccl-mh-customizer .mh-posts-list-header {
	margin-top: 0;
	margin-bottom: 6px;
}

.ccl-mh-customizer .mh-posts-list-title {
	font-size: 1.05rem;
	line-height: 1.35;
	margin: 0 0 4px;
	word-break: break-word;
}

.ccl-mh-customizer .mh-posts-list-header .mh-meta,
.ccl-mh-customizer .mh-posts-list-header .entry-meta {
	font-size: 0.75rem;
	line-height: 1.3;
	margin: 0 0 4px;
}

.ccl-mh-customizer .mh-posts-list-excerpt {
	font-size: 0.875rem;
	line-height: 1.45;
	margin: 0;
}

/**
 * Text clamp ON: same row height as 16:9 thumb.
 * Title/meta on top; excerpt fills remaining space down to image bottom.
 */
.ccl-mh-text-clamp .mh-posts-list-item {
	display: grid;
	grid-template-columns: minmax(190px, 234px) minmax(0, 1fr);
	column-gap: 18px;
	align-items: stretch;
}

.ccl-mh-text-clamp .mh-posts-list-thumb {
	width: auto;
	max-width: none;
	margin: 0;
}

.ccl-mh-text-clamp .mh-posts-list-content {
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	/* height:0 + min-height:100% → same height as thumb, without growing the row */
	height: 0;
	min-height: 100%;
	min-width: 0;
	overflow: hidden;
}

.ccl-mh-text-clamp .mh-posts-list-header {
	flex: 0 0 auto;
}

.ccl-mh-text-clamp .mh-posts-list-title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--ccl-mh-title-lines, 2);
	line-clamp: var(--ccl-mh-title-lines, 2);
	overflow: hidden;
}

.ccl-mh-text-clamp .mh-posts-list-excerpt {
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--ccl-mh-excerpt-lines, 6);
	line-clamp: var(--ccl-mh-excerpt-lines, 6);
}

.ccl-mh-customizer .mh-posts-large-title,
.ccl-mh-customizer .mh-custom-posts-xl-title,
.ccl-mh-customizer .mh-posts-grid-title {
	word-break: break-word;
}

.ccl-mh-customizer .mh-custom-posts-thumb-xl a.mh-thumb-icon,
.ccl-mh-customizer .mh-custom-posts-thumb a.mh-thumb-icon,
.ccl-mh-customizer .mh-posts-large-thumb a.mh-thumb-icon {
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	line-height: 0;
	background: transparent;
}

.ccl-mh-customizer .mh-custom-posts-thumb-xl img,
.ccl-mh-customizer .mh-custom-posts-thumb img,
.ccl-mh-customizer .mh-posts-large-thumb img {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: var(--ccl-mh-thumb-fit, contain);
	object-position: center center;
	display: block;
}

/* Pagination */
.ccl-mh-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-top: 20px;
	margin-bottom: 10px;
}

.ccl-mh-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	height: 42px;
	padding: 0 12px;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: #e9e9e9;
	color: #111;
	font-weight: 700;
	font-size: 15px;
	line-height: 1;
	text-decoration: none;
	box-sizing: border-box;
}

.ccl-mh-pagination a.page-numbers:hover {
	background: #dcdcdc;
	color: #111;
}

.ccl-mh-pagination .page-numbers.current,
.ccl-mh-pagination .page-numbers.current:hover {
	background: var(--ccl-mh-page-accent, #2f80ed);
	color: #fff;
}

.ccl-mh-pagination .page-numbers.dots {
	background: transparent;
	min-width: 28px;
	padding: 0 4px;
	font-weight: 700;
}

.ccl-mh-pagination .prev,
.ccl-mh-pagination .next {
	font-size: 16px;
}

.ccl-mh-posts-paginated {
	margin-bottom: 5px;
}

@media (max-width: 767px) {
	.ccl-mh-customizer .mh-posts-list-item,
	.ccl-mh-text-clamp .mh-posts-list-item {
		display: block;
	}

	.ccl-mh-customizer .mh-posts-list-thumb,
	.ccl-mh-text-clamp .mh-posts-list-thumb {
		float: left;
		width: auto;
		max-width: 120px;
		margin: 0 12px 0 0;
	}

	.ccl-mh-text-clamp .mh-posts-list-content {
		height: auto;
		min-height: 0;
		overflow: visible;
		display: block;
	}

	.ccl-mh-customizer .mh-posts-list-title {
		font-size: 0.95rem;
	}

	.ccl-mh-pagination .page-numbers {
		min-width: 36px;
		height: 36px;
		font-size: 14px;
	}
}
