/* ========================================
   Nature 2025 妊娠丢失研究 - 苹果风格网页
   ======================================== */

/* 基础变量 */
:root {
    --color-bg-dark: #0a0a1a;
    --color-bg-primary: #1a1a2e;
    --color-bg-secondary: #16213e;
    --color-bg-tertiary: #0f3460;
    --color-accent-cyan: #00d9ff;
    --color-accent-blue: #3b82f6;
    --color-accent-purple: #8b5cf6;
    --color-accent-pink: #ec4899;
    --color-text-primary: #ffffff;
    --color-text-secondary: #a1a1aa;
    --color-text-muted: #71717a;
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* 重置样式 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--color-bg-dark);
    color: var(--color-text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

::-webkit-scrollbar-track {
    background: var(--color-bg-primary);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--color-accent-cyan), var(--color-accent-purple));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--color-accent-blue), var(--color-accent-pink));
}

/* 选择文本样式 */
::selection {
    background: rgba(0, 217, 255, 0.3);
    color: var(--color-text-primary);
}

/* ========================================
   导航栏样式
   ======================================== */
#navbar {
    background: transparent;
    backdrop-filter: blur(0px);
    transition: all 0.5s var(--transition-smooth);
}

#navbar.scrolled {
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-link {
    position: relative;
    padding: 0.5rem 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--color-accent-cyan), var(--color-accent-blue));
    transition: width 0.3s var(--transition-smooth);
}

.nav-link:hover::after {
    width: 100%;
}

/* 移动端菜单 */
#mobile-menu {
    transition: all 0.3s var(--transition-smooth);
}

/* ========================================
   Hero区块样式
   ======================================== */
#hero {
    position: relative;
}

.hero-badge {
    animation: fadeInUp 0.8s var(--transition-smooth) forwards;
}

.hero-title {
    letter-spacing: -0.02em;
}

.hero-stats {
    perspective: 1000px;
}

.stat-card {
    transform-style: preserve-3d;
    transition: all 0.5s var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-8px) rotateX(5deg);
    box-shadow: 0 20px 40px rgba(0, 217, 255, 0.15);
    border-color: rgba(0, 217, 255, 0.3);
}

.stat-number {
    font-variant-numeric: tabular-nums;
}

/* 粒子动画 */
.particles-container {
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(0, 217, 255, 0.5);
    border-radius: 50%;
    animation: float 15s infinite ease-in-out;
}

.particle:nth-child(1) {
    left: 10%;
    top: 20%;
    animation-delay: 0s;
    animation-duration: 12s;
}

.particle:nth-child(2) {
    left: 30%;
    top: 60%;
    animation-delay: 2s;
    animation-duration: 18s;
    background: rgba(139, 92, 246, 0.5);
}

.particle:nth-child(3) {
    left: 50%;
    top: 30%;
    animation-delay: 4s;
    animation-duration: 15s;
    background: rgba(236, 72, 153, 0.5);
}

.particle:nth-child(4) {
    left: 70%;
    top: 70%;
    animation-delay: 6s;
    animation-duration: 20s;
    background: rgba(59, 130, 246, 0.5);
}

.particle:nth-child(5) {
    left: 90%;
    top: 40%;
    animation-delay: 8s;
    animation-duration: 14s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0.5;
    }
    25% {
        transform: translateY(-30px) translateX(10px) scale(1.2);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-20px) translateX(-10px) scale(0.8);
        opacity: 0.3;
    }
    75% {
        transform: translateY(-40px) translateX(5px) scale(1.1);
        opacity: 0.6;
    }
}

/* 滚动提示动画 */
.animate-scroll {
    animation: scrollDown 2s infinite ease-in-out;
}

@keyframes scrollDown {
    0%, 100% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateY(8px);
        opacity: 0.5;
    }
}

/* ========================================
   区块通用样式
   ======================================== */
section {
    position: relative;
}

.finding-card {
    position: relative;
}

.finding-number {
    font-family: 'Inter', sans-serif;
    user-select: none;
    pointer-events: none;
}

/* 图片容器样式 */
.finding-image img,
.section-image img {
    transition: transform 0.7s var(--transition-smooth);
}

.finding-image:hover img,
.section-image:hover img {
    transform: scale(1.02);
}

/* ========================================
   卡片样式
   ======================================== */
.significance-card {
    position: relative;
    overflow: hidden;
}

.significance-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.5s var(--transition-smooth);
}

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

/* ========================================
   模态框样式
   ======================================== */
.modal {
    opacity: 0;
    transition: opacity 0.3s var(--transition-smooth);
}

.modal.active {
    opacity: 1;
}

.modal img {
    animation: zoomIn 0.3s var(--transition-smooth);
}

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

/* ========================================
   动画类
   ======================================== */
[data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s var(--transition-smooth);
}

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

[data-animate="fade-right"] {
    transform: translateX(-50px);
}

[data-animate="fade-right"].animated {
    transform: translateX(0);
}

[data-animate="fade-left"] {
    transform: translateX(50px);
}

[data-animate="fade-left"].animated {
    transform: translateX(0);
}

[data-animate="fade-up"] {
    transform: translateY(30px);
}

[data-animate="fade-up"].animated {
    transform: translateY(0);
}

/* 延迟动画 */
[data-delay="100"] { transition-delay: 100ms; }
[data-delay="200"] { transition-delay: 200ms; }
[data-delay="300"] { transition-delay: 300ms; }
[data-delay="400"] { transition-delay: 400ms; }
[data-delay="500"] { transition-delay: 500ms; }
[data-delay="600"] { transition-delay: 600ms; }
[data-delay="700"] { transition-delay: 700ms; }
[data-delay="800"] { transition-delay: 800ms; }

/* 初始可见状态 */
.hero-badge,
.hero-title,
.hero-subtitle,
.hero-stats,
.hero-cta {
    opacity: 0;
}

.hero-badge.animated,
.hero-title.animated,
.hero-subtitle.animated,
.hero-stats.animated,
.hero-cta.animated {
    opacity: 1;
}

/* ========================================
   关键帧动画
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.animate-pulse {
    animation: pulse 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.animate-bounce {
    animation: bounce 2s infinite;
}

/* ========================================
   渐变背景
   ======================================== */
.bg-gradient-radial {
    background: radial-gradient(ellipse at center, var(--tw-gradient-from), var(--tw-gradient-to));
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1024px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .finding-number {
        font-size: 5rem;
    }
    
    section {
        padding-top: 4rem;
        padding-bottom: 4rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 0.875rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

/* ========================================
   打印样式
   ======================================== */
@media print {
    #navbar,
    .particles-container,
    .modal {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    section {
        page-break-inside: avoid;
    }
}

/* ========================================
   无障碍支持
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .particle {
        display: none;
    }
}

/* 焦点样式 */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-accent-cyan);
    outline-offset: 2px;
}

/* ========================================
   工具类
   ======================================== */
.text-gradient {
    background: linear-gradient(135deg, var(--color-accent-cyan), var(--color-accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hover-lift {
    transition: transform 0.3s var(--transition-smooth), box-shadow 0.3s var(--transition-smooth);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

/* 加载状态 */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}
