/* =========================================
   SafeW Global Styles & Design Tokens
   ========================================= */

:root {
    /* 色板定义 */
    --color-bg-dark: #13102D;
    --color-bg-paper: #D6D4ED;
    --color-text-body: #171523;
    --color-brand: #2714EB;
    --color-accent: #89ED6E;

    /* 衍生颜色（用于边框、次要元素） */
    --color-border-light: rgba(23, 21, 35, 0.08);
    --color-border-dark: rgba(214, 212, 237, 0.15);
    --color-overlay: rgba(19, 16, 45, 0.85);

    /* 尺寸与间距 */
    --content-max: 960px;
    --section-y: clamp(2.5rem, 5vw, 4rem);
    --gap: clamp(0.75rem, 1.5vw, 1.25rem);
    --header-height: 72px;

    /* 圆角 */
    --radius-card: 24px;
    --radius-btn: 999px;
    --radius-sm: 8px;
    --radius-md: 12px;

    /* 阴影 */
    --card-shadow: 0 10px 28px -14px rgba(23, 21, 35, 0.3);
    --card-hover-shadow: 0 14px 32px -12px rgba(23, 21, 35, 0.4);

    /* 字体 */
    --font-sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, monospace;
}

/* =========================================
   Base Reset & Typography
   ========================================= */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text-body);
    background-color: var(--color-bg-paper);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img, svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

/* =========================================
   Layout Utilities
   ========================================= */

.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);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: var(--gap);
}

.text-center { text-align: center; }
.text-right { text-align: right; }

/* 高亮词 */
.hl {
    color: var(--color-brand);
    font-weight: 700;
}

.dark-mode .hl {
    color: var(--color-accent);
}

/* =========================================
   Header & Nav
   ========================================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--color-bg-paper);
    border-bottom: 1px solid var(--color-border-light);
    height: var(--header-height);
    display: flex;
    align-items: center;
    transition: background-color 0.3s ease;
}

.site-header.scrolled {
    background-color: rgba(214, 212, 237, 0.95);
    backdrop-filter: blur(8px);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.brand-logo img {
    height: 32px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-body);
    transition: color 0.2s;
}

.nav-link:hover, .nav-link[aria-current="page"] {
    color: var(--color-brand);
}

/* Mobile Menu Toggle (Hidden on Desktop) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

@media (max-width: 768px) {
    .menu-toggle { display: block; }
    .nav-links {
        display: none; /* JS would toggle this usually, keeping it simple here */
    }
    /* Simple fallback: show nav below header on mobile if needed, 
       but for static demo we keep it clean. */
}

/* =========================================
   Components: Buttons
   ========================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 24px;
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 3px solid var(--color-brand);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-bg-dark);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -4px rgba(137, 237, 110, 0.4);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-text-body);
    border: 1.5px solid var(--color-text-body);
}

.dark-mode .btn-secondary {
    color: var(--color-bg-paper);
    border-color: var(--color-bg-paper);
}

.btn-secondary:hover {
    background-color: rgba(23, 21, 35, 0.05);
    transform: translateY(-1px);
}

.dark-mode .btn-secondary:hover {
    background-color: rgba(214, 212, 237, 0.1);
}

/* =========================================
   Components: Cards & Panels
   ========================================= */

.card {
    background-color: #fff; /* Fallback */
    background-color: var(--color-bg-paper);
    border-radius: var(--radius-card);
    padding: 32px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
}

/* Dark Mode Card Override */
.dark-mode .card {
    background-color: #1A173B; /* Slightly lighter dark */
    border: 1px solid var(--color-border-dark);
}

.feature-panel {
    background-color: var(--color-bg-dark);
    border-radius: var(--radius-card);
    padding: 40px;
    color: var(--color-bg-paper);
    position: relative;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.dark-mode .feature-panel {
    /* Inverted logic handled by parent */
}

/* =========================================
   Components: Tables
   ========================================= */

.platform-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.platform-table th, .platform-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

.platform-table th {
    font-weight: 700;
    color: var(--color-brand);
}

.dark-mode .platform-table th {
    color: var(--color-accent);
}

.platform-table tr:last-child td {
    border-bottom: none;
}

/* =========================================
   Components: FAQ
   ========================================= */

.faq-item {
    margin-bottom: 16px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    background-color: rgba(255, 255, 255, 0.5);
    overflow: hidden;
}

.dark-mode .faq-item {
    background-color: rgba(26, 23, 59, 0.5);
    border-color: var(--color-border-dark);
}

details summary {
    padding: 20px;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

details summary::-webkit-details-marker { display: none; }

details summary::after {
    content: "+";
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--color-brand);
    transition: transform 0.3s;
}

details[open] summary::after {
    transform: rotate(45deg);
}

details p {
    padding: 0 20px 20px 20px;
    line-height: 1.7;
    color: var(--color-text-body);
}

.dark-mode details p {
    color: var(--color-bg-paper);
}

/* =========================================
   Components: Badges & Labels
   ========================================= */

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.badge-brand {
    background-color: rgba(39, 20, 235, 0.1);
    color: var(--color-brand);
}

.dark-mode .badge-brand {
    background-color: rgba(137, 237, 110, 0.15);
    color: var(--color-accent);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--color-accent);
    color: var(--color-bg-dark);
    border-radius: 8px;
    font-weight: 800;
    margin-right: 12px;
    flex-shrink: 0;
}

/* =========================================
   SVG Animation Keyframes
   ========================================= */

/* Floating Cards (Hero) */
@keyframes float-card-1 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}
@keyframes float-card-2 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Bubble Pop */
@keyframes pop-in {
    0% { opacity: 0; transform: scale(0.8) translateY(10px); }
    20% { opacity: 1; transform: scale(1.05) translateY(0); }
    30% { transform: scale(1); }
    80% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.95); }
}

/* Line Draw */
@keyframes draw-line {
    0% { stroke-dashoffset: 1; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 1; }
}

/* Pulse Dot */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

/* Apply Animations via Classes */
.anim-float-1 { animation: float-card-1 6s ease-in-out infinite; }
.anim-float-2 { animation: float-card-2 5s ease-in-out infinite 0.5s; }
.anim-pop { animation: pop-in 4s cubic-bezier(0.34, 1.56, 0.64, 1) infinite; }
.anim-draw { animation: draw-line 3s linear infinite; }
.anim-pulse { animation: pulse 2s ease-in-out infinite; }

/* 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;
    }
}

/* =========================================
   Responsive Adjustments
   ========================================= */

@media (max-width: 768px) {
    :root {
        --section-y: clamp(2rem, 6vw, 3rem);
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .feature-panel {
        min-height: 240px;
    }
}
