/* 自定义样式 */
:root {
    --primary-blue: #3b82f6;
    --secondary-purple: #8b5cf6;
    --dark-bg: #111827;
    --darker-bg: #0f172a;
}

/* 平滑滚动和布局稳定性 */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    position: relative;
}

/* 防止focus导致的跳动和缩放 */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 允许文本选择和输入框交互 */
input, textarea, [contenteditable] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 防止focus导致的缩放 */
input, textarea, select, button {
    font-size: 16px; /* 防止iOS缩放 */
}

/* 移除所有focus outline 防止布局跳动 */
*:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* 基础字体和缩放设置 */
html, body {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 防止transform导致的跳动 */
* {
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: auto !important;
}

/* 基础布局设置 */
html {
    position: relative;
    width: 100%;
    overflow-x: hidden;
}

body {
    position: relative;
    width: 100%;
    overflow-x: hidden;
}

/* 基础GPU加速 */
.hero-content, nav {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* 防止hover和focus状态导致的跳动 */
a, button, input, textarea {
    -webkit-transition: none !important;
    transition: none !important;
}

a:hover, button:hover, input:hover, textarea:hover,
a:focus, button:focus, input:focus, textarea:focus {
    -webkit-transform: none !important;
    transform: none !important;
}

/* 特别处理导航栏链接，移除可能导致跳动的效果 */
nav a {
    transition: color 0.2s ease !important;
    transform: none !important;
    will-change: auto !important;
}

nav a:hover, nav a:focus {
    transform: none !important;
    will-change: auto !important;
}

/* Hero section 按钮特殊处理 */
.hero-content a {
    transition: background-color 0.2s ease, border-color 0.2s ease !important;
    transform: none !important;
    will-change: auto !important;
}

.hero-content a:hover, .hero-content a:focus {
    transform: none !important;
    will-change: auto !important;
}

/* 简化的防跳动措施 */
nav {
    will-change: auto;
}

/* 防止transform导致的跳动 */
nav a:hover, .hero-content a:hover {
    transform: none;
}

/* 移动端视口元标签优化 */
@media screen and (max-width: 768px) {
    html, body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    body {
        /* 防止移动端滚动回弹 */
        overscroll-behavior: none;
        -webkit-overflow-scrolling: touch;
    }
}

/* 防止页面跳动 */
main {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
}

/* 确保Hero section完全填充视口 */
#home {
    width: 100%;
    height: 100vh;
    position: relative;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hero section 内容居中 */
.hero-content {
    position: relative;
    z-index: 20;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* 确保Hero内容垂直居中 */
#home {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 移动端视口优化 - 使用动态视口高度 */
@supports (height: 100dvh) {
    #home {
        height: 100dvh;
        min-height: 100dvh;
    }
}

/* iOS Safari 和其他移动浏览器 */
@supports (-webkit-touch-callout: none) {
    #home {
        height: 100vh;
        height: -webkit-fill-available;
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
}

/* 移动端特殊处理 */
@media screen and (max-width: 768px) {
    #home {
        height: 100vh;
        min-height: 100vh;
        /* 确保移动端有足够的高度 */
        min-height: calc(100vh - env(safe-area-inset-top));
    }
    
    .hero-content {
        min-height: 100vh;
        padding: 2rem 1rem;
    }
    
    /* iOS Safari */
    @supports (-webkit-touch-callout: none) {
        #home {
            height: -webkit-fill-available;
            min-height: -webkit-fill-available;
        }
        
        .hero-content {
            min-height: -webkit-fill-available;
        }
    }
    
    /* 现代浏览器动态视口 */
    @supports (height: 100dvh) {
        #home {
            height: 100dvh;
            min-height: 100dvh;
        }
        
        .hero-content {
            min-height: 100dvh;
        }
    }
}

/* Three.js canvas 固定 */
#hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 0;
    display: block;
}

/* 防止内容溢出导致的跳动 */
.overflow-hidden {
    overflow: hidden !important;
}

/* 优化section布局 */
section {
    display: block;
    position: relative;
    width: 100%;
}

/* 非Hero section的布局优化 */
section:not(#home) {
    position: relative;
    z-index: 10;
    padding-top: 5rem;
    padding-bottom: 5rem;
}

/* section之间的视觉分隔 */
section:not(#home):not(:last-child) {
    border-bottom: 1px solid rgba(59, 130, 246, 0.1);
}

/* 内容容器优化 */
section .max-w-7xl {
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    section .max-w-7xl {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    section .max-w-7xl {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* 导航栏固定优化 */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
}

/* 导航栏内容容器正常高度 */
nav .flex {
    height: 5rem; /* 80px = 5rem */
    min-height: 5rem;
}

/* 导航栏链接正常尺寸 */
nav a {
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

/* 基础盒模型设置 */
* {
    box-sizing: border-box;
}

/* 重置可能影响显示的样式 */
* {
    box-sizing: border-box;
}

/* 确保内容容器正常显示 */
.max-w-7xl {
    position: relative;
    z-index: 1;
}

/* 确保section可见性 */
section {
    opacity: 1;
    visibility: visible;
}

/* 自定义动画 */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

@keyframes float-delayed {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

@keyframes float-slow {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-10px) scale(1.05); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.3); }
    50% { box-shadow: 0 0 30px rgba(59, 130, 246, 0.6); }
}

@keyframes tech-pulse {
    0%, 100% { 
        opacity: 0.4;
        transform: scale(1);
    }
    50% { 
        opacity: 0.8;
        transform: scale(1.02);
    }
}

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

/* 浮动动画类 */
.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-float-delayed {
    animation: float-delayed 8s ease-in-out infinite;
}

.animate-float-slow {
    animation: float-slow 10s ease-in-out infinite;
}

/* 科技感背景网格 */
.tech-grid {
    background-image: 
        linear-gradient(rgba(59, 130, 246, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* 渐变文字效果 */
.gradient-text {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 卡片悬浮效果 - 仅限特定元素 */
.card-hover:not(body):not(html) {
    transition: all 0.3s ease;
}

.card-hover:not(body):not(html):hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* 防止body和html应用card-hover效果 */
body.card-hover, html.card-hover {
    transition: none !important;
    transform: none !important;
}

body.card-hover:hover, html.card-hover:hover {
    transition: none !important;
    transform: none !important;
}

/* 按钮发光效果 */
.btn-glow {
    position: relative;
    overflow: hidden;
}

.btn-glow::before {
    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.5s;
}

.btn-glow:hover::before {
    left: 100%;
}

/* 动画延迟类 */
.animation-delay-2000 {
    animation-delay: 2s;
}

.animation-delay-4000 {
    animation-delay: 4s;
}

/* 响应式表格 */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 14px;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 8px 12px;
    }
}

/* 加载动画 */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* 正常滚动设置 */
html {
    overflow-y: auto;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
}

/* 隐藏式滚动条样式 */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

/* Firefox 滚动条 */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.3) transparent;
}

/* 表单聚焦效果 */
.form-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 导航栏毛玻璃效果 */
.nav-blur {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* 图标旋转动画 */
.icon-spin {
    animation: spin 2s linear infinite;
}

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

/* 脉冲效果 */
.pulse-effect {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 移动端优化 */
@media (max-width: 640px) {
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .section-padding {
        padding: 60px 0;
    }
    
    /* Hero section 移动端内容调整 */
    #home .text-5xl {
        font-size: 2.5rem !important;
    }
    
    #home .md\\:text-7xl {
        font-size: 3rem !important;
    }
    
    #home .text-xl {
        font-size: 1rem !important;
    }
    
    #home .md\\:text-2xl {
        font-size: 1.25rem !important;
    }
    
    /* 移动端按钮调整 */
    #home .px-10 {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
    
    #home .py-4 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    /* 移动端间距调整 */
    #home .mb-12 {
        margin-bottom: 2rem !important;
    }
    
    #home .mb-8 {
        margin-bottom: 1.5rem !important;
    }
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: var(--darker-bg);
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .border-gray-700 {
        border-color: #4b5563;
    }
    
    .text-gray-400 {
        color: #9ca3af;
    }
}

/* 优化的AOS动画效果 */
[data-aos] {
    opacity: 0;
    transition-property: opacity, transform;
    transition-duration: 0.6s;
    transition-timing-function: ease-out-quart;
}

[data-aos].aos-animate {
    opacity: 1;
}

/* Hero content 渐入动画 */
.hero-content[data-aos] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.hero-content[data-aos].aos-animate {
    opacity: 1;
    transform: translateY(0);
}

/* 卡片动画优化 */
.group[data-aos] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.group[data-aos].aos-animate {
    opacity: 1;
    transform: translateY(0);
}

/* 自定义缓动函数 */
.aos-animate {
    transition-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 标题动画效果 */
h1[data-aos], h2[data-aos], h3[data-aos] {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

h1[data-aos].aos-animate, h2[data-aos].aos-animate, h3[data-aos].aos-animate {
    opacity: 1;
    transform: translateY(0);
}

/* 段落动画效果 */
p[data-aos] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out 0.2s, transform 0.6s ease-out 0.2s;
}

p[data-aos].aos-animate {
    opacity: 1;
    transform: translateY(0);
}

/* 渐进式卡片动画 */
.grid > *[data-aos] {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.grid > *[data-aos].aos-animate {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* 交错动画延迟 */
.grid > *[data-aos-delay="100"] { transition-delay: 0.1s; }
.grid > *[data-aos-delay="200"] { transition-delay: 0.2s; }
.grid > *[data-aos-delay="300"] { transition-delay: 0.3s; }
.grid > *[data-aos-delay="400"] { transition-delay: 0.4s; }

/* 滚动进度指示器 */
.scroll-progress {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(59, 130, 246, 0.2);
    z-index: 49;
}

.scroll-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 0.1s ease-out;
}

/* 页面加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1f2937, #111827);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-text {
    font-size: 1rem;
    color: #9ca3af;
    margin: 0;
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
    }
    
    .loading-spinner {
        animation: none;
        border: 3px solid #3b82f6;
    }
} 