/**
 * Card bài viết NTM — dùng chung mọi trang (archive, slider, related…).
 */

.ntm-post-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 28px 24px;
	align-items: stretch;
}

.ntm-post-grid > .ntm-post-card {
	height: 100%;
}

.ntm-post-grid__pagination {
	grid-column: 1 / -1;
	margin-top: 16px;
	padding-top: 8px;
}

.ntm-post-grid__pagination .page-numbers.nav-pagination {
	margin: 0;
}

.ntm-post-grid__pagination .page-numbers li .page-number,
.ntm-post-grid__pagination .page-numbers li a {
	min-width: 40px;
	height: 40px;
	line-height: 40px;
	border-radius: 999px;
	border: 1px solid color-mix(in srgb, var(--primary-color) 16%, transparent);
}

.ntm-post-grid__pagination .page-numbers li .current .page-number,
.ntm-post-grid__pagination .page-numbers li .page-number.current {
	background: var(--ntm-home-primary);
	border-color: var(--ntm-home-primary);
	color: #fff;
}

.ntm-post-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #fff;
	border-radius: var(--ntm-home-radius);
	overflow: hidden;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ntm-post-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--ntm-home-shadow);
}

.ntm-post-card__media {
	position: relative;
	display: block;
	overflow: hidden;
}

.ntm-post-card__media img {
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.ntm-post-card__media:hover img {
	transform: scale(1.05);
}

.ntm-post-card__badge {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 2;
	max-width: calc(100% - 28px);
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--ntm-home-primary);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ntm-post-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 18px 20px 22px;
}

.ntm-post-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-bottom: 10px;
	font-size: 0.78rem;
	color: var(--ntm-color-muted);
}

.ntm-post-card__sep {
	opacity: 0.6;
}

.ntm-post-card__title {
	margin: 0 0 10px;
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	min-height: calc(1.4em * 2);
}

.ntm-post-card__title a {
	color: #1a1a1a !important;
	transition: color 0.2s ease;
}

.ntm-post-card:hover .ntm-post-card__title a {
	color: var(--ntm-home-primary) !important;
}

.ntm-post-card__excerpt {
	margin: 0 0 16px;
	font-size: 0.9rem;
	line-height: 1.65;
	color: #555;
	flex: 1;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	min-height: calc(1.65em * 2);
}

.ntm-post-card__more {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: auto;
	font-size: 0.84rem;
	font-weight: 700;
	color: var(--ntm-home-primary) !important;
}

.ntm-post-card__more-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--ntm-home-primary-light);
	transition: background 0.2s ease, transform 0.2s ease;
}

.ntm-post-card__more-icon svg {
	width: 14px;
	height: 14px;
}

.ntm-post-card__more:hover .ntm-post-card__more-icon {
	background: var(--ntm-home-primary);
	color: #fff;
	transform: translateX(2px);
}

.ntm-post-card__more:hover .ntm-post-card__more-icon svg path {
	stroke: #fff;
}

.ntm-related-posts {
	margin-top: 48px;
	padding-top: 40px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.ntm-related-posts__title {
	margin: 0 0 24px;
	font-size: 1.35rem;
	font-weight: 700;
	color: #1a1a1a;
}

.ntm-post-grid--related {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Slider / UX Builder [blog_posts] */
.ntm-post-card-scope.row-slider .flickity-viewport {
	transition: height 0.2s ease;
}

.ntm-post-card-scope .post-item {
	display: flex;
	align-self: stretch;
}

.ntm-post-card-scope .post-item .col-inner {
	display: flex;
	flex-direction: column;
	flex: 1;
	width: 100%;
	height: 100%;
}

.ntm-post-card-scope .post-item .ntm-post-card {
	flex: 1;
	width: 100%;
}

.ntm-post-card-scope .flickity-slider > .col,
.ntm-post-card-scope .slider .col {
	display: flex;
	align-items: stretch;
}

@media (max-width: 849px) {
	.ntm-post-grid,
	.ntm-post-grid--related {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 20px;
	}
}

@media (max-width: 549px) {
	.ntm-post-grid,
	.ntm-post-grid--related {
		grid-template-columns: 1fr;
	}

	.ntm-post-card__body {
		padding: 16px 16px 20px;
	}

	.ntm-related-posts {
		margin-top: 36px;
		padding-top: 28px;
	}
}
