/* Block Sản phẩm theo nhóm (Figma 289:995) */

.block-products .container {
	max-width: 1374px;
}

/* Tab chỉ hiện khi JS đã gắn (tabs.js thêm .is-enhanced); không có JS thì mọi panel hiện kèm tiêu đề. */
.block-products__tabs {
	display: none;
	flex-wrap: wrap;
	justify-content: center;
	gap: clamp(8px, 1.67vw, 32px);
}

.block-products.is-enhanced .block-products__tabs {
	display: flex;
}

.block-products__tab {
	padding: clamp(10px, 0.83vw, 16px);
	border: 0;
	border-radius: var(--radius-sm);
	background: #fff;
	color: var(--color-text);
	font-family: var(--font-display);
	font-size: clamp(15px, 1.25vw, 24px);
	font-weight: 400;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
}

.block-products__tab:hover {
	background: #e9e9e9;
}

.block-products__tab[aria-selected="true"] {
	background: var(--color-text-strong);
	color: #fff;
	font-weight: 700;
}

.block-products__panel + .block-products__panel {
	margin-top: var(--section-space);
}

.block-products.is-enhanced .block-products__panel + .block-products__panel {
	margin-top: 0;
}

.block-products__panel-title {
	font-size: var(--fs-h2-sm);
	font-weight: 900;
	text-align: center;
	text-transform: uppercase;
}

.block-products.is-enhanced .block-products__panel-title {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
}

.block-products__desc {
	max-width: 820px;
	margin: clamp(16px, 1.67vw, 32px) auto 0;
	font-size: var(--fs-body);
	line-height: 1.25;
	text-align: center;
	color: var(--color-text-muted);
}

.block-products__stage {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 16px;
	margin-top: clamp(24px, 1.72vw, 33px);
}

.block-products__main {
	position: relative;
	overflow: hidden;
	border-radius: var(--radius-md);
	aspect-ratio: 736 / 662;
}

.block-products__main picture,
.block-products__main img {
	width: 100%;
	height: 100%;
}

.block-products__main img {
	object-fit: cover;
}

.block-products__caption {
	position: absolute;
	inset: auto 0 0;
	display: grid;
	gap: 4px;
	padding: clamp(16px, 1.25vw, 24px) clamp(20px, 2.08vw, 40px);
	background: rgba(0, 0, 0, 0.5);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	color: #fff;
}

.block-products__caption strong {
	font-family: var(--font-display);
	font-size: clamp(20px, 1.67vw, 32px);
	font-weight: 700;
	line-height: 1.22;
}

.block-products__caption span {
	font-size: var(--fs-body);
	line-height: 1.25;
	color: #e0e0e0;
}

.block-products__thumbs {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
}

.block-products__thumbs li {
	overflow: hidden;
	border-radius: var(--radius-sm);
	aspect-ratio: 1;
	background: var(--color-beige);
}

.block-products__thumbs img,
.block-products__thumbs picture {
	width: 100%;
	height: 100%;
}

.block-products__thumbs img {
	object-fit: cover;
	transition: transform 0.4s;
}

.block-products__thumbs li:hover img {
	transform: scale(1.06);
}

/* Desktop: 3 ảnh trái – ảnh chính – 3 ảnh phải (Figma: cột trái canh phải, cột phải canh trái, đối xứng). */
@media (min-width: 1024px) {
	.block-products__stage {
		grid-template-columns: minmax(0, 303fr) minmax(0, 736fr) minmax(0, 303fr);
		align-items: stretch;
	}

	.block-products__thumbs {
		grid-template-columns: minmax(0, 1fr);
		align-content: space-between;
		gap: 8px;
	}

	.block-products__thumbs--start li { justify-self: end; }
	.block-products__thumbs--end li { justify-self: start; }

	.block-products__thumbs--start li:nth-child(1),
	.block-products__thumbs--end li:nth-child(3) { width: 66%; aspect-ratio: 200 / 150; }

	.block-products__thumbs li:nth-child(2) { width: 100%; aspect-ratio: 303 / 228; }

	.block-products__thumbs--start li:nth-child(3),
	.block-products__thumbs--end li:nth-child(1) { width: 65%; aspect-ratio: 198 / 264; }
}

.block-products__cta {
	margin-top: clamp(24px, 1.67vw, 32px);
	text-align: center;
}

/* Tab tự chuyển mỗi 3 giây (assets/js/products.js): thanh tiến trình dưới tab đang chọn, chạy hết thì sang tab kế.
   Animation tự chạy lại từ đầu mỗi khi tab được chọn; .is-paused dừng tại chỗ. */
.block-products__tab {
	position: relative;
	overflow: hidden;
}

.block-products.is-autoplay .block-products__tab[aria-selected="true"]::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 3px;
	background: var(--color-primary);
	transform-origin: left;
	animation: products-tab-progress 3s linear both;
}

.block-products.is-paused .block-products__tab[aria-selected="true"]::after {
	animation-play-state: paused;
}

@keyframes products-tab-progress {
	from { transform: scaleX(0); }
	to { transform: scaleX(1); }
}

/* Chọn tab: nội dung nhóm mới chạy hiệu ứng vào (panel chuyển từ hidden sang hiện nên animation tự chạy lại). */
@media (prefers-reduced-motion: no-preference) {
	.block-products.is-enhanced .block-products__panel:not([hidden]) :is(.block-products__desc, .block-products__cta) {
		animation: products-up 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	}

	.block-products.is-enhanced .block-products__panel:not([hidden]) .block-products__cta {
		animation-delay: 0.3s;
	}

	.block-products.is-enhanced .block-products__panel:not([hidden]) .block-products__main {
		animation: products-zoom 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.05s both;
	}

	.block-products.is-enhanced .block-products__panel:not([hidden]) .block-products__thumbs--start li {
		animation: products-from-start 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	}

	.block-products.is-enhanced .block-products__panel:not([hidden]) .block-products__thumbs--end li {
		animation: products-from-end 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	}

	.block-products.is-enhanced .block-products__panel:not([hidden]) .block-products__thumbs li:nth-child(2) { animation-delay: 0.1s; }
	.block-products.is-enhanced .block-products__panel:not([hidden]) .block-products__thumbs li:nth-child(3) { animation-delay: 0.2s; }
}

@keyframes products-up {
	from { opacity: 0; transform: translateY(24px); }
}

@keyframes products-zoom {
	from { opacity: 0; transform: scale(0.94); }
}

@keyframes products-from-start {
	from { opacity: 0; transform: translateX(-48px); }
}

@keyframes products-from-end {
	from { opacity: 0; transform: translateX(48px); }
}
