/* ========================================
   ViSiLight 官网 - 公共样式变量
   ======================================== */

/* 默认主题：白蓝色主题 */
:root {
    /* 颜色系统 - 白蓝色主题 */
    --bg-deep: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-border: rgba(59, 130, 246, 0.15);
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-glow: rgba(59, 130, 246, 0.2);
    --secondary: #8b5cf6;
    --secondary-glow: rgba(139, 92, 246, 0.15);
    --text-white: #1a1a2e;
    --text-gray: rgba(26, 26, 46, 0.7);
    --text-light-gray: rgba(26, 26, 46, 0.5);
    
    /* 渐变 */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --gradient-bg: linear-gradient(180deg, #ffffff 0%, #f0f4ff 100%);
    
    /* 动画曲线 */
    --transition-soft: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --transition-elastic: all 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    
    /* 阴影 */
    --shadow-primary: 0 4px 20px rgba(59, 130, 246, 0.1);
    --shadow-hover: 0 10px 40px rgba(59, 130, 246, 0.15);
    --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* 黑紫色主题 */
html[data-theme="dark"] {
    /* 颜色系统 - 黑紫色主题 */
    --bg-deep: #000814;
    --bg-secondary: #0a192f;
    --bg-card: rgba(17, 25, 40, 0.7);
    --bg-border: rgba(59, 130, 246, 0.2);
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --secondary: #8b5cf6;
    --secondary-glow: rgba(139, 92, 246, 0.3);
    --text-white: #f8fafc;
    --text-gray: rgba(248, 250, 252, 0.7);
    --text-light-gray: rgba(248, 250, 252, 0.4);
    
    /* 渐变 */
    --gradient-bg: linear-gradient(180deg, #000814 0%, #0a192f 100%);
    
    /* 阴影 */
    --shadow-primary: 0 0 30px rgba(59, 130, 246, 0.15);
    --shadow-hover: 0 20px 40px rgba(59, 130, 246, 0.15);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ========================================
   基础重置与全局样式
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    overflow-y: auto;
    width: 100%;
    max-width: 100vw;
}

body {
    font-family: 'Inter', 'Noto Sans SC', sans-serif;
    background: var(--gradient-bg);
    color: var(--text-white);
    -webkit-font-smoothing: antialiased;
    position: relative;
    min-height: 100vh;
    /* 默认背景色 - 在CSS变量加载前使用 */
    background-color: #ffffff;
    transition: background-color 0.15s ease;
}

/* 暗色主题 - body背景色 - 必须在CSS变量之前定义 */
html[data-theme="dark"] body {
    background-color: #000814 !important;
}

/* 亮色主题 - body背景色 */
html[data-theme="light"] body {
    background-color: #ffffff !important;
}

/* ========================================
   通用容器
   ======================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2.5rem;
    position: relative;
    z-index: 1;
    word-wrap: break-word;
}

section {
    padding: 6rem 0;
    position: relative;
    overflow: hidden;
}

/* 首页特殊间距 - 更紧凑精致 */
#index section {
    padding: 5rem 0;
}

/* 首屏英雄区不需要顶部间距 */
.hero {
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* 统计数据区域间距 - 优化版，紧贴hero下方 */
.stats-section-refined {
    padding: 3rem 0 5rem 0;
    margin-top: 0;
}

/* CTA区域间距 - 优化版 */
.cta-section-refined {
    padding: 7rem 0;
}

/* 技术实力区域间距 - 优化版 */
.tech-strength-refined {
    padding: 7rem 0;
}

/* 移动端间距优化 */
@media (max-width: 768px) {
    section {
        padding: 4rem 0;
    }
    
    #index section {
        padding: 3.5rem 0;
    }
    
    .stats-section-refined {
        padding: 2rem 0 4rem 0;
    }
    
    .cta-section-refined,
    .tech-strength-refined {
        padding: 4rem 0;
    }
}

/* ========================================
   粒子背景
   ======================================== */
#particle-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ========================================
   光波动画
   ======================================== */
.wave-animation {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: radial-gradient(circle at center, var(--primary-glow) 0%, transparent 70%);
    opacity: 0.3;
    animation: wave-pulse 8s infinite ease-in-out;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

@keyframes wave-pulse {
    0%, 100% { transform: scale(1); opacity: 0.2; }
    50% { transform: scale(1.2); opacity: 0.4; }
}

/* ========================================
   滚动渐入动画 - 增强版
   ======================================== */
.reveal {
    opacity: 0;
    transform: translateY(60px);
    will-change: opacity, transform;
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* 从左侧滑入 */
.reveal-left {
    opacity: 0;
    transform: translateX(-60px);
    will-change: opacity, transform;
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

/* 从右侧滑入 */
.reveal-right {
    opacity: 0;
    transform: translateX(60px);
    will-change: opacity, transform;
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

/* 缩放效果 */
.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    will-change: opacity, transform;
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }
.reveal-delay-6 { transition-delay: 0.6s; }

/* ========================================
   章节标题
   ======================================== */
.section-header {
    margin-bottom: 6rem;
    position: relative;
    text-align: center;
}

.section-header::before {
    content: '';
    position: absolute;
    top: -4rem;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.section-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 900;
    letter-spacing: -2px;
    margin-bottom: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    position: relative;
    white-space: normal;
    line-height: 1.2;
}

.section-title::after {
    content: attr(data-text);
    position: absolute;
    top: 4px;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    z-index: -1;
}

.section-desc {
    color: var(--text-gray);
    font-size: clamp(1rem, 2vw, 1.25rem);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
    text-align: center;
    white-space: normal;
}

/* ========================================
   按钮组件
   ======================================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 1.2rem 3rem;
    background: transparent;
    color: var(--text-white);
    border: 1px solid var(--bg-border);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 50px;
    transition: var(--transition-bounce);
    position: relative;
    overflow: hidden;
    z-index: 1;
    min-width: 180px;
    justify-content: center;
    cursor: pointer;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: -1;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s ease;
}

.btn-primary:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.btn-primary:hover::after {
    left: 100%;
}

.btn-primary:hover {
    border-color: transparent;
    box-shadow: 0 0 50px var(--primary-glow), 0 0 20px var(--secondary-glow);
    transform: translateY(-5px);
}

.btn-primary:active {
    transform: translateY(-2px) scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================
   网格布局
   ======================================== */
.grid-4 { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 2rem; 
}

.grid-3 { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 2rem; 
}

/* ========================================
   卡片组件
   ======================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    padding: 3rem 2rem;
    border-radius: 20px;
    transition: var(--transition-bounce);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transform-style: preserve-3d;
    perspective: 1000px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    will-change: transform;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-glow) 0%, var(--secondary-glow) 100%);
    opacity: 0;
    transition: var(--transition-soft);
    z-index: -1;
}

.card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 60%);
    opacity: 0;
    transition: all 0.5s ease;
    z-index: -1;
}

.card:hover {
    transform: translateY(-15px) rotateX(5deg) rotateY(5deg);
    border-color: var(--primary);
    box-shadow: 0 30px 60px rgba(0,0,0,0.2), 0 0 50px var(--primary-glow);
}

.card:hover::before {
    opacity: 1;
}

.card:hover::after {
    opacity: 1;
}

.card:active {
    transform: translateY(-8px) scale(0.98) rotateX(2deg) rotateY(2deg);
}

.card-icon {
    font-size: 3.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
    transition: var(--transition-elastic);
    display: inline-block;
}

.card:hover .card-icon {
    transform: scale(1.2) rotate(5deg);
    text-shadow: 0 0 20px var(--primary-glow);
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
    font-weight: 700;
    white-space: normal;
}

.card p {
    color: var(--text-gray);
    line-height: 1.8;
    position: relative;
    z-index: 1;
    flex-grow: 1;
}

/* ========================================
   响应式优化
   ======================================== */
@media (max-width: 1400px) {
    .container {
        padding: 0 2rem;
    }
}

@media (max-width: 992px) {
    section {
        padding: 10rem 0;
    }
}

@media (max-width: 768px) {
    /* 移动端：允许页面正常滚动，添加宽度控制 */
    html {
        overflow: visible;
        position: relative;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    body {
        overflow: visible;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    .container {
        padding: 0 1.5rem;
    }
    
    section {
        padding: 8rem 0;
    }
    
    .section-header {
        margin-bottom: 4rem;
    }
    
    .section-header::before {
        width: 60px;
        height: 3px;
        top: -3rem;
    }
    
    .section-title {
        font-size: clamp(1.8rem, 4vw, 3rem);
    }
    
    .section-desc {
        font-size: 1rem;
    }
    
    .card {
        padding: 2rem 1.5rem;
        min-height: 280px;
    }
    
    .card-icon {
        font-size: 3rem;
    }
    
    .btn-primary {
        min-width: 150px;
        padding: 1rem 2rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 1rem;
    }
    
    section {
        padding: 6rem 0;
    }
    
    .section-title {
        font-size: clamp(1.5rem, 4vw, 2.5rem);
    }
    
    .card {
        padding: 1.5rem 1.2rem;
        min-height: 260px;
    }
    
    .card-icon {
        font-size: 2.5rem;
    }
    
    .btn-primary {
        padding: 0.9rem 1.8rem;
        font-size: 0.95rem;
    }
}

/* 全局 body 背景色 - 防止页面切换闪烁 */
body {
    background: var(--bg-deep);
    transition: background 0.3s ease;
}

/* 黑紫色主题下的 body 背景 */
html[data-theme="dark"] body {
    background: #000814;
}
