/* ==========================================================================
   DECAL TẤN KIỆT - ANIMATIONS (animations.css)
   - Vào web kiểu 1: Gạt phim / Lướt tem đua (Squeegee & Racing Reveal)
     + 3 sọc chéo vàng–cyan–trắng quét nhanh hé lộ trang
     + Hero stagger entrance + dải vàng quét nền + reel đáp xuống + đếm số
   - Chuyển tab kiểu 2: Sliding Active Pill trên Header + Directional Slide & Skew
     + Nền vàng trượt mượt giữa các tab, giữ nguyên bo tròn đầu/cuối
     + Nội dung lướt ra/vào đúng hướng trái–phải theo thứ tự tab
   - Scroll reveal nhẹ nhàng & micro-interactions khi rê chuột
   - Tôn trọng prefers-reduced-motion, tối ưu GPU (transform/opacity/clip-path)
   ========================================================================== */

/* ---------- 1. MÀN GẠT PHIM KHI VÀO WEB (Intro Squeegee Wipe) ---------- */
.intro-wipe {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
  visibility: visible;
  animation: introWrapDone 0.72s cubic-bezier(0.76, 0, 0.24, 1) forwards;
}

.intro-wipe__curtain {
  position: absolute;
  inset: 0 -20vw;
  background: rgb(var(--rgb-bg-deep, 14, 15, 18));
  transform: skewX(-14deg) translateX(0);
  will-change: transform;
  animation: introCurtainSweep 0.68s cubic-bezier(0.76, 0, 0.24, 1) 0.04s forwards;
}

:root[data-theme="light"] .intro-wipe__curtain {
  background: #15171a;
}

.intro-wipe__stripes {
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: -30vw;
  width: 120px;
  background: linear-gradient(
    90deg,
    rgb(var(--rgb-gold, 255, 210, 31)) 0 46%,
    transparent 46% 54%,
    rgb(var(--rgb-cyan, 34, 211, 238)) 54% 78%,
    transparent 78% 86%,
    #f5f6f7 86% 100%
  );
  transform: skewX(-14deg) translateX(0);
  box-shadow:
    0 0 36px rgba(var(--rgb-gold, 255, 210, 31), 0.5),
    0 0 18px rgba(var(--rgb-cyan, 34, 211, 238), 0.35);
  will-change: transform, opacity;
  animation: introStripesSweep 0.68s cubic-bezier(0.76, 0, 0.24, 1) 0.02s forwards;
}

@keyframes introCurtainSweep {
  0%   { transform: skewX(-14deg) translateX(0); }
  100% { transform: skewX(-14deg) translateX(135vw); }
}

@keyframes introStripesSweep {
  0%   { transform: skewX(-14deg) translateX(0); opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: skewX(-14deg) translateX(165vw); opacity: 0; }
}

@keyframes introWrapDone {
  0%, 99% { visibility: visible; }
  100%    { visibility: hidden; }
}

/* ---------- 2. HEADER ACCENT LINE & SLIDING TAB PILL ---------- */
.site-header::after {
  transform-origin: left center;
  animation: headerLineSweep 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.22s both;
}

@keyframes headerLineSweep {
  from { transform: scaleX(0); opacity: 0.3; }
  to   { transform: scaleX(1); opacity: 0.9; }
}

/* Thanh tab có nền trượt vàng: dùng :first-of-type / :last-of-type để nút đầu & cuối
   luôn giữ bo tròn 9999px + padding khớp khung pill kể cả khi chèn phần tử indicator */
.nav-tab-list {
  position: relative;
}

.nav-tab-list .nav-tab-item:first-of-type .nav-tab-btn {
  border-top-left-radius: 9999px;
  border-bottom-left-radius: 9999px;
  padding-left: 14px;
}

.nav-tab-list .nav-tab-item:last-of-type .nav-tab-btn {
  border-top-right-radius: 9999px;
  border-bottom-right-radius: 9999px;
  padding-right: 14px;
}

.nav-tab-indicator {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: var(--radius-sm, 6px);
  background: rgb(var(--rgb-gold));
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  will-change: transform, width, border-radius;
  transition:
    transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.18s ease;
  box-shadow: 0 4px 14px -4px rgba(var(--rgb-gold), 0.45);
}

.nav-tab-indicator.is-ready {
  opacity: 1;
}

.nav-tab-indicator.is-instant {
  transition: none !important;
}

.nav-tab-list.has-indicator .nav-tab-item {
  position: relative;
  z-index: 1;
}

.nav-tab-list.has-indicator .nav-tab-btn {
  position: relative;
  z-index: 1;
  transition: none;
}

.nav-tab-list.has-indicator.is-animated .nav-tab-btn {
  transition: color 0.18s ease;
}

.nav-tab-list.has-indicator .nav-tab-btn.active,
.nav-tab-list.has-indicator .nav-tab-btn.active:hover {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

/* ---------- 3. HERO STAGGERED RACING ENTRANCE (chỉ chạy lần đầu vào trang) ---------- */
body.anim-intro #view-home .hero-section::before {
  animation: heroStripesIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) 0.16s both;
}

@keyframes heroStripesIn {
  from {
    opacity: 0;
    transform: skewX(-24deg) translateX(70px);
  }
  to {
    opacity: 0.16;
    transform: skewX(-24deg) translateX(0);
  }
}

body.anim-intro #view-home .hero-badge {
  animation: raceSlideUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both;
}

body.anim-intro #view-home .hero-title--race .race-line {
  animation: raceDashIn 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.24s both;
}

body.anim-intro #view-home .hero-title--race .race-line--accent {
  animation-delay: 0.34s;
}

/* Dải vàng + sọc cyan sau dòng tiêu đề 2 quét ra như dán decal */
body.anim-intro #view-home .race-line--accent::before {
  transform-origin: left center;
  animation: decalStripeWipe 0.58s cubic-bezier(0.22, 1, 0.36, 1) 0.44s both;
}

body.anim-intro #view-home .race-line--accent::after {
  transform-origin: left center;
  animation: decalStripeWipe 0.42s cubic-bezier(0.22, 1, 0.36, 1) 0.62s both;
}

body.anim-intro #view-home .hero-desc {
  animation: raceSlideUp 0.58s cubic-bezier(0.22, 1, 0.36, 1) 0.46s both;
}

body.anim-intro #view-home .hero-cta-group {
  animation: raceSlideUp 0.58s cubic-bezier(0.22, 1, 0.36, 1) 0.54s both;
}

/* .hero-stats có xen kẽ .stat-divider nên các .stat-item là con thứ 1, 3, 5 */
body.anim-intro #view-home .hero-stats .stat-item {
  animation: raceSlideUp 0.52s cubic-bezier(0.22, 1, 0.36, 1) both;
}
body.anim-intro #view-home .hero-stats .stat-item:nth-child(1) { animation-delay: 0.62s; }
body.anim-intro #view-home .hero-stats .stat-item:nth-child(3) { animation-delay: 0.70s; }
body.anim-intro #view-home .hero-stats .stat-item:nth-child(5) { animation-delay: 0.78s; }

/* Khung Video Reel đáp xuống kiểu vỗ tem */
body.anim-intro #view-home .hero-reel {
  animation: reelLand 0.78s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

/* Sticker Zalo nổi bật nhẹ lúc vào, sau đó lơ lửng êm giữ nguyên góc nghiêng -3deg */
body.anim-intro #view-home .hero-media-wrapper--reel .hero-badge-float {
  animation: stickerPopIn 0.56s cubic-bezier(0.2, 0.9, 0.25, 1.18) 0.62s both;
}

body.anim-idle #view-home .hero-media-wrapper--reel .hero-badge-float {
  animation: floatBounceReel 4.2s ease-in-out infinite;
}

/* Dải điểm mạnh trượt lần lượt */
body.anim-intro #view-home .value-strip-list .value-item {
  animation: raceSlideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
body.anim-intro #view-home .value-strip-list .value-item:nth-child(1) { animation-delay: 0.68s; }
body.anim-intro #view-home .value-strip-list .value-item:nth-child(2) { animation-delay: 0.74s; }
body.anim-intro #view-home .value-strip-list .value-item:nth-child(3) { animation-delay: 0.80s; }
body.anim-intro #view-home .value-strip-list .value-item:nth-child(4) { animation-delay: 0.86s; }
body.anim-intro #view-home .value-strip-list .value-item:nth-child(5) { animation-delay: 0.92s; }

/* Sau khi xong intro, không chạy lại raceIn cũ của sport.css mỗi khi quay về Home */
body.anim-idle #view-home .race-line {
  animation: none;
}

@keyframes raceDashIn {
  from {
    opacity: 0;
    transform: translateX(-44px) skewX(-6deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes decalStripeWipe {
  from {
    transform: skewX(-14deg) scaleX(0);
    opacity: 0.4;
  }
  to {
    transform: skewX(-14deg) scaleX(1);
    opacity: 1;
  }
}

@keyframes raceSlideUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes reelLand {
  0% {
    opacity: 0;
    transform: translateY(32px) scale(0.92) rotate(5deg);
  }
  100% {
    opacity: 1;
    transform: rotate(1.5deg);
  }
}

@keyframes reelLandMobile {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes stickerPopIn {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.88) rotate(-7deg);
  }
  100% {
    opacity: 1;
    transform: rotate(-3deg);
  }
}

@keyframes floatBounceReel {
  0%, 100% { transform: rotate(-3deg) translateY(0); }
  50%      { transform: rotate(-3deg) translateY(-6px); }
}

@media (max-width: 860px) {
  body.anim-intro #view-home .hero-reel {
    animation-name: reelLandMobile;
  }
  body.anim-intro #view-home .hero-media-wrapper--reel .hero-badge-float {
    animation: raceSlideUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.58s both;
  }
  body.anim-idle #view-home .hero-media-wrapper--reel .hero-badge-float {
    animation: none;
  }
}

/* ---------- 4. CHUYỂN TAB KIỂU 2: DIRECTIONAL SLIDE + SKEW ---------- */
#main-content {
  overflow-x: clip;
  position: relative;
}

/* Ghi đè fadeIn cũ của style.css; chỉ bật will-change đúng lúc đang trượt */
.tab-view {
  animation: none;
}

.tab-view.is-leaving-forward,
.tab-view.is-leaving-backward,
.tab-view.is-entering-forward,
.tab-view.is-entering-backward {
  will-change: transform, opacity;
}

.tab-view.is-leaving-forward {
  display: block;
  animation: tabLeaveLeft 0.17s cubic-bezier(0.4, 0, 1, 1) forwards;
  pointer-events: none;
}

.tab-view.is-leaving-backward {
  display: block;
  animation: tabLeaveRight 0.17s cubic-bezier(0.4, 0, 1, 1) forwards;
  pointer-events: none;
}

.tab-view.is-entering-forward {
  display: block;
  animation: tabEnterFromRight 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tab-view.is-entering-backward {
  display: block;
  animation: tabEnterFromLeft 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes tabLeaveLeft {
  from {
    opacity: 1;
    transform: translateX(0) skewX(0deg);
  }
  to {
    opacity: 0;
    transform: translateX(-34px) skewX(1.2deg);
  }
}

@keyframes tabLeaveRight {
  from {
    opacity: 1;
    transform: translateX(0) skewX(0deg);
  }
  to {
    opacity: 0;
    transform: translateX(34px) skewX(-1.2deg);
  }
}

@keyframes tabEnterFromRight {
  from {
    opacity: 0;
    transform: translateX(48px) skewX(-1.5deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes tabEnterFromLeft {
  from {
    opacity: 0;
    transform: translateX(-48px) skewX(1.5deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Hiệu ứng đồng bộ cho phần đầu trang con khi chuyển tab vào */
.tab-view.is-entering-forward .subpage-hero .subpage-title,
.tab-view.is-entering-backward .subpage-hero .subpage-title {
  animation: raceSlideUp 0.44s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
}

.tab-view.is-entering-forward .subpage-hero .subpage-desc,
.tab-view.is-entering-backward .subpage-hero .subpage-desc {
  animation: raceSlideUp 0.44s cubic-bezier(0.22, 1, 0.36, 1) 0.13s both;
}

.tab-view.is-entering-forward .subpage-hero::after,
.tab-view.is-entering-backward .subpage-hero::after {
  animation: subpageStripeIn 0.52s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

@keyframes subpageStripeIn {
  from {
    opacity: 0;
    transform: skewX(-24deg) translateX(60px);
  }
  to {
    opacity: 1;
    transform: skewX(-24deg) translateX(0);
  }
}

/* ---------- 5. SCROLL REVEAL (HIỆN THẺ & MỤC KHI CUỘN) ---------- */
/* Chỉ ẩn khi chưa hiện; không ghi đè transform của trạng thái :hover sau khi đã hiện */
[data-reveal]:not(.is-revealed) {
  opacity: 0;
  transform: translateY(24px) scale(0.985);
}

[data-reveal="left"]:not(.is-revealed) {
  opacity: 0;
  transform: translateX(-20px);
}

[data-reveal] {
  transition:
    opacity 0.56s cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0ms),
    transform 0.56s cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0ms),
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

/* ---------- 6. MICRO-INTERACTIONS KHI RÊ CHUỘT ---------- */
@media (hover: hover) and (pointer: fine) {
  /* Tương tác tinh tế đồng bộ trên ảnh & icon khi rê chuột */
  .choice-card .choice-bg-img {
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .choice-card:hover .choice-bg-img {
    transform: scale(1.045);
  }

  .choice-card .choice-btn i {
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .choice-card:hover .choice-btn i {
    transform: translateX(4px);
  }

  .feature-item .feature-icon {
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.25s ease;
  }
  .feature-item:hover .feature-icon {
    transform: scale(1.08) rotate(-4deg);
    background: rgba(var(--rgb-gold), 0.2);
  }

  .feature-item .feature-proof-img {
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
  }
  .feature-item:hover .feature-proof-img {
    transform: rotate(0deg) translateY(-3px) scale(1.03);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.28);
  }

  .value-item .value-icon {
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .value-item:hover .value-icon {
    transform: scale(1.14);
  }
}

/* ---------- 7. GIẢM CHUYỂN ĐỘNG (ACCESSIBILITY) ---------- */
@media (prefers-reduced-motion: reduce) {
  .intro-wipe {
    display: none !important;
  }
  .site-header::after,
  .tab-view,
  .tab-view.is-leaving-forward,
  .tab-view.is-leaving-backward,
  .tab-view.is-entering-forward,
  .tab-view.is-entering-backward,
  body.anim-intro #view-home .hero-section::before,
  body.anim-intro #view-home .hero-badge,
  body.anim-intro #view-home .hero-title--race .race-line,
  body.anim-intro #view-home .race-line--accent::before,
  body.anim-intro #view-home .race-line--accent::after,
  body.anim-intro #view-home .hero-desc,
  body.anim-intro #view-home .hero-cta-group,
  body.anim-intro #view-home .hero-stats .stat-item,
  body.anim-intro #view-home .hero-reel,
  body.anim-intro #view-home .hero-media-wrapper--reel .hero-badge-float,
  body.anim-idle #view-home .hero-media-wrapper--reel .hero-badge-float,
  body.anim-intro #view-home .value-strip-list .value-item {
    animation: none !important;
  }
  .nav-tab-indicator {
    transition: none !important;
  }
  [data-reveal]:not(.is-revealed),
  [data-reveal="left"]:not(.is-revealed) {
    opacity: 1 !important;
    transform: none !important;
  }
  [data-reveal] {
    transition: none !important;
  }
}
