:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.2, 0.64, 1);
  --dur-fast: 0.25s;
  --dur: 0.55s;
  --dur-slow: 0.85s;
}

@media (prefers-reduced-motion: no-preference) {
  .page-enter {
    animation: pageIn 0.75s var(--ease-out) forwards;
  }

  @keyframes pageIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .header-bar,
  .header-pill {
    animation: dropIn 0.7s var(--ease-out) 0.05s both;
  }

  @keyframes dropIn {
    from {
      opacity: 0;
      transform: translateY(-18px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .header.is-scrolled .header-bar,
  .header.is-scrolled .header-pill {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.14);
  }

  .hero-bg {
    animation: heroDrift 22s var(--ease-out) infinite alternate;
  }

  @keyframes heroDrift {
    from { transform: scale(1) translateY(0); }
    to { transform: scale(1.04) translateY(-1.5%); }
  }

  .hero-copy > * {
    opacity: 0;
    animation: riseIn var(--dur-slow) var(--ease-out) forwards;
  }

  .hero-title { animation-delay: 0.15s; }
  .hero-lead { animation-delay: 0.28s; }

  .hero-stats.stagger-children > * {
    opacity: 0;
    animation: riseIn var(--dur) var(--ease-out) forwards;
  }

  .hero-stats.stagger-children > *:nth-child(1) { animation-delay: 0.42s; }
  .hero-stats.stagger-children > *:nth-child(2) { animation-delay: 0.52s; }
  .hero-stats.stagger-children > *:nth-child(3) { animation-delay: 0.62s; }

  @keyframes riseIn {
    from {
      opacity: 0;
      transform: translateY(24px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .reveal {
    opacity: 0;
    transform: translateY(32px);
    transition:
      opacity var(--dur) var(--ease-out),
      transform var(--dur) var(--ease-out);
  }

  .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  .reveal[data-delay="1"] { transition-delay: 0.06s; }
  .reveal[data-delay="2"] { transition-delay: 0.12s; }
  .reveal[data-delay="3"] { transition-delay: 0.18s; }
  .reveal[data-delay="4"] { transition-delay: 0.24s; }
  .reveal[data-delay="5"] { transition-delay: 0.3s; }
  .reveal[data-delay="6"] { transition-delay: 0.36s; }

  .stagger-children.is-visible > * {
    animation: riseIn var(--dur) var(--ease-out) both;
  }

  .stagger-children.is-visible > *:nth-child(1) { animation-delay: 0.04s; }
  .stagger-children.is-visible > *:nth-child(2) { animation-delay: 0.1s; }
  .stagger-children.is-visible > *:nth-child(3) { animation-delay: 0.16s; }
  .stagger-children.is-visible > *:nth-child(4) { animation-delay: 0.22s; }
  .stagger-children.is-visible > *:nth-child(5) { animation-delay: 0.28s; }
  .stagger-children.is-visible > *:nth-child(6) { animation-delay: 0.34s; }

  .bento-card {
    transition:
      transform 0.45s var(--ease-out),
      border-color 0.35s var(--ease-out),
      box-shadow 0.45s var(--ease-out);
  }

  .bento-card:hover {
    transform: translateY(-4px);
    border-color: rgba(139, 92, 246, 0.35);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(139, 92, 246, 0.12);
  }

  .bento-card__art {
    animation: orbFloat 8s var(--ease-out) infinite alternate;
  }

  @keyframes orbFloat {
    from { transform: translateY(0) scale(1); }
    to { transform: translateY(-8px) scale(1.03); }
  }

  .plan-item {
    transition:
      background 0.3s var(--ease-out),
      transform 0.35s var(--ease-out),
      border-color 0.3s var(--ease-out);
  }

  .plan-item.is-selected {
    animation: planPulse 0.45s var(--ease-spring);
  }

  @keyframes planPulse {
    0% { transform: scale(1); }
    45% { transform: scale(1.008); }
    100% { transform: scale(1); }
  }

  .btn-purchase,
  .btn-login,
  .btn-profile,
  .btn--white {
    transition:
      opacity 0.25s var(--ease-out),
      transform 0.35s var(--ease-spring),
      box-shadow 0.35s var(--ease-out);
  }

  .btn-purchase:hover,
  .btn-login:hover,
  .btn-profile:hover,
  .btn--white:hover {
    box-shadow: 0 12px 32px rgba(255, 255, 255, 0.12);
  }

  .video-frame {
    transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
  }

  .video-frame.is-visible {
    box-shadow: 0 24px 60px rgba(139, 92, 246, 0.15);
  }

  .video-frame__play {
    transition: transform 0.35s var(--ease-spring), background 0.3s var(--ease-out);
  }

  .video-frame__trigger:hover .video-frame__play {
    transform: scale(1.08);
    background: rgba(139, 92, 246, 0.55);
  }

  .review-glow {
    animation: glowPulse 6s ease-in-out infinite alternate;
  }

  @keyframes glowPulse {
    from { opacity: 0.65; transform: translate(-50%, -50%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  }

  .footer-bar {
    transition: transform 0.5s var(--ease-out), border-color 0.4s var(--ease-out);
  }

  .footer-bar.is-visible:hover {
    border-color: rgba(255, 255, 255, 0.14);
    transform: translateY(-2px);
  }

  .nav-link::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.06);
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
    z-index: -1;
  }

  .nav-link:hover::before {
    opacity: 1;
    transform: scale(1);
  }

  .page-grid {
    animation: gridFade 12s ease-in-out infinite alternate;
  }

  @keyframes gridFade {
    from { opacity: 0.28; }
    to { opacity: 0.42; }
  }

  .stat-pill {
    transition: transform 0.35s var(--ease-spring), border-color 0.3s var(--ease-out);
  }

  .stat-pill:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.4);
  }

  .auth-form-wrap {
    animation: cardIn 0.65s var(--ease-out) 0.12s both;
  }

  .auth-visual__copy,
  .auth-visual__brand {
    animation: riseIn 0.7s var(--ease-out) 0.08s both;
  }

  .auth-points li {
    opacity: 0;
    animation: riseIn 0.55s var(--ease-out) both;
  }

  .auth-points li:nth-child(1) { animation-delay: 0.2s; }
  .auth-points li:nth-child(2) { animation-delay: 0.28s; }
  .auth-points li:nth-child(3) { animation-delay: 0.36s; }

  .cabinet-hero__bg {
    animation: heroDrift 24s var(--ease-out) infinite alternate;
  }

  .cabinet-profile {
    animation: cardIn 0.7s var(--ease-out) 0.18s both;
  }

  .cabinet-sub-panel {
    animation: cardIn 0.7s var(--ease-out) 0.28s both;
  }

  @keyframes cardIn {
    from {
      opacity: 0;
      transform: translateY(22px) scale(0.98);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  .cabinet-tile {
    transition:
      transform 0.45s var(--ease-out),
      border-color 0.35s var(--ease-out),
      box-shadow 0.45s var(--ease-out);
  }

  .cabinet-tile:hover {
    transform: translateY(-3px);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
  }

  .cabinet-tile__glow {
    animation: orbFloat 10s var(--ease-out) infinite alternate;
  }

  .status-dot {
    animation: statusBlink 2.4s ease-in-out infinite;
  }

  .status-dot.is-inactive {
    animation: none;
  }

  @keyframes statusBlink {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
    50% { opacity: 0.75; box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
  }

  .toast.is-visible {
    animation: toastPop 0.45s var(--ease-spring);
  }

  @keyframes toastPop {
    from {
      opacity: 0;
      transform: translate(-50%, 16px) scale(0.94);
    }
    to {
      opacity: 1;
      transform: translate(-50%, 0) scale(1);
    }
  }

  .checkout-price.is-updating {
    animation: priceFlip 0.35s var(--ease-out);
  }

  @keyframes priceFlip {
    0% { opacity: 1; transform: translateY(0); }
    45% { opacity: 0; transform: translateY(-8px); }
    100% { opacity: 1; transform: translateY(0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
