/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 1. 设计变量 (Design Tokens) --- */
:root {
    /* 色板 */
    --color-dark-bg: #141838;       /* 深色面背景 */
    --color-paper: #FCFCFD;         /* 纸面背景 */
    --color-text: #151723;          /* 正文与标题 */
    --color-brand: #142CEB;         /* 品牌色（强调词、链接、图标） */
    --color-accent: #6EAFED;        /* 强调色（按钮、徽标、深色面强调） */
    
    /* 圆角 */
    --radius-card: 8px;
    --radius-btn: 6px;
    --radius-badge: 4px;

    /* 卡片风格：粗描边 + 硬阴影 */
    --card-border: 2px solid var(--color-text);
    --card-shadow: 4px 4px 0 var(--color-text);

    /* 间距与布局 */
    --section-y: clamp(2.5rem, 5vw, 4rem);
    --gap: clamp(0.75rem, 1.5vw, 1.25rem);
    --content-max: 960px;
    
    /* 排版 */
    --font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --line-height-tight: 1.25;
    --line-height-body: 1.55;
}

/* --- 2. 基础重置与全局样式 --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-paper);
    color: var(--color-text);
    line-height: var(--line-height-body);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img, svg {
    display: block;
    max-width: 100%;
}

a {
    color: var(--color-brand);
    text-decoration: none;
    transition: opacity 0.2s ease;
}
a:hover {
    opacity: 0.8;
}

/* 焦点样式 */
:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

/* --- 3. 容器与排版 --- */
.container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--gap);
}

.section {
    padding: var(--section-y) 0;
}

/* 眉标 (Eyebrow) */
.eyebrow {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: var(--gap);
    color: var(--color-brand);
}

.dark-surface .eyebrow {
    color: var(--color-accent);
}

/* 标题 */
h1, h2, h3, h4 {
    line-height: var(--line-height-tight);
    font-weight: 600;
    letter-spacing: 0;
    color: var(--color-text);
}

h1 {
    font-size: clamp(2rem, 4.6vw, 3.4rem);
    margin-bottom: var(--gap);
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    margin-bottom: var(--gap);
}

h3 {
    font-size: 1.25rem;
    margin-bottom: calc(var(--gap) / 2);
}

p {
    margin-bottom: var(--gap);
    max-width: 38em;
}

/* 高亮关键词 */
.hl {
    color: var(--color-brand);
}

.dark-surface .hl {
    color: var(--color-accent);
}

/* --- 4. 组件：按钮 --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    text-decoration: none;
    line-height: 1;
}

.btn:active {
    transform: translateY(2px);
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-dark-bg);
    border: none;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-text);
    border: 2px solid var(--color-text);
}

.dark-surface .btn-secondary {
    color: var(--color-paper);
    border-color: var(--color-paper);
}

/* --- 5. 组件：卡片 --- */
.card {
    background-color: var(--color-paper);
    border: var(--card-border);
    border-radius: var(--radius-card);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* --- 6. 组件：表格 --- */
.table-wrapper {
    overflow-x: auto;
    border: var(--card-border);
    border-radius: var(--radius-card);
    box-shadow: var(--card-shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

th {
    background-color: rgba(0,0,0,0.05);
    font-weight: 700;
}

tr:last-child td {
    border-bottom: none;
}

/* --- 7. 组件：FAQ --- */
details {
    border: var(--card-border);
    border-radius: var(--radius-card);
    margin-bottom: var(--gap);
    overflow: hidden;
}

summary {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    position: relative;
    background-color: rgba(0,0,0,0.02);
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: "+";
    position: absolute;
    right: 1.5rem;
    font-weight: 400;
    font-size: 1.2rem;
}

details[open] summary::after {
    content: "-";
}

details > div {
    padding: 1rem 1.5rem;
}

/* --- 8. 组件：页头与页脚 --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(252, 252, 253, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding: 0.75rem 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--color-text);
    text-decoration: none;
}

.brand-logo img {
    height: 32px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-links a.active {
    color: var(--color-brand);
    text-decoration: underline;
}

.site-footer {
    background-color: var(--color-dark-bg);
    color: var(--color-paper);
    padding: 3rem 0;
    margin-top: var(--section-y);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
    text-align: center;
}

.footer-nav {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-nav a {
    color: var(--color-accent);
}

/* --- 9. SVG 动效体系 --- */
/* 基础 SVG 样式 */
svg.anim-svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

/* 网格节点依次点亮动画 */
@keyframes gridPulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

.node {
    fill: var(--color-accent);
    animation: gridPulse 3s infinite ease-in-out;
}

/* 错开动画时间 */
.node-1 { animation-delay: 0.0s; }
.node-2 { animation-delay: 0.5s; }
.node-3 { animation-delay: 1.0s; }
.node-4 { animation-delay: 1.5s; }
.node-5 { animation-delay: 2.0s; }

/* 消息气泡浮入动画 */
@keyframes floatIn {
    0% { transform: translateY(20px); opacity: 0; }
    20% { transform: translateY(0); opacity: 1; }
    80% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(20px); opacity: 0; }
}

.bubble-anim {
    animation: floatIn 6s infinite ease-in-out;
}

.bubble-1 { animation-delay: 0s; }
.bubble-2 { animation-delay: 2s; }
.bubble-3 { animation-delay: 4s; }

/* 连接线流动动画 */
@keyframes dashFlow {
    to { stroke-dashoffset: -20; }
}

.flow-line {
    stroke-dasharray: 10 10;
    animation: dashFlow 1s linear infinite;
}

/* 呼吸灯效果 */
@keyframes breathe {
    0%, 100% { opacity: 0.3; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
}

.pulse-dot {
    animation: breathe 2s infinite ease-in-out;
    transform-box: fill-box;
    transform-origin: center;
}

/* 减少动态效果适配 */
@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;
    }
    .node, .bubble-anim, .flow-line, .pulse-dot {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* --- 10. 响应式调整 --- */
@media (max-width: 768px) {
    .nav-links {
        display: none; /* 简化处理，移动端隐藏导航或改为汉堡菜单（此处保持简单） */
    }
    
    .grid-2-col {
        grid-template-columns: 1fr;
    }
    
    .deep-dive-layout {
        display: block;
    }
    
    .deep-dive-sidebar {
        display: none;
    }
}

.grid-2-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: var(--gap);
}
