/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量与重置 --- */
:root {
    /* 色板 */
    --color-dark-surface: #17203F;
    --color-paper: #FCFCFD;
    --color-text: #151823;
    --color-brand: #1441EB;
    --color-accent: #6EEDBD;
    
    /* 辅助色 */
    --color-text-muted: rgba(21, 24, 35, 0.6);
    --color-border-light: rgba(21, 24, 35, 0.08);
    --color-border-dark: rgba(252, 252, 253, 0.1);
    
    /* 组件样式 */
    --radius-card: 8px;
    --radius-btn: 6px;
    --card-border: 1px solid var(--color-border-light);
    --card-shadow: none;
    
    /* 间距与布局 */
    --section-y: clamp(3.5rem, 7vw, 6rem);
    --gap: clamp(1rem, 2vw, 1.75rem);
    --content-max: 1280px;
    
    /* 字体 */
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    color: var(--color-text);
    background-color: var(--color-paper);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img, svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

/* --- 排版系统 --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0;
    color: var(--color-text);
}

.dark-surface h1, .dark-surface h2, .dark-surface h3 {
    color: var(--color-paper);
}

.highlight {
    color: var(--color-brand);
}

.dark-surface .highlight {
    color: var(--color-accent);
}

.section-title {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    margin-bottom: var(--gap);
    position: relative;
    padding-top: 2rem;
}

.section-title::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background-color: var(--color-brand);
    border-radius: 2px;
}

.dark-surface .section-title::before {
    background-color: var(--color-accent);
}

.label-tag {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-brand);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.dark-surface .label-tag {
    color: var(--color-accent);
}

.container {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--gap);
}

/* --- 通用区块 --- */
section {
    padding: var(--section-y) 0;
    position: relative;
}

.bg-paper {
    background-color: var(--color-paper);
}

.bg-dark {
    background-color: var(--color-dark-surface);
    color: var(--color-paper);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr));
    gap: var(--gap);
    align-items: center;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: var(--gap);
}

.card {
    background: var(--color-paper);
    border: var(--card-border);
    border-radius: var(--radius-card);
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dark-surface .card {
    background: rgba(252, 252, 253, 0.05);
    border-color: var(--color-border-dark);
}

.card:hover {
    transform: translateY(-2px);
}

/* --- 按钮 --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 24px;
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    gap: 8px;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-dark-surface);
}

.btn-primary:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

.btn-primary:focus-visible {
    outline: 2px solid var(--color-paper);
    outline-offset: 2px;
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-text);
    border-color: var(--color-text);
}

.dark-surface .btn-secondary {
    color: var(--color-paper);
    border-color: var(--color-paper);
}

.btn-secondary:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

/* --- 导航栏 --- */
header.nav-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(252, 252, 253, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border-light);
    padding: 1rem 0;
}

.dark-surface header.nav-header {
    background-color: rgba(23, 32, 63, 0.9);
    border-bottom-color: var(--color-border-dark);
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--color-brand);
}

.dark-surface .brand-logo {
    color: var(--color-paper);
}

.brand-logo img {
    height: 32px;
    width: auto;
}

nav ul {
    display: flex;
    gap: 2rem;
    align-items: center;
}

nav a {
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

nav a:hover, nav a[aria-current="page"] {
    color: var(--color-brand);
}

.dark-surface nav a:hover, .dark-surface nav a[aria-current="page"] {
    color: var(--color-accent);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text);
}

/* --- 表格 --- */
table.spec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.spec-table th, .spec-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

.dark-surface .spec-table th, .dark-surface .spec-table td {
    border-bottom-color: var(--color-border-dark);
}

.spec-table th {
    font-weight: 600;
    color: var(--color-brand);
}

.dark-surface .spec-table th {
    color: var(--color-accent);
}

/* --- FAQ --- */
details.faq-item {
    border-bottom: 1px solid var(--color-border-light);
    padding: 1rem 0;
}

.dark-surface details.faq-item {
    border-bottom-color: var(--color-border-dark);
}

summary {
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: "+";
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--color-brand);
}

.dark-surface summary::after {
    color: var(--color-accent);
}

details[open] summary::after {
    content: "-";
}

.faq-answer {
    margin-top: 1rem;
    color: var(--color-text-muted);
    line-height: 1.7;
}

.dark-surface .faq-answer {
    color: rgba(252, 252, 253, 0.8);
}

/* --- 标签页 (核心功能) --- */
.tab-nav {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--color-border-light);
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 4px;
}

.dark-surface .tab-nav {
    border-bottom-color: var(--color-border-dark);
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color 0.2s;
}

.tab-btn[aria-selected="true"] {
    color: var(--color-brand);
    font-weight: 600;
}

.dark-surface .tab-btn[aria-selected="true"] {
    color: var(--color-accent);
}

.tab-btn[aria-selected="true"]::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--color-brand);
}

.dark-surface .tab-btn[aria-selected="true"]::after {
    background-color: var(--color-accent);
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

/* --- 流程图 (功能协同) --- */
.flow-chart {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
}

.flow-node {
    flex: 1;
    min-width: 200px;
    text-align: center;
    padding: 1.5rem;
    background: var(--color-paper);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-card);
    position: relative;
}

.dark-surface .flow-node {
    background: rgba(252, 252, 253, 0.05);
    border-color: var(--color-border-dark);
}

.flow-arrow {
    flex: 0 0 40px;
    height: 2px;
    background-color: var(--color-brand);
    position: relative;
}

.dark-surface .flow-arrow {
    background-color: var(--color-accent);
}

.flow-arrow::after {
    content: "";
    position: absolute;
    right: 0;
    top: -4px;
    width: 8px;
    height: 8px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
    color: inherit;
}

/* --- 动画类 --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse-grid {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.float-anim {
    animation: float 6s ease-in-out infinite;
}

.pulse-node {
    animation: pulse-grid 3s ease-in-out infinite;
    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;
    }
}

/* --- 响应式 --- */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    nav ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--color-paper);
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    
    nav ul.show {
        display: flex;
    }
    
    .flow-chart {
        flex-direction: column;
    }
    
    .flow-arrow {
        width: 2px;
        height: 30px;
        background-color: var(--color-brand);
    }
    
    .flow-arrow::after {
        right: -4px;
        top: auto;
        bottom: -4px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
    }
}
