/**
 * AI分享会网站 - 动画库
 * 版本: 1.0
 */

/* ========================================
   入场动画类
   ======================================== */

.animate-fade-in {
  animation: fadeIn 0.6s var(--ease-out) forwards;
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s var(--ease-out) forwards;
}

.animate-fade-in-down {
  animation: fadeInDown 0.6s var(--ease-out) forwards;
}

.animate-slide-in-left {
  animation: slideInLeft 0.6s var(--ease-out) forwards;
}

.animate-slide-in-right {
  animation: slideInRight 0.6s var(--ease-out) forwards;
}

.animate-scale-in {
  animation: scaleIn 0.5s var(--ease-spring) forwards;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

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

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

.animate-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

.animate-gradient {
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

/* ========================================
   动画延迟类
   ======================================== */

.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }

/* ========================================
   滚动触发动画
   ======================================== */

.scroll-animate {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.scroll-animate.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-animate-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.scroll-animate-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-animate-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.scroll-animate-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-animate-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-spring);
}

.scroll-animate-scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* ========================================
   交错动画
   ======================================== */

.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
}

.stagger-children.is-visible > *:nth-child(1) { animation: fadeInUp 0.5s var(--ease-out) 0.1s forwards; }
.stagger-children.is-visible > *:nth-child(2) { animation: fadeInUp 0.5s var(--ease-out) 0.2s forwards; }
.stagger-children.is-visible > *:nth-child(3) { animation: fadeInUp 0.5s var(--ease-out) 0.3s forwards; }
.stagger-children.is-visible > *:nth-child(4) { animation: fadeInUp 0.5s var(--ease-out) 0.4s forwards; }
.stagger-children.is-visible > *:nth-child(5) { animation: fadeInUp 0.5s var(--ease-out) 0.5s forwards; }
.stagger-children.is-visible > *:nth-child(6) { animation: fadeInUp 0.5s var(--ease-out) 0.6s forwards; }
.stagger-children.is-visible > *:nth-child(7) { animation: fadeInUp 0.5s var(--ease-out) 0.7s forwards; }
.stagger-children.is-visible > *:nth-child(8) { animation: fadeInUp 0.5s var(--ease-out) 0.8s forwards; }

/* ========================================
   悬停动画
   ======================================== */

.hover-lift {
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

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

.hover-scale {
  transition: transform var(--duration-normal) var(--ease-spring);
}

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

.hover-glow {
  transition: box-shadow var(--duration-normal) var(--ease-out);
}

.hover-glow:hover {
  box-shadow: var(--shadow-glow);
}

.hover-rotate {
  transition: transform var(--duration-normal) var(--ease-out);
}

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

/* ========================================
   粒子背景动画
   ======================================== */

.particles-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--primary-500);
  border-radius: 50%;
  opacity: 0.3;
  animation: float-particle 20s infinite linear;
}

@keyframes float-particle {
  0% {
    transform: translateY(100vh) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 0.3;
  }
  90% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(-100vh) translateX(100px);
    opacity: 0;
  }
}

/* ========================================
   网格背景动画
   ======================================== */

.grid-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
}

/* ========================================
   渐变光晕
   ======================================== */

.gradient-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: -1;
  opacity: 0.4;
}

.gradient-orb-primary {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--primary-500) 0%, transparent 70%);
  top: -200px;
  right: -200px;
}

.gradient-orb-cyan {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
  bottom: -150px;
  left: -150px;
}

.gradient-orb-purple {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ========================================
   扫描线效果
   ======================================== */

.scan-line {
  position: relative;
  overflow: hidden;
}

.scan-line::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-500), transparent);
  animation: scan 3s ease-in-out infinite;
}

@keyframes scan {
  0%, 100% {
    transform: translateY(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(100%);
    opacity: 0;
  }
}

/* ========================================
   打字机效果
   ======================================== */

.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--primary-500);
  white-space: nowrap;
  animation:
    typing 3s steps(40, end),
    blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--primary-500); }
}

/* ========================================
   脉冲环效果
   ======================================== */

.pulse-ring {
  position: relative;
}

.pulse-ring::before,
.pulse-ring::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--primary-500);
  animation: pulse-ring 2s ease-out infinite;
}

.pulse-ring::after {
  animation-delay: 1s;
}

@keyframes pulse-ring {
  0% {
    width: 100%;
    height: 100%;
    opacity: 1;
  }
  100% {
    width: 200%;
    height: 200%;
    opacity: 0;
  }
}

/* ========================================
   波形动画
   ======================================== */

.wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%233B82F6' fill-opacity='0.1' d='M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,112C672,96,768,96,864,112C960,128,1056,160,1152,160C1248,160,1344,128,1392,112L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E");
  background-size: 1440px 100px;
  animation: wave 10s linear infinite;
}

@keyframes wave {
  0% { background-position-x: 0; }
  100% { background-position-x: 1440px; }
}

/* ========================================
   故障效果
   ======================================== */

.glitch {
  position: relative;
}

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

.glitch::before {
  animation: glitch-1 0.3s infinite linear alternate-reverse;
  color: var(--accent-cyan);
  z-index: -1;
}

.glitch::after {
  animation: glitch-2 0.3s infinite linear alternate-reverse;
  color: var(--accent-rose);
  z-index: -2;
}

@keyframes glitch-1 {
  0% { clip-path: inset(20% 0 80% 0); transform: translate(-2px, 0); }
  20% { clip-path: inset(60% 0 10% 0); transform: translate(2px, 0); }
  40% { clip-path: inset(40% 0 50% 0); transform: translate(-2px, 0); }
  60% { clip-path: inset(80% 0 5% 0); transform: translate(2px, 0); }
  80% { clip-path: inset(10% 0 70% 0); transform: translate(-2px, 0); }
  100% { clip-path: inset(30% 0 20% 0); transform: translate(2px, 0); }
}

@keyframes glitch-2 {
  0% { clip-path: inset(10% 0 60% 0); transform: translate(2px, 0); }
  20% { clip-path: inset(30% 0 20% 0); transform: translate(-2px, 0); }
  40% { clip-path: inset(70% 0 10% 0); transform: translate(2px, 0); }
  60% { clip-path: inset(20% 0 50% 0); transform: translate(-2px, 0); }
  80% { clip-path: inset(50% 0 30% 0); transform: translate(2px, 0); }
  100% { clip-path: inset(5% 0 80% 0); transform: translate(-2px, 0); }
}
