/* Tam Nhất — Category image-box grid (responsive) */

.tamnhat-cgrid {
	display: grid;
	grid-template-columns: repeat(var(--tn-cgrid-cols, 3), minmax(0, 1fr));
	gap: clamp(0.5rem, 1.2vw, 0.85rem);
	width: 100%;
}

.tamnhat-cbox {
	position: relative;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	aspect-ratio: var(--tn-cgrid-ratio, 4 / 3);
	min-height: 0;
	overflow: hidden;
	background-color: #012318;
	text-decoration: none !important;
	color: #fff !important;
	border-radius: clamp(2px, 0.4vw, 6px);
}

.tamnhat-cbox-bg {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	transition: transform 0.55s ease;
	z-index: 0;
}

.tamnhat-cbox-shade {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top,
		rgba(1, 35, 24, 0.82) 0%,
		rgba(1, 35, 24, 0.35) 42%,
		rgba(1, 35, 24, 0.12) 100%
	);
	transition: background 0.35s ease;
	pointer-events: none;
	z-index: 1;
}

.tamnhat-cbox-title {
	position: relative;
	z-index: 2;
	margin: 0;
	padding: clamp(0.85rem, 2.2vw, 1.35rem) clamp(0.5rem, 1.5vw, 1rem);
	width: 100%;
	box-sizing: border-box;
	font-size: clamp(0.8rem, 0.55vw + 0.7rem, 1.125rem);
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1.35;
	text-align: center;
	text-transform: uppercase;
	color: #fff !important;
	text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
	word-break: normal;
	overflow-wrap: anywhere;
}

.tamnhat-cbox-badge {
	position: absolute;
	top: clamp(0.4rem, 1vw, 0.65rem);
	right: clamp(0.4rem, 1vw, 0.65rem);
	z-index: 3;
	padding: 0.2rem 0.45rem;
	font-size: clamp(0.65rem, 0.3vw + 0.55rem, 0.75rem);
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #fff;
	background: #c62828;
	clip-path: polygon(0 0, 100% 0, 100% 70%, 85% 100%, 0 100%);
	line-height: 1.2;
}

.tamnhat-cbox:hover .tamnhat-cbox-shade {
	background: linear-gradient(
		to top,
		rgba(1, 35, 24, 0.9) 0%,
		rgba(1, 35, 24, 0.45) 48%,
		rgba(206, 170, 98, 0.18) 100%
	);
}

.tamnhat-cbox:hover .tamnhat-cbox-bg {
	transform: scale(1.06);
}

.tamnhat-cbox:focus-visible {
	outline: 2px solid #ceaa62;
	outline-offset: 2px;
}

@media (max-width: 849px) {
	.tamnhat-cgrid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 549px) {
	.tamnhat-cgrid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: clamp(0.35rem, 2vw, 0.55rem);
	}

	.tamnhat-cbox {
		aspect-ratio: 1 / 1;
	}
}
