/* ========================================
   思洋-Ai 智脑 — 动画系统 (修复版)
   安全回退：无 JS 时内容正常显示
   ======================================== */

/* ===== 1. 滚动揭示动画 ===== */
/* 默认可见 — 确保 JS 未加载时内容正常显示 */
[data-animate] {
  opacity: 1;
  transform: none;
  transition: opacity .8s cubic-bezier(.16,1,.3,1), transform .8s cubic-bezier(.16,1,.3,1);
  will-change: opacity, transform;
}

/* 仅当 JS 激活时才隐藏元素 */
html.js-ready [data-animate] {
  opacity: 0;
  transform: translateY(40px);
}
html.js-ready [data-animate].in-view {
  opacity: 1;
  transform: translateY(0);
}

/* 错峰延迟 */
html.js-ready [data-animate][data-delay="1"] { transition-delay: .08s; }
html.js-ready [data-animate][data-delay="2"] { transition-delay: .16s; }
html.js-ready [data-animate][data-delay="3"] { transition-delay: .24s; }
html.js-ready [data-animate][data-delay="4"] { transition-delay: .32s; }
html.js-ready [data-animate][data-delay="5"] { transition-delay: .40s; }
html.js-ready [data-animate][data-delay="6"] { transition-delay: .48s; }

/* ===== 2. 不同入场方向 ===== */
html.js-ready [data-animate="fade-up"] { transform: translateY(40px); }
html.js-ready [data-animate="fade-down"] { transform: translateY(-40px); }
html.js-ready [data-animate="fade-left"] { transform: translateX(40px); }
html.js-ready [data-animate="fade-right"] { transform: translateX(-40px); }
html.js-ready [data-animate="fade-scale"] { transform: scale(.92); }
html.js-ready [data-animate="fade-blur"] { filter: blur(12px); opacity: 0; }
html.js-ready [data-animate="fade-blur"].in-view { filter: blur(0); opacity: 1; }
html.js-ready [data-animate="fade-scale"].in-view { transform: scale(1); }

/* ===== 3. 渐变流动背景 ===== */
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.gradient-animate {
  background-size: 200% 200%;
  animation: gradient-shift 8s ease infinite;
}

/* ===== 4. 浮动动画 ===== */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.float-anim { animation: float 4s ease-in-out infinite; }
.float-anim-slow { animation: float 7s ease-in-out infinite; }

/* ===== 5. 光晕脉冲 ===== */
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0,201,176,0.15); }
  50% { box-shadow: 0 0 40px rgba(0,201,176,0.3); }
}
.glow-anim { animation: glow-pulse 3s ease-in-out infinite; }

/* ===== 6. 卡片悬浮增强 ===== */
.card-hover {
  transition: all .5s cubic-bezier(.16,1,.3,1);
}
.card-hover:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 30px 60px -15px rgba(0,0,0,0.15);
}

/* ===== 7. 按钮 Ripple 效果 ===== */
.btn-ripple {
  position: relative;
  overflow: hidden;
}
.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: translate(-50%, -50%);
  transition: width .5s ease, height .5s ease;
}
.btn-ripple:active::after {
  width: 300px;
  height: 300px;
  transition: 0s;
}

/* ===== 8. 文字渐变动画 ===== */
@keyframes text-shine {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.text-shine {
  background: linear-gradient(90deg, #00C9B0 0%, #D4A853 50%, #00C9B0 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: text-shine 4s linear infinite;
}

/* ===== 9. 骨架屏闪烁 ===== */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ===== 10. 渐进式条形图 ===== */
@keyframes bar-grow {
  from { width: 0; }
  to { width: var(--bar-width, 100%); }
}
.bar-grow {
  animation: bar-grow 1.2s cubic-bezier(.16,1,.3,1) both;
}

/* ===== 11. 旋转加载 ===== */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spin { animation: spin 1s linear infinite; }

/* ===== 12. 淡入旋转 ===== */
@keyframes fade-rotate {
  from { opacity: 0; transform: rotate(-8deg) scale(.9); }
  to { opacity: 1; transform: rotate(0) scale(1); }
}
.fade-rotate { animation: fade-rotate .7s cubic-bezier(.16,1,.3,1) both; }

/* ===== 13. 弹跳入场 ===== */
@keyframes bounce-in {
  0% { opacity: 0; transform: scale(.3); }
  50% { opacity: 1; transform: scale(1.05); }
  70% { transform: scale(.95); }
  100% { transform: scale(1); }
}
.bounce-in { animation: bounce-in .8s cubic-bezier(.16,1,.3,1) both; }

/* ===== 14. 视差容器 ===== */
.parallax {
  will-change: transform;
  transition: transform .1s linear;
}

/* ===== 15. 玻璃态毛玻璃增强 ===== */
.glass {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.3);
}
.glass-dark {
  background: rgba(15,18,24,0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.06);
}

/* ===== 16. 悬浮放大图片 ===== */
.img-zoom {
  overflow: hidden;
}
.img-zoom img {
  transition: transform .8s cubic-bezier(.16,1,.3,1);
}
.img-zoom:hover img {
  transform: scale(1.08);
}

/* ===== 17. 下划线动画 ===== */
.link-underline {
  position: relative;
}
.link-underline::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 2px;
  background: #00C9B0;
  transition: width .3s cubic-bezier(.16,1,.3,1);
}
.link-underline:hover::after {
  width: 100%;
}

/* ===== 18. 徽章弹跳 ===== */
@keyframes badge-bounce {
  0%, 100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-4px) rotate(-3deg); }
  75% { transform: translateY(-4px) rotate(3deg); }
}
.badge-bounce { animation: badge-bounce 2s ease-in-out infinite; }

/* ===== 19. 尊重用户偏好 ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-animate] {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}
