/**
 * Trang Ứng dụng — CSS riêng.
 *
 * Chỉ chứa những khối chỉ trang này mới có: hero hai cột với mockup điện thoại
 * nghiêng, thẻ social proof, dải ảnh chụp màn hình, banner QR.
 * Mọi thứ còn lại (card, grid, nút, stats, carousel) dùng lại components.css.
 *
 * Mọi màu lấy từ tokens.css — không hardcode.
 */

/* ═════════════════════════════════════════════════════════
 * HERO
 * ═════════════════════════════════════════════════════════ */
.htd-app-hero {
	overflow: hidden;
	background: var(--htd-grad-hero);
	padding-bottom: calc(var(--htd-section-y) + var(--htd-space-4));
}

.htd-app-hero__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
	align-items: center;
	gap: var(--htd-space-10);
}

.htd-app-hero__copy {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--htd-space-5);
}

/* "Ứng dụng" — chữ nhấn phía trên H1, không viết hoa toàn bộ như eyebrow chuẩn */
.htd-app-hero__eyebrow {
	font-family: var(--htd-font-display);
	font-size: var(--htd-text-2xl);
	font-weight: var(--htd-weight-extrabold);
	line-height: 1.1;
	color: var(--htd-primary);
}

.htd-app-hero__title {
	font-size: var(--htd-text-5xl);
	line-height: 1.08;
	color: var(--htd-blue-800);
}

.htd-app-hero__lead {
	max-width: 34ch;
	font-size: var(--htd-text-lg);
	line-height: var(--htd-leading-relaxed);
	color: var(--htd-ink-600);
}

.htd-app-hero__stores {
	gap: var(--htd-space-4);
	margin-top: var(--htd-space-2);
}

/* ── Thẻ social proof nổi ───────────────────────────────── */
.htd-app-proof {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--htd-space-6);
	margin-top: var(--htd-space-4);
	padding: var(--htd-space-3) var(--htd-space-6);
	border-radius: var(--htd-radius-pill);
	background: var(--htd-surface);
	box-shadow: var(--htd-shadow-lg);
}

.htd-app-proof__item {
	display: flex;
	align-items: center;
	gap: var(--htd-space-3);
}

/* Vạch ngăn giữa cụm avatar và cụm đánh giá */
.htd-app-proof__item + .htd-app-proof__item {
	padding-left: var(--htd-space-6);
	border-left: 1px solid var(--htd-border);
}

.htd-app-proof__text {
	display: grid;
	gap: 0.125rem;
	font-size: var(--htd-text-xs);
	line-height: var(--htd-leading-snug);
	color: var(--htd-ink-500);
}

.htd-app-proof__text strong {
	font-size: var(--htd-text-sm);
	font-weight: var(--htd-weight-bold);
	color: var(--htd-ink-900);
}

/* Cụm avatar chồng mép lên nhau */
.htd-app-avatars {
	display: flex;
	flex: none;
}

.htd-app-avatars li + li {
	margin-left: -0.6875rem;
}

.htd-app-avatars .htd-avatar {
	width: 2rem;
	height: 2rem;
}

/* ── Cột phải: mockup điện thoại + bong bóng ────────────── */
.htd-app-hero__visual {
	position: relative;
	display: flex;
	justify-content: center;
	padding-bottom: var(--htd-space-8);
}

/* Phân tử 3D trôi phía sau, thuần trang trí */
.htd-app-hero__molecule {
	position: absolute;
	top: var(--htd-space-4);
	left: 0;
	z-index: var(--htd-z-decor);
	width: clamp(6rem, 14vw, 10.5rem);
	pointer-events: none;
	user-select: none;
}

.htd-app-phones {
	position: relative;
	z-index: var(--htd-z-content);
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.htd-app-phone {
	width: clamp(9rem, 20vw, 16rem);
	filter: drop-shadow(var(--htd-shadow-xl));
}

/* Máy trước: màn hình chính, nghiêng nhẹ ngược chiều kim đồng hồ */
.htd-app-phone--front {
	position: relative;
	z-index: 2;
	transform: rotate(-4deg);
}

/* Máy sau: lùi về phía sau, nhấc cao hơn và thu nhỏ để tạo chiều sâu */
.htd-app-phone--back {
	position: relative;
	z-index: 1;
	margin-left: -18%;
	margin-bottom: 7%;
	transform: rotate(3deg) scale(0.93);
}

.htd-app-hero__bubble {
	position: absolute;
	right: 0;
	bottom: 0;
	z-index: 2;
	max-width: 12rem;
	line-height: var(--htd-leading-snug);
	text-align: center;
}

/* ═════════════════════════════════════════════════════════
 * ICON LỚN TRONG CARD (tính năng & lợi ích)
 * ═════════════════════════════════════════════════════════ */
.htd-app-glyph {
	width: 4rem;
	height: 4rem;
	color: var(--htd-blue-400);
}

.htd-app-glyph svg {
	width: 3rem;
	height: 3rem;
}

/* Card của trang này thoáng hơn card mặc định để bám thiết kế */
.htd-app-cards .htd-card {
	padding-block: var(--htd-space-8);
}

/* ═════════════════════════════════════════════════════════
 * GIAO DIỆN ỨNG DỤNG — dải ảnh chụp màn hình
 * ═════════════════════════════════════════════════════════ */
.htd-app-gallery {
	overflow: hidden;
	background: linear-gradient(180deg, var(--htd-surface) 0%, var(--htd-surface-sunken) 45%, var(--htd-surface) 100%);
}

/* Công thức H2O mờ trang trí hai bên tiêu đề */
.htd-app-formula {
	position: absolute;
	top: calc(var(--htd-section-y) - var(--htd-space-2));
	font-family: var(--htd-font-display);
	font-size: var(--htd-text-xl);
	font-weight: var(--htd-weight-bold);
	color: var(--htd-blue-300);
	opacity: 0.75;
	pointer-events: none;
	user-select: none;
}

.htd-app-formula--left  { left: 22%; }
.htd-app-formula--right { right: 22%; }

.htd-app-formula sub {
	font-size: 0.7em;
}

.htd-app-shot {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--htd-space-4);
	margin: 0;
}

.htd-app-shot img {
	width: 100%;
	border-radius: var(--htd-radius-xl);
	background: var(--htd-surface);
	box-shadow: var(--htd-shadow-lg);
}

.htd-app-shot__caption {
	font-size: var(--htd-text-base);
	font-weight: var(--htd-weight-bold);
	color: var(--htd-primary);
}

.htd-app-carousel .htd-carousel__item {
	width: clamp(10.5rem, 42vw, 14rem);
}

/* ═════════════════════════════════════════════════════════
 * BANNER TẢI APP
 * ═════════════════════════════════════════════════════════ */
.htd-app-cta-section {
	/* Ảnh Thầy Đạt tràn xuống dưới banner nên bớt padding đáy cho khít dải số liệu */
	padding-bottom: var(--htd-space-10);
	/* Tạo ngữ cảnh xếp lớp thấp hơn dải số liệu phía dưới */
	z-index: var(--htd-z-decor);
}

.htd-app-cta {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) auto minmax(0, 0.85fr);
	align-items: center;
	gap: var(--htd-space-8);
	padding: var(--htd-space-12) var(--htd-space-10);
	border-radius: var(--htd-radius-xl);
	background: var(--htd-grad-banner);
	box-shadow: var(--htd-shadow-lg);
}

.htd-app-cta__copy {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--htd-space-4);
}

.htd-app-cta__title {
	font-size: var(--htd-text-3xl);
	line-height: 1.25;
	color: var(--htd-ink-on-dark);
}

.htd-app-cta__text {
	color: var(--htd-ink-on-dark-muted);
}

.htd-app-cta__stores {
	gap: var(--htd-space-4);
	margin-top: var(--htd-space-2);
}

/* ── Cụm mã QR ──────────────────────────────────────────── */
.htd-app-cta__qr {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--htd-space-4);
}

.htd-app-qr {
	width: clamp(6.5rem, 11vw, 8.5rem);
	height: auto;
	padding: var(--htd-space-2);
	border-radius: var(--htd-radius-md);
	background: var(--htd-surface);
	box-shadow: var(--htd-shadow-md);
}

/* Mũi tên cong trỏ ngược vào mã QR từ bên phải */
.htd-app-qr__arrow {
	position: absolute;
	top: 38%;
	left: calc(100% + var(--htd-space-3));
	width: 3rem;
	height: 3rem;
	color: var(--htd-ink-on-dark-muted);
	transform: scaleY(-1);
}

.htd-app-qr__note {
	display: flex;
	align-items: center;
	gap: var(--htd-space-2);
	font-family: var(--htd-font-display);
	font-size: var(--htd-text-sm);
	font-weight: var(--htd-weight-semibold);
	line-height: var(--htd-leading-snug);
	color: var(--htd-ink-on-dark);
}

.htd-app-qr__note-arrow {
	width: 1.75rem;
	height: 1.75rem;
	flex: none;
	color: var(--htd-ink-on-dark-muted);
	transform: rotate(-90deg);
}

/* Ảnh Thầy Đạt tràn lên mép trên và xuống mép dưới banner */
.htd-app-cta__figure {
	align-self: end;
	justify-self: center;
	width: 100%;
	max-width: 20rem;
	margin-top: calc(var(--htd-space-16) * -1);
	margin-bottom: calc(var(--htd-space-10) * -1);
}

/* ═════════════════════════════════════════════════════════
 * DẢI SỐ LIỆU — tràn hết bề ngang, không bo góc
 * ═════════════════════════════════════════════════════════ */
.htd-app-stats-band {
	position: relative;
	/* Nằm trên ảnh Thầy Đạt đang tràn xuống từ banner phía trên */
	z-index: var(--htd-z-content);
	padding-block: var(--htd-space-8);
	background: var(--htd-grad-stats);
}

.htd-app-stats {
	padding: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
}

/* Thiết kế không có vạch ngăn giữa các số liệu */
.htd-app-stats .htd-stat + .htd-stat {
	border-left: 0;
}

.htd-app-stats .htd-stat__value {
	font-size: var(--htd-text-3xl);
}

/* ═════════════════════════════════════════════════════════
 * RESPONSIVE
 * ═════════════════════════════════════════════════════════ */
@media (max-width: 1180px) {
	.htd-app-formula--left  { left: var(--htd-space-6); }
	.htd-app-formula--right { right: var(--htd-space-6); }
}

@media (max-width: 1024px) {
	.htd-app-hero__inner {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--htd-space-8);
	}

	.htd-app-hero__copy {
		align-items: center;
		text-align: center;
	}

	.htd-app-hero__lead {
		max-width: 52ch;
	}

	.htd-app-hero__stores,
	.htd-app-proof {
		justify-content: center;
	}

	.htd-app-hero__molecule {
		left: var(--htd-space-2);
	}

	/* Banner: chữ chiếm trọn hàng đầu, QR và ảnh xuống hàng dưới */
	.htd-app-cta {
		grid-template-columns: minmax(0, 1fr) auto;
		padding: var(--htd-space-10) var(--htd-space-8);
	}

	.htd-app-cta__copy {
		grid-column: 1 / -1;
	}

	.htd-app-cta__figure {
		max-width: 15rem;
		margin-top: 0;
	}
}

@media (max-width: 768px) {
	.htd-app-hero__bubble {
		right: auto;
		left: 50%;
		bottom: calc(var(--htd-space-2) * -1);
		transform: translateX(-50%);
	}

	/* Bỏ nghiêng trên mobile: hai máy chồng nhau dễ vỡ bố cục */
	.htd-app-phone--front,
	.htd-app-phone--back {
		transform: none;
	}

	.htd-app-phone {
		width: clamp(8rem, 34vw, 11rem);
	}

	.htd-app-phone--back {
		margin-left: -12%;
		margin-bottom: 5%;
	}

	.htd-app-formula {
		display: none;
	}
}

@media (max-width: 640px) {
	.htd-app-proof {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--htd-space-3);
		border-radius: var(--htd-radius-xl);
	}

	.htd-app-proof__item + .htd-app-proof__item {
		padding-left: 0;
		padding-top: var(--htd-space-3);
		border-left: 0;
		border-top: 1px solid var(--htd-border);
		width: 100%;
	}

	.htd-app-cta {
		grid-template-columns: minmax(0, 1fr);
		padding: var(--htd-space-8) var(--htd-space-5);
		text-align: center;
	}

	.htd-app-cta__copy {
		grid-column: auto;
		align-items: center;
	}

	.htd-app-cta__stores {
		justify-content: center;
	}

	/* Mũi tên cong hết chỗ khi banner xếp dọc */
	.htd-app-qr__arrow {
		display: none;
	}

	.htd-app-cta__figure {
		max-width: 13rem;
		margin-bottom: calc(var(--htd-space-8) * -1);
	}

	.htd-app-stats .htd-stat {
		justify-content: flex-start;
	}
}
