/* ============================================
   佳前程官网 - 增强动画样式
   ============================================ */

/* ============================================
   滚动动画 - 增强版
   ============================================ */
[data-animate] {
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-animate].animated {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1) rotate(0);
}

[data-animate="fade-up"] {
  transform: translateY(60px);
}

[data-animate="fade-down"] {
  transform: translateY(-60px);
}

[data-animate="fade-left"] {
  transform: translateX(-60px);
}

[data-animate="fade-right"] {
  transform: translateX(60px);
}

[data-animate="zoom-in"] {
  transform: scale(0.8);
}

[data-animate="zoom-out"] {
  transform: scale(1.2);
}

[data-animate="rotate-in"] {
  transform: rotate(-10deg) scale(0.9);
}

[data-animate="flip-x"] {
  transform: perspective(800px) rotateX(30deg);
}

[data-animate="flip-y"] {
  transform: perspective(800px) rotateY(30deg);
}

/* 延迟动画 */
[data-delay="100"] { transition-delay: 0.1s; }
[data-delay="200"] { transition-delay: 0.2s; }
[data-delay="300"] { transition-delay: 0.3s; }
[data-delay="400"] { transition-delay: 0.4s; }
[data-delay="500"] { transition-delay: 0.5s; }
[data-delay="600"] { transition-delay: 0.6s; }
[data-delay="700"] { transition-delay: 0.7s; }
[data-delay="800"] { transition-delay: 0.8s; }
[data-delay="1000"] { transition-delay: 1s; }
[data-delay="1200"] { transition-delay: 1.2s; }

/* ============================================
   Hero区域炫酷动画
   ============================================ */
.hero__title {
  animation: heroTitleReveal 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes heroTitleReveal {
  0% {
    opacity: 0;
    transform: translateY(40px);
    filter: blur(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* 打字机效果 - 副标题 */
.hero__subtitle.typewriter {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
}

/* 打字机光标 */
.typewriter-cursor {
  color: var(--accent);
  font-weight: bold;
  animation: cursorBlink 0.75s step-end infinite;
}

@keyframes cursorBlink {
  from, to { opacity: 1; }
  50% { opacity: 0; }
}

.hero__desc {
  animation: fadeInUp 1s cubic-bezier(0.4, 0, 0.2, 1) 2.5s forwards;
  opacity: 0;
}

.hero__actions {
  animation: fadeInUp 1s cubic-bezier(0.4, 0, 0.2, 1) 3s forwards;
  opacity: 0;
}

.hero__stats {
  animation: fadeInUp 1s cubic-bezier(0.4, 0, 0.2, 1) 3.5s forwards;
  opacity: 0;
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   文字逐字动画
   ============================================ */
.text-reveal {
  display: inline-block;
  overflow: hidden;
}

.text-reveal span {
  display: inline-block;
  opacity: 0;
  transform: translateY(100%);
  animation: textRevealChar 0.5s forwards;
}

@keyframes textRevealChar {
  0% {
    opacity: 0;
    transform: translateY(100%) rotateX(-80deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateX(0);
  }
}

/* ============================================
   数字滚动动画 - 增强版
   ============================================ */
.counter {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  position: relative;
}

.counter::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: scaleX(0);
  animation: counterUnderline 0.5s ease forwards 2s;
}

@keyframes counterUnderline {
  to {
    transform: scaleX(1);
  }
}

/* ============================================
   粒子效果增强
   ============================================ */
.particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.particle {
  position: absolute;
  background: rgba(197, 160, 89, 0.4);
  border-radius: 50%;
  animation: floatParticle linear infinite;
}

@keyframes floatParticle {
  0% {
    transform: translateY(100vh) rotate(0deg) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) rotate(720deg) scale(0.5);
    opacity: 0;
  }
}

/* 粒子大小和位置变化 */
.particle:nth-child(1) { left: 10%; width: 6px; height: 6px; animation-duration: 12s; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; width: 4px; height: 4px; animation-duration: 15s; animation-delay: 1s; }
.particle:nth-child(3) { left: 30%; width: 8px; height: 8px; animation-duration: 10s; animation-delay: 2s; }
.particle:nth-child(4) { left: 40%; width: 5px; height: 5px; animation-duration: 14s; animation-delay: 0.5s; }
.particle:nth-child(5) { left: 50%; width: 7px; height: 7px; animation-duration: 11s; animation-delay: 1.5s; }
.particle:nth-child(6) { left: 60%; width: 4px; height: 4px; animation-duration: 13s; animation-delay: 3s; }
.particle:nth-child(7) { left: 70%; width: 6px; height: 6px; animation-duration: 16s; animation-delay: 2.5s; }
.particle:nth-child(8) { left: 80%; width: 5px; height: 5px; animation-duration: 12s; animation-delay: 0.8s; }
.particle:nth-child(9) { left: 90%; width: 7px; height: 7px; animation-duration: 14s; animation-delay: 1.2s; }
.particle:nth-child(10) { left: 95%; width: 4px; height: 4px; animation-duration: 11s; animation-delay: 2.2s; }
.particle:nth-child(11) { left: 15%; width: 3px; height: 3px; animation-duration: 18s; animation-delay: 3.5s; }
.particle:nth-child(12) { left: 45%; width: 5px; height: 5px; animation-duration: 13s; animation-delay: 4s; }

/* 连线效果 */
.particle-line {
  position: absolute;
  background: linear-gradient(90deg, rgba(197, 160, 89, 0.2), transparent);
  height: 1px;
  transform-origin: left center;
  animation: lineGlow 3s ease-in-out infinite;
}

@keyframes lineGlow {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* ============================================
   悬浮卡片效果
   ============================================ */
.hover-float {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-float:hover {
  transform: translateY(-15px) scale(1.02);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

/* ============================================
   光效按钮
   ============================================ */
.btn-glow {
  position: relative;
  overflow: hidden;
}

.btn-glow::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 70%
  );
  transform: rotate(45deg);
  animation: btnGlow 3s linear infinite;
}

@keyframes btnGlow {
  0% {
    transform: translateX(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) rotate(45deg);
  }
}

/* ============================================
   渐变边框动画
   ============================================ */
.gradient-border {
  position: relative;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
}

.gradient-border::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, var(--primary), var(--accent), var(--primary));
  background-size: 300% 300%;
  border-radius: inherit;
  z-index: -1;
  animation: gradientBorder 4s ease infinite;
}

@keyframes gradientBorder {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ============================================
   滚动视差效果
   ============================================ */
.parallax-container {
  overflow: hidden;
  position: relative;
}

.parallax-bg {
  position: absolute;
  top: -20%;
  left: 0;
  width: 100%;
  height: 140%;
  background-size: cover;
  background-position: center;
  will-change: transform;
}

/* ============================================
   磁性悬浮效果
   ============================================ */
.magnetic-hover {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ============================================
   3D卡片效果
   ============================================ */
.card-3d {
  perspective: 1000px;
  transform-style: preserve-3d;
}

.card-3d-inner {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.card-3d:hover .card-3d-inner {
  transform: rotateY(5deg) rotateX(5deg);
}

/* ============================================
   涟漪效果
   ============================================ */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ============================================
   文字渐变动画
   ============================================ */
.text-gradient-animate {
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary-light), var(--accent));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: textGradientFlow 4s linear infinite;
}

@keyframes textGradientFlow {
  0% { background-position: 0% center; }
  100% { background-position: 300% center; }
}

/* ============================================
   摆动动画
   ============================================ */
.wobble {
  animation: wobble 1s ease-in-out;
}

@keyframes wobble {
  0% { transform: translateX(0); }
  15% { transform: translateX(-15px) rotate(-5deg); }
  30% { transform: translateX(10px) rotate(3deg); }
  45% { transform: translateX(-10px) rotate(-3deg); }
  60% { transform: translateX(5px) rotate(2deg); }
  75% { transform: translateX(-5px) rotate(-1deg); }
  100% { transform: translateX(0); }
}

/* ============================================
   弹簧效果
   ============================================ */
.spring {
  animation: spring 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes spring {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.1); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

/* ============================================
   翻转入场
   ============================================ */
.flip-in {
  animation: flipIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  perspective: 1000px;
}

@keyframes flipIn {
  0% {
    transform: perspective(800px) rotateX(90deg);
    opacity: 0;
  }
  100% {
    transform: perspective(800px) rotateX(0);
    opacity: 1;
  }
}

/* ============================================
   光线扫过效果
   ============================================ */
.light-sweep {
  position: relative;
  overflow: hidden;
}

.light-sweep::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: lightSweep 3s ease-in-out infinite;
}

@keyframes lightSweep {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: 100%; }
}

/* ============================================
   打字机效果 - 图标
   ============================================ */
.typewriter-icon {
  position: relative;
  overflow: hidden;
}

.typewriter-icon svg {
  animation: typewriterDraw 2s ease forwards;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
}

@keyframes typewriterDraw {
  0% {
    stroke-dashoffset: 1000;
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

/* ============================================
   滚动进度条
   ============================================ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  z-index: 9999;
  transition: width 0.1s linear;
}

/* ============================================
   链接下划线动画
   ============================================ */
.link-underline {
  position: relative;
  display: inline-block;
}

.link-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-underline:hover::after {
  width: 100%;
}

/* ============================================
   图标旋转入场
   ============================================ */
.icon-spin-in {
  animation: iconSpinIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes iconSpinIn {
  0% {
    transform: rotate(-180deg) scale(0);
    opacity: 0;
  }
  100% {
    transform: rotate(0) scale(1);
    opacity: 1;
  }
}

/* ============================================
   加载动画 - 增强版
   ============================================ */
.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(30, 58, 95, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.loading-dots span {
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  animation: dotBounce 1.4s ease-in-out infinite;
}

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

@keyframes dotBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.6;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 骨架屏动画 */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 25%,
    var(--bg-tertiary) 37%,
    var(--bg-secondary) 63%
  );
  background-size: 400% 100%;
  animation: skeletonLoading 1.4s ease infinite;
}

@keyframes skeletonLoading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ============================================
   滚动指示器动画
   ============================================ */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  animation: fadeInUp 1s ease 1.5s forwards;
  opacity: 0;
}

.scroll-indicator__mouse {
  width: 26px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 13px;
  position: relative;
  margin: 0 auto;
}

.scroll-indicator__wheel {
  width: 4px;
  height: 8px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 2px;
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  animation: scrollWheel 2s ease-in-out infinite;
}

@keyframes scrollWheel {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(15px);
  }
}

.scroll-indicator__arrow {
  width: 12px;
  height: 12px;
  border-right: 2px solid rgba(255, 255, 255, 0.6);
  border-bottom: 2px solid rgba(255, 255, 255, 0.6);
  transform: rotate(45deg);
  margin: 10px auto 0;
  animation: scrollArrow 2s ease-in-out infinite;
}

@keyframes scrollArrow {
  0%, 100% {
    opacity: 0;
    transform: rotate(45deg) translateY(0);
  }
  50% {
    opacity: 1;
    transform: rotate(45deg) translateY(5px);
  }
}

/* ============================================
   禁用动画（无障碍）
   ============================================ */
@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;
  }
}