/* Đình Huy Academy — lớp hiệu ứng motion (11/2026).
   Chỉ thêm chuyển động: không đổi bố cục, kích thước, màu nền hay nội dung.
   Chỉ dùng opacity / translate / scale / rotate / clip-path / filter để không xê dịch layout.
   Tắt hoàn toàn khi người dùng bật "giảm chuyển động" hoặc trình duyệt tự động (QA pixel). */
:root{--mo-ease:cubic-bezier(.22,1,.36,1);--mo-spring:cubic-bezier(.34,1.56,.64,1)}

@keyframes mo-rise{from{opacity:0;translate:0 28px}to{opacity:1;translate:0 0}}
@keyframes mo-rise-blur{from{opacity:0;translate:0 34px;filter:blur(12px)}to{opacity:1;translate:0 0;filter:blur(0)}}
@keyframes mo-drop{from{opacity:0;translate:0 -22px}to{opacity:1;translate:0 0}}
@keyframes mo-pop{0%{opacity:0;scale:.82;translate:0 18px}100%{opacity:1;scale:1;translate:0 0}}
@keyframes mo-from-right{from{opacity:0;translate:46px 0}to{opacity:1;translate:0 0}}
@keyframes mo-clip{from{clip-path:inset(0 100% 0 0)}to{clip-path:inset(0 0 0 0)}}
@keyframes mo-write{from{clip-path:inset(-20% 100% -20% -10%);opacity:.2}to{clip-path:inset(-20% -10% -20% -10%);opacity:1}}
@keyframes mo-person{from{opacity:0;translate:0 70px;filter:saturate(.6) blur(6px)}to{opacity:1;translate:0 0;filter:none}}
@keyframes mo-breathe{0%,100%{scale:1}50%{scale:1.014}}
@keyframes mo-float{0%,100%{translate:0 0}50%{translate:0 -10px}}
@keyframes mo-kenburns{0%{scale:1;translate:0 0}100%{scale:1.09;translate:-1.5% -1%}}
@keyframes mo-shine-text{0%{background-position:0 0}38%,100%{background-position:100% 0}}
@keyframes mo-sweep{from{background-position:130% 0}to{background-position:-30% 0}}
@keyframes mo-sweep-loop{0%{background-position:130% 0}24%,100%{background-position:-30% 0}}
@keyframes mo-ring{0%{box-shadow:0 .25rem .75rem #ffa52d20,0 0 0 0 rgba(255,153,8,.5)}70%,100%{box-shadow:0 .25rem .75rem #ffa52d20,0 0 0 16px rgba(255,153,8,0)}}
@keyframes mo-ring-soft{0%{box-shadow:0 0 0 0 rgba(243,170,51,.55)}60%,100%{box-shadow:0 0 0 14px rgba(243,170,51,0)}}
@keyframes mo-halo{0%,100%{opacity:.75;scale:1}50%{opacity:1;scale:1.07}}
@keyframes mo-icon-pop{0%{scale:0;rotate:-120deg}70%{scale:1.18}100%{scale:1;rotate:0deg}}
@keyframes mo-wiggle{0%,100%{rotate:0deg}25%{rotate:-12deg}50%{rotate:10deg}75%{rotate:-5deg}}
@keyframes mo-spin{from{rotate:0deg}to{rotate:360deg}}
@keyframes mo-star{0%{scale:0;opacity:0}60%{scale:1.35;opacity:1}100%{scale:1;opacity:1}}
@keyframes mo-swap-in{from{opacity:0;translate:var(--mo-sx,40px) var(--mo-sy,0px);scale:.96}to{opacity:1;translate:0 0;scale:1}}

@media (prefers-reduced-motion:no-preference){
  /* ---------- Hero: màn mở đầu (chạy bằng CSS để không nháy khi tải) ---------- */
  html:not(.mo-off) .hero>.academy-header{animation:mo-drop .8s var(--mo-ease) backwards}
  html:not(.mo-off) .hero-copy .eyebrow{animation:mo-clip 1s var(--mo-ease) .15s backwards}
  html:not(.mo-off) .hero-copy h1{animation:mo-rise-blur 1.1s var(--mo-ease) .3s backwards}
  html:not(.mo-off) .hero-copy h1 em{background:linear-gradient(100deg,#ff7200 0 40%,#ffc861 50%,#ff7200 60% 100%) 0 0/260% 100%;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;animation:mo-shine-text 7s ease-in-out 1.5s infinite}
  html:not(.mo-off) .hero-copy h1 em:nth-of-type(2){animation-delay:1.75s}
  html:not(.mo-off) .hero-copy h1 em:nth-of-type(3){animation-delay:2s}
  html:not(.mo-off) .hero-description{animation:mo-rise .9s var(--mo-ease) .55s backwards}
  html:not(.mo-off) .hero-buttons>*{animation:mo-pop .8s var(--mo-spring) .75s backwards}
  html:not(.mo-off) .hero-buttons>:nth-child(2){animation-delay:.88s}
  html:not(.mo-off) .hero-person{transform-origin:50% 100%;animation:mo-person 1.3s var(--mo-ease) .2s backwards,mo-breathe 7s ease-in-out 1.6s infinite}
  html:not(.mo-off) .hero-side .handwriting{animation:mo-write 1.8s ease-out 1.05s backwards}
  html:not(.mo-off) .hero-values{animation:mo-from-right .9s var(--mo-ease) .95s backwards}
  html:not(.mo-off) .hero-values li{animation:mo-rise .6s var(--mo-ease) backwards}
  html:not(.mo-off) .hero-values li:nth-child(1){animation-delay:1.15s}
  html:not(.mo-off) .hero-values li:nth-child(2){animation-delay:1.25s}
  html:not(.mo-off) .hero-values li:nth-child(3){animation-delay:1.35s}
  html:not(.mo-off) .hero-values li:nth-child(4){animation-delay:1.45s}
  html:not(.mo-off) .hero-values li i{animation:mo-icon-pop .7s var(--mo-spring) backwards;animation-delay:inherit}
  html:not(.mo-off) .hero-values li:nth-child(n) i{animation-delay:calc(var(--mo-li,0) * 1s)}
  html:not(.mo-off) .hero-values li:nth-child(1) i{--mo-li:1.25}
  html:not(.mo-off) .hero-values li:nth-child(2) i{--mo-li:1.35}
  html:not(.mo-off) .hero-values li:nth-child(3) i{--mo-li:1.45}
  html:not(.mo-off) .hero-values li:nth-child(4) i{--mo-li:1.55}
  html:not(.mo-off) .hero:has(.hero-person):before{content:'';position:absolute;inset:0;background:inherit;animation:mo-kenburns 26s ease-in-out infinite alternate;pointer-events:none}
  html:not(.mo-off) .hero+main .assistant{animation:mo-rise 1s var(--mo-ease) .95s backwards}
  html:not(.mo-off) .assistant>img{animation:mo-float 4.5s ease-in-out 2s infinite}
  html:not(.mo-off) .assistant .prompts button{animation:mo-pop .6s var(--mo-spring) backwards}
  html:not(.mo-off) .assistant .prompts button:nth-child(1){animation-delay:1.25s}
  html:not(.mo-off) .assistant .prompts button:nth-child(2){animation-delay:1.35s}
  html:not(.mo-off) .assistant .prompts button:nth-child(3){animation-delay:1.45s}
  html:not(.mo-off) .assistant .prompts button:nth-child(4){animation-delay:1.55s}
}

/* ---------- Trang con: mở màn tiêu đề h1 và các khối liền sau (sắc nét ngay, không mờ/ẩn H1) ---------- */
@media (prefers-reduced-motion:no-preference){
  html:not(.mo-off) :is(main, body > section, body > div:not([class*="header"])) :is(h1):not(dialog *){animation:mo-rise .42s var(--mo-ease) both}
  html:not(.mo-off) :is(main, body > section, body > div:not([class*="header"])) :has(+ h1):not(dialog *){animation:mo-rise .38s var(--mo-ease) both}
  html:not(.mo-off) :is(main, body > section, body > div:not([class*="header"])) h1 ~ :not(dialog *){animation:mo-rise .45s var(--mo-ease) .06s both}
  html:not(.mo-off) :is(main, body > section, body > div:not([class*="header"])) h1 ~ * ~ *{animation-delay:.12s}
  html:not(.mo-off) :is(main, body > section, body > div:not([class*="header"])) h1 ~ * ~ * ~ *{animation-delay:.18s}
  html:not(.mo-off) :is(main, body > section, body > div:not([class*="header"])) h1 ~ * ~ * ~ * ~ *{animation-delay:.24s}
  html:not(.mo-off) :is(main, body > section, body > div:not([class*="header"])) h1 ~ * ~ * ~ * ~ * ~ *{animation-delay:.3s}
  html:not(.mo-off) :is(main, body > section, body > div:not([class*="header"])) h1 ~ :is(a,button){animation-name:mo-pop;animation-timing-function:var(--mo-spring)}
  html:not(.mo-off) :is(main, body > section, body > div:not([class*="header"])) h1 em{background:linear-gradient(100deg,currentColor 0 40%,#ffc861 50%,currentColor 60% 100%) 0 0/260% 100%;-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;animation:mo-shine-text 7s ease-in-out 1.4s infinite}
}

/* ---------- Các lớp do motion.js gắn (chỉ khi motion bật) ---------- */
.mo-progress{position:fixed;top:0;left:0;width:100%;height:3px;transform-origin:0 50%;transform:scaleX(0);background:linear-gradient(90deg,#ffdb82,#ff9908 60%,#ff5a00);box-shadow:0 0 10px rgba(255,153,8,.6);z-index:1000;pointer-events:none}
.mo-canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.mo-halo{position:absolute;pointer-events:none;border-radius:50%;z-index:1;background:radial-gradient(circle,rgba(255,206,110,.55) 0%,rgba(255,180,60,.22) 38%,rgba(255,170,40,0) 68%);animation:mo-halo 5.5s ease-in-out infinite;opacity:0;transition:opacity 1.2s}
.mo-halo.mo-show{opacity:1}

/* Hiện dần khi cuộn */
.mo-on [data-mo]{transition:opacity .9s var(--mo-ease),translate .9s var(--mo-ease),scale .9s var(--mo-ease),filter .9s var(--mo-ease),transform .2s,box-shadow .2s;transition-delay:var(--mo-d,0ms),var(--mo-d,0ms),var(--mo-d,0ms),var(--mo-d,0ms),0ms,0ms}
.mo-on [data-mo]:not(.mo-in){opacity:0}
.mo-on [data-mo=up]:not(.mo-in){translate:0 36px}
.mo-on [data-mo=left]:not(.mo-in){translate:-50px 0}
.mo-on [data-mo=right]:not(.mo-in){translate:50px 0}
.mo-on [data-mo=zoom]:not(.mo-in){scale:.9}
.mo-on [data-mo=blur]:not(.mo-in){translate:0 22px;filter:blur(10px)}
.mo-on [data-mo=rise]:not(.mo-in){translate:0 40px;scale:.94;filter:blur(4px)}
.mo-on [data-mo=wipe]{transition:opacity .6s,clip-path 1.2s var(--mo-ease),scale 1.4s var(--mo-ease);transition-delay:var(--mo-d,0ms)}
.mo-on [data-mo=wipe]:not(.mo-in){clip-path:inset(100% 0 0 0);scale:1.08}
.mo-on [data-mo=write]:not(.mo-in){clip-path:inset(-20% 100% -20% -10%)}
.mo-on [data-mo=write]{transition:opacity .4s,clip-path 1.8s ease-out}
.mo-on .mo-swap{animation:mo-swap-in .6s var(--mo-ease) backwards;animation-delay:var(--mo-d,0ms)}
.mo-on .mo-icon{animation:mo-icon-pop .75s var(--mo-spring) backwards;animation-delay:var(--mo-d,0ms)}
.mo-on .mo-hover .mo-icon{animation:mo-wiggle .7s ease}
.mo-on .mo-bar:not(.mo-bar-in){clip-path:inset(0 100% 0 0)}
.mo-on .mo-cta{animation:mo-ring-any 2.6s ease-out 1.8s infinite}
.mo-on .mo-lift.mo-hover{translate:0 -6px;filter:drop-shadow(0 12px 18px rgba(16,35,80,.13))}
.mo-on img.mo-zi{transition:scale .8s var(--mo-ease)}
.mo-on .mo-zcard.mo-hover img.mo-zi{scale:1.07}
@keyframes mo-ring-any{0%{box-shadow:var(--mo-bs),0 0 0 0 rgba(255,153,8,.5)}70%,100%{box-shadow:var(--mo-bs),0 0 0 16px rgba(255,153,8,0)}}

/* Lộ trình: kẻ đường nối + nhịp sáng các mốc */
.mo-on .roadmap ol:before{transform-origin:0 50%;transition:transform 1.6s var(--mo-ease) .2s}
.mo-on .roadmap ol[data-mo]:not(.mo-in):before{transform:scaleX(0)}
.mo-on .roadmap ol.mo-done li i{animation:mo-ring-soft 3.2s ease-out infinite;animation-delay:calc(var(--mo-i,0) * .8s)}
.mo-on .newsletter-copy:before{transform-origin:50% 0;transition:transform 1.2s var(--mo-ease) .35s}
.mo-on .newsletter-copy[data-mo]:not(.mo-in):before{transform:scaleY(0)}
.mo-on .newsletter-person.mo-done{transform-origin:50% 100%;animation:mo-breathe 7s ease-in-out infinite}

/* Sao đánh giá lần lượt bật sáng */
.mo-on .mo-stars svg{animation:mo-star .5s var(--mo-spring) backwards;animation-delay:calc(var(--mo-s,0) * 90ms + 250ms)}

/* Thẻ: nghiêng 3D theo chuột + đốm sáng vàng */
.mo-on :is(.category-grid,.course-grid,.review-grid,.benefit-grid){perspective:1100px}
.mo-on .mo-tilt{position:relative}
.mo-on :is(.category-card,.course-card,.review-card,.benefit-grid article).mo-tilt:not([data-mo]){transition:transform .2s,box-shadow .2s,rotate .45s var(--mo-ease),translate .45s var(--mo-ease)}
.mo-on .mo-tilt:is(.review-card,article).mo-hover{translate:0 -4px}
.mo-on .mo-tilt::after{content:'';position:absolute;inset:0;border-radius:inherit;pointer-events:none;background:radial-gradient(240px circle at var(--mo-x,50%) var(--mo-y,50%),rgba(255,178,30,.17),transparent 65%);opacity:0;transition:opacity .35s}
.mo-on .mo-tilt.mo-hover::after{opacity:1}
.mo-on .course-cover{overflow:hidden}
.mo-on .course-cover img{transition:scale .7s var(--mo-ease)}
.mo-on .course-card:hover .course-cover img{scale:1.07}
.mo-on .category-card>img{transition:filter .5s}
.mo-on .category-card:hover>img{filter:saturate(1.15) brightness(1.04)}
.mo-on .category-card:hover .cat-icon{animation:mo-spin .8s var(--mo-ease)}
.mo-on .category-card .cat-arrow,.mo-on .see-all span{transition:translate .35s var(--mo-spring)}
.mo-on .category-card:hover .cat-arrow,.mo-on .see-all:hover span{translate:4px 0}
.mo-on .benefit-grid article:hover i,.mo-on .roadmap li:hover i{animation:mo-wiggle .7s ease}
.mo-on .prompts button,.mo-on .socials :is(button,a){transition:translate .3s var(--mo-spring),box-shadow .3s}
.mo-on .prompts button:hover{translate:0 -3px}
.mo-on .socials :is(button,a):hover{translate:0 -4px;box-shadow:0 0 0 1px #ff9908,0 6px 18px rgba(255,153,8,.35)}
.mo-on .arrows button{transition:scale .25s var(--mo-spring)}
.mo-on .arrows button:hover{scale:1.1}
.mo-on .arrows button:active{scale:.92}

/* Nút vàng: vệt sáng quét + vòng toả */
.mo-on .mo-shine{position:relative}
.mo-on .mo-shine::after{content:'';position:absolute;inset:0;border-radius:inherit;pointer-events:none;background:linear-gradient(105deg,transparent 38%,rgba(255,255,255,.6) 50%,transparent 62%) no-repeat 130% 0/260% 100%}
.mo-on .mo-shine:hover::after{animation:mo-sweep .9s ease}
.mo-on .hero-buttons .mo-shine::after,.mo-on .newsletter form .mo-shine::after{animation:mo-sweep-loop 5s ease-in-out 2.2s infinite}
.mo-on .newsletter form button.gold,.mo-on #ai-form button.gold{animation:mo-ring 2.6s ease-out 2.4s infinite}
.mo-on .hero-buttons .button.gold{animation:mo-pop .8s var(--mo-spring) .75s backwards,mo-ring 2.6s ease-out 2.4s infinite}
.mo-on .mo-magnet{transition:translate .35s var(--mo-ease)}
.mo-on .play{animation:mo-ring-soft 2.2s ease-out 2s infinite}
