/**
 * 热门文章（Popular Posts）
 *
 * 创意点：
 *   1. 编号徽章压在图片下沿（负边距 + 卡片底色外环），形成层叠感
 *   2. 悬停时标题底部的强调色下划线从 0 扫到 100%
 *   3. 悬停时图片右下角浮出「읽기 ›」胶囊
 *   4. 杂志式排版：第一条跨两列做大卡，文字压在图上（渐变遮罩），其余小卡
 *   5. 卡片抬升 + 边框变强调色 + 图片缓慢推近
 */

.wjc-posts {
	--wjc-posts-accent: #b6c81a;
	--wjc-posts-muted: #8b8f95;
	--wjc-posts-card-bg: #ffffff;
	--wjc-posts-card-border: rgba(17, 24, 39, 0.09);
	--wjc-posts-radius: 12px;
	--wjc-posts-ratio: 16/10;
	--wjc-posts-gap: 24px;
	--wjc-posts-cols: 3;
	--wjc-posts-btn-hover-bg: #16181b;
	--wjc-posts-btn-hover-color: #ffffff;

	position: relative;
	box-sizing: border-box;
	padding: 72px 20px;
}

.wjc-posts *,
.wjc-posts *::before,
.wjc-posts *::after {
	box-sizing: border-box;
}

/* ==================== 标题区 ==================== */
.wjc-posts__head {
	max-width: 900px;
	margin: 0 auto 38px;
	text-align: center;
}

.wjc-posts__eyebrow {
	margin-bottom: 10px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 11px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--wjc-posts-accent);
}

.wjc-posts__heading {
	margin: 0;
	font-size: clamp(23px, 2.2vw, 34px);
	font-weight: 800;
	line-height: 1.25;
	letter-spacing: -0.01em;
	color: #16181b;
	word-break: keep-all;
}

.wjc-posts__sub {
	margin: 12px 0 0;
	font-size: 14px;
	line-height: 1.7;
	color: var(--wjc-posts-muted);
}

/* ==================== 网格 ==================== */
.wjc-posts__grid {
	display: grid;
	grid-template-columns: repeat(var(--wjc-posts-cols, 3), minmax(0, 1fr));
	gap: var(--wjc-posts-gap);
	max-width: 1300px;
	margin: 0 auto;
	align-items: start;
}

/* ==================== 卡片 ==================== */
.wjc-posts__card {
	position: relative;
	border: 1px solid var(--wjc-posts-card-border);
	border-radius: var(--wjc-posts-radius);
	background-color: var(--wjc-posts-card-bg);
	transition:
		transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
		box-shadow 0.45s ease,
		border-color 0.45s ease;
}

.wjc-posts__link {
	display: block;
	height: 100%;
	color: inherit;
	text-decoration: none;
}

/* ==================== 图片 ==================== */
.wjc-posts__media {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: var(--wjc-posts-ratio, 16/10);
	overflow: hidden;
	border-radius: calc(var(--wjc-posts-radius) - 1px) calc(var(--wjc-posts-radius) - 1px) 0 0;
	background-color: #eef0f2;
}

.wjc-posts__media img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.wjc-posts__scrim {
	position: absolute;
	inset: 0;
	pointer-events: none;
	opacity: 0;
	background-image: linear-gradient(180deg, rgba(8, 10, 14, 0) 50%, rgba(8, 10, 14, 0.5) 100%);
	transition: opacity 0.45s ease;
}

/* 悬停浮出的「읽기」胶囊 */
.wjc-posts__read {
	position: absolute;
	right: 14px;
	bottom: 14px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	border-radius: 999px;
	background-color: var(--wjc-posts-accent);
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	color: #ffffff;
	opacity: 0;
	transform: translateY(10px);
	transition:
		opacity 0.35s ease,
		transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.wjc-posts__read svg {
	flex: 0 0 auto;
}

/* ==================== 文字区 ==================== */
.wjc-posts__body {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 22px 22px 24px;
}

/* 压在图片下沿的编号徽章 */
.wjc-posts__badge {
	position: relative;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin-top: -40px;
	margin-bottom: 4px;
	border-radius: 9px;
	background-color: var(--wjc-posts-accent);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1;
	color: #ffffff;
	box-shadow:
		0 8px 18px rgba(17, 24, 39, 0.18),
		0 0 0 4px var(--wjc-posts-card-bg);
	transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.wjc-posts__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.wjc-posts__date {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 11.5px;
	letter-spacing: 0.06em;
	color: var(--wjc-posts-muted);
}

.wjc-posts__tag {
	padding: 2px 8px;
	border: 1px solid var(--wjc-posts-card-border);
	border-radius: 999px;
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 0.04em;
	line-height: 1.6;
	color: var(--wjc-posts-muted);
}

/* 标题：悬停时底部强调色下划线从左扫到右 */
.wjc-posts__card-title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: -0.005em;
	color: #1d1f22;
	word-break: keep-all;
	background-image: linear-gradient(var(--wjc-posts-accent), var(--wjc-posts-accent));
	background-repeat: no-repeat;
	background-position: 0 100%;
	background-size: 0% 2px;
	transition: background-size 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.wjc-posts__excerpt {
	display: -webkit-box;
	margin: 2px 0 0;
	overflow: hidden;
	font-size: 13px;
	line-height: 1.75;
	color: #6b6f76;
	word-break: keep-all;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* ==================== 杂志式：第一条大卡 ==================== */
.wjc-posts.is-layout-featured .wjc-posts__card.is-featured {
	grid-column: span 2;
	border-color: transparent;
	background-color: transparent;
	box-shadow: 0 1px 2px rgba(17, 24, 39, 0.06);
}

.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__link {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	height: 100%;
	min-height: clamp(300px, 30vw, 420px);
	overflow: hidden;
	border-radius: var(--wjc-posts-radius);
}

.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__media {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	aspect-ratio: auto;
	border-radius: 0;
}

.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__scrim {
	opacity: 1;
	background-image: linear-gradient(180deg, rgba(8, 10, 14, 0.15) 20%, rgba(8, 10, 14, 0.85) 100%);
}

.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__body {
	margin-top: auto;
	padding: 26px 28px 28px;
}

/* 大卡上的文字反白 */
.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__badge {
	margin-top: 0;
	margin-bottom: 10px;
	box-shadow: 0 8px 18px rgba(8, 10, 14, 0.3);
}

.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__card-title {
	max-width: 42ch;
	font-size: clamp(18px, 1.7vw, 23px);
	color: #ffffff;
}

.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__excerpt {
	max-width: 52ch;
	color: rgba(255, 255, 255, 0.82);
}

.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__date {
	color: rgba(255, 255, 255, 0.72);
}

.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__tag {
	border-color: rgba(255, 255, 255, 0.32);
	color: rgba(255, 255, 255, 0.9);
}

/* 大卡不需要再浮「읽기」，整卡就是入口 */
.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__read {
	display: none;
}

/* ==================== 悬停（桌面） ==================== */
@media (hover: hover) {
	.wjc-posts__card:hover {
		transform: translateY(-6px);
		border-color: var(--wjc-posts-accent);
		box-shadow: 0 22px 46px rgba(17, 24, 39, 0.13);
	}

	.wjc-posts__card:hover .wjc-posts__media img {
		transform: scale(1.06);
	}

	.wjc-posts__card:hover .wjc-posts__card-title {
		background-size: 100% 2px;
	}

	.wjc-posts__card:hover .wjc-posts__badge {
		transform: translateY(-4px);
	}

	.wjc-posts__card:not(.is-featured):hover .wjc-posts__scrim {
		opacity: 0.85;
	}

	.wjc-posts__card:hover .wjc-posts__read {
		opacity: 1;
		transform: none;
	}

	.wjc-posts.is-layout-featured .wjc-posts__card.is-featured:hover {
		border-color: transparent;
		box-shadow: 0 26px 56px rgba(17, 24, 39, 0.22);
	}
}

/* 焦点可见性 */
.wjc-posts__link:focus-visible,
.wjc-posts__btn:focus-visible {
	outline: 2px solid var(--wjc-posts-accent);
	outline-offset: 3px;
}

/* ==================== 底部按钮 ==================== */
.wjc-posts__foot {
	margin-top: 38px;
	text-align: center;
}

.wjc-posts__btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 26px;
	border: 1px solid rgba(17, 24, 39, 0.16);
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	color: #2b2d31;
	text-decoration: none;
	transition:
		background-color 0.3s ease,
		color 0.3s ease,
		border-color 0.3s ease,
		transform 0.3s ease;
}

.wjc-posts__btn svg {
	flex: 0 0 auto;
	transition: transform 0.3s ease;
}

@media (hover: hover) {
	.wjc-posts__btn:hover {
		background-color: var(--wjc-posts-btn-hover-bg);
		border-color: var(--wjc-posts-btn-hover-bg);
		color: var(--wjc-posts-btn-hover-color);
		transform: translateY(-1px);
	}

	.wjc-posts__btn:hover svg {
		transform: translateX(3px);
	}
}

/* ==================== 响应式 ==================== */
@media (max-width: 1024px) {
	.wjc-posts {
		padding: 56px 20px;
	}

	.wjc-posts.is-layout-featured .wjc-posts__card.is-featured {
		grid-column: span 2;
	}
}

@media (max-width: 767px) {
	.wjc-posts {
		padding: 42px 16px;
		--wjc-posts-gap: 16px;
	}

	.wjc-posts__head {
		margin-bottom: 26px;
	}

	.wjc-posts__body {
		padding: 18px 18px 20px;
	}

	.wjc-posts__card-title {
		font-size: 15px;
	}

	/* 手机上大卡不再跨列，改回普通卡 */
	.wjc-posts.is-layout-featured .wjc-posts__card.is-featured {
		grid-column: span 1;
	}

	.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__link {
		min-height: 0;
	}

	.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__media {
		position: relative;
		inset: auto;
		height: auto;
		aspect-ratio: var(--wjc-posts-ratio, 16/10);
	}

	.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__scrim {
		opacity: 0;
	}

	.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__body {
		padding: 18px 18px 20px;
	}

	.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__badge {
		margin-top: -40px;
	}

	.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__card-title {
		font-size: 16px;
		color: #1d1f22;
	}

	.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__excerpt {
		color: #6b6f76;
	}

	.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__date {
		color: var(--wjc-posts-muted);
	}

	.wjc-posts.is-layout-featured .wjc-posts__card.is-featured .wjc-posts__tag {
		border-color: var(--wjc-posts-card-border);
		color: var(--wjc-posts-muted);
	}

	.wjc-posts__foot {
		margin-top: 28px;
	}
}

/* ==================== 降低动效 ==================== */
@media (prefers-reduced-motion: reduce) {
	.wjc-posts__card,
	.wjc-posts__media img,
	.wjc-posts__scrim,
	.wjc-posts__read,
	.wjc-posts__badge,
	.wjc-posts__card-title,
	.wjc-posts__btn,
	.wjc-posts__btn svg {
		transition: none;
	}

	.wjc-posts__card:hover,
	.wjc-posts__badge:hover,
	.wjc-posts__btn:hover {
		transform: none;
	}

	.wjc-posts__card:hover .wjc-posts__media img {
		transform: none;
	}

	.wjc-posts__read {
		opacity: 1;
		transform: none;
	}
}
