/* =========================================
   SafeW 全局设计系统与组件样式
   ========================================= */

/* --- 1. 设计 Token (CSS 自定义属性) --- */
:root {
    /* 色彩体系 */
    --color-dark: #13102D;
    --color-paper: #D6D4ED;
    --color-text: #171523;
    --color-brand: #2714EB;
    --color-accent: #89ED6E;
    
    /* 组件尺寸与几何 */
    --radius-card: 24px;
    --radius-btn: 999px;
    --card-border: 0;
    --card-shadow: 0 10px 28px -14px rgba(23, 21, 35, 0.3);
    --content-max: 1120px;
    
    /* 间距与排版 */
    --section-y: clamp(2.5rem, 5vw, 4rem);
    --gap: clamp(0.75rem, 1.5vw, 1.25rem);
    --body-line-height: 1.55;
    
    /* 字体 */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- 2. 基础重置与排版 --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-paper);
    color: var(--color-text);
    line-height: var(--body-line-height);
    font-size: 16px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

ul, ol {
    list-style: none;
}

/* --- 3. 通用布局容器 --- */
.container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--gap);
}

.section-divider {
    width: 100%;
    height: 1px;
    background-color: rgba(23, 21, 35, 0.15);
    border: none;
}

/* --- 4. 页头与页脚 --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(214, 212, 237, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(23, 21, 35, 0.08);
    padding: 16px 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo img {
    height: 32px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: var(--gap);
    align-items: center;
}

.nav-link {
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.nav-link:hover, .nav-link[aria-current="page"] {
    background-color: rgba(23, 21, 35, 0.06);
    color: var(--color-brand);
}

.site-footer {
    background-color: var(--color-dark);
    color: var(--color-paper);
    padding: 64px 0 32px;
    margin-top: var(--section-y);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.footer-nav a {
    color: var(--color-paper);
    opacity: 0.8;
    font-size: 0.9rem;
}

.footer-nav a:hover {
    opacity: 1;
    color: var(--color-accent);
}

.copyright {
    font-size: 0.85rem;
    opacity: 0.6;
    border-top: 1px solid rgba(214, 212, 237, 0.1);
    padding-top: 24px;
    text-align: center;
}

/* --- 5. 按钮组件 --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-weight: 600;
    font-size: 1rem;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    border: none;
    text-decoration: none;
}

.btn:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(137, 237, 110, 0.3);
}

.btn-secondary {
    background-color: transparent;
    border: 2px solid var(--color-text);
    color: var(--color-text);
}

.btn-secondary:hover {
    background-color: rgba(23, 21, 35, 0.05);
    transform: translateY(-1px);
}

/* 深色面上的按钮变体 */
.dark-surface .btn-secondary {
    border-color: var(--color-paper);
    color: var(--color-paper);
}
.dark-surface .btn-secondary:hover {
    background-color: rgba(214, 212, 237, 0.1);
}

/* --- 6. 卡片与面板 --- */
.card {
    background-color: #FFFFFF;
    border-radius: var(--radius-card);
    border: var(--card-border);
    box-shadow: var(--card-shadow);
    padding: 32px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px -12px rgba(23, 21, 35, 0.35);
}

.panel {
    background-color: var(--color-dark);
    border-radius: var(--radius-card);
    padding: 32px;
    position: relative;
    overflow: hidden;
}

/* --- 7. 排版细节 --- */
.section-label {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.paper-surface .section-label {
    color: var(--color-brand);
}

.dark-surface .section-label {
    color: var(--color-accent);
}

h1 {
    font-size: clamp(2.6rem, 6.4vw, 5rem);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 500;
    line-height: 1.25;
    margin-bottom: 24px;
    margin-top: 48px;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 16px;
    margin-top: 32px;
}

p {
    margin-bottom: 16px;
    max-width: 38em;
}

.hl {
    color: var(--color-brand);
}

.dark-surface .hl {
    color: var(--color-accent);
}

.text-large {
    font-size: 1.125rem;
    line-height: 1.6;
}

/* --- 8. 表格样式 --- */
.table-wrapper {
    overflow-x: auto;
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(23, 21, 35, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

th, td {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(23, 21, 35, 0.08);
}

th {
    background-color: rgba(23, 21, 35, 0.04);
    font-weight: 600;
    width: 30%;
}

tr:last-child td {
    border-bottom: none;
}

/* --- 9. FAQ 样式 --- */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.faq-item {
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    border: 1px solid rgba(23, 21, 35, 0.06);
    overflow: hidden;
}

.faq-summary {
    padding: 20px 24px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.faq-summary::-webkit-details-marker {
    display: none;
}

.faq-summary::after {
    content: "+";
    font-size: 1.2rem;
    color: var(--color-brand);
    transition: transform 0.2s ease;
}

.faq-item[open] .faq-summary::after {
    transform: rotate(45deg);
}

.faq-summary:hover {
    background-color: rgba(23, 21, 35, 0.03);
}

.faq-answer {
    padding: 0 24px 24px;
    color: var(--color-text);
    opacity: 0.9;
}

/* --- 10. SVG 动效 Keyframes --- */
@keyframes float-up-down {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes float-delayed {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes dash-flow {
    to { stroke-dashoffset: -24; }
}

@keyframes bubble-pop {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.05); opacity: 1; }
}

/* --- 11. 响应式适配 --- */
@media (max-width: 768px) {
    h1 {
        font-size: clamp(2.2rem, 8vw, 3.5rem);
    }
    
    .header-inner {
        flex-direction: row;
    }
    
    .nav-links {
        display: none; /* 简化处理，实际项目可加汉堡菜单 */
    }
    
    .panel-grid {
        grid-template-columns: 1fr !important;
    }
    
    .flex-row {
        flex-direction: column;
    }
    
    .flex-row > * {
        width: 100% !important;
        margin-bottom: var(--gap);
    }
}

/* 减少动态效果支持 */
@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;
    }
}
