/*
# animations.css
# Written by: 广州羲驭科技有限公司
# Description: Animation system for the project.
# Copyright: © 2024-2025 广州羲驭科技有限公司. All rights reserved. | 粤ICP备2025458335号
*/

/* ===== Vista Geometric Glass 动画系统 ===== */

/* ===== 全局动画设置 ===== */
*,
*::before,
*::after {
  animation-duration: var(--animation-medium);
  animation-timing-function: var(--ease-out-smooth);
  /* Removed universal animation-fill-mode: both; to reduce state tracking */
}

/* ===== 淡入动画 ===== */
.fade-in {
  opacity: 0;
  animation: fadeIn var(--animation-medium) var(--ease-out-smooth) forwards;
}

.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp var(--animation-medium) var(--ease-out-smooth) forwards;
}

.fade-in-down {
  opacity: 0;
  transform: translateY(-30px);
  animation: fadeInDown var(--animation-medium) var(--ease-out-smooth) forwards;
}

.fade-in-left {
  opacity: 0;
  transform: translateX(-30px);
  animation: fadeInLeft var(--animation-medium) var(--ease-out-smooth) forwards;
}

.fade-in-right {
  opacity: 0;
  transform: translateX(30px);
  animation: fadeInRight var(--animation-medium) var(--ease-out-smooth) forwards;
}

/* ===== 缩放动画 ===== */
.scale-in {
  opacity: 0;
  transform: scale(0.8);
  animation: scaleIn var(--animation-medium) var(--ease-out-smooth) forwards;
}

.scale-up {
  animation: scaleUp var(--animation-medium) var(--ease-out-smooth);
}

.scale-down {
  animation: scaleDown var(--animation-medium) var(--ease-out-smooth);
}

/* ===== 旋转动画 ===== */
.rotate-in {
  opacity: 0;
  transform: rotate(-180deg) scale(0.8);
  animation: rotateIn var(--animation-slow) var(--ease-out-smooth) forwards;
}

.rotate-continuous {
  animation: rotateContinuous 20s linear infinite;
  /* Slowed down */
  will-change: transform;
}

/* ===== 滑动动画 ===== */
.slide-up {
  transform: translateY(100%);
  animation: slideUp var(--animation-medium) var(--ease-out-smooth);
}

.slide-down {
  transform: translateY(-100%);
  animation: slideDown var(--animation-medium) var(--ease-out-smooth);
}

.slide-left {
  transform: translateX(100%);
  animation: slideLeft var(--animation-medium) var(--ease-out-smooth);
}

.slide-right {
  transform: translateX(-100%);
  animation: slideRight var(--animation-medium) var(--ease-out-smooth);
}

/* ===== 弹跳动画 ===== */
.bounce {
  animation: bounce 1s var(--ease-bounce);
}

.bounce-in {
  animation: bounceIn var(--animation-slow) var(--ease-bounce);
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* ===== 摇摆动画 ===== */
.shake {
  animation: shake 0.5s ease-in-out;
}

.wobble {
  animation: wobble 1s ease-in-out;
}

.swing {
  animation: swing 1s ease-in-out;
}

/* ===== 玻璃特效动画 ===== */
.glass-shimmer {
  position: relative;
  overflow: hidden;
}

.glass-shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.2) 50%,
      transparent 100%);
  animation: shimmer 2s ease-in-out infinite;
}

.glass-float {
  animation: glassFloat 20s ease-in-out infinite;
  /* Slowed down */
  will-change: transform;
}

.glass-glow {
  animation: glassGlow 3s ease-in-out infinite alternate;
}

.glass-refract {
  animation: glassRefract 4s ease-in-out infinite;
}

/* ===== 几何动画 ===== */
.geo-morph {
  animation: geoMorph 8s ease-in-out infinite;
}

.geo-rotate {
  animation: geoRotate 40s linear infinite;
}

.geo-pulse {
  animation: geoPulse 3s ease-in-out infinite;
}

.geo-float {
  animation: geoFloat 30s ease-in-out infinite;
}

/* ===== 文字动画 ===== */
.text-reveal {
  opacity: 0;
  animation: textReveal var(--animation-slow) var(--ease-out-smooth) forwards;
}

/* .text-glow {
  animation: textGlow 2s ease-in-out infinite alternate;
} - Removed to reduce repaints */

.text-typewriter {
  overflow: hidden;
  border-right: 2px solid var(--vista-glass-teal);
  white-space: nowrap;
  animation: typewriter 3s steps(40) forwards;
}

/* ===== 滚动触发动画 ===== */
.scroll-reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: all var(--animation-slow) var(--ease-out-smooth);
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.scroll-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--animation-slow) var(--ease-out-smooth);
}

.scroll-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

.scroll-rotate {
  opacity: 0;
  transform: rotate(45deg) scale(0.8);
  transition: all var(--animation-slow) var(--ease-out-smooth);
}

.scroll-rotate.revealed {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* ===== 鼠标悬停动画 ===== */
.hover-lift {
  transition: all var(--animation-fast) var(--ease-out-smooth);
}

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: var(--glass-shadow-hover);
}

.hover-tilt {
  transition: all var(--animation-fast) var(--ease-out-smooth);
}

.hover-tilt:hover {
  transform: perspective(1000px) rotateX(10deg) rotateY(-10deg) scale(1.02);
}

.hover-glow {
  transition: all var(--animation-fast) var(--ease-out-smooth);
}

.hover-glow:hover {
  box-shadow: 0 0 40px rgba(0, 217, 199, 0.6);
}

.hover-rotate {
  transition: all var(--animation-fast) var(--ease-out-smooth);
}

.hover-rotate:hover {
  transform: rotate(5deg) scale(1.05);
}

/* ===== 加载动画 ===== */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--glass-border-light);
  border-top: 3px solid var(--vista-glass-teal);
  border-radius: 50%;
  animation: spinner 1s linear infinite;
}

.loading-dots {
  display: inline-flex;
  gap: var(--space-2);
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--vista-glass-teal);
  border-radius: 50%;
  animation: loadingDot 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.loading-pulse {
  width: 40px;
  height: 40px;
  background: var(--vista-glass-teal);
  border-radius: 50%;
  animation: loadingPulse 1.5s ease-in-out infinite;
}

/* ===== 粒子动画 ===== */
.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.particle-float {
  animation: particleFloat 10s ease-in-out infinite;
}

.particle-burst {
  animation: particleBurst 1s ease-out forwards;
}

.particle-spiral {
  animation: particleSpiral 8s linear infinite;
}

/* ===== 波纹效果 ===== */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  animation: ripple 0.6s ease-out;
}

/* ===== 故障效果 ===== */
.glitch {
  position: relative;
  animation: glitch 2s ease-in-out infinite;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
}

.glitch::before {
  color: var(--vista-glass-blue);
  animation: glitchBefore 2s ease-in-out infinite;
}

.glitch::after {
  color: var(--vista-glass-teal);
  animation: glitchAfter 2s ease-in-out infinite;
}

/* ===== 动画延迟类 ===== */
.delay-100 {
  animation-delay: 0.1s;
}

.delay-200 {
  animation-delay: 0.2s;
}

.delay-300 {
  animation-delay: 0.3s;
}

.delay-400 {
  animation-delay: 0.4s;
}

.delay-500 {
  animation-delay: 0.5s;
}

.delay-600 {
  animation-delay: 0.6s;
}

.delay-700 {
  animation-delay: 0.7s;
}

.delay-800 {
  animation-delay: 0.8s;
}

.delay-900 {
  animation-delay: 0.9s;
}

.delay-1000 {
  animation-delay: 1s;
}

/* ===== 动画持续时间类 ===== */
.duration-fast {
  animation-duration: var(--animation-fast);
}

.duration-medium {
  animation-duration: var(--animation-medium);
}

.duration-slow {
  animation-duration: var(--animation-slow);
}

.duration-ultra-slow {
  animation-duration: var(--animation-ultra-slow);
}

/* ===== 无动画类 ===== */
.no-animation {
  animation: none !important;
  transition: none !important;
}

/* ===== @keyframes 定义 ===== */

/* 淡入动画 */
@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 缩放动画 */
@keyframes scaleIn {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleUp {
  to {
    transform: scale(1.1);
  }
}

@keyframes scaleDown {
  to {
    transform: scale(0.9);
  }
}

/* 旋转动画 */
@keyframes rotateIn {
  to {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
}

@keyframes rotateContinuous {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* 滑动动画 */
@keyframes slideUp {
  to {
    transform: translateY(0);
  }
}

@keyframes slideDown {
  to {
    transform: translateY(0);
  }
}

@keyframes slideLeft {
  to {
    transform: translateX(0);
  }
}

@keyframes slideRight {
  to {
    transform: translateX(0);
  }
}

/* 弹跳动画 */
@keyframes bounce {

  0%,
  20%,
  53%,
  80%,
  100% {
    transform: translateY(0);
  }

  40%,
  43% {
    transform: translateY(-30px);
  }

  70% {
    transform: translateY(-15px);
  }

  90% {
    transform: translateY(-4px);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }

  50% {
    opacity: 1;
    transform: scale(1.05);
  }

  70% {
    transform: scale(0.9);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

/* 摇摆动画 */
@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }

  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

@keyframes wobble {

  0%,
  100% {
    transform: translateX(0);
  }

  15% {
    transform: translateX(-25px) rotate(-5deg);
  }

  30% {
    transform: translateX(20px) rotate(3deg);
  }

  45% {
    transform: translateX(-15px) rotate(-3deg);
  }

  60% {
    transform: translateX(10px) rotate(2deg);
  }

  75% {
    transform: translateX(-5px) rotate(-1deg);
  }
}

@keyframes swing {
  20% {
    transform: rotate(15deg);
  }

  40% {
    transform: rotate(-10deg);
  }

  60% {
    transform: rotate(5deg);
  }

  80% {
    transform: rotate(-5deg);
  }

  100% {
    transform: rotate(0deg);
  }
}

/* 玻璃特效动画 */
@keyframes shimmer {
  to {
    left: 100%;
  }
}

@keyframes glassFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes glassGlow {
  from {
    box-shadow: var(--glass-shadow-medium);
  }

  to {
    box-shadow: var(--glass-shadow-hover), 0 0 40px rgba(0, 217, 199, 0.4);
  }
}

@keyframes glassRefract {

  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }

  25% {
    transform: rotate(1deg) scale(1.01);
  }

  50% {
    transform: rotate(-1deg) scale(1.02);
  }

  75% {
    transform: rotate(0.5deg) scale(1.01);
  }
}

/* 几何动画 */
@keyframes geoMorph {

  0%,
  100% {
    border-radius: 50%;
  }

  25% {
    border-radius: 20%;
  }

  50% {
    border-radius: 30%;
  }

  75% {
    border-radius: 10%;
  }
}

@keyframes geoRotate {
  from {
    transform: rotate(0deg) translate3d(0, 0, 0);
  }

  to {
    transform: rotate(360deg) translate3d(0, 0, 0);
  }
}

@keyframes geoPulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes geoFloat {

  0%,
  100% {
    transform: translateY(0) translateX(0);
  }

  25% {
    transform: translateY(-20px) translateX(10px);
  }

  50% {
    transform: translateY(10px) translateX(-10px);
  }

  75% {
    transform: translateY(-10px) translateX(-5px);
  }
}

/* 文字动画 */
@keyframes textReveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes textGlow {
  from {
    text-shadow: 0 0 10px rgba(0, 217, 199, 0.4);
  }

  to {
    text-shadow: 0 0 20px rgba(0, 217, 199, 0.8);
  }
}

@keyframes typewriter {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

/* 加载动画 */
@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loadingDot {

  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes loadingPulse {

  0%,
  100% {
    transform: scale(0);
    opacity: 1;
  }

  50% {
    transform: scale(1);
    opacity: 0.5;
  }
}

/* 粒子动画 */
@keyframes particleFloat {
  0% {
    transform: translateY(100vh) translateX(0);
    opacity: 0;
  }

  10% {
    opacity: 1;
  }

  90% {
    opacity: 1;
  }

  100% {
    transform: translateY(-100vh) translateX(100px);
    opacity: 0;
  }
}

@keyframes particleBurst {
  to {
    transform: translate(var(--tx), var(--ty)) scale(0);
    opacity: 0;
  }
}

@keyframes particleSpiral {
  from {
    transform: rotate(0deg) translateX(0) rotate(0deg);
  }

  to {
    transform: rotate(360deg) translateX(100px) rotate(-360deg);
  }
}

/* 波纹效果 */
@keyframes ripple {
  to {
    width: 200px;
    height: 200px;
    opacity: 0;
  }
}

/* 故障效果 */
@keyframes glitch {

  0%,
  100% {
    transform: translate(0);
  }

  20% {
    transform: translate(-2px, 2px);
  }

  40% {
    transform: translate(-2px, -2px);
  }

  60% {
    transform: translate(2px, 2px);
  }

  80% {
    transform: translate(2px, -2px);
  }
}

@keyframes glitchBefore {

  0%,
  100% {
    clip-path: inset(0 0 0 0);
  }

  25% {
    clip-path: inset(0 0 100px 0);
  }

  50% {
    clip-path: inset(0 0 0 100px);
  }

  75% {
    clip-path: inset(100px 0 0 0);
  }
}

@keyframes glitchAfter {

  0%,
  100% {
    clip-path: inset(0 0 0 0);
  }

  25% {
    clip-path: inset(100px 0 0 0);
  }

  50% {
    clip-path: inset(0 0 0 100px);
  }

  75% {
    clip-path: inset(0 0 100px 0);
  }
}

/* ===== 响应式动画 ===== */
@media (max-width: 768px) {
  .hover-tilt:hover {
    transform: perspective(800px) rotateX(5deg) rotateY(-5deg) scale(1.01);
  }
}

/* ===== 减少动画偏好设置 ===== */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .rotate-continuous,
  .pulse,
  .geo-morph,
  .geo-rotate,
  .geo-pulse,
  .geo-float,
  .loading-spinner {
    animation: none !important;
  }
}