/* ==============================================
   Category Grid Widget
   ============================================== */

.ccg-wrap {
	width: 100%;
}

.ccg-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	column-gap: 30px;
	row-gap: 40px;
}

.ccg-item {
	display: flex;
	flex-direction: column;
}

/* --- 图片 --- */
.ccg-image {
	display: block;
	width: 100%;
	height: 320px;
	overflow: hidden;
	background-color: #0d0d0d;
	position: relative;
}

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

/* --- 文字内容区 --- */
.ccg-content {
	text-align: center;
	display: flex;
	flex-direction: column;
}

.ccg-title-link {
	text-decoration: none;
	color: inherit;
	display: inline-block;
}

.ccg-title {
	margin: 0;
	font-size: 20px;
	font-weight: 500;
	line-height: 1.3;
	color: #1f2937;
	transition: color .3s ease;
}

/* --- 图片悬停覆盖层 --- */
.ccg-image-overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.45);
	opacity: 0;
	transition: opacity .35s ease;
	pointer-events: none;
	z-index: 1;
}

/* --- 按钮（绝对定位在图片中央） --- */
.ccg-btn {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(0.92);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 32px;
	background-color: #000;
	color: #fff;
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.3px;
	border: 0 solid transparent;
	cursor: pointer;
	white-space: nowrap;
	z-index: 2;
	opacity: 0;
	visibility: hidden;
	transition: background-color .3s ease, color .3s ease, border-color .3s ease,
		opacity .35s ease, transform .35s ease, visibility .35s ease;
}

.ccg-btn:hover {
	background-color: #2b4182;
	color: #fff;
}

/* --- 悬停模式：仅悬停时显示 --- */
.ccg-wrap.ccg-show-hover .ccg-item:hover .ccg-image-overlay,
.ccg-wrap.ccg-show-hover .ccg-item:focus-within .ccg-image-overlay {
	opacity: 1;
}

.ccg-wrap.ccg-show-hover .ccg-item:hover .ccg-btn,
.ccg-wrap.ccg-show-hover .ccg-item:focus-within .ccg-btn {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, -50%) scale(1);
}

/* --- 始终显示模式 --- */
.ccg-wrap.ccg-show-always .ccg-image-overlay {
	opacity: 0;
}
.ccg-wrap.ccg-show-always .ccg-item:hover .ccg-image-overlay {
	opacity: 1;
}
.ccg-wrap.ccg-show-always .ccg-btn {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, -50%) scale(1);
}

/* --- 响应式 --- */
@media (max-width: 1024px) {
	.ccg-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 600px) {
	.ccg-grid {
		grid-template-columns: 1fr;
	}
}
