/**
 * Global CSS - Design System & Common Styles
 * Purpose: Design Tokens + Base Styles + Universal Components
 */

/* ========== 1. CSS Reset ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background: #fff;
    overflow-x: hidden;
}

/* ========== 2. Design Tokens - Color System ========== */
:root {
    --brand-primary: #1EB7E6;
    --brand-secondary: #004E89;
    --brand-accent: #ffc107;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --bg-dark: #2c3e50;
    --border-color: #e0e0e0;
    --success: #28a745;
    --error: #dc3545;
}

/* ========== 3. Typography System ========== */
h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.2; margin-bottom: 1.5rem; color: var(--text-primary); }
h2 { font-size: 2rem; font-weight: 700; line-height: 1.3; margin-bottom: 1.25rem; color: var(--text-primary); }
h3 { font-size: 1.75rem; font-weight: 600; line-height: 1.3; margin-bottom: 1rem; color: var(--text-primary); }
h4 { font-size: 1.5rem; font-weight: 600; line-height: 1.4; margin-bottom: 0.875rem; color: var(--text-primary); }
h5 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; margin-bottom: 0.75rem; color: var(--text-primary); }
h6 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; margin-bottom: 0.5rem; color: var(--text-primary); }
p { font-size: 1rem; line-height: 1.6; margin-bottom: 1rem; color: var(--text-secondary); }
.lead { font-size: 1.125rem; font-weight: 300; line-height: 1.7; color: var(--text-secondary); }

/* ========== 4. Spacing Utilities ========== */
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}
.section-padding { padding: 4rem 0; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mb-4 { margin-bottom: 2rem !important; }
.mb-5 { margin-bottom: 3rem !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mt-4 { margin-top: 2rem !important; }
.mt-5 { margin-top: 3rem !important; }

/* ========== 5. Layout Utilities ========== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.d-flex { display: flex; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }

/* ========== 6. Common Components ========== */
/* Buttons - 全站通用按钮 */
.btn {
    display: inline-block;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    min-width: 48px;
    min-height: 48px;
}
.btn-primary {
    background-color: var(--brand-primary);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--brand-secondary);
    color: #fff;
    text-decoration: none;
}
.btn-secondary {
    background-color: var(--brand-secondary);
    color: #fff;
}
.btn-secondary:hover {
    background-color: var(--brand-primary);
    color: #fff;
    text-decoration: none;
}
.btn-accent {
    background-color: var(--brand-accent);
    color: #333;
}
.btn-accent:hover {
    background-color: #e6a800;
    color: #333;
    text-decoration: none;
}

/* Cards - 基础卡片样式 */
.card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* ========== 7. Responsive Container ========== */
@media (min-width: 576px) { .container { max-width: 540px; } }
@media (min-width: 768px) { .container { max-width: 720px; } }
@media (min-width: 992px) { .container { max-width: 960px; } }
@media (min-width: 1200px) { .container { max-width: 1140px; } }

/* ========== 8. Accessibility ========== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 12px;
    text-decoration: none;
    z-index: 10000;
}
.skip-link:focus { top: 0; }

/* ========== 9. Images ========== */
img, .img-fluid {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========== 10. Links ========== */
a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}
a:hover {
    color: var(--brand-secondary);
    text-decoration: underline;
}

/* ========== 11. Scroll Animations ========== */
/* 初始状态 — 元素不可见，等待滚动触发 */
.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.from-left {
    transform: translateX(-40px);
}
.reveal.from-right {
    transform: translateX(40px);
}
.reveal.from-scale {
    transform: scale(0.92);
}

/* 触发后 — 元素可见 */
.reveal.visible {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* 子元素交错动画 — 同一容器内卡片依次出现 */
.reveal-stagger > * {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1), transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0s; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.08s; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.16s; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.24s; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.32s; }
.reveal-stagger.visible > *:nth-child(6) { transition-delay: 0.4s; }
.reveal-stagger.visible > *:nth-child(7) { transition-delay: 0.48s; }
.reveal-stagger.visible > *:nth-child(8) { transition-delay: 0.56s; }
.reveal-stagger.visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* 数字计数动画的闪烁防止 */
[data-count-to] {
    font-variant-numeric: tabular-nums;
}

/* 减少动画偏好 — 尊重用户系统设置 */
@media (prefers-reduced-motion: reduce) {
    .reveal, .reveal-stagger > * {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* Bootstrap Icons font fix - prevent global font-family from overriding icons */
.bi::before,
[class^="bi-"]::before,
[class*=" bi-"]::before {
  font-family: "bootstrap-icons" !important;
}
