/**
 * 动态效果库
 * 包含：粒子背景、滚动动画、悬停效果、微交互
 */

/* ========== 1. Hero 区域动态背景 ========== */
.hero-decoration {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
    pointer-events: none;
}

/* 粒子容器 */
.particles-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
}

/* 装饰圆圈动画 */
.decoration-circle {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(107, 142, 35, 0.1) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    animation: float 8s ease-in-out infinite;
}

.decoration-circle::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(218, 165, 32, 0.08) 0%, transparent 70%);
    top: 50px;
    right: 50px;
    animation: float 6s ease-in-out infinite reverse;
}

/* 装饰三角形动画 */
.decoration-triangle {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 100px solid transparent;
    border-right: 100px solid transparent;
    border-bottom: 173px solid rgba(143, 188, 143, 0.05);
    bottom: 10%;
    left: 5%;
    animation: rotate 20s linear infinite;
}

.decoration-triangle::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 60px solid transparent;
    border-right: 60px solid transparent;
    border-bottom: 104px solid rgba(107, 142, 35, 0.08);
    top: -40px;
    left: -60px;
    animation: rotate 15s linear infinite reverse;
}

/* 装饰点阵 */
.decoration-dots {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, rgba(85, 107, 47, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: dotsMove 30s linear infinite;
}

/* ========== 2. 浮动动画 ========== */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-30px) rotate(5deg);
    }
}

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

@keyframes dotsMove {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 30px 30px;
    }
}

/* ========== 3. 文字渐入动画 ========== */
.hero-content {
    position: relative;
    z-index: 1;
    animation: fadeInUp 1s ease-out;
}

.hero-content h1 {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
}

.hero-content .hero-subtitle {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.4s forwards;
}

.hero-content .hero-description {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.6s forwards;
}

.hero-content .hero-buttons {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.8s forwards;
}

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

/* ========== 4. 导航栏滚动效果 ========== */
.header {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.header.scrolled {
    background-color: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 20px rgba(47, 79, 79, 0.1);
    padding: 8px 0;
}

.header.scrolled .nav {
    padding: 8px 0;
}

/* 导航链接下划线动画 */
.nav-menu a {
    position: relative;
    transition: color 0.3s ease;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width 0.3s ease;
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}

/* ========== 5. 作品卡片动态效果 ========== */
.portfolio-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.portfolio-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 48px rgba(47, 79, 79, 0.15);
}

.portfolio-image {
    position: relative;
    overflow: hidden;
}

.portfolio-image img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.portfolio-card:hover .portfolio-image img {
    transform: scale(1.08);
}

.portfolio-overlay {
    opacity: 0;
    background: rgba(47, 79, 79, 0.85);
    transition: opacity 0.4s ease;
}

.portfolio-card:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-overlay .btn-view {
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.portfolio-card:hover .btn-view {
    transform: translateY(0);
}

/* ========== 6. 滚动出现动画 ========== */
.fade-in-section {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* 延迟动画 */
.fade-in-delay-1 { transition-delay: 0.1s; }
.fade-in-delay-2 { transition-delay: 0.2s; }
.fade-in-delay-3 { transition-delay: 0.3s; }
.fade-in-delay-4 { transition-delay: 0.4s; }

/* ========== 7. 服务卡片动画 ========== */
.service-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(218, 165, 32, 0.05), transparent);
    transition: left 0.6s ease;
}

.service-card:hover::before {
    left: 100%;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(47, 79, 79, 0.12);
    border-color: var(--accent-color);
}

.service-icon {
    transition: all 0.4s ease;
}

.service-card:hover .service-icon {
    transform: rotate(360deg) scale(1.1);
}

/* ========== 8. 按钮动画 ========== */
.cta-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.cta-button::before {
    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 0.6s ease, height 0.6s ease;
}

.cta-button:active::before {
    width: 300px;
    height: 300px;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(85, 107, 47, 0.3);
}

/* ========== 9. 联系表单动画 ========== */
.form-group input,
.form-group textarea {
    transition: all 0.3s ease;
    border-color: var(--border-color);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(85, 107, 47, 0.1);
    transform: translateY(-2px);
}

/* ========== 10. 页脚渐入动画 ========== */
.footer {
    animation: fadeInUp 1s ease-out;
}

/* ========== 11. 加载动画 ========== */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========== 12. 脉冲效果 ========== */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* ========== 13. 呼吸效果 ========== */
.breathing {
    animation: breathing 3s ease-in-out infinite;
}

@keyframes breathing {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* ========== 14. 旋转加载 ========== */
.spin-loader {
    border: 3px solid rgba(85, 107, 47, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========== 15. 弹性缩放 ========== */
.bounce-scale {
    animation: bounceScale 0.5s ease-out;
}

@keyframes bounceScale {
    0% {
        transform: scale(0.9);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}
