/* Animation cho landing Ting Ting. CSS-first, không thư viện. JS (landing-animations.js) chỉ gắn class .in khi cuộn tới. */

@keyframes fadeUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes phoneIn { from { opacity: 0; transform: translateY(60px) scale(.94) rotate(-2deg); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.6) translateY(10px); } 70% { transform: scale(1.06); } to { opacity: 1; transform: none; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes ring { 0% { transform: scale(.55); opacity: .55; } 100% { transform: scale(1.35); opacity: 0; } }
@keyframes bell { 0%, 60%, 100% { transform: rotate(0); } 10% { transform: rotate(-7deg); } 20% { transform: rotate(6deg); } 30% { transform: rotate(-4deg); } 40% { transform: rotate(3deg); } 50% { transform: rotate(-1deg); } }
@keyframes drift { 0% { transform: translate(0, 0); } 50% { transform: translate(-30px, 20px); } 100% { transform: translate(0, 0); } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: .12; } 50% { transform: scale(1.12); opacity: .2; } }
@keyframes shine { from { transform: translateX(-120%) skewX(-20deg); } to { transform: translateX(220%) skewX(-20deg); } }

/* Hero: orchestration lúc tải trang */
.hero-copy > * { animation: fadeUp .7s cubic-bezier(.2, .7, .2, 1) both; }
.hero-copy > :nth-child(1) { animation-delay: .05s; }
.hero-copy > :nth-child(2) { animation-delay: .15s; }
.hero-copy > :nth-child(3) { animation-delay: .28s; }
.hero-copy > :nth-child(4) { animation-delay: .4s; }
.hero-copy > :nth-child(5) { animation-delay: .5s; }
.ting { display: inline-block; transform-origin: 50% 0; animation: bell 2.6s ease-in-out 1.2s infinite; }
.phone { animation: phoneIn .9s cubic-bezier(.2, .7, .2, 1) .25s both; position: relative; z-index: 1; }
.float { animation: popIn .6s cubic-bezier(.2, .7, .2, 1) both, bob 4s ease-in-out infinite; z-index: 2; }
.float-1 { animation-delay: .9s, 1.5s; }
.float-2 { animation-delay: 1.1s, 1.7s; animation-duration: .6s, 5s; }
.float-3 { animation-delay: 1.3s, 1.9s; animation-duration: .6s, 4.5s; }
.float:hover { animation-play-state: paused; }

/* Vòng sóng "ting" sau điện thoại (giống logo: đồng xu + sóng âm) */
.ting-rings { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.ting-rings span {
  position: absolute; width: 420px; height: 420px; border-radius: 50%;
  border: 2px solid rgba(242, 101, 34, .45); animation: ring 3.6s ease-out infinite;
}
.ting-rings span:nth-child(2) { animation-delay: 1.2s; }
.ting-rings span:nth-child(3) { animation-delay: 2.4s; }

/* Nền hero trôi nhẹ */
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none; filter: blur(10px);
  animation: drift 14s ease-in-out infinite;
}
.hero::before { width: 520px; height: 420px; right: -80px; top: -60px; background: radial-gradient(circle, rgba(255, 138, 76, .28), transparent 65%); }
.hero::after { width: 460px; height: 400px; left: -100px; bottom: 0; background: radial-gradient(circle, rgba(247, 197, 72, .28), transparent 65%); animation-delay: -7s; animation-direction: reverse; }
.hero > .container { position: relative; z-index: 1; }

/* Header đổ bóng khi cuộn */
.header { transition: box-shadow .3s, background .3s; }
.header.scrolled { box-shadow: 0 6px 24px rgba(27, 31, 42, .08); background: rgba(255, 251, 248, .96); }

/* Cuộn tới đâu hiện tới đó (JS gắn .in) */
[data-reveal] > * { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }
[data-reveal].in > * { opacity: 1; transform: none; }
[data-reveal] > :nth-child(2) { transition-delay: .1s; }
[data-reveal] > :nth-child(3) { transition-delay: .2s; }
[data-reveal] > :nth-child(4) { transition-delay: .3s; }
[data-reveal] > :nth-child(5) { transition-delay: .4s; }
[data-reveal] > :nth-child(6) { transition-delay: .5s; }
[data-reveal="one"] { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }
[data-reveal="one"].in { opacity: 1; transform: none; }
[data-reveal="one"] > * { opacity: 1; transform: none; transition: none; }

/* Micro-interaction hover */
/* Thẻ bước / tính năng: nâng thẳng, viền cam sáng, thanh gradient chạy ở mép trên, icon nảy nhẹ (không xoay) */
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-6px); } 70% { transform: translateY(-2px); } }
.step, .feature { overflow: hidden; transition: transform .25s, box-shadow .25s, border-color .25s; }
.step::before, .feature::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, var(--orange-light), var(--gold));
  transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
.feature { position: relative; }
.step:hover, .feature:hover { transform: translateY(-6px); border-color: rgba(242, 101, 34, .45); box-shadow: 0 14px 34px rgba(233, 87, 26, .16), 0 0 0 1px rgba(242, 101, 34, .12); }
.step:hover::before, .feature:hover::before { transform: scaleX(1); }
.step .num { transition: box-shadow .3s; }
.step:hover .num { box-shadow: 0 0 0 6px var(--orange-pale); }
.step:hover .emoji, .feature:hover .ic { animation: hop .5s ease; }
.feature .ic { transition: background .3s; }
.feature:hover .ic { background: var(--orange-pale); }
.stat { transition: transform .25s, box-shadow .25s; }
.stat:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.platform { transition: transform .25s, background .25s; }
.platform:hover { transform: translateX(6px); background: rgba(255, 255, 255, .1); }
.tag-live { position: relative; padding-left: 20px; }
.tag-live::before { content: ""; position: absolute; left: 8px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #6FE0A0; box-shadow: 0 0 0 0 rgba(111, 224, 160, .6); animation: pulseDot 2s infinite; }
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 rgba(111, 224, 160, .6); } 70% { box-shadow: 0 0 0 7px rgba(111, 224, 160, 0); } 100% { box-shadow: 0 0 0 0 rgba(111, 224, 160, 0); } }
/* Ảnh màn hình: nâng thẳng, viền khung chuyển cam phát sáng, chú thích đổi màu (không nghiêng) */
.screen .frame { transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s; }
.screen:hover .frame { transform: translateY(-8px); box-shadow: 0 0 0 3px var(--orange), 0 24px 44px rgba(233, 87, 26, .28); }
.screen b { transition: color .25s; }
.screen:hover b { color: var(--orange-dark); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); transform: translateX(-120%) skewX(-20deg); }
.btn-primary:hover::after { animation: shine .7s ease; }
.faq details p { animation: fadeUp .35s ease both; }
.faq summary::after { transition: transform .3s; }
.faq details[open] summary::after { transform: rotate(180deg); }

/* CTA: vòng sáng thở + huy hiệu store */
.cta::before { animation: breathe 6s ease-in-out infinite; }
.store { transition: transform .25s, background .25s; }
.store:hover { transform: translateY(-3px); }

/* Tôn trọng người dùng tắt hiệu ứng */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] > *, [data-reveal="one"] { opacity: 1; transform: none; }
}
@media (max-width: 640px) {
  .ting-rings span { width: 300px; height: 300px; }
}
