/* =========================================================
   SafeW 全局样式 (Style System)
   Design Tokens & Base Styles
   ========================================================= */
:root {
    /* Color Palette - Strictly from Brand Board */
    --color-deep: #271231;       /* 深色面底色 */
    --color-paper: #F6F3F7;      /* 纸面底色 */
    --color-text: #1F1523;       /* 正文色 */
    --color-brand: #9E13DD;      /* 品牌色 (纸面上的强调) */
    --color-accent: #ED6EC0;     /* 强调色 (按钮, 深色面上的强调) */

    /* Structural Variables */
    --content-max: 1280px;
    --section-y: clamp(3.5rem, 7vw, 6rem);
    --gap: clamp(1rem, 2vw, 1.75rem);
    
    /* UI Elements */
    --radius-card: 0;
    --radius-btn: 0;
    --card-border: 1px solid rgba(31, 21, 35, 0.16);
    --card-shadow: none;
    
    /* Typography */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --line-height-base: 1.65;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-family: var(--font-sans);
    color: var(--color-text);
    background-color: var(--color-paper);
    line-height: var(--line-height-base);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    min-width: 320px;
    overflow-x: hidden;
}

img, svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

/* =========================================================
   Layout & Containers
   ========================================================= */
.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);
    position: relative;
}

.section--dark {
    background-color: var(--color-deep);
    color: var(--color-paper);
}

.section--light {
    background-color: var(--color-paper);
    color: var(--color-text);
}

/* Alternating sub-layers for visual rhythm without hard cuts */
.section--light .sub-layer {
    background-color: #EBE7ED; /* 浅一档的纸面色 */
    padding: var(--section-y) 0;
    margin: calc(var(--section-y) * -1) 0;
}

/* =========================================================
   Typography
   ========================================================= */
.badge {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    display: inline-block;
}

.section--light .badge {
    color: var(--color-brand);
}

.section--dark .badge {
    color: var(--color-accent);
}

h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

h1 {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    margin-bottom: 1.5rem;
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    margin-bottom: 1.25rem;
}

h3 {
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1rem;
    max-width: 38em;
}

.hl {
    color: var(--color-brand);
}

.section--dark .hl {
    color: var(--color-accent);
}

/* =========================================================
   Components: Buttons
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 48px;
    padding: 0 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    border: none;
    border-radius: var(--radius-btn);
    text-decoration: none;
}

.btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.btn--primary {
    background-color: var(--color-accent);
    color: var(--color-deep);
}

.btn--primary:hover {
    background-color: #d85aad;
    transform: translateY(-1px);
}

.btn--secondary {
    background-color: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-text);
}

.section--dark .btn--secondary {
    color: var(--color-paper);
    border-color: var(--color-paper);
}

.btn--secondary:hover {
    background-color: rgba(31, 21, 35, 0.05);
}

.section--dark .btn--secondary:hover {
    background-color: rgba(246, 243, 247, 0.1);
}

/* =========================================================
   Components: Cards & Tables
   ========================================================= */
.card {
    background-color: #fff;
    border: var(--card-border);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    border-radius: var(--radius-card);
}

.section--dark .card {
    background-color: rgba(246, 243, 247, 0.05);
    border-color: rgba(246, 243, 247, 0.1);
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    min-width: 600px; /* Force scroll on very small screens */
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(31, 21, 35, 0.1);
}

.section--dark th, 
.section--dark td {
    border-bottom-color: rgba(246, 243, 247, 0.1);
}

th {
    font-weight: 700;
    background-color: rgba(31, 21, 35, 0.03);
}

.section--dark th {
    background-color: rgba(246, 243, 247, 0.05);
    color: var(--color-accent);
}

/* =========================================================
   Components: Tabs (Core Features)
   ========================================================= */
.tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(31, 21, 35, 0.1);
}

.section--dark .tabs-nav {
    border-bottom-color: rgba(246, 243, 247, 0.1);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.section--dark .tab-btn {
    color: var(--color-paper);
}

.tab-btn:hover {
    color: var(--color-brand);
}

.section--dark .tab-btn:hover {
    color: var(--color-accent);
}

.tab-btn[aria-selected="true"] {
    border-bottom-color: var(--color-brand);
    color: var(--color-brand);
}

.section--dark .tab-btn[aria-selected="true"] {
    border-bottom-color: var(--color-accent);
    color: var(--color-accent);
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel[data-active="true"] {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .tab-panel[data-active="true"] {
        grid-template-columns: 1fr;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Components: FAQ
   ========================================================= */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

details {
    border: var(--card-border);
    background-color: #fff;
    padding: 1rem;
    border-radius: var(--radius-card);
}

.section--dark details {
    background-color: rgba(246, 243, 247, 0.05);
    border-color: rgba(246, 243, 247, 0.1);
}

summary {
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    position: relative;
    padding-right: 2rem;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: "+";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    font-weight: 400;
}

details[open] summary::after {
    content: "-";
}

details p {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: inherit;
    opacity: 0.9;
}

/* =========================================================
   Components: Steps & Lists
   ========================================================= */
.steps-list {
    counter-reset: step-counter;
    display: grid;
    gap: 1.5rem;
}

.step-item {
    position: relative;
    padding-left: 3rem;
}

.step-item::before {
    counter-increment: step-counter;
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background-color: var(--color-accent);
    color: var(--color-deep);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-btn);
}

/* =========================================================
   Components: News Grid
   ========================================================= */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--gap);
}

.news-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.news-date {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

/* =========================================================
   Header & Footer
   ========================================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(246, 243, 247, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(31, 21, 35, 0.05);
    padding: 1rem 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--color-text);
}

.logo img {
    height: 32px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--color-brand);
}

.nav-link[aria-current="page"] {
    color: var(--color-brand);
    border-bottom: 2px solid var(--color-brand);
}

.site-footer {
    padding: 3rem 0;
    border-top: 1px solid rgba(31, 21, 35, 0.1);
    font-size: 0.9rem;
    text-align: center;
    opacity: 0.8;
}

/* =========================================================
   SVG Animations
   ========================================================= */
.svg-flow-dot {
    fill: var(--color-accent);
    animation: flowPath 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.svg-flow-dot.delay-1 { animation-delay: 1s; }
.svg-flow-dot.delay-2 { animation-delay: 2s; }

@keyframes flowPath {
    0% { offset-distance: 0%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { offset-distance: 100%; opacity: 0; }
}

.bubble-float {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.cursor-blink {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Reduced Motion */
@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;
    }
    .svg-flow-dot {
        animation: none;
        offset-path: none;
        opacity: 1;
    }
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .nav-links {
        display: none; /* Simplified for mobile, ideally a hamburger menu in real prod */
    }
    .header-inner {
        justify-content: space-between;
    }
}
