/* ============================================================
   Category Posts Widget（分类文章网格）
   ============================================================ */

.cpg-section {
	box-sizing: border-box;
}

.cpg-section *,
.cpg-section *::before,
.cpg-section *::after {
	box-sizing: border-box;
}

/* ---- 网格 ---- */
.cpg-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: 40px;
	row-gap: 40px;
}

/* ---- 单个卡片：左图右文 ---- */
.cpg-item {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 20px;
	min-width: 0;
}

/* 整卡可点击（覆盖全卡的透明链接） */
.cpg-item-link {
	position: absolute;
	inset: 0;
	z-index: 1;
	text-indent: -9999px;
	overflow: hidden;
}

/* 图片和内容区在 cpg-item-link 之上，以便各自交互仍可点击 */
.cpg-image,
.cpg-content {
	position: relative;
	z-index: 2;
}

/* ---- 图片 ---- */
.cpg-image {
	flex: 0 0 45%;
	max-width: 45%;
	aspect-ratio: 1.5 / 1;
	display: block;
	overflow: hidden;
	background-color: #f2f2f2;
	line-height: 0;
}

.cpg-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.cpg-item:hover .cpg-image img {
	transform: scale(1.04);
}

/* ---- 内容区 ---- */
.cpg-content {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

/* ---- 标题（默认 2 行截断，可通过控件改行数） ---- */
.cpg-title {
	margin: 0 0 12px;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.35;
	color: #0a0f2e;

	/* 多行省略（-webkit-line-clamp 为实际生效属性，line-clamp 为未来标准兼容） */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	word-break: break-word;
}

.cpg-title a {
	color: inherit;
	text-decoration: none;
	transition: color 0.3s ease;
}

.cpg-title a:hover {
	color: #b71a33;
}

/* ---- 描述 ---- */
.cpg-excerpt {
	margin: 0;
	font-size: 14px;
	line-height: 1.7;
	color: #666;
	word-break: break-word;
}

/* ---- 空状态 ---- */
.cpg-empty {
	padding: 60px 20px;
	text-align: center;
	color: #888;
	font-size: 15px;
}

/* ============================================================
   分页：1 2 3 4 5 Next »
   ============================================================ */
.cpg-pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 40px;
}

.cpg-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	padding: 2px 4px;
	font-size: 15px;
	line-height: 1.4;
	color: #555;
	text-decoration: none;
	transition: color 0.25s ease;
}

.cpg-pagination a.page-numbers:hover {
	color: #b71a33;
}

.cpg-pagination .page-numbers.current {
	color: #b71a33;
	font-weight: 600;
}

.cpg-pagination .page-numbers.dots {
	color: #999;
	cursor: default;
}

.cpg-pagination .page-numbers.prev,
.cpg-pagination .page-numbers.next {
	padding: 2px 6px;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1024px) {
	.cpg-grid {
		column-gap: 30px;
		row-gap: 30px;
	}
}

@media (max-width: 767px) {
	.cpg-grid {
		grid-template-columns: 1fr;
		column-gap: 0;
		row-gap: 24px;
	}

	.cpg-item {
		gap: 14px;
	}

	.cpg-image {
		flex-basis: 40%;
		max-width: 40%;
	}

	.cpg-title {
		font-size: 16px;
		margin-bottom: 8px;
	}

	.cpg-excerpt {
		font-size: 13px;
		line-height: 1.6;
	}

	.cpg-pagination {
		gap: 10px;
		margin-top: 30px;
	}

	.cpg-pagination .page-numbers {
		font-size: 14px;
	}
}
