/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
    /* 色板 */
    --color-dark-bg: #13102D;
    --color-paper: #D6D4ED;
    --color-text: #171523;
    --color-brand: #2714EB;
    --color-accent: #89ED6E;

    /* 派生色（用于边框、分割线等，不用于文字） */
    --color-border-subtle: rgba(23, 21, 35, 0.1);
    --color-dark-border: rgba(214, 212, 237, 0.15);

    /* 结构性约束 */
    --radius-card: 24px;
    --radius-btn: 999px;
    --card-border: 0;
    --card-shadow: 0 10px 28px -14px rgba(23, 21, 35, 0.3);
    
    --section-y: clamp(2.5rem, 5vw, 4rem);
    --gap: clamp(0.75rem, 1.5vw, 1.25rem);
    --content-max: 960px;
    
    /* 字体 */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- 基础重置 --- */
*, *::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);
    color: var(--color-text);
    background-color: var(--color-paper);
    line-height: 1.55;
    font-size: 16px;
    overflow-x: hidden;
}

img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

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: var(--section-y) 0;
    position: relative;
}

/* --- 面（Surface）管理 --- */
.surface-dark {
    background-color: var(--color-dark-bg);
    color: var(--color-paper);
}

.surface-dark .hl {
    color: var(--color-accent);
}

.surface-dark a:not(.btn):hover {
    color: var(--color-accent);
}

.surface-light {
    background-color: var(--color-paper);
    color: var(--color-text);
}

.surface-light .hl {
    color: var(--color-brand);
}

.surface-light a:not(.btn):hover {
    color: var(--color-brand);
}

/* 卡片内的取色回退到纸面逻辑 */
.card-in-dark {
    background-color: var(--color-paper);
    color: var(--color-text);
    border-radius: var(--radius-card);
    padding: var(--gap);
    box-shadow: var(--card-shadow);
}

.card-in-dark .hl {
    color: var(--color-brand);
}

/* --- 排版 --- */
h1, h2, h3, h4 {
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

h1 {
    font-size: clamp(2.4rem, 6vw, 4.5rem);
    margin-bottom: var(--gap);
    text-wrap: balance;
}

h2 {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    margin-bottom: var(--gap);
    text-wrap: balance;
}

h3 {
    font-size: clamp(1.25rem, 2vw, 1.5rem);
    margin-bottom: calc(var(--gap) / 2);
    text-wrap: balance;
}

p {
    margin-bottom: var(--gap);
    max-width: 38em;
}

/* 眉标 */
.section-label {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: calc(var(--gap) / 2);
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.section-label::before {
    content: "";
    display: block;
    width: 1.2em;
    height: 2px;
    background-color: currentColor;
    opacity: 0.6;
}

.surface-light .section-label {
    color: var(--color-brand);
}

.surface-dark .section-label {
    color: var(--color-accent);
}

/* --- 按钮 --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6em;
    height: 48px;
    padding: 0 24px;
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
    border: none;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-dark-bg);
    box-shadow: 0 4px 12px rgba(137, 237, 110, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(137, 237, 110, 0.4);
    filter: brightness(1.05);
}

.btn-secondary {
    background-color: transparent;
    border: 2px solid currentColor;
    color: inherit;
}

.surface-light .btn-secondary {
    border-color: var(--color-text);
}

.surface-dark .btn-secondary {
    border-color: var(--color-paper);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    background-color: rgba(128, 128, 128, 0.1);
}

/* --- 卡片 --- */
.card {
    background-color: var(--color-paper);
    border-radius: var(--radius-card);
    padding: var(--gap);
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px -12px rgba(23, 21, 35, 0.35);
}

/* --- 表格 --- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-card);
    background-color: var(--color-paper);
    box-shadow: var(--card-shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 400px;
}

th, td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-subtle);
}

th {
    font-weight: 700;
    background-color: rgba(23, 21, 35, 0.03);
}

tr:last-child td {
    border-bottom: none;
}

/* --- FAQ (Details/Summary) --- */
.faq-item {
    border-bottom: 1px solid var(--color-border-subtle);
    margin-bottom: 8px;
}

.faq-item summary {
    padding: 16px 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    font-size: 1.5rem;
    font-weight: 400;
    transition: transform 0.3s ease;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item p {
    margin-top: 8px;
    margin-bottom: 16px;
    opacity: 0.9;
    font-size: 0.95rem;
}

/* --- 导航 --- */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(214, 212, 237, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border-subtle);
    padding: 16px 0;
}

.surface-dark header {
    background-color: rgba(19, 16, 45, 0.85);
    border-bottom-color: var(--color-dark-border);
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.25rem;
}

.brand img {
    height: 32px;
    width: auto;
}

nav ul {
    display: flex;
    gap: 24px;
    align-items: center;
}

nav a {
    font-weight: 500;
    font-size: 0.95rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

nav a:hover, nav a[aria-current="page"] {
    opacity: 1;
    color: var(--color-brand);
}

.surface-dark nav a:hover, 
.surface-dark nav a[aria-current="page"] {
    color: var(--color-accent);
}

/* --- Footer --- */
footer {
    padding: 48px 0;
    border-top: 1px solid var(--color-border-subtle);
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.footer-links {
    display: flex;
    gap: 24px;
}

/* --- SVG 动效 --- */
svg {
    overflow: visible;
}

/* 星点明灭 */
@keyframes star-fade {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.star {
    animation: star-fade 4s ease-in-out infinite;
}

.star:nth-child(odd) {
    animation-duration: 5s;
    animation-delay: 1s;
}

.star:nth-child(3n) {
    animation-duration: 6s;
    animation-delay: 2s;
}

/* 连线流动 */
@keyframes line-flow {
    from { stroke-dashoffset: 1; }
    to { stroke-dashoffset: 0; }
}

.connecting-line {
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: line-flow 3s linear infinite;
}

/* 消息气泡上浮 */
@keyframes float-bubble {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.bubble-float {
    animation: float-bubble 6s ease-in-out infinite;
}

.bubble-float.delayed {
    animation-delay: 2s;
}

/* 减少动态效果 */
@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;
    }
    .star, .connecting-line, .bubble-float {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* --- 响应式 --- */
@media (max-width: 768px) {
    .nav-inner {
        flex-direction: column;
        gap: 16px;
    }
    nav ul {
        gap: 16px;
    }
    .hero-layout {
        flex-direction: column-reverse;
    }
    .split-row {
        flex-direction: column;
    }
    .split-row.reverse {
        flex-direction: column;
    }
    .grid-3 {
        grid-template-columns: 1fr;
    }
    h1 {
        font-size: 2.5rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.grid-3 {
    display: grid;
    gap: var(--gap);
}

.split-row {
    display: flex;
    gap: var(--gap);
    align-items: center;
}

.split-row > div {
    flex: 1;
    min-width: 0;
}
