/*
 * Chuyển động — chỉ transform/opacity, có lý do, tắt hẳn khi prefers-reduced-motion.
 *
 * 1. Hiện dần từng phần khi cuộn: tiêu đề → chữ → từng thẻ (reveal.js + inc/motion.php, bật/tắt trong Tuỳ biến).
 *    Hero + banner đầu trang không animate để không làm chậm LCP. JS lỗi → sau 2,5s hiện toàn bộ.
 * 2. Phản hồi thao tác: nút nhấn lún nhẹ, card nhấc lên khi hover (chỉ thiết bị có chuột).
 * 3. Cuộn mượt tới #dat-lich (nút Đặt lịch) + chừa khoảng cho header.
 */

:root {
	--hs-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
	--hs-dur-fast: 150ms;
	--hs-dur: 300ms;
}

/* ===== 3. Cuộn mượt tới anchor ===== */
@media (prefers-reduced-motion: no-preference) {

	html {
		scroll-behavior: smooth;
	}
}

#dat-lich {
	scroll-margin-top: 24px;
}

/* ===== 2. Phản hồi thao tác ===== */
.button,
input[type="submit"].wpcf7-submit {
	transition:
		background-color var(--hs-dur-fast) ease-out,
		color var(--hs-dur-fast) ease-out,
		transform var(--hs-dur-fast) var(--hs-ease-out);
}

.button:active,
input[type="submit"].wpcf7-submit:active {
	transform: scale(0.98);
}

.header-button-1 .button::after,
.hs-hero .button.primary::after,
.hs-dat-lich .hs-goi-to::after {
	transition: transform var(--hs-dur) var(--hs-ease-out);
}

@media (hover: hover) {

	.header-button-1 .button:hover::after,
	.hs-hero .button.primary:hover::after,
	.hs-dat-lich .hs-goi-to:hover::after {
		transform: rotate(45deg);
	}
}

/* Card: bỏ hiệu ứng hover ở thiết bị cảm ứng (tránh "dính" trạng thái hover sau khi chạm). */
@media (hover: none) {

	.hs-card:hover .elementor-icon-box-wrapper {
		box-shadow: none;
		transform: none;
	}
}

/* ===== 1. Hiện dần từng phần khi cuộn =====
 * html.hs-reveal do inc/motion.php đặt (tắt được trong Tuỳ biến → Hiệu ứng); reveal.js thêm .is-in khi mẩu vào màn hình.
 * Danh sách selector PHẢI trùng ITEMS trong assets/js/reveal.js. Dùng animation + thuộc tính translate
 * (không đụng transform/transition) → hiệu ứng hover của thẻ vẫn giữ nguyên. */
@keyframes hs-rv {

	from {
		opacity: 0;
		translate: 0 28px;
	}
}

html.hs-reveal #main .hs-sec .col-inner > :not(.hs-grid),
html.hs-reveal #main .hs-sec .hs-grid > *,
html.hs-reveal .hs-has-banner #content .col > *,
html.hs-reveal .footer-wrapper .widget {
	opacity: 0;
}

html.hs-reveal :is(#main .hs-sec .col-inner > :not(.hs-grid), #main .hs-sec .hs-grid > *, .hs-has-banner #content .col > *, .footer-wrapper .widget).is-in {
	opacity: 1;
	animation: hs-rv 0.7s var(--hs-ease-out) var(--hs-d, 0ms) backwards;
}

/* ===== Giảm chuyển động: tắt mọi hiệu ứng ===== */
@media (prefers-reduced-motion: reduce) {

	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}
}
