/* VIBEROLL — animations.css
 * Text reveals: letter-by-letter blur/rise for the intro title, mask
 * reveal for the Chinese result, tracking-in for English, staged fades.
 * Each element has its own duration/easing — no uniform motion.
 */

/* intro title letters */
.intro-title .ch {
  display: inline-block; opacity: 0; filter: blur(14px); transform: translateY(0.18em) scale(1.04);
  transition: opacity 1.6s cubic-bezier(.2, .7, .1, 1), filter 1.9s cubic-bezier(.2, .7, .1, 1), transform 2.1s cubic-bezier(.16, 1, .3, 1);
  transition-delay: calc(0.45s + var(--i) * 0.085s);
}
.intro.show .intro-title .ch { opacity: 1; filter: blur(0); transform: none; }
.intro .intro-sub, .intro .intro-cta { opacity: 0; transform: translateY(6px); transition: opacity 1.4s ease, transform 1.4s cubic-bezier(.16, 1, .3, 1); }
.intro.show .intro-sub { opacity: 1; transform: none; transition-delay: 1.5s; }
.intro.show .intro-cta { opacity: 1; transform: none; transition-delay: 2.3s; }
.intro.show .intro-cta span { animation: cta-breathe 3.2s ease-in-out 3.6s infinite; }
@keyframes cta-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.38; } }

/* intro exit: letters drift up and dissolve, staggered from the centre */
.intro.out .intro-title .ch {
  opacity: 0; filter: blur(18px); transform: translateY(-0.25em) scale(0.96);
  transition: opacity 1.1s ease, filter 1.2s ease, transform 1.4s cubic-bezier(.5, 0, .2, 1);
  transition-delay: calc(abs(var(--i) - 3.5) * 0.06s);
}
@supports not (transition-delay: calc(abs(1) * 1s)) {
  .intro.out .intro-title .ch { transition-delay: calc(var(--i) * 0.05s); }
}
.intro.out .intro-sub, .intro.out .intro-cta { opacity: 0; transition: opacity .6s ease; transition-delay: 0s; }

/* hint line pulse */
.hint.show .hint-text::before, .hint.show .hint-text::after { animation: hint-line 2.4s ease-in-out infinite; }
@keyframes hint-line { 0%, 100% { opacity: .9; width: 28px; } 50% { opacity: .35; width: 14px; } }

/* ── result reveal choreography ─────────────────────────────────────
 * 1. challenge number  2. Chinese pair (mask reveal, per glyph)
 * 3. English pair (tracking in)  4. descriptions  5. actions
 */
.result .r-head { opacity: 0; transform: translateX(-10px); }
.result .r-zh .ch, .result .r-zh .r-x {
  display: inline-block; opacity: 0; transform: translateY(0.62em); clip-path: inset(0 0 100% 0);
}
.result .r-en { opacity: 0; letter-spacing: 0.32em; filter: blur(4px); }
.result .r-desc::before { transform-origin: 0 50%; transform: scaleX(0); }
.result .r-desc-zh, .result .r-desc-en { opacity: 0; transform: translateY(8px); }
.result .r-actions { opacity: 0; transform: translateY(6px); }

.result.show .r-head { opacity: 1; transform: none; transition: opacity .7s ease .15s, transform .9s cubic-bezier(.16, 1, .3, 1) .15s; }
.result.show .r-zh .ch, .result.show .r-zh .r-x {
  opacity: 1; transform: none; clip-path: inset(-20% 0 -20% 0);
  transition: opacity .5s ease, transform .9s cubic-bezier(.16, 1, .3, 1), clip-path .9s cubic-bezier(.16, 1, .3, 1);
  transition-delay: calc(0.55s + var(--i) * 0.055s);
}
.result.show .r-en { opacity: 1; filter: blur(0); letter-spacing: 0.12em; transition: opacity 1s ease, letter-spacing 1.6s cubic-bezier(.16, 1, .3, 1), filter 1s ease; transition-delay: calc(0.8s + var(--n) * 0.055s); }
.result.show .r-desc::before { transform: none; transition: transform 1s cubic-bezier(.65, 0, .35, 1); transition-delay: calc(1.25s + var(--n) * 0.055s); }
.result.show .r-desc-zh { opacity: 1; transform: none; transition: opacity .9s ease, transform 1.1s cubic-bezier(.16, 1, .3, 1); transition-delay: calc(1.45s + var(--n) * 0.055s); }
.result.show .r-desc-en { opacity: 1; transform: none; transition: opacity .9s ease, transform 1.1s cubic-bezier(.16, 1, .3, 1); transition-delay: calc(1.75s + var(--n) * 0.055s); }
.result.show .r-actions { opacity: 1; transform: none; transition: opacity .8s ease, transform .9s cubic-bezier(.16, 1, .3, 1); transition-delay: calc(2.2s + var(--n) * 0.055s); }
@media (max-aspect-ratio: 19/20) {
  .result .r-head { transform: translateY(-6px); }
  .result.show .r-desc::before { transform: translateX(-50%); }
  .result .r-desc::before { transform: translateX(-50%) scaleX(0); }
}

/* ── reduced motion: keep reveals, drop the travel ─────────────────── */
@media (prefers-reduced-motion: reduce) {
  .intro-title .ch, .result .r-zh .ch, .result .r-zh .r-x { transform: none !important; filter: none !important; }
  .result .r-en { letter-spacing: 0.12em !important; filter: none !important; }
  .intro.show .intro-cta span { animation: none; }
  * { scroll-behavior: auto !important; }
}
