/* Vui Học Sử – lớp chuyển động (motion graphic).
   Tự tắt khi máy đặt giảm chuyển động hoặc khi bật "Tắt chuyển động" ở trang Trợ năng (lớp tn-giam-dong). */

/* Thanh tiến độ cuộn trang */
.thanh-cuon{position:fixed;left:0;top:0;z-index:70;width:100%;height:3px;transform-origin:0 50%;transform:scaleX(0);
  background:linear-gradient(90deg,#b97f1c,#ffe9a6,#eab543);box-shadow:0 0 10px rgba(255,215,110,.8);pointer-events:none}

/* Lớp bụi vàng và tia sáng ở sảnh */
.bui-vang{position:absolute;inset:0;z-index:-1;width:100%;height:100%;pointer-events:none}

/* Thẻ nghiêng theo chuột: biến do motion.js đặt */
.arch{transform:perspective(900px) rotateX(var(--rx,0deg)) rotateY(var(--ry,0deg)) translateY(var(--ty,0px));transform-style:preserve-3d}
.arch:hover{transform:perspective(900px) rotateX(var(--rx,0deg)) rotateY(var(--ry,0deg)) translateY(-10px)}
.arch::after{content:"";position:absolute;inset:5px;border-radius:inherit;pointer-events:none;opacity:0;transition:opacity .3s;
  background:radial-gradient(circle at var(--mx,50%) var(--my,30%),rgba(255,240,200,.35),transparent 55%)}
.arch:hover::after{opacity:1}

/* Đèn rọi theo chuột trên thẻ */
.room,.exhibit,.promo,.room-row{position:relative}
.den-roi::before{content:"";position:absolute;inset:0;z-index:4;border-radius:inherit;pointer-events:none;opacity:0;transition:opacity .3s;
  background:radial-gradient(260px circle at var(--mx,50%) var(--my,50%),rgba(255,226,150,.2),transparent 70%)}
.den-roi:hover::before{opacity:1}

@media (prefers-reduced-motion:no-preference){
html:not(.tn-giam-dong){

  /* ===== Sảnh: nền chuyển động chậm, tia sáng xoay ===== */
  & .hero-bg{animation:kb 32s ease-in-out infinite alternate;will-change:scale}
  & .hero::after{content:"";position:absolute;left:50%;top:44%;z-index:-1;width:170vmax;height:170vmax;margin:-85vmax 0 0 -85vmax;pointer-events:none;
    background:repeating-conic-gradient(from 0deg,rgba(255,214,120,.12) 0deg 5deg,transparent 5deg 18deg);
    -webkit-mask:radial-gradient(circle,#000 0,rgba(0,0,0,.6) 18%,transparent 45%);mask:radial-gradient(circle,#000 0,rgba(0,0,0,.6) 18%,transparent 45%);
    animation:xoay 90s linear infinite;mix-blend-mode:screen}

  /* ===== Sảnh: màn mở đầu ===== */
  & .ribbon{animation:roi .9s cubic-bezier(.2,1.4,.4,1) .15s both}
  & .hero-title .laurel{animation:mo-la 1s cubic-bezier(.2,1.3,.4,1) .55s both,dua 6s ease-in-out 1.6s infinite;transform-origin:50% 100%}
  & .hero-title .laurel.flip{animation:mo-la-p 1s cubic-bezier(.2,1.3,.4,1) .55s both,dua-p 6s ease-in-out 1.6s infinite}
  & .hero-title h1{animation:hien-chu 1.1s cubic-bezier(.2,.9,.3,1) .3s both}
  & .hero-sub{animation:len .8s ease-out .8s both}
  & .ornament{animation:len .8s ease-out .95s both}
  & .ornament i{animation:dai .9s ease-out 1.05s both}
  & .arches li{animation:mo-vom 1s cubic-bezier(.2,1.1,.3,1) both}
  & .arches li:nth-child(1){animation-delay:1s}
  & .arches li:nth-child(2){animation-delay:1.12s}
  & .arches li:nth-child(3){animation-delay:1.24s}
  & .arches li:nth-child(4){animation-delay:1.36s}
  & .hero .btn-xl{animation:len .8s ease-out 1.7s both,nhip 2.6s ease-in-out 2.6s infinite}
  & .quick{animation:len 1s cubic-bezier(.2,.9,.3,1) 1.9s both}
  & .banner{animation:buong 1.2s cubic-bezier(.2,1.2,.4,1) .1s both,dua-co 7s ease-in-out 1.4s infinite;transform-origin:50% 0}
  & .banner-r{animation-delay:.25s,1.8s}

  /* Ánh kim lướt qua chữ vàng */
  & .hero-title h1,& .ph-title h1{
    background-image:linear-gradient(110deg,transparent 42%,rgba(255,255,255,.9) 50%,transparent 58%),linear-gradient(180deg,#fff3c2 5%,#f6c956 50%,#c58a1f 95%);
    background-size:260% 100%,100% 100%;background-repeat:no-repeat;
    animation-name:hien-chu,anh-kim;animation-duration:1.1s,5.5s;animation-delay:.3s,2s;animation-iteration-count:1,infinite;animation-fill-mode:both,none}
  & .ph-title h1{animation:anh-kim 6s ease-in-out 1s infinite}
  & .logo-text b{background-image:linear-gradient(110deg,transparent 42%,rgba(255,255,255,.85) 50%,transparent 58%),var(--gold-grad);
    background-size:260% 100%,100% 100%;background-repeat:no-repeat;animation:anh-kim 7s ease-in-out 3s infinite}

  /* Huy hiệu quay khi rê chuột, mũi tên nhích */
  & .medal svg{transition:transform .8s cubic-bezier(.3,1.4,.5,1)}
  & .arch:hover .medal svg,& .room:hover .medal svg,& .room-row:hover .medal svg{transform:rotate(360deg) scale(1.08)}
  & .arch:hover .go svg,& .ex-more:hover svg{animation:nhich .7s ease-in-out infinite}
  & .medal{animation:sang-huy 4s ease-in-out infinite}

  /* Nút lớn: vệt sáng lướt */
  & .btn-xl,& .btn-red{position:relative;overflow:hidden;isolation:isolate}
  & .btn-xl::after,& .btn-red::after{content:"";position:absolute;inset:0;z-index:-1;border-radius:inherit;pointer-events:none;
    background:linear-gradient(110deg,transparent 35%,rgba(255,255,255,.4) 50%,transparent 65%);background-size:260% 100%;background-repeat:no-repeat;
    animation:anh-kim 3.6s ease-in-out infinite}

  /* ===== Phần dưới sảnh ===== */
  & .quick svg{animation:nay 3.2s ease-in-out infinite}
  & .quick a:nth-child(2) svg{animation-delay:.25s}
  & .quick a:nth-child(3) svg{animation-delay:.5s}
  & .quick a:nth-child(4) svg{animation-delay:.75s}
  & .quick a:nth-child(5) svg{animation-delay:1s}
  & .quick a:nth-child(6) svg{animation-delay:1.25s}
  & .quill{animation:viet 4s ease-in-out infinite;transform-origin:20% 90%}
  &.js .goal-card .checks li{opacity:0}
  &.js .goal-card .checks li.ve{opacity:1;animation:tick .5s cubic-bezier(.2,1.5,.4,1) both}
  & .goal-card .checks li.ve:nth-child(2){animation-delay:.12s}
  & .goal-card .checks li.ve:nth-child(3){animation-delay:.24s}
  & .goal-card .checks li.ve:nth-child(4){animation-delay:.36s}
  & .promo-art{animation:noi 4s ease-in-out infinite}
  & .stem-tiles i{animation:lat 6s ease-in-out infinite}
  & .stem-tiles i:nth-child(2){animation-delay:.3s}
  & .stem-tiles i:nth-child(3){animation-delay:.6s}
  & .stem-tiles i:nth-child(4){animation-delay:.9s}

  /* Thẻ hiện ra theo kiểu lật nhẹ khi cuộn tới */
  &.js .room.reveal,&.js .exhibit.reveal,&.js .room-row.reveal{transform:perspective(900px) rotateX(16deg) translateY(46px) scale(.97);transform-origin:50% 100%}
  &.js .room.reveal.in,&.js .exhibit.reveal.in,&.js .room-row.reveal.in{transform:none}

  /* Tiêu đề mục: hai đường kẻ mọc ra */
  &.js .sec-title::before,&.js .sec-title::after{transition:transform 1s cubic-bezier(.2,.9,.3,1);transform:scaleX(0)}
  & .sec-title::before{transform-origin:100% 50%}
  & .sec-title::after{transform-origin:0 50%}
  &.js .sec-title.ve::before{transform:scaleX(1)}
  &.js .sec-title.ve::after{transform:scaleX(-1)}

  /* Dòng thời gian: đường vàng chạy, mốc bật lên */
  &.js .timeline::before{transform:scaleX(0);transform-origin:0 50%;transition:transform 1.6s cubic-bezier(.4,0,.2,1)}
  & .timeline.ve::before{transform:scaleX(1)}
  &.js .timeline li .dot{transform:scale(0);transition:transform .6s cubic-bezier(.2,1.6,.4,1)}
  & .timeline.ve li .dot{transform:scale(1)}
  & .timeline.ve li:nth-child(2) .dot{transition-delay:.3s}
  & .timeline.ve li:nth-child(3) .dot{transition-delay:.6s}
  & .timeline.ve li:nth-child(4) .dot{transition-delay:.9s}
  & .timeline.ve li:nth-child(5) .dot{transition-delay:1.2s}
  & .timeline .dot::after{content:"";position:absolute;inset:-6px;border-radius:50%;border:2px solid var(--gold-500);opacity:0}
  & .timeline.ve .dot::after{animation:song 2.8s ease-out 1.8s infinite}
  & .timeline .dot{position:relative;overflow:visible}
  & .timeline .dot img{border-radius:50%}

  /* ===== Trang con ===== */
  & .page-hero{animation:troi 40s ease-in-out infinite alternate}
  & .ph-title .medal{animation:mo-vom .9s cubic-bezier(.2,1.3,.4,1) .1s both,sang-huy 4s ease-in-out 1s infinite}
  & .ph-lead,& .crumbs{animation:len .7s ease-out .25s both}
  & .room-tabs{animation:len .8s ease-out .4s both}
  & .vtime li{animation:sang-phai .7s cubic-bezier(.2,.9,.3,1) both;animation-timeline:view();animation-range:entry 0% entry 60%}
  & .quiz-opt.dung{animation:bat .5s cubic-bezier(.2,1.6,.4,1)}
  & .quiz-opt.sai{animation:lac .45s ease-in-out}
  & .quiz-score{animation:hien-diem .9s cubic-bezier(.2,1.5,.4,1) both}
}
}

@keyframes kb{from{scale:1.02}to{scale:1.14}}
@keyframes xoay{to{transform:rotate(360deg)}}
@keyframes roi{from{opacity:0;transform:translateY(-40px) scale(.8)}}
@keyframes hien-chu{from{opacity:0;transform:scale(1.18);filter:blur(10px)}to{opacity:1;filter:drop-shadow(0 3px 0 rgba(90,50,0,.6)) drop-shadow(0 8px 18px rgba(0,0,0,.55))}}
@keyframes mo-la{from{opacity:0;transform:translateX(30px) rotate(-30deg) scale(.4)}}
@keyframes mo-la-p{from{opacity:0;transform:scaleX(-1) translateX(30px) rotate(-30deg) scale(.4)}to{transform:scaleX(-1)}}
@keyframes dua{0%,100%{transform:rotate(0)}50%{transform:rotate(-4deg)}}
@keyframes dua-p{0%,100%{transform:scaleX(-1) rotate(0)}50%{transform:scaleX(-1) rotate(-4deg)}}
@keyframes len{from{opacity:0;transform:translateY(26px)}}
@keyframes dai{from{transform:scaleX(0)}}
@keyframes mo-vom{from{opacity:0;transform:translateY(70px) scale(.85)}}
@keyframes nhip{0%,100%{box-shadow:0 0 0 2px #f1c659,0 3px 0 2px #7a5510,0 10px 22px rgba(120,10,15,.45),0 0 0 0 rgba(234,181,67,.55)}
  60%{box-shadow:0 0 0 2px #f1c659,0 3px 0 2px #7a5510,0 10px 22px rgba(120,10,15,.45),0 0 0 18px rgba(234,181,67,0)}}
@keyframes buong{from{transform:translateY(-110%)}}
@keyframes dua-co{0%,100%{transform:rotate(0)}50%{transform:rotate(1.6deg)}}
@keyframes anh-kim{0%{background-position:130% 0,0 0}55%,100%{background-position:-30% 0,0 0}}
@keyframes nhich{50%{transform:translateX(4px)}}
@keyframes sang-huy{0%,100%{box-shadow:0 4px 12px rgba(0,0,0,.5)}50%{box-shadow:0 4px 12px rgba(0,0,0,.5),0 0 18px 4px rgba(255,215,110,.55)}}
@keyframes nay{0%,80%,100%{transform:none}86%{transform:translateY(-6px)}92%{transform:translateY(1px)}}
@keyframes viet{0%,100%{transform:rotate(0)}25%{transform:rotate(-5deg) translateY(-2px)}50%{transform:rotate(2deg)}75%{transform:rotate(-3deg)}}
@keyframes tick{from{opacity:0;transform:translateX(-14px)}}
@keyframes noi{0%,100%{transform:translateY(0) rotate(-2deg)}50%{transform:translateY(-8px) rotate(2deg)}}
@keyframes lat{0%,70%,100%{transform:none}80%{transform:perspective(200px) rotateY(180deg)}90%{transform:perspective(200px) rotateY(360deg)}}
@keyframes song{0%{opacity:.9;transform:scale(1)}100%{opacity:0;transform:scale(1.5)}}
@keyframes troi{from{background-position:0 0,center 30%}to{background-position:0 0,center 65%}}
@keyframes sang-phai{from{opacity:0;transform:translateX(-30px)}}
@keyframes bat{40%{transform:scale(1.05)}}
@keyframes lac{20%,60%{transform:translateX(-6px)}40%,80%{transform:translateX(6px)}}
@keyframes hien-diem{from{opacity:0;transform:scale(.3) rotate(-8deg)}}

@media print{.thanh-cuon,.bui-vang{display:none}}
