/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 1. 设计变量 (Design Tokens) --- */
:root {
    /* 颜色系统 */
    --color-dark: #1B1231;      /* 深色面 */
    --color-paper: #F4F3F7;     /* 纸面 */
    --color-text: #191523;      /* 正文色 */
    --color-brand: #5214EB;     /* 品牌色 */
    --color-accent: #9977EE;    /* 强调色 */
    
    /* 派生颜色 (用于卡片背景等，保持低对比度层次) */
    --color-card-bg: #E6E4EE;   /* 纸面上的卡片底色 (略深) */
    --color-card-bg-dark: #2A1F4A; /* 深色面上的卡片底色 (略浅/透明化) */
    --color-border: rgba(82, 20, 235, 0.15); /* 极淡的品牌色边框 */

    /* 尺寸与间距 */
    --radius-card: 24px;
    --radius-btn: 999px;
    --content-max: 960px;
    --section-y: clamp(2.5rem, 5vw, 4rem);
    --gap: clamp(0.75rem, 1.5vw, 1.25rem);
    
    /* 排版 */
    --font-main: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
    --line-height: 1.55;
    
    /* 状态 */
    --focus-ring: 2px solid var(--color-accent);
}

/* --- 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-main);
    font-size: 16px;
    line-height: var(--line-height);
    color: var(--color-text);
    background-color: var(--color-paper);
    overflow-x: hidden;
}

/* 容器 */
.container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--gap);
}

/* 链接 */
a {
    color: var(--color-brand);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.8;
}

a:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
    border-radius: 4px;
}

/* 标题 */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0;
    color: inherit;
}

h1 {
    font-size: clamp(2rem, 4.6vw, 3.4rem);
    margin-bottom: var(--gap);
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    margin-bottom: calc(var(--gap) * 1.5);
}

h3 {
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    margin-bottom: var(--gap);
}

/* 眉标 (Section Label) */
.section-label {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--gap);
    color: var(--color-brand);
}

.dark-surface .section-label {
    color: var(--color-accent);
}

/* 高亮词 */
.hl {
    color: var(--color-brand);
}

.dark-surface .hl {
    color: var(--color-accent);
}

/* --- 3. 通用组件 --- */

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 24px;
    border-radius: var(--radius-btn);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    border: none;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-dark);
}

.btn-primary:hover {
    background-color: #8A66DF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(153, 119, 238, 0.3);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-text);
    border: 1px solid currentColor;
}

.dark-surface .btn-secondary {
    color: var(--color-paper);
    border-color: var(--color-paper);
}

.btn-secondary:hover {
    background-color: rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

.dark-surface .btn-secondary:hover {
    background-color: rgba(255,255,255,0.1);
}

/* 图标按钮内部 SVG */
.btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* 卡片 */
.card {
    background-color: var(--color-card-bg);
    border-radius: var(--radius-card);
    padding: calc(var(--gap) * 1.5);
    border: var(--card-border); /* 0 */
    box-shadow: var(--card-shadow); /* none */
    transition: transform 0.3s ease;
}

.dark-surface .card {
    background-color: var(--color-card-bg-dark);
    border-color: rgba(255,255,255,0.05);
}

.card:hover {
    transform: translateY(-4px);
}

/* 表格 */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-card);
    background-color: var(--color-card-bg);
    padding: var(--gap);
}

.dark-surface .table-wrapper {
    background-color: var(--color-card-bg-dark);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th, td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}

th {
    font-weight: 600;
    color: var(--color-brand);
}

.dark-surface th {
    color: var(--color-accent);
}

tr:last-child td {
    border-bottom: none;
}

/* FAQ Details */
details {
    background-color: var(--color-card-bg);
    border-radius: var(--radius-card);
    margin-bottom: var(--gap);
    padding: var(--gap);
    transition: background-color 0.2s;
}

.dark-surface details {
    background-color: var(--color-card-bg-dark);
}

summary {
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    position: relative;
    padding-right: 24px;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: "+";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    color: var(--color-brand);
    transition: transform 0.2s;
}

.dark-surface summary::after {
    color: var(--color-accent);
}

details[open] summary::after {
    content: "−";
    transform: translateY(-50%) rotate(180deg);
}

details p {
    margin-top: var(--gap);
    color: var(--color-text);
    opacity: 0.9;
}

.dark-surface details p {
    color: var(--color-paper);
}

/* --- 4. 页头与页脚 --- */

header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(244, 243, 247, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 0;
}

.dark-surface header {
    background-color: rgba(27, 18, 49, 0.9);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--color-text);
}

.dark-surface .logo {
    color: var(--color-paper);
}

.logo img {
    height: 32px;
    width: auto;
}

nav {
    display: flex;
    gap: 24px;
    align-items: center;
}

nav a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
}

.dark-surface nav a {
    color: var(--color-paper);
}

nav a[aria-current="page"] {
    color: var(--color-brand);
    font-weight: 700;
}

.dark-surface nav a[aria-current="page"] {
    color: var(--color-accent);
}

footer {
    background-color: var(--color-dark);
    color: var(--color-paper);
    padding: 64px 0 32px;
    margin-top: var(--section-y);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 48px;
    margin-bottom: 48px;
}

.footer-col h4 {
    color: var(--color-accent);
    margin-bottom: 16px;
    font-size: 1rem;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 8px;
}

.footer-col a {
    color: var(--color-paper);
    opacity: 0.7;
    font-size: 0.9rem;
}

.footer-col a:hover {
    opacity: 1;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 32px;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.6;
}

/* --- 5. SVG 动效 --- */

/* 星点明灭 */
@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.star {
    animation: twinkle 4s infinite ease-in-out;
}

.star:nth-child(odd) {
    animation-delay: 1s;
    animation-duration: 5s;
}

.star:nth-child(even) {
    animation-delay: 2.5s;
    animation-duration: 3.5s;
}

/* 连线绘制 */
@keyframes drawLine {
    0% { stroke-dashoffset: 1; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 1; }
}

.line-draw {
    stroke-dasharray: 1;
    animation: drawLine 6s infinite linear;
}

/* 气泡浮动 */
@keyframes floatBubble {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.bubble-float {
    animation: floatBubble 4s infinite ease-in-out;
}

.bubble-float-delayed {
    animation: floatBubble 4s infinite ease-in-out;
    animation-delay: 2s;
}

/* 呼吸灯 */
@keyframes breathe {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.breathe {
    animation: breathe 3s infinite ease-in-out;
}

/* 减少动态效果 */
@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;
    }
}

/* --- 6. 响应式调整 --- */

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 16px;
    }
    
    nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }
    
    .hero-layout {
        flex-direction: column-reverse;
    }
    
    .hero-svg-container {
        width: 100%;
        height: auto;
        margin-bottom: 32px;
    }
}
