/* Kho giao diện
   Dựng lại đúng khối .vd-* của trang cũ. Con số nào không khớp biến theme
   thì ghi thẳng, vì giống trang cũ quan trọng hơn gọn CSS. */

.cvm-showcase {
	/* Trang cũ đặt cỡ chữ gốc 16.5px / giãn dòng 1.72 cho cả trang chủ.
	   Nhãn "Web bán hàng" và mã mẫu không tự đặt line-height nên chiều cao
	   của chúng đẻ ra từ đúng hai con số này — theme mới dùng 14.5px/1.6
	   nên phải đặt lại ở đây, nếu không dải chú thích hụt mất 5px. */
	font-size: 16.5px;
	line-height: 1.72;
	color: #3D4A5F;

	--cvm-showcase-cols: 4;
	--cvm-showcase-ratio: 1.3333333;
	--cvm-ease: cubic-bezier(.2, .7, .3, 1);

	display: grid;
	grid-template-columns: repeat(var(--cvm-showcase-cols), minmax(0, 1fr));
	gap: 26px;
	/* Màn siêu rộng: lưới nở tới 1600px rồi dừng, quá nữa thì ảnh chụp to
	   hơn cả màn hình thật của người xem. */
	max-width: 1600px;
	margin-inline: auto;
}

.cvm-showcase__card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--wp--preset--color--line, #E5EBF3);
	border-radius: 20px;
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(11, 22, 51, .04), 0 10px 28px -14px rgba(11, 22, 51, .14);
	transition: transform .3s var(--cvm-ease), box-shadow .3s var(--cvm-ease), border-color .3s var(--cvm-ease);
}

.cvm-showcase__card:hover,
.cvm-showcase__card:focus-within {
	transform: translateY(-6px);
	box-shadow: 0 14px 36px -14px rgba(11, 22, 51, .2), 0 34px 70px -34px rgba(1, 80, 172, .3);
	border-color: rgba(10, 132, 255, .45);
}

/* Khung giấy quanh ảnh.
   Đệm dưới 28.5px = 12px viền dưới + 16.5px khoảng thở mà trang cũ có được
   nhờ margin-bottom của thẻ <p> WordPress tự chèn quanh nhãn "Xem chi tiết".
   Bỏ 16.5px đó là mỗi thẻ hụt 16.5px, cả khối hụt gần 50px. */
.cvm-showcase__frame {
	position: relative;
	padding: 14px 14px 28.5px;
	background-image: linear-gradient(180deg, #F4F8FD 0%, #FFFFFF 78%);
}

/* Bóng đổ hắt xuống dưới ô ảnh cho thẻ có chiều sâu; không có nền nên chỉ
   thấy phần bóng. Mốc bottom vẫn là 12px tính từ đáy khung như trang cũ. */
.cvm-showcase__frame::after {
	content: "";
	position: absolute;
	left: 14px;
	right: 14px;
	top: 14px;
	bottom: 12px;
	border-radius: 11px;
	box-shadow: 0 12px 24px -16px rgba(11, 22, 51, .28);
	pointer-events: none;
	z-index: 2;
}

.cvm-showcase__shot {
	position: relative;
	z-index: 1;
	aspect-ratio: 1 / var(--cvm-showcase-ratio);
	overflow: hidden;
	background: #EEF3F9;
	border-radius: 11px;
}

.cvm-showcase__img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: auto;
	display: block;
	border-radius: 0;
	transition: transform .7s var(--cvm-ease);
}

/* Quãng đẩy dài nên thời gian phải dài theo, nếu không ảnh lướt vèo qua và
   người xem không kịp đọc gì. */
.cvm-showcase__card:hover .cvm-showcase__img,
.cvm-showcase__card:focus-within .cvm-showcase__img {
	transform: translateY(var(--cvm-shift, 0));
	transition: transform 3.6s cubic-bezier(.3, 0, .25, 1);
}

.cvm-showcase__hint {
	position: absolute;
	right: 24px;
	bottom: 22px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 11px;
	border-radius: 999px;
	background: rgba(11, 22, 51, .82);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity .25s var(--cvm-ease), transform .25s var(--cvm-ease);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	pointer-events: none;
}

.cvm-showcase__hint svg {
	width: 14px;
	height: 14px;
	stroke: #7DD3FC;
	fill: none;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.cvm-showcase__card:hover .cvm-showcase__hint {
	opacity: 1;
	transform: translateY(0);
}

/* ---- Dải chú thích: ngành · loại web · mã mẫu ---- */
.cvm-showcase__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 13px 15px 14px;
	border-top: 1px solid var(--wp--preset--color--line, #E5EBF3);
}

/* Trang cũ đặt p{font-size:16.5px;line-height:1.72} cho cả trang, và chiều
   cao dải chú thích đẻ ra từ đúng hai con số đó. Theme mới có quy tắc toàn
   cục :root :where(p){line-height:1.6} — nó đặt thẳng lên thẻ <p> nên thắng
   cả giá trị 1.72 mà .cvm-showcase truyền xuống. Phải ghi lại ở đây, nếu
   không mỗi thẻ hụt hơn 1px và cả lưới lệch theo. */
.cvm-showcase__meta p {
	margin: 0;
	font-size: 16.5px;
	line-height: 1.72;
}

.cvm-showcase__txt {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 7px;
}

.cvm-showcase__name {
	font-family: var(--wp--preset--font-family--body, Inter, sans-serif);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: 0;
	color: #0B1633;
	margin: 0 0 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cvm-showcase__kind {
	display: inline-flex;
	align-items: center;
	padding: 3px 9px;
	border-radius: 999px;
	background: rgba(1, 80, 172, .07);
	color: var(--wp--preset--color--primary, #0150AC);
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	white-space: nowrap;
}

.cvm-showcase__code {
	flex: 0 0 auto;
	padding: 5px 9px;
	border-radius: 9px;
	background: rgba(1, 80, 172, .08);
	font-size: 11.5px;
	font-weight: 800;
	letter-spacing: .02em;
	color: var(--wp--preset--color--primary, #0150AC);
	/* Mã mẫu toàn chữ số: chữ số cùng bề ngang thì cột mã không nhấp nhô. */
	font-variant-numeric: tabular-nums;
}

.cvm-showcase__card:hover .cvm-showcase__code {
	background: var(--wp--preset--color--primary, #0150AC);
	color: #fff;
}

/* Cả thẻ là một liên kết. Chữ bị đẩy ra ngoài khung chứ không ẩn, để bộ đọc
   màn hình vẫn đọc được tên mẫu. */
.cvm-showcase__cover {
	position: absolute;
	inset: 0;
	z-index: 4;
	border-radius: inherit;
	text-indent: -9999px;
	overflow: hidden;
}

/* Viền bàn phím. Liên kết phủ đúng khung trong của thẻ, mà thẻ lại
   overflow:hidden — viền đặt ra ngoài liên kết (offset dương) bị cắt sạch.
   Trình duyệt cũ (không có :has) vẽ viền thụt vào trong liên kết để còn thấy. */
.cvm-showcase__cover:focus-visible {
	outline: 3px solid var(--wp--preset--color--primary-light, #0A84FF);
	outline-offset: -4px;
	/* main.css bo góc 4px cho mọi liên kết đang được bàn phím chọn; ở đây
	   viền phải ôm đúng góc 20px của thẻ nên phải lấy lại bo của thẻ. */
	border-radius: inherit;
}

/* Có :has thì vẽ viền lên chính thẻ (viền của thẻ không bị overflow của nó
   cắt) và bỏ viền trên liên kết để không thành hai vòng. */
@supports selector(:has(*)) {
	.cvm-showcase__card:has(.cvm-showcase__cover:focus-visible) {
		outline: 3px solid var(--wp--preset--color--primary-light, #0A84FF);
		outline-offset: 3px;
	}

	.cvm-showcase__cover:focus-visible { outline: none; }
}

@media (max-width: 1100px) {
	.cvm-showcase {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 20px;
	}
}

@media (max-width: 760px) {
	.cvm-showcase {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 14px;
	}

	.cvm-showcase__frame { padding: 10px 10px 24.5px; }

	.cvm-showcase__frame::after {
		left: 10px;
		right: 10px;
		top: 10px;
		bottom: 8px;
	}

	.cvm-showcase__meta { padding: 11px 12px 12px; }
	.cvm-showcase__txt { gap: 6px; }

	/* Thẻ hẹp một nửa: tên dài xuống hai dòng rồi mới cắt, chứ cắt ngay
	   dòng đầu thì "Thợ sửa khoá tại nhà" chỉ còn "Thợ sửa…". */
	.cvm-showcase__name {
		font-size: 13.5px;
		white-space: normal;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
		text-overflow: clip;
	}

	.cvm-showcase__kind {
		font-size: 9.5px;
		padding: 2px 7px;
	}

	.cvm-showcase__code {
		padding: 4px 7px;
		font-size: 10.5px;
		margin-top: 1px;
	}
}

/* Máy cảm ứng không có trạng thái rê chuột nên nhãn sẽ đứng yên mãi mãi. */
@media (hover: none) {
	.cvm-showcase__hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	/* Thẻ vẫn nhấc lên khi rê chuột / chọn bằng bàn phím, chỉ bỏ chuyển động. */
	.cvm-showcase__card { transition: none; }
	.cvm-showcase__img { transition: none; }

	.cvm-showcase__card:hover .cvm-showcase__img,
	.cvm-showcase__card:focus-within .cvm-showcase__img { transition: none; }
}

/* Trong trình soạn thảo luôn hiện nhãn để người dựng trang thấy nó tồn tại. */
.cvm-showcase.is-editing .cvm-showcase__hint {
	opacity: 1;
	transform: none;
}
