/* =========================================
   SafeW 全站共享样式 (Global Styles)
   ========================================= */

/* --- 1. 设计变量 (Design Tokens) --- */
:root {
    /* 色板 */
    --color-dark-bg: #10112D;
    --color-paper-bg: #F5F0E5;
    --color-text: #151523;
    --color-brand: #1416EB;
    --color-accent: #89ED6E;
    
    /* 结构变量 */
    --radius-card: 24px;
    --radius-btn: 999px;
    --card-border: 0;
    --card-shadow: 0 10px 28px -14px rgba(21, 21, 35, 0.3);
    --section-y: clamp(5rem, 10vw, 9rem);
    --gap: clamp(1.5rem, 3vw, 2.5rem);
    --content-max: 1280px;
    
    /* 排版与间距 */
    --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-title: "Inter", var(--font-body);
    --line-height-base: 1.75;
    --spacing-unit: 8px;
}

/* --- 2. 基础重置与排版 (Reset & Typography) --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-paper-bg);
    line-height: var(--line-height-base);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-title);
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.25;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

h1 {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    margin-bottom: calc(var(--spacing-unit) * 3);
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    margin-top: 0;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

p {
    margin-bottom: calc(var(--spacing-unit) * 2);
    max-width: 38em;
}

a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

ul, ol {
    list-style: none;
}

img, svg {
    display: block;
    max-width: 100%;
}

/* --- 3. 布局容器 (Layout) --- */
.container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
}

.section {
    padding-block: var(--section-y);
}

.section--dark {
    background-color: var(--color-dark-bg);
    color: var(--color-paper-bg);
}

.section--paper {
    background-color: var(--color-paper-bg);
    color: var(--color-text);
}

/* 面内取色覆盖逻辑 */
.section--dark .hl {
    color: var(--color-accent);
}

.section--paper .hl {
    color: var(--color-brand);
}

/* --- 4. 组件：按钮 (Buttons) --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 52px;
    padding: 0 32px;
    border-radius: var(--radius-btn);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    border: none;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

.btn--primary {
    background-color: var(--color-accent);
    color: var(--color-dark-bg);
}

.btn--primary:hover {
    filter: brightness(0.95);
    box-shadow: 0 8px 20px rgba(137, 237, 110, 0.3);
}

.btn--secondary {
    background-color: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-text);
}

.section--dark .btn--secondary {
    color: var(--color-paper-bg);
    border-color: var(--color-paper-bg);
}

.btn--secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* --- 5. 组件：卡片与面板 (Cards & Panels) --- */
.card {
    background-color: var(--color-paper-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--card-shadow);
    border: var(--card-border);
    padding: calc(var(--spacing-unit) * 3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.section--dark .card {
    background-color: #1A1B38;
    box-shadow: none;
    border: 1px solid rgba(245, 240, 229, 0.1);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px -12px rgba(21, 21, 35, 0.4);
}

.visual-panel {
    background-color: var(--color-dark-bg);
    border-radius: var(--radius-card);
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    position: relative;
    overflow: hidden;
}

.section--paper .visual-panel {
    background-color: #EAE5D9;
}

/* --- 6. 组件：眉标 (Badge) --- */
.badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: calc(var(--spacing-unit) * 2);
    color: var(--color-brand);
}

.section--dark .badge {
    color: var(--color-accent);
}

/* --- 7. 组件：FAQ (Details/Summary) --- */
.faq-list details {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: background-color 0.2s;
}

.faq-list details[open] {
    background-color: rgba(255, 255, 255, 0.08);
}

.faq-list summary {
    padding: 20px 24px;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-list summary::-webkit-details-marker {
    display: none;
}

.faq-list summary::after {
    content: '+';
    font-size: 1.2rem;
    font-weight: 400;
    opacity: 0.6;
}

.faq-list details[open] summary::after {
    content: '−';
}

.faq-list .answer {
    padding: 0 24px 24px 24px;
    font-size: 0.95rem;
    line-height: 1.7;
    opacity: 0.9;
}

/* --- 8. 组件：表格 (Table) --- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-card);
    border: 1px solid rgba(245, 240, 229, 0.15);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

th, td {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(245, 240, 229, 0.1);
}

th {
    background-color: rgba(0, 0, 0, 0.2);
    font-weight: 700;
    color: var(--color-accent);
    white-space: nowrap;
}

td {
    color: var(--color-paper-bg);
}

tr:last-child th, tr:last-child td {
    border-bottom: none;
}

/* --- 9. 页头与页脚 (Header & Footer) --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(245, 240, 229, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(21, 21, 35, 0.05);
    padding: 16px 0;
}

.section--dark .site-header {
    background-color: rgba(16, 17, 45, 0.9);
    border-bottom-color: rgba(245, 240, 229, 0.1);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--color-text);
}

.section--dark .brand-logo {
    color: var(--color-paper-bg);
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-links a {
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.nav-links a:hover, .nav-links a[aria-current="page"] {
    opacity: 1;
    color: var(--color-brand);
}

.section--dark .nav-links a:hover, .section--dark .nav-links a[aria-current="page"] {
    color: var(--color-accent);
}

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 16px;
    }
    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
}

.site-footer {
    background-color: var(--color-dark-bg);
    color: var(--color-paper-bg);
    padding: 48px 0;
    border-top: 1px solid rgba(245, 240, 229, 0.1);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
}

.footer-col h4 {
    color: var(--color-accent);
    font-size: 1rem;
    margin-bottom: 20px;
}

.footer-col ul li {
    margin-bottom: 12px;
}

.footer-col a {
    opacity: 0.7;
    font-size: 0.9rem;
}

.footer-col a:hover {
    opacity: 1;
    color: var(--color-accent);
}

/* --- 10. SVG 动效系统 (SVG Animations) --- */
/* 几何体旋转拼合：几块几何形状缓慢旋转、交错对齐 */
@keyframes rotate-slow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes rotate-reverse {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

@keyframes float-sync {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

@keyframes pulse-opacity {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.svg-geo-1 {
    animation: rotate-slow 16s linear infinite;
    transform-origin: center;
    transform-box: fill-box;
}

.svg-geo-2 {
    animation: rotate-reverse 20s linear infinite;
    transform-origin: center;
    transform-box: fill-box;
}

.svg-geo-3 {
    animation: float-sync 6s ease-in-out infinite;
}

.svg-pulse {
    animation: pulse-opacity 4s ease-in-out infinite;
}

/* 减少动态效果适配 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .svg-geo-1, .svg-geo-2, .svg-geo-3, .svg-pulse {
        animation: none;
    }
}

/* --- 11. 响应式微调 (Responsive Utilities) --- */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    .hero-layout {
        flex-direction: column-reverse;
    }
    .feature-row {
        flex-direction: column;
    }
    .feature-row.reverse {
        flex-direction: column;
    }
    .visual-panel {
        min-height: 240px;
    }
}
