/* ============================================================
   MOTION SYSTEM v3 "Continuum" — Cinematic Black & Gold
   Nạp sau cả bộ css chính (base → … → chrome, xem views/styles.js). Nguyên tắc:
   • MỘT chủ sở hữu cho mỗi thuộc tính động (không hai rule cùng
     giành transform/transition trên một phần tử — nguyên nhân gốc
     khiến tilt chết và hover bị giật ở v2).
   • Motion token thống nhất duration/easing/stagger.
   • Mọi hiệu ứng tôn trọng prefers-reduced-motion và tự tắt trên
     watch-page (CSS dưới /js/motion.js gates JS).
   ============================================================ */
:root {
  /* Easing — gia tốc/giảm tốc tự nhiên, không dùng linear cho tương tác */
  --ease-cine: cubic-bezier(0.22, 1, 0.36, 1);        /* easeOutQuint-ish — settle mượt */
  --ease-swift: cubic-bezier(0.4, 0, 0.2, 1);          /* chuẩn material — vi micro */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);    /* back-out nhẹ — overshoot tinh tế */
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);          /* easeOutExpo — entrance điện ảnh */
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);         /* easeOutCubic — parallax/ambience */
  /* Duration — theo cấp.icon < nút < thẻ < ánh sáng */
  --dur-xs: 140ms;
  --dur-sm: 200ms;
  --dur-md: 320ms;
  --dur-lg: 520ms;
  --dur-xl: 760ms;
  --stagger: 60ms;
  /* Lift thẻ — .has-tilt đọc biến này trong transform pipeline duy nhất */
  --card-lift: -6px;
  --card-lift-sm: -4px;
}

/* @property cho góc gradient quay (viền năng lượng) */
@property --ring-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

/* ============================================================
   1. TRƯỜNG ÁNH SÁNG TOÀN CỤ (aurora + grain + vignette)
   ============================================================ */
/* Aurora: các mảng sáng vàng-amber trôi cực chậm phía sau mọi nội dung.
   Lớp chỉ phình -6% (đủ chỗ cho translate/scale nhẹ) thay vì -20% —
   diện tích layer composite nhỏ hơn ~30% mỗi khung hình. */
body::before {
  content: '';
  position: fixed;
  inset: -6%;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(42% 34% at 18% 12%, rgba(255, 176, 32, 0.075), transparent 70%),
    radial-gradient(36% 30% at 84% 22%, rgba(255, 120, 40, 0.05), transparent 70%),
    radial-gradient(50% 42% at 50% 96%, rgba(255, 200, 90, 0.055), transparent 72%);
  animation: aurora-drift 26s var(--ease-soft) infinite alternate;
  will-change: transform;
}
@keyframes aurora-drift {
  0%   { transform: translate3d(-1.4%, -1%, 0) rotate(-0.8deg) scale(1.01); }
  50%  { transform: translate3d(1.2%, 1%, 0) rotate(0.6deg) scale(1.045); }
  100% { transform: translate3d(-0.8%, 1.6%, 0) rotate(-0.3deg) scale(1.02); }
}

/* Film grain: nhiễu phim mịn phủ toàn trang (tinh thần rạp chiếu).
   TĨNH và KHÔNG blend-mode — mix-blend-mode: overlay buộc composite toàn
   trang qua lớp blend mỗi khung hình (nguyên nhân drop frame khi cuộn).
   Opacity thuần trên nền tối cho texture tương đương, chi phí thấp hơn. */
body::after {
  content: '';
  position: fixed;
  inset: -60px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Ánh đèn theo con trỏ (JS tạo .cursor-light) */
.cursor-light {
  position: fixed;
  top: 0; left: 0;
  width: 600px; height: 600px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 196, 88, 0.07), rgba(255, 196, 88, 0.02) 45%, transparent 68%);
  will-change: transform;
}

/* Watch page: tắt aurora/grain để dành toàn bộ GPU cho video */
body.watch-page::before, body.watch-page::after { display: none; }

/* ============================================================
   2. VIEW TRANSITIONS (cross-document, progressive)
   IN/OUT ĐỐI XỨNG cùng duration + easing: old 1→0 và new 0→1 chồng lên
   nhau cho tổng sáng không đổi — out 240ms/in 460ms lệch nhịp từng gây
   "vết đen" giữa chuyển cảnh (old tắt xong trong khi new mới nửa đường).
   VT không chặn điều hướng nên out chậm không làm rời trang chậm hơn.
   CHỈ opacity — không scale: phóng/thu snapshot cả trang khiến chữ
   như chạy keyframe cỡ chữ. Header + bottom-nav là phần tử bền: morph
   liên tục giữa các trang (swap tức thì, không fade).
   ============================================================ */
::view-transition-old(root) { animation: vt-out 460ms var(--ease-expo) both; }
::view-transition-new(root) { animation: vt-in 460ms var(--ease-expo) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }

/* ============================================================
   2b. FALLBACK chuyển trang cho trình duyệt không có VT (@supports
   phủ định = không hiểu view-transition-name). Toàn bộ diễn trên
   .site-main — header/bottom-nav đứng im tuyệt đối, không nháy.
   data-navfade do /js/nav-state.js đặt, data-leaving do /js/motion.js.
   ============================================================ */
html[data-leaving] .site-main {
  opacity: 0;
  transition: opacity 190ms var(--ease-swift);
}
@supports not (view-transition-name: none) {
  html[data-navfade] .site-main { animation: page-enter 300ms var(--ease-expo) both; }
}
@keyframes page-enter { from { opacity: 0; } }

/* Shared-element: poster thẻ phim giãn thành hero trang chi tiết */
::view-transition-group(poster-hero) { animation-duration: 0.5s; animation-timing-function: var(--ease-cine); }
::view-transition-old(poster-hero) { animation: poster-out 260ms var(--ease-swift) both; }
::view-transition-new(poster-hero) { animation: poster-in 460ms var(--ease-expo) both; }
@keyframes poster-out { to { opacity: 0; filter: brightness(1.6); } }
@keyframes poster-in { from { opacity: 0.4; filter: brightness(1.8); } }

/* Phần tử bền——trải nghiệm liên tục khi chuyển trang (cùng vị trí 2 trang
   nên group morph gần như tĩnh: header/nav "sống xuyên" qua chuyển cảnh) */
.site-header { view-transition-name: site-header; }
.bottom-nav { view-transition-name: bottom-nav; }
::view-transition-old(site-header), ::view-transition-new(site-header) { animation-duration: 0s; height: 100%; }
::view-transition-old(bottom-nav), ::view-transition-new(bottom-nav) { animation-duration: 0s; height: 100%; }

/* ============================================================
   3. SCROLL REVEAL (IO thêm .is-revealed)
   Chỉ ẩn phần tử khi entrance chạy (html[data-entrance] — /js/nav-state.js
   đặt trước first paint khi tải trang lần đầu). Điều hướng nội bộ: mặc định
   hiện ngay → snapshot VT/fade của trang đích ĐẦY ĐỦ nội dung, không
   nháy "trang rỗng rồi nội dung bật lên" từng xảy ra trên mọi trang.
   ============================================================ */
html[data-entrance] [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  transition: opacity var(--dur-lg) var(--ease-cine), transform var(--dur-lg) var(--ease-cine);
  will-change: opacity, transform;
}
html[data-entrance] [data-reveal].is-revealed { opacity: 1; transform: none; will-change: auto; }
html[data-entrance] [data-reveal="fade"] { transform: none; }
html[data-entrance] [data-reveal-item] {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity var(--dur-md) var(--ease-cine), transform var(--dur-md) var(--ease-cine);
}
html[data-entrance] [data-reveal].is-revealed [data-reveal-item] { opacity: 1; transform: none; }

/* Hero entrance (GSAP — motion.js §5a): ẩn sẵn trước khung đầu những phần
   tử GSAP sẽ dựng lại, để không "hiện → ẩn → chạy animation" (chớp khi tải
   lần đầu). data-hero-in do motion.js đặt khi cam kết entrance + giờ ngân
   2.4s. Danh sách selector MIRROR của mảng sels trong /js/motion.js §5a —
   sửa hai nơi cùng lúc. Trang tìm kiếm không nằm đây — hero search do §3c
   sở hữu (chạy được cả khi điều hướng nội bộ). */
@media (prefers-reduced-motion: no-preference) {
  html[data-entrance]:not([data-hero-in]) .hero .hero-kicker-row,
  html[data-entrance]:not([data-hero-in]) .hero .hero-badge,
  html[data-entrance]:not([data-hero-in]) .hero .hero-title,
  html[data-entrance]:not([data-hero-in]) .movie-hero .movie-title,
  html[data-entrance]:not([data-hero-in]) .hero .hero-meta,
  html[data-entrance]:not([data-hero-in]) .hero .hero-desc,
  html[data-entrance]:not([data-hero-in]) .movie-hero .movie-desc,
  html[data-entrance]:not([data-hero-in]) .hero .hero-actions,
  html[data-entrance]:not([data-hero-in]) .movie-hero .movie-actions,
  html[data-entrance]:not([data-hero-in]) .hero .hero-subrow { opacity: 0; }
}

/* ============================================================
   3c. SOFT ENTRANCE — trang chức năng (tìm kiếm, đăng nhập/đăng ký)
   Chạy ở MỌI kiểu tải trang: fresh (data-entrance) LẪN điều hướng nội bộ
   (VT hoặc fallback) — trước đây các trang này chỉ có crossfade cả trang
   khi bấm menu, người dùng thấy "trang không có hiệu ứng vào".
   Nguyên tắc an toàn: animation CSS thuần bắt đầu ngay tại khung đầu
   (fill backwards + delay giữ trạng thái from), KHÔNG phụ thuộc JS/IO
   nên không bao giờ kẹt ẩn; VT chụp new-side LIVE nên snapshot ghi được
   nội dung đang vào — không tái diễn lỗi "trang rỗng bật nội dung".
   Chỉ opacity + transform → CLS = 0. reduced-motion: kill-switch §8 ép
   duration 0.01ms → vào tức thì.
   ============================================================ */
@keyframes soft-rise {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
}
@keyframes soft-fade { from { opacity: 0; } }

/* Tìm kiếm: badge → tiêu đề → ô tìm kiếm → quickpills (mobile ẩn badge +
   pills nên chỉ thấy title → omnisearch lệch nhịp) */
.search-hero-inner > * { animation: soft-rise 480ms var(--ease-expo) backwards; }
.search-hero-inner > *:nth-child(1) { animation-delay: 60ms; }
.search-hero-inner > *:nth-child(2) { animation-delay: 140ms; }
.search-hero-inner > *:nth-child(3) { animation-delay: 220ms; }
.search-hero-inner > *:nth-child(4) { animation-delay: 300ms; }

/* Đăng nhập/đăng ký: card mờ vào, title → từng field → nút → alt leo lệch nhịp.
   input hidden (csrf/next) được đếm vị trí nhưng vô hình — nhịp vẫn tăng dần.
   .form-error KHÔNG animate (thông báo lỗi phải hiện tức thì). */
.auth-card { animation: soft-fade 340ms var(--ease-swift) both; }
.auth-title, .auth-form > *, .auth-alt { animation: soft-rise 460ms var(--ease-expo) backwards; }
.auth-title { animation-delay: 60ms; }
.auth-form > *:nth-child(1) { animation-delay: 130ms; }
.auth-form > *:nth-child(2) { animation-delay: 200ms; }
.auth-form > *:nth-child(3) { animation-delay: 270ms; }
.auth-form > *:nth-child(4) { animation-delay: 340ms; }
.auth-form > *:nth-child(5) { animation-delay: 410ms; }
.auth-form > *:nth-child(6) { animation-delay: 480ms; }
.auth-alt { animation-delay: 540ms; }

/* ============================================================
   4. ẢNH FADE-IN KHI TẢI + ZOOM POSTER (một transition duy nhất
   gồm cả opacity lẫn transform — v2 từng bị main.css/meta ghi đè
   shorthand làm mất transition transform → zoom giật tức thì)
   ============================================================ */
.card-poster-img,
.catalog-poster .card-poster-img,
.continue-thumb img {
  opacity: 0;
  transition: opacity var(--dur-lg) var(--ease-swift), transform 620ms var(--ease-cine);
}
.card-poster-img.is-loaded, .catalog-poster .card-poster-img.is-loaded,
.continue-thumb img.is-loaded,
.collection-cover.is-loaded, .is-error { opacity: 1; }
.hero-bg-img { opacity: 0; transform: scale(1.045); transition: opacity 1100ms var(--ease-cine), transform 1400ms var(--ease-cine); }
.hero-bg-img.is-loaded.is-active { opacity: 1; transform: scale(1); }

/* ============================================================
   5. THẺ PHIM — HOVER CHOREOGRAPHY (tilt + lift + spotlight +
   holo + magnetic). .has-tilt là chủ sở hữu DUY NHẤT của transform
   thẻ: mọi chuyển động (nghiêng 3D + nhấc) đi qua một pipeline var
   → enter/leave/interrupt đều nội suy từ giá trị hiện tại, không
   bao giờ reset đột ngột.
   ============================================================ */
.has-tilt {
  transform: perspective(950px) rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)) translateY(var(--lift, 0px)) translateZ(0);
  transition:
    transform 220ms var(--ease-swift),
    background-color var(--dur-sm) var(--ease-swift),
    border-color var(--dur-sm) var(--ease-swift),
    box-shadow 180ms var(--ease-swift),
    color var(--dur-sm) var(--ease-swift);
}
.has-tilt:hover { --lift: var(--card-lift); }
.collection-card.has-tilt:hover { --lift: var(--card-lift-sm); }
.has-tilt:hover {
  /* blur hẹp hơn v2 (48→36px) — chi phí paint của shadow tỉ lệ bình phương
     bán kính; chênh lệch hình ảnh không đáng kể ở opacity này */
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.55), 0 0 24px rgba(255, 184, 0, 0.15);
}

/* Spotlight theo con trỏ */
.has-tilt::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 216, 130, 0.16), rgba(255, 216, 130, 0) 58%);
  opacity: 0;
  transition: opacity var(--dur-sm) var(--ease-swift);
  pointer-events: none;
  z-index: 3;
}
.has-tilt:hover::after { opacity: 1; }

/* Dải holo quét chéo khi hover (phản xạ kiếng). Opacity có transition
   riêng — v2 để `transition: transform 0s` khiến opacity bật/tắt tức thì */
.has-tilt::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 236, 190, 0.13) 46%, rgba(190, 220, 255, 0.07) 52%, transparent 66%);
  transform: translateX(-130%) skewX(-8deg);
  transition: transform 0s, opacity var(--dur-sm) var(--ease-swift);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}
.has-tilt:hover::before { opacity: 1; transition: transform 900ms var(--ease-cine), opacity var(--dur-xs) var(--ease-swift); transform: translateX(130%) skewX(-8deg); }

/* Vòng năng lượng bung khi hover vào (JS tạo .card-burst-ring) */
.card-burst-ring {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid rgba(255, 200, 90, 0.55);
  box-shadow: 0 0 24px rgba(255, 184, 0, 0.35), inset 0 0 18px rgba(255, 184, 0, 0.2);
  animation: burst-ring 0.56s var(--ease-cine) both;
  pointer-events: none;
  z-index: 4;
}
@keyframes burst-ring {
  0% { opacity: 0; transform: scale(0.94); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.05); }
}

/* Thẻ media desktop cần position cho spotlight/ring */
@media (min-width: 769px) {
  .movie-card.has-tilt, .catalog-card.has-tilt, .collection-card.has-tilt, .continue-card.has-tilt { position: relative; }
}

/* Nút play "magnetic" — hút theo con trỏ. Scale cũng qua var để hover
   scale và magnetic DÙNG MỘT transform (v2 hai rule giành nhau transform) */
.card-hover-play span, .catalog-overlay-play, .continue-play {
  transform: translate3d(var(--mag-x, 0px), var(--mag-y, 0px), 0) scale(var(--play-scale, 1));
  transition: transform var(--dur-md) var(--ease-spring);
}
.catalog-card { --play-scale: 0.86; }
.continue-card { --play-scale: 0.9; }
.catalog-card:hover .catalog-overlay-play,
.catalog-card:focus-within .catalog-overlay-play { --play-scale: 1.06; }
.catalog-overlay-play:hover { --play-scale: 1.1; }
.continue-card:hover .continue-play,
.continue-card:focus-within .continue-play { --play-scale: 1.1; }
.has-tilt:hover .card-hover-play span { --play-scale: 1.06; }

/* Card hover-play trượt lên từ dưới */
.card-hover-play { transform: translate3d(0, 34%, 0); transition: opacity var(--dur-md) var(--ease-cine), transform var(--dur-md) var(--ease-cine); }
.card-poster:hover .card-hover-play, .movie-card:focus-within .card-hover-play { transform: translate3d(0, 0, 0); }

/* Overlay catalog mở mở mượt hơn (v2 200ms ease — hơi cứng) */
.catalog-overlay { transition: opacity var(--dur-md) var(--ease-cine); }

/* ============================================================
   6. MICRO-INTERACTIONS — mỗi hover đổi property nào thì property
   đó phải có transition (v2 thiếu ở 16 vị trí → bật/tắt tức thì)
   ============================================================ */
.btn { transition: transform var(--dur-xs) var(--ease-swift), background var(--dur-sm) var(--ease-swift), box-shadow var(--dur-sm) var(--ease-swift), border-color var(--dur-sm) var(--ease-swift), color var(--dur-sm) var(--ease-swift); }
.btn:active { transform: scale(0.96); }

/* Nav: màu + nền vi micro; gạch dưới quét bằng ::after */
.nav-link { transition: color var(--dur-xs) var(--ease-swift), background-color var(--dur-xs) var(--ease-swift); }

.icon-btn { transition: color var(--dur-xs) var(--ease-swift), background-color var(--dur-sm) var(--ease-swift), border-color var(--dur-sm) var(--ease-swift); }
.header-account { transition: color var(--dur-xs) var(--ease-swift); }
.avatar { transition: box-shadow var(--dur-sm) var(--ease-swift), transform var(--dur-sm) var(--ease-spring); }
.avatar:hover { transform: scale(1.07); }

/* Brand logo (v2 nhắm .brand-mark không tồn tại trong markup) */
.brand-logo { transition: transform var(--dur-md) var(--ease-spring), filter var(--dur-md) var(--ease-swift); }
.brand:hover .brand-logo { transform: scale(1.04) rotate(-2deg); filter: drop-shadow(0 0 10px rgba(255, 184, 0, 0.35)); }

/* Quét sáng trên CTA vàng */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.4) 50%, transparent 65%);
  transform: translateX(-130%);
  transition: transform 750ms var(--ease-cine);
  pointer-events: none;
}
.btn-primary:hover::before { transform: translateX(130%); }

/* Ripple (JS tạo .ripple-ink) */
.ripple-ink {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 220, 150, 0.5), rgba(255, 220, 150, 0) 65%);
  transform: scale(0);
  animation: ripple 0.6s var(--ease-swift) forwards;
  pointer-events: none;
  z-index: 5;
}
.btn, .omnisearch-submit, .catalog-round-btn, .genre-pill { position: relative; overflow: hidden; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* Chip / pill / nút tròn / link phụ — màu & nền vi micro */
.chip { transition: color var(--dur-xs) var(--ease-swift), border-color var(--dur-sm) var(--ease-swift), background-color var(--dur-sm) var(--ease-swift); }
.catalog-round-btn { transition: color var(--dur-xs) var(--ease-swift), background-color var(--dur-sm) var(--ease-swift); }
a.search-quickpill, .trending-tag { transition: color var(--dur-xs) var(--ease-swift), background-color var(--dur-sm) var(--ease-swift); }
.omnisearch-clear { transition: color var(--dur-xs) var(--ease-swift), background-color var(--dur-sm) var(--ease-swift); }
.filter-reset { transition: color var(--dur-xs) var(--ease-swift); }
.breadcrumb a, .breadcrumb-hero a { transition: color var(--dur-xs) var(--ease-swift); }
.footer-nav a { transition: color var(--dur-xs) var(--ease-swift); }
.lib-tab { transition: color var(--dur-xs) var(--ease-swift), background-color var(--dur-sm) var(--ease-swift); }
.page-btn { transition: color var(--dur-xs) var(--ease-swift), background-color var(--dur-sm) var(--ease-swift); }

/* Ô tìm kiếm: glow focus-within mở từ từ, không bật gốc */
.omnisearch { transition: box-shadow var(--dur-md) var(--ease-cine), border-color var(--dur-md) var(--ease-swift); }
.omnisearch-submit { transition: background var(--dur-sm) var(--ease-swift), box-shadow var(--dur-md) var(--ease-cine), transform var(--dur-sm) var(--ease-spring); }

/* Watch / episode */
.watch-back-circle { transition: background-color var(--dur-sm) var(--ease-swift), color var(--dur-xs) var(--ease-swift); }
.ep-btn { transition: background-color var(--dur-sm) var(--ease-swift), border-color var(--dur-sm) var(--ease-swift), color var(--dur-xs) var(--ease-swift); }

/* Shelf "xem thêm" — icon trượt theo hover */
.shelf-more { transition: color var(--dur-xs) var(--ease-swift); }
.shelf-more .icon { transition: transform var(--dur-sm) var(--ease-spring); }

/* Nav: pill glow trượt theo link hover (JS cập nhật left/width) */
.nav-glow-pill {
  position: absolute;
  top: 50%; left: 0;
  height: 36px;
  transform: translateY(-50%);
  border-radius: var(--radius-sm);
  background: radial-gradient(60% 100% at 50% 50%, rgba(255, 184, 0, 0.16), rgba(255, 184, 0, 0) 80%);
  pointer-events: none;
  transition: left var(--dur-md) var(--ease-cine), width var(--dur-md) var(--ease-cine), opacity var(--dur-sm) var(--ease-swift);
  animation: nav-pill-pulse 3.2s var(--ease-soft) infinite;
}
@keyframes nav-pill-pulse { 0%, 100% { opacity: 0.65; } 50% { opacity: 1; } }

/* Save pop */
.save-icon { display: inline-flex; transition: transform var(--dur-sm) var(--ease-spring); }
[data-save-btn]:hover .save-icon { transform: scale(1.18); }
[data-save-btn].is-saved .save-icon { animation: save-pop 480ms var(--ease-spring); }
@keyframes save-pop { 0% { transform: scale(0.55); } 55% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* Gold word shimmer (chữ vàng lấp lánh nhẹ) */
.gold-word {
  background: linear-gradient(100deg, var(--gold) 20%, #ffe9b8 40%, var(--gold) 60%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gold-shimmer 5s var(--ease-swift) infinite;
}
@keyframes gold-shimmer { 0%, 100% { background-position: 0% 0; } 50% { background-position: 100% 0; } }

/* Hero dots + genre pill */
.hero-dot { transition: width var(--dur-md) var(--ease-cine), background var(--dur-sm) var(--ease-swift); }
.genre-pill { transition: color var(--dur-sm) var(--ease-swift), background var(--dur-sm) var(--ease-swift), box-shadow var(--dur-md) var(--ease-cine), transform var(--dur-sm) var(--ease-spring); }
.genre-pill:hover { transform: translateY(-1.5px); }
.genre-pill.is-active { animation: pill-glow 2.8s var(--ease-soft) infinite; }
@keyframes pill-glow { 0%, 100% { box-shadow: 0 0 14px rgba(255, 184, 0, 0.3); } 50% { box-shadow: 0 0 22px rgba(255, 184, 0, 0.5); } }

/* Collection cover zoom — curve điện ảnh thay vì ease phẳng */
.collection-cover { transition: opacity var(--dur-lg) var(--ease-swift), transform 700ms var(--ease-cine); }

/* Glow thở cho banner + player + sao */
.ad-banner-glow { animation: glow-breathe 7s var(--ease-soft) infinite; }
@keyframes glow-breathe { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
.catalog-spotlight-chip.is-rating .icon { animation: star-twinkle 2.6s var(--ease-soft) infinite; }
@keyframes star-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.player-shell { position: relative; }
.player-shell::before {
  content: '';
  position: absolute; inset: -8%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255, 184, 0, 0.1), rgba(255, 184, 0, 0) 70%);
  pointer-events: none;
  z-index: -1;
  animation: glow-breathe 9s var(--ease-soft) infinite;
}

/* Skeleton shimmer cho fallback */
.card-poster-fallback { position: relative; overflow: hidden; }
.card-poster-fallback::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 220, 161, 0.07) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shimmer 2.4s var(--ease-swift) infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* Toast */
.toast { animation: rise-in var(--dur-md) var(--ease-cine) both; }
@keyframes rise-in { from { opacity: 0; transform: translate3d(0, 12px, 0); } }

/* ============================================================
   7. CANVAS ATMOSPHERE
   ============================================================ */
.atmosphere-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
/* Scope toàn trang: nền ambient cố định theo viewport, ngầm dưới mọi nội dung
   (cùng lớp âm bản với aurora body::before và .cursor-light). */
.atmosphere-canvas--page { position: fixed; z-index: -1; }
.hero-content, .movie-hero-inner { z-index: 10; }

/* ============================================================
   8. KILL SWITCH — reduced-motion & thiết bị yếu
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* Universal selector không chạm tới pseudo cây view-transition — tắt riêng */
  ::view-transition-group(*), ::view-transition-image-pair(*),
  ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  body::before, body::after, .cursor-light { display: none !important; }
  [data-reveal], [data-reveal-item] { opacity: 1 !important; transform: none !important; }
  .card-poster-img, .continue-thumb img, .hero-bg img { opacity: 1; transform: none; }
  .has-tilt { transform: none; }
  .gold-word { -webkit-text-fill-color: currentColor; animation: none; }
}

/* ============================================================
   9. SHARED-ELEMENT: poster trang chi tiết là đích morph
   ============================================================ */
.movie-poster-frame { view-transition-name: poster-hero; }
