/**
 * DS Elements — Thẻ nhóm con
 *
 * Cuộn bằng scroll-snap thuần CSS; JS chỉ lo mũi tên (assets/js/carousel.js).
 */

.elementor-widget-ds-term-cards {
	width: 100%;
	min-width: 0;
}

.ds-tc {
	--ds-tc-cols: 8;
	--ds-tc-gap: var(--ds-space-4);
	--ds-tc-ratio: 1;
	--ds-tc-arrow-size: 36px;

	width: 100%;
	min-width: 0;
}

.ds-tc *,
.ds-tc *::before,
.ds-tc *::after {
	box-sizing: border-box;
}

/* --- Tiêu đề ------------------------------------------------------------ */

.ds-tc__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ds-space-4);
	margin-bottom: var(--ds-tc-head-gap, var(--ds-space-4));
}

.ds-tc__heading {
	margin: 0;
	color: var(--ds-tc-heading-color, var(--ds-color-brand));
	font-size: var(--ds-tc-heading-fs, var(--ds-fs-h2));
	font-weight: var(--ds-fw-bold);
	line-height: var(--ds-lh-h2);
	text-transform: uppercase;
}

.ds-tc__tools {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: var(--ds-space-4);
}

.ds-tc__more {
	color: var(--ds-tc-more-color, var(--ds-color-brand-light));
	font-size: var(--ds-fs-small);
	line-height: var(--ds-lh-small);
	text-decoration: none;
	white-space: nowrap;
}

.ds-tc__more:hover {
	text-decoration: underline;
}

.ds-tc__arrows {
	display: flex;
	gap: var(--ds-space-2);
}

.ds-tc__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--ds-tc-arrow-size);
	height: var(--ds-tc-arrow-size);
	padding: 0;

	background: transparent;
	color: var(--ds-tc-arrow-color, var(--ds-color-brand));
	border: 1px solid var(--ds-color-border);
	border-radius: var(--ds-radius-pill);
	cursor: pointer;
	transition: color var(--ds-transition), border-color var(--ds-transition), opacity var(--ds-transition);
}

.ds-tc__arrow:hover:not(:disabled) {
	color: var(--ds-color-brand-light);
	border-color: var(--ds-color-brand-light);
}

.ds-tc__arrow:disabled {
	opacity: .35;
	cursor: default;
}

.ds-tc__chev {
	width: 7px;
	height: 7px;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
}

.ds-tc__chev--prev {
	transform: translateX(2px) rotate(-135deg);
}

.ds-tc__chev--next {
	transform: translateX(-2px) rotate(45deg);
}

/* --- Vùng cuộn ---------------------------------------------------------- */

.ds-tc__track {
	display: flex;
	gap: var(--ds-tc-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-ms-overflow-style: none;

	/* Chừa chỗ cho box-shadow khỏi bị overflow cắt, kéo lại bằng margin âm.
	   scroll-padding phải đi kèm cùng giá trị, nếu không vị trí nghỉ lệch đúng
	   8px và nút lùi không bao giờ tắt. */
	padding: var(--ds-space-2);
	margin: calc(var(--ds-space-2) * -1);
	scroll-padding-inline: var(--ds-space-2);
}

.ds-tc__track::-webkit-scrollbar {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.ds-tc__track {
		scroll-behavior: auto;
	}
}

/* --- Thẻ ---------------------------------------------------------------- */

.ds-tc__card {
	flex: 0 0 auto;
	width: calc(
		(100% - (var(--ds-tc-cols) - 1) * var(--ds-tc-gap)) / var(--ds-tc-cols)
	);
	min-width: 0;
	scroll-snap-align: start;

	display: flex;
	flex-direction: column;
	overflow: hidden;

	background: var(--ds-tc-card-bg, var(--ds-color-white));
	border: 1px solid var(--ds-tc-card-border, var(--ds-color-border));
	border-radius: var(--ds-tc-card-radius, var(--ds-radius-md));
	box-shadow: var(--ds-shadow-card);
	transition: box-shadow var(--ds-transition), transform var(--ds-transition);
}

.ds-tc__card:hover {
	transform: translateY(-2px);
	box-shadow: var(--ds-shadow-raised);
}

.ds-tc__media {
	display: block;
	background: var(--ds-color-surface);
}

/* Tỉ lệ đặt thẳng lên <img>, không đặt trên khung bọc — cùng lỗi đã sửa ở
   material-cards.css: ảnh vuông trong khung 1.15 đẩy khung lên 130×130 thay vì
   130×113, thẻ "Chọn theo sản phẩm" lại cao hơn thẻ vị trí bên trái. */
.ds-tc__media img {
	width: 100%;
	height: auto; /* thuộc tính height của <img> WordPress thắng aspect-ratio nếu thiếu dòng này */
	display: block;
	aspect-ratio: var(--ds-tc-ratio);
	object-fit: cover;
}

.ds-tc__body {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	gap: var(--ds-space-2);
	padding: var(--ds-space-3);
	min-width: 0;
}

.ds-tc__name {
	margin: 0;
	font-size: var(--ds-fs-body);
	font-weight: var(--ds-fw-semibold);
	line-height: var(--ds-lh-tight);
}

.ds-tc__name a {
	color: var(--ds-tc-name-color, var(--ds-color-heading));
	text-decoration: none;
	transition: color var(--ds-transition);
}

.ds-tc__name a:hover {
	color: var(--ds-color-brand-light);
}

.ds-tc__link {
	margin-top: auto;
	color: var(--ds-tc-link-color, var(--ds-color-brand-light));
	font-size: var(--ds-fs-small);
	line-height: var(--ds-lh-small);
	text-decoration: none;
}

.ds-tc__link:hover {
	text-decoration: underline;
}

/* --- Màn nhỏ ------------------------------------------------------------ */

@media (max-width: 767px) {
	.ds-tc__head {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--ds-space-3);
	}

	.ds-tc__tools {
		width: 100%;
		justify-content: space-between;
	}
}
