/* 动画关键帧定义 */
@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes rotateIn {
    from {
        transform: rotate(-180deg) scale(0);
        opacity: 0;
    }
    to {
        transform: rotate(0) scale(1);
        opacity: 1;
    }
}

/* 动画类 */
.animate-slide-up {
    animation: slideInUp 0.8s ease forwards;
}

.animate-slide-down {
    animation: slideInDown 0.8s ease forwards;
}

.animate-slide-left {
    animation: slideInLeft 0.8s ease forwards;
}

.animate-slide-right {
    animation: slideInRight 0.8s ease forwards;
}

.animate-fade-in {
    animation: fadeIn 0.6s ease forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease forwards;
}

.animate-rotate-in {
    animation: rotateIn 0.8s ease forwards;
}

/* 延迟类 */
.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;
}

/* 动画持续时间类 */
.duration-300 {
    animation-duration: 0.3s;
}

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

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

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

/* 动画填充模式类 */
.fill-forwards {
    animation-fill-mode: forwards;
}

.fill-backwards {
    animation-fill-mode: backwards;
}

.fill-both {
    animation-fill-mode: both;
}

/* 动画时间函数类 */
.ease-linear {
    animation-timing-function: linear;
}

.ease-in {
    animation-timing-function: ease-in;
}

.ease-out {
    animation-timing-function: ease-out;
}

.ease-in-out {
    animation-timing-function: ease-in-out;
}

/* 滚动触发动画 */
.scroll-trigger {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

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

/* 悬停动画 */
.hover-scale {
    transition: transform 0.3s ease;
}

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

.hover-lift {
    transition: transform 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
}

.hover-rotate {
    transition: transform 0.3s ease;
}

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

/* 加载动画 */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--background-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* 粒子动画 */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--white);
    border-radius: 50%;
    opacity: 0.5;
    animation: float 20s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

/* 文字动画 */
.text-reveal {
    overflow: hidden;
}

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

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

/* 背景动画 */
.gradient-animate {
    background: linear-gradient(-45deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
}

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

/* 页面过渡动画 */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--secondary-color);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.6s ease;
}

.page-transition.active {
    transform: translateY(0);
}

/* 菜单动画 */
.menu-item {
    position: relative;
    overflow: hidden;
}

.menu-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.menu-item:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* 卡片翻转动画 */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* 动画样式 */

/* 基础类，用于初始隐藏元素 */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

/* 显示动画后的类 */
.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* 不同元素的延迟时间 */
.section-header.animate-on-scroll {
    transition-delay: 0.1s;
}

.about-content.animate-on-scroll {
    transition-delay: 0.3s;
}

.about-stats.animate-on-scroll {
    transition-delay: 0.5s;
}

/* 从左向右的动画 */
.animate-from-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.animate-from-left.animated {
    opacity: 1;
    transform: translateX(0);
}

/* 从右向左的动画 */
.animate-from-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.animate-from-right.animated {
    opacity: 1;
    transform: translateX(0);
}

/* 缩放动画 */
.animate-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.animate-scale.animated {
    opacity: 1;
    transform: scale(1);
}

/* 淡入动画 */
.animate-fade {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.animate-fade.animated {
    opacity: 1;
}

/* 数字计数器特效 */
.stat-number {
    position: relative;
    display: inline-block;
}

.stat-number::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #4a90e2, transparent);
    transform: scaleX(0);
    transition: transform 0.5s ease;
}

.stat-item:hover .stat-number::after {
    transform: scaleX(1);
}

/* 基础动画效果 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slideDown {
  from { transform: translateY(-30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slideLeft {
  from { transform: translateX(-30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideRight {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 英雄区动画 */
.animate-fade-in {
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
}

.animate-slide-up {
  opacity: 0;
  animation: slideUp 0.8s ease forwards;
}

.animate-slide-down {
  opacity: 0;
  animation: slideDown 0.8s ease forwards;
}

.animate-scale-in {
  opacity: 0;
  animation: scaleIn 0.8s ease forwards;
}

/* 为section-header设置动画延迟 */
.section-header .section-label.animate-on-scroll {
  transition-delay: 0.1s;
}

.section-header .section-title.animate-on-scroll {
  transition-delay: 0.2s;
}

.section-header .section-subtitle.animate-on-scroll {
  transition-delay: 0.3s;
}

/* 设置不同内容的动画延迟 */
.about-content.animate-on-scroll {
  transition-delay: 0.2s;
}

.about-stats.animate-on-scroll {
  transition-delay: 0.3s;
}

.about-stats .stat-card:nth-child(1) {
  transition-delay: 0.3s;
}

.about-stats .stat-card:nth-child(2) {
  transition-delay: 0.4s;
}

.about-stats .stat-card:nth-child(3) {
  transition-delay: 0.5s;
}

.about-stats .stat-card:nth-child(4) {
  transition-delay: 0.6s;
}

/* 悬停动画 */
.stat-number {
  position: relative;
}

.stat-number::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  transform: scaleX(0);
  transform-origin: bottom right;
  transition: transform 0.3s ease;
}

.stat-card:hover .stat-number::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

/* 并行滚动效果 */
.parallax-element {
  transition: transform 0.3s cubic-bezier(0.2, 0, 0.8, 1);
}

/* 英雄区域滚动指示器动画 */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

.scroll-down i {
  animation: bounce 2s infinite;
}

/* 首页标题分段淡入动画 */
.home-hero h1 {
  opacity: 0;
  animation: fadeIn 1s ease forwards;
}

.home-hero p {
  opacity: 0;
  animation: fadeIn 1s 0.3s ease forwards;
}

.home-buttons {
  /* 不设置初始opacity为0，而是保持可见状态 */
  transform: translateY(20px);
  transition: transform 0.8s ease;
}

.home-hero .home-buttons.animated {
  transform: translateY(0);
}

/* 为每个按钮单独设置变换效果，而不是整体透明度 */
.home-hero .home-button {
  transform: translateY(20px);
  transition: transform 0.8s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.home-hero .home-button:nth-child(1) {
  transition-delay: 0.6s;
}

.home-hero .home-button:nth-child(2) {
  transition-delay: 0.8s;
}

.home-hero .home-buttons.animated .home-button {
  transform: translateY(0);
}

.scroll-down {
  opacity: 0;
  animation: fadeIn 1s 0.9s ease forwards;
}

/* 添加首页英雄区特定动画类 */
.fadeInUp {
  animation-name: fadeInUp;
  animation-duration: 0.8s;
  animation-fill-mode: both;
}

.fadeIn {
  animation-name: fadeIn;
  animation-duration: 0.8s;
  animation-fill-mode: both;
}

@keyframes fadeInUp {
  from {
    opacity: 0.2; /* 不完全透明，减少闪烁感 */
    transform: translate3d(0, 40px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* 添加animated类，用于JavaScript中添加 */
.animated {
  animation-duration: 0.8s;
  animation-fill-mode: both;
}

/* 首页动画初始状态 */
.home-hero h1,
.home-hero p,
.home-hero .scroll-down {
  opacity: 0;
}

/* 首页英雄区动画添加后状态 */
.home-hero h1.animated,
.home-hero p.animated,
.home-hero .home-buttons.animated,
.home-hero .scroll-down.animated {
  opacity: 1;
} 