/* SafeW 全站共享样式 */
:root {
    /* 色板 */
    --color-dark: #251943;
    --color-paper: #DBD4ED;
    --color-text: #191523;
    --color-brand: #5214EB;
    --color-accent: #ED6E89;

    /* 组件变量 */
    --radius-card: 0;
    --radius-btn: 0;
    --card-border: 1px solid rgba(25, 21, 35, 0.16);
    --card-shadow: none;

    /* 间距与布局 */
    --section-y: clamp(5rem, 10vw, 9rem);
    --gap: clamp(1.5rem, 3vw, 2.5rem);
    --content-max: 1280px;

    /* 字体 */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* 基础重置 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    line-height: 1.75;
    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;
}

/* 通用容器 */
.container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--gap);
}

/* 区块通用 */
.section {
    padding-top: var(--section-y);
    padding-bottom: var(--section-y);
}

.section--dark {
    background-color: var(--color-dark);
    color: var(--color-paper);
}

.section--paper {
    background-color: var(--color-paper);
    color: var(--color-text);
}

/* 标题系统 */
.section-header {
    margin-bottom: calc(var(--gap) * 2);
}

.badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.paper .badge {
    color: var(--color-brand);
}

.dark .badge {
    color: var(--color-accent);
}

h1 {
    font-size: clamp(2.4rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    max-width: 38em;
}

.hl {
    color: var(--color-brand);
}

.dark .hl {
    color: var(--color-accent);
}

/* 按钮系统 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 48px;
    padding: 0 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.btn--primary {
    background-color: var(--color-accent);
    color: var(--color-dark);
    border: 2px solid var(--color-accent);
}

.btn--primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.btn--secondary {
    background-color: transparent;
    color: var(--color-text);
    border: 2px solid var(--color-text);
}

.dark .btn--secondary {
    color: var(--color-paper);
    border-color: var(--color-paper);
}

.btn--secondary:hover {
    background-color: rgba(25, 21, 35, 0.05);
    transform: translateY(-2px);
}

.dark .btn--secondary:hover {
    background-color: rgba(219, 212, 237, 0.1);
}

/* 页头 */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--color-paper);
    border-bottom: 1px solid rgba(25, 21, 35, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.header--dark {
    background-color: var(--color-dark);
    border-bottom-color: rgba(219, 212, 237, 0.1);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.2rem;
}

.brand img {
    height: 32px;
    width: auto;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav a {
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.nav a:hover, .nav a[aria-current="page"] {
    opacity: 1;
}

.dark .nav a {
    color: var(--color-paper);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text);
}

/* 卡片系统 */
.card {
    background-color: #ffffff;
    border: var(--card-border);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    border-radius: var(--radius-card);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.paper .card {
    background-color: #ffffff;
    color: var(--color-text);
}

.dark .card {
    background-color: var(--color-paper);
    color: var(--color-text);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* 网格系统 */
.grid {
    display: grid;
    gap: var(--gap);
}

.grid--2 {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
}

.grid--3 {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

/* 表格 */
.table-wrapper {
    overflow-x: auto;
    border: var(--card-border);
    border-radius: var(--radius-card);
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

th {
    font-weight: 700;
    background-color: rgba(25, 21, 35, 0.03);
}

tr:last-child th, tr:last-child td {
    border-bottom: none;
}

/* FAQ */
.faq-item {
    border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.faq-item summary {
    padding: 1.5rem 0;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    position: relative;
    padding-right: 2rem;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    font-weight: 400;
}

.faq-item[open] summary::after {
    content: "-";
}

.faq-item p {
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

/* 页脚 */
.footer {
    background-color: var(--color-dark);
    color: var(--color-paper);
    padding: 4rem 0;
    border-top: 1px solid rgba(219, 212, 237, 0.1);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-col h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--color-paper);
}

.footer-col ul li {
    margin-bottom: 0.5rem;
}

.footer-col a {
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: 0.9rem;
}

.footer-col a:hover {
    opacity: 1;
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid rgba(219, 212, 237, 0.1);
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.6;
}

/* SVG 动效 */
.svg-container {
    width: 100%;
    height: auto;
    overflow: hidden;
}

.draw-line {
    pathLength: 1;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: drawLine 4s ease-in-out infinite alternate;
}

.bubble-float {
    animation: floatBubble 6s ease-in-out infinite alternate;
}

.input-blink {
    animation: blinkInput 2s step-end infinite;
}

@keyframes drawLine {
    0% { stroke-dashoffset: 1; }
    100% { stroke-dashoffset: 0; }
}

@keyframes floatBubble {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}

@keyframes blinkInput {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@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;
    }
    .draw-line, .bubble-float, .input-blink {
        animation: none;
    }
}

/* 响应式适配 */
@media (max-width: 768px) {
    .nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }

    h1 {
        font-size: 2.5rem;
    }

    .grid--2, .grid--3 {
        grid-template-columns: 1fr;
    }
}
