/**
 * Animations - 动画样式定义
 * Includes entrance animation、interactive animation、special effects、3DEffect、parallax effect
 */

/* ========== Basic keyframe definition ========== */

/* fade in */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* fade out */
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Fade up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade in and move down */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* fade left */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* fade right */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Zoom fade in */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ========== Cool keyframe animation ========== */

/* Flexible scaling admission */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
  70% {
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* elastic float */
@keyframes bounceInUp {
  0% {
    opacity: 0;
    transform: translateY(80px);
  }
  60% {
    opacity: 1;
    transform: translateY(-15px);
  }
  80% {
    transform: translateY(8px);
  }
  100% {
    transform: translateY(0);
  }
}

/* bounce */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

/* pulse */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* soft pulsing glow */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(245, 166, 35, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(245, 166, 35, 0.6), 0 0 60px rgba(245, 166, 35, 0.3);
  }
}

/* rotate */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* 3Dflip entryXaxis */
@keyframes flipInX {
  0% {
    opacity: 0;
    transform: perspective(800px) rotateX(90deg);
  }
  40% {
    transform: perspective(800px) rotateX(-15deg);
  }
  70% {
    transform: perspective(800px) rotateX(10deg);
  }
  100% {
    opacity: 1;
    transform: perspective(800px) rotateX(0deg);
  }
}

/* 3Dflip entryYaxis */
@keyframes flipInY {
  0% {
    opacity: 0;
    transform: perspective(800px) rotateY(90deg);
  }
  40% {
    transform: perspective(800px) rotateY(-15deg);
  }
  70% {
    transform: perspective(800px) rotateY(10deg);
  }
  100% {
    opacity: 1;
    transform: perspective(800px) rotateY(0deg);
  }
}

/* Gradient glitter effect */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* Hover animation */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
}

/* Softly suspended */
@keyframes floatSoft {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-8px) rotate(1deg);
  }
  75% {
    transform: translateY(-8px) rotate(-1deg);
  }
}

/* Swing animation */
@keyframes swing {
  0%, 100% {
    transform: rotate(0deg);
    transform-origin: top center;
  }
  20% {
    transform: rotate(8deg);
  }
  40% {
    transform: rotate(-6deg);
  }
  60% {
    transform: rotate(4deg);
  }
  80% {
    transform: rotate(-2deg);
  }
}

/* heartbeat animation */
@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  14% {
    transform: scale(1.15);
  }
  28% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.15);
  }
  70% {
    transform: scale(1);
  }
}

/* rubber band effect */
@keyframes rubberBand {
  0%, 100% {
    transform: scaleX(1) scaleY(1);
  }
  30% {
    transform: scaleX(1.2) scaleY(0.8);
  }
  40% {
    transform: scaleX(0.85) scaleY(1.15);
  }
  50% {
    transform: scaleX(1.1) scaleY(0.9);
  }
  65% {
    transform: scaleX(0.95) scaleY(1.05);
  }
  75% {
    transform: scaleX(1.03) scaleY(0.97);
  }
}

/* Typewriter cursor flashes */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Ripple diffusion */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* Slide into rotation */
@keyframes slideRotateIn {
  0% {
    opacity: 0;
    transform: translateY(60px) rotate(-8deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
}

/* blur fade in */
@keyframes blurIn {
  0% {
    opacity: 0;
    filter: blur(25px);
    transform: scale(1.15);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

/* Text displayed verbatim */
@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

/* border streamer */
@keyframes borderFlow {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Background gradient animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Underline expand */
@keyframes underlineExpand {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Slide to expand */
@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

/* infinite scroll */
@keyframes scrollLeft {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Particles float */
@keyframes particleFloat {
  0% {
    transform: translateY(100%) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(-100vh) scale(1);
    opacity: 0;
  }
}

/* Cursor jumps */
@keyframes cursorPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }
}

/* Rotate and zoom for entry */
@keyframes zoomInRotate {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(-180deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* 晃动提示 */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* light sweeps across */
@keyframes lightSweep {
  0% {
    left: -100%;
  }
  100% {
    left: 200%;
  }
}

/* ========== Animation - base state ========== */

/* Basic scroll animation state - Initial hiding */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* The state after the animation is triggered */
.animate-on-scroll.animated {
  opacity: 1;
  transform: translateY(0);
}

/* Enter from the left */
.animate-from-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-from-left.animated {
  opacity: 1;
  transform: translateX(0);
}

/* Enter from the right */
.animate-from-right {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-from-right.animated {
  opacity: 1;
  transform: translateX(0);
}

/* Zoom in */
.animate-scale {
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-scale.animated {
  opacity: 1;
  transform: scale(1);
}

/* blurry entry */
.animate-blur {
  opacity: 0;
  filter: blur(20px);
  transform: scale(1.1);
  transition: opacity 0.8s ease-out, 
              filter 0.8s ease-out, 
              transform 0.8s ease-out;
}

.animate-blur.animated {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}

/* 3Dflip to enter */
.animate-flip-x {
  opacity: 0;
  transform: perspective(800px) rotateX(90deg);
  transition: opacity 0.8s ease-out, 
              transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.animate-flip-x.animated {
  opacity: 1;
  transform: perspective(800px) rotateX(0deg);
}

.animate-flip-y {
  opacity: 0;
  transform: perspective(800px) rotateY(90deg);
  transition: opacity 0.8s ease-out, 
              transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.animate-flip-y.animated {
  opacity: 1;
  transform: perspective(800px) rotateY(0deg);
}

/* Flexible entry */
.animate-bounce-in {
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.6s ease-out, 
              transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.animate-bounce-in.animated {
  opacity: 1;
  transform: scale(1);
}

/* ========== Direct animation class ========== */

/* fade in animation */
.animate-fade-in {
  animation: fadeIn 0.6s var(--ease-out) forwards;
}

/* Fade up animation */
.animate-fade-in-up {
  animation: fadeInUp 0.7s var(--ease-out) forwards;
}

/* Fade down animation */
.animate-fade-in-down {
  animation: fadeInDown 0.7s var(--ease-out) forwards;
}

/* Fade left animation */
.animate-fade-in-left {
  animation: fadeInLeft 0.7s var(--ease-out) forwards;
}

/* Fade right animation */
.animate-fade-in-right {
  animation: fadeInRight 0.7s var(--ease-out) forwards;
}

/* 缩放淡入动画 */
.animate-scale-in {
  animation: scaleIn 0.5s var(--ease-out) forwards;
}

/* Flexible entry */
.animate-bounce-enter {
  animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* blurry entry */
.animate-blur-enter {
  animation: blurIn 0.8s ease-out forwards;
}

/* 3Dflip */
.animate-flip-x-enter {
  animation: flipInX 0.9s ease-out forwards;
}

.animate-flip-y-enter {
  animation: flipInY 0.9s ease-out forwards;
}

/* ========== animation delay ========== */
.delay-100 { animation-delay: 100ms; transition-delay: 100ms; }
.delay-200 { animation-delay: 200ms; transition-delay: 200ms; }
.delay-300 { animation-delay: 300ms; transition-delay: 300ms; }
.delay-400 { animation-delay: 400ms; transition-delay: 400ms; }
.delay-500 { animation-delay: 500ms; transition-delay: 500ms; }
.delay-600 { animation-delay: 600ms; transition-delay: 600ms; }
.delay-700 { animation-delay: 700ms; transition-delay: 700ms; }
.delay-800 { animation-delay: 800ms; transition-delay: 800ms; }
.delay-1000 { animation-delay: 1000ms; transition-delay: 1000ms; }

/* Staggered animation delay */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }
.stagger-5 { transition-delay: 0.5s; }
.stagger-6 { transition-delay: 0.6s; }
.stagger-7 { transition-delay: 0.7s; }
.stagger-8 { transition-delay: 0.8s; }

/* ========== hover effect ========== */

/* Hover up */
.hover-lift {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
              box-shadow 0.4s ease;
}

.hover-lift:hover {
  transform: translateY(-8px);
}

/* Hover zoom */
.hover-scale {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* Hover rotation */
.hover-rotate {
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

/* Hover underline */
.hover-underline {
  position: relative;
}

.hover-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--color-primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.hover-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* glow on hover */
.hover-glow {
  transition: box-shadow 0.4s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(245, 166, 35, 0.4), 
              0 0 60px rgba(245, 166, 35, 0.2);
}

/* Hover3Dtilt - CooperateJSuse */
.hover-tilt {
  transform-style: preserve-3d;
  transition: transform 0.3s ease-out;
}

/* Magnetic button effect - CooperateJSuse */
.magnetic-btn {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Hover border animation */
.hover-border-animate {
  position: relative;
  overflow: hidden;
}

.hover-border-animate::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  transition: left 0.5s ease;
}

.hover-border-animate:hover::before {
  left: 100%;
}

/* Hover image zoom */
.hover-img-zoom {
  overflow: hidden;
}

.hover-img-zoom img {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.hover-img-zoom:hover img {
  transform: scale(1.1);
}

/* ========== Continuous animation effect ========== */

/* levitating effect */
.animate-float {
  animation: float 4s ease-in-out infinite;
}

/* Softly suspended */
.animate-float-soft {
  animation: floatSoft 5s ease-in-out infinite;
}

/* pulse effect */
.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* pulse halo */
.animate-pulse-glow {
  animation: pulseGlow 2.5s ease-in-out infinite;
}

/* heartbeat effect */
.animate-heartbeat {
  animation: heartbeat 1.5s ease-in-out infinite;
}

/* rocking effect */
.animate-swing {
  animation: swing 2s ease-in-out infinite;
  transform-origin: top center;
}

/* gradient glitter - for buttons or text */
.animate-shimmer {
  background: linear-gradient(
    90deg,
    var(--color-primary) 0%,
    #FFD700 25%,
    var(--color-primary) 50%,
    #FFD700 75%,
    var(--color-primary) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s linear infinite;
}

/* border streamer effect */
.animate-border-flow {
  position: relative;
  background: linear-gradient(90deg, var(--color-primary), #FFD700, var(--color-primary));
  background-size: 200% 100%;
  animation: borderFlow 3s ease infinite;
}

/* ========== Light effect decoration ========== */

/* light sweep effect */
.light-sweep {
  position: relative;
  overflow: hidden;
}

.light-sweep::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: lightSweep 3s ease-in-out infinite;
}

/* Gradient background animation */
.gradient-animate {
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

/* ========== loading animation ========== */

/* Spin loading */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-gray-200);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* pulse loading */
.loading-pulse {
  animation: pulse 1.5s var(--ease-in-out) infinite;
}

/* Skeleton screen flickering */
.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    var(--color-gray-100) 25%,
    var(--color-gray-50) 50%,
    var(--color-gray-100) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ========== Logowall scroll animation ========== */
.logo-scroll {
  display: flex;
  animation: scrollLeft 30s linear infinite;
}

.logo-scroll:hover {
  animation-play-state: paused;
}

/* ========== 数字计数动画 (需配合JS) ========== */
.count-up {
  display: inline-block;
}

/* ========== TabContent switching ========== */
.tab-content {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
  position: absolute;
  width: 100%;
}

.tab-content.active {
  opacity: 1;
  visibility: visible;
  position: relative;
}

/* ========== FAQAccordion animation ========== */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1), 
              padding 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.accordion-item.active .accordion-content {
  max-height: 500px;
}

.accordion-icon {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.accordion-item.active .accordion-icon {
  transform: rotate(45deg);
}

/* ========== Menu expansion animation ========== */
.mobile-menu {
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-menu.open {
  transform: translateX(0);
}

/* ========== Notification bar closing animation ========== */
.notice-bar {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.4s ease, 
              height 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              padding 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.notice-bar.hidden {
  transform: translateY(-100%);
  opacity: 0;
  height: 0;
  padding: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ========== Page transition keyframes（double curtain · transform plan） ========== */

/*
 * Double layer superimposed curtain transition：Orange branding layer + dark base layer
 * Admission：When the two layers are staggered, slide upwards，cascading unveiling
 * Leave：Slide down from above when the two levels are staggered，form cascading coverage
 * 纯 transform 驱动，GPU 合成层渲染，流畅 60fps
 */

/* The curtain slides up — Admission unveiling */
@keyframes curtainSlideUp {
  from { transform: translateY(0); }
  to   { transform: translateY(-101%); }
}

/* The curtain slides down from above — departure cover */
@keyframes curtainSlideDown {
  from { transform: translateY(-101%); }
  to   { transform: translateY(0); }
}

/* ========== card3Dhover effect ========== */
.card-3d {
  perspective: 1000px;
}

.card-3d-inner {
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-style: preserve-3d;
}

.card-3d:hover .card-3d-inner {
  transform: rotateY(10deg) rotateX(5deg);
}

/* ========== text effects ========== */

/* 文字渐入 - 逐字动画容器 */
.text-reveal {
  overflow: hidden;
}

.text-reveal span {
  display: inline-block;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.text-reveal.animated span {
  opacity: 1;
  transform: translateY(0);
}

/* typewriter effect */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--color-primary);
  white-space: nowrap;
  animation: typewriter 3s steps(40) 1s forwards, blink 0.7s step-end infinite;
}

/* ========== Button effects ========== */

/* 按钮波纹效果容器 */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple .ripple-effect {
  position: absolute;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* Button hover fill effect */
.btn-fill-hover {
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn-fill-hover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background-color: var(--color-primary-hover);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: -1;
}

.btn-fill-hover:hover::before {
  width: 100%;
}

/* ========== scroll indicator ========== */
.scroll-indicator {
  animation: bounce 2s infinite;
}

/* ========== parallax scrolling - CooperateJS ========== */
.parallax-layer {
  will-change: transform;
}

/* ========== Responsive animation adjustments ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .animate-on-scroll,
  .animate-from-left,
  .animate-from-right,
  .animate-scale,
  .animate-blur,
  .animate-flip-x,
  .animate-flip-y,
  .animate-bounce-in {
    opacity: 1;
    transform: none;
    filter: none;
  }

  /* Skip page transition curtain */
  body {
    opacity: 1 !important;
    animation: none !important;
  }

  .page-transition-overlay {
    display: none !important;
  }
}

/* Simplified animation on mobile */
@media (max-width: 768px) {
  .animate-on-scroll,
  .animate-from-left,
  .animate-from-right {
    transform: translateY(30px);
  }
  
  .animate-from-left,
  .animate-from-right {
    transform: translateY(30px);
  }
  
  .hover-tilt:hover,
  .card-3d:hover .card-3d-inner {
    transform: none;
  }
}
