/* Hiệu ứng chung cho mọi trang. Gắn hieu-ung.css ngay sau dien-thoai.css và hieu-ung.js trước </body>;
   trang mới cũng phải gắn cả 2. Tất cả tự tắt khi máy bật giảm chuyển động.
   Trình duyệt cũ hoặc không có JavaScript thì trang hiện đủ như thường, chỉ không có hiệu ứng. */

/* ---------- 1. Chuyển trang mượt ---------- */
/* Bấm thẻ ở trang chủ: ảnh của thẻ phóng thành khối đầu trang con, quay lại thì thu về thẻ.
   Thẻ thứ n và khối đầu trang con tương ứng (lớp the-dich-n) mang cùng một tên.
   Thanh đầu trang và 2 nút tròn nổi đứng yên trong lúc chuyển trang. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto }
}
header.sticky { view-transition-name: dau-trang }
body > .fixed.z-40 { view-transition-name: nut-noi }
.thu-muc:nth-child(1) .thu-muc-anh, .the-dich-1 { view-transition-name: the-1 }
.thu-muc:nth-child(2) .thu-muc-anh, .the-dich-2 { view-transition-name: the-2 }
.thu-muc:nth-child(3) .thu-muc-anh, .the-dich-3 { view-transition-name: the-3 }
.thu-muc:nth-child(4) .thu-muc-anh, .the-dich-4 { view-transition-name: the-4 }
.thu-muc:nth-child(5) .thu-muc-anh, .the-dich-5 { view-transition-name: the-5 }
.thu-muc:nth-child(6) .thu-muc-anh, .the-dich-6 { view-transition-name: the-6 }
.thu-muc-anh, [class*="the-dich-"] { view-transition-class: the }

::view-transition-old(root) { animation-duration: .3s }
::view-transition-new(root) { animation-duration: .4s }
::view-transition-group(.the) { animation-duration: .55s; animation-timing-function: cubic-bezier(.2, .7, .2, 1); overflow: clip }
::view-transition-old(.the), ::view-transition-new(.the) { height: 100%; object-fit: cover; animation-duration: .55s }
/* thẻ không có khối tương ứng ở trang kia thì mờ đi cùng nhịp với cả trang */
::view-transition-old(.the):only-child { animation-duration: .3s }
::view-transition-new(.the):only-child { animation-duration: .4s }

/* ---------- 2. Trang con: các khối hiện dần khi lướt tới ---------- */
/* hieu-ung.js gắn lớp hd + hd-cho cho khối còn nằm dưới màn hình, lướt tới thì gỡ hd-cho */
@media (prefers-reduced-motion: no-preference) {
  .hd { transition: opacity .8s ease-out var(--tre, 0s), translate .8s cubic-bezier(.2, .7, .2, 1) var(--tre, 0s) }
  .hd-cho { opacity: 0; translate: 0 1.75rem }
}
@media print {
  .hd-cho { opacity: 1; translate: none }
}

/* ---------- 3. Về chúng tôi: dòng thời gian tự vẽ ---------- */
/* lớp ve-san do đoạn script ngay sau danh sách gắn; hieu-ung.js đặt --ve (0 → 1) theo tay lướt
   và gắn lớp "sang" cho từng thẻ khi đường kẻ chạy tới số của thẻ đó */
.dong-thoi-gian.ve-san > div.absolute { clip-path: inset(0 0 calc((1 - var(--ve, 0)) * 100%) 0) }
.dong-thoi-gian.ve-san > li > span.absolute { transition: background-color .5s, color .5s, scale .55s cubic-bezier(.3, 1.5, .5, 1) }
.dong-thoi-gian.ve-san > li:not(.sang) > span.absolute { background-color: var(--color-cream-2); color: #c2410c8c; scale: .84; box-shadow: inset 0 0 0 1.5px #c2410c40 }
.dong-thoi-gian.ve-san > li.sang > span.absolute { animation: so-sang .9s ease-out }
@keyframes so-sang {
  from { box-shadow: 0 0 0 0 #f9731699 }
  to { box-shadow: 0 0 0 1rem #f9731600 }
}

/* ---------- 6. Nút Gọi nổi: 2 vòng sóng lan, vài giây một lần ---------- */
/* thay cho vòng nháy liên tục mỗi giây (animate-ping) có sẵn; máy bật giảm chuyển động thì thẻ span này đã ẩn */
body > .fixed.z-40 > a[href^="tel:"] > .animate-ping { animation: none; background: none }
body > .fixed.z-40 > a[href^="tel:"] > .animate-ping::before,
body > .fixed.z-40 > a[href^="tel:"] > .animate-ping::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: #c2410c66; opacity: 0; animation: goi-song 3.6s cubic-bezier(0, 0, .2, 1) infinite }
body > .fixed.z-40 > a[href^="tel:"] > .animate-ping::after { animation-delay: .45s }
@media (prefers-reduced-motion: no-preference) {
  body > .fixed.z-40 > a[href^="tel:"] > svg { animation: goi-rung 3.6s ease-in-out infinite }
}
@keyframes goi-song {
  0% { transform: scale(1); opacity: .85 }
  42%, 100% { transform: scale(1.9); opacity: 0 }
}
@keyframes goi-rung {
  0%, 26%, 100% { rotate: 0deg }
  4% { rotate: -14deg }
  9% { rotate: 12deg }
  14% { rotate: -9deg }
  19% { rotate: 6deg }
}
