/* =========================================
   SafeW Global Styles & Design System
   ========================================= */

:root {
    /* Color Palette */
    --color-dark-bg: #13102D;
    --color-paper-bg: #D6D4ED;
    --color-text-main: #171523;
    --color-brand: #2714EB;
    --color-accent: #89ED6E;
    
    /* Derived / Functional Colors */
    --color-border: rgba(23, 21, 35, 0.16);
    --color-white: #ffffff;
    --color-dark-text-on-accent: #13102D;

    /* Spacing & Layout */
    --section-y: clamp(5rem, 10vw, 9rem);
    --gap: clamp(1.5rem, 3vw, 2.5rem);
    --content-max: 1280px;
    
    /* Radius */
    --radius-card: 24px;
    --radius-btn: 999px;
    --radius-sm: 8px;

    /* Typography */
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Dark Surface Context Overrides */
.dark-surface {
    --bg-color: var(--color-dark-bg);
    --text-color: var(--color-paper-bg);
    --accent-color: var(--color-accent);
    --brand-color: var(--color-accent);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Paper Surface Context Overrides */
.paper-surface {
    --bg-color: var(--color-paper-bg);
    --text-color: var(--color-text-main);
    --accent-color: var(--color-accent); /* Used sparingly */
    --brand-color: var(--color-brand);
    --card-bg: #ffffff;
    --card-border: 1px solid rgba(23, 21, 35, 0.08);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-main);
    background-color: var(--color-paper-bg);
    color: var(--color-text-main);
    line-height: 1.75;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Typography Scale */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(2rem, 4.6vw, 3.4rem);
    margin-bottom: 1.5rem;
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    margin-bottom: 2rem;
    position: relative;
}

h3 {
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1.5rem;
    max-width: 38em;
}

/* Utility Classes */
.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);
}

.hl {
    color: var(--brand-color);
}

.dark-surface .hl {
    color: var(--accent-color);
}

/* Labels /眉标 */
.section-label {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    color: var(--brand-color);
}

.dark-surface .section-label {
    color: var(--color-dark-bg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 2rem;
    height: 48px;
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
    border: none;
}

.btn:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--brand-color);
    color: #ffffff;
}

.dark-surface .btn-primary {
    background-color: var(--accent-color);
    color: var(--color-dark-bg);
}

.btn-primary:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid currentColor;
}

.dark-surface .btn-secondary {
    color: var(--paper-bg); /* Fallback for dark surface secondary text if needed, usually white-ish */
    border-color: rgba(255,255,255,0.3);
}

.btn-secondary:hover {
    background-color: rgba(0,0,0,0.05);
}

.dark-surface .btn-secondary:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--color-paper-bg);
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    height: 72px;
    display: flex;
    align-items: center;
}

.dark-surface.site-header {
    background-color: rgba(19, 16, 45, 0.9);
    border-bottom-color: rgba(255,255,255,0.1);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.logo-img {
    height: 32px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.95rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
    opacity: 1;
    color: var(--brand-color);
}

.dark-surface .nav-links a:hover,
.dark-surface .nav-links a[aria-current="page"] {
    color: var(--accent-color);
}

@media (max-width: 768px) {
    .nav-links { display: none; }
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--radius-card);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease;
}

/* Feature Tabs (Pure CSS/HTML accessible structure) */
.tabs-wrapper {
    margin-top: 2rem;
}

.tab-nav {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 1px; /* Fix subpixel gap */
}

.tab-radio {
    display: none;
}

.tab-label {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.6;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab-radio:checked + .tab-label {
    opacity: 1;
    color: var(--brand-color);
    border-bottom-color: var(--brand-color);
}

.dark-surface .tab-radio:checked + .tab-label {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-radio:checked ~ .tab-content {
    display: block;
}

/* Default content visibility for no-JS */
.tab-content:first-child {
    display: block;
}

/* FAQ Details */
.faq-item {
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 1rem;
}

.faq-item summary {
    padding: 1.5rem 0;
    cursor: pointer;
    font-weight: 600;
    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.5rem;
    font-weight: 300;
    color: var(--brand-color);
}

.dark-surface .faq-item summary::after {
    color: var(--accent-color);
}

.faq-item[open] summary::after {
    content: '-';
}

.faq-item p {
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
    padding-right: 2rem;
}

/* Tables */
.spec-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
}

.spec-table th, .spec-table td {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.spec-table th {
    font-weight: 600;
    color: var(--brand-color);
    width: 30%;
}

.dark-surface .spec-table th {
    color: var(--accent-color);
}

/* SVG Containers */
.svg-visual {
    width: 100%;
    height: auto;
    max-width: 100%;
    overflow: visible;
}

/* Animations */
@keyframes dash {
    to { stroke-dashoffset: 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes flow {
    to { stroke-dashoffset: -20; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.anim-draw {
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: dash 2s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

.anim-float {
    animation: float 6s ease-in-out infinite;
}

.anim-flow {
    stroke-dasharray: 4 4;
    stroke-dashoffset: 0;
    animation: flow 1s linear 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;
    }
}

/* News Grid */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--gap);
}

.news-card h4 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.news-date {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-bottom: 1rem;
    display: block;
}

/* Footer */
.site-footer {
    background-color: var(--color-dark-bg);
    color: var(--color-paper-bg);
    padding: 4rem 0 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-col h4 {
    color: var(--color-accent);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 0.8rem;
}

.footer-col a {
    color: var(--color-paper-bg);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.footer-col a:hover {
    opacity: 1;
}

.copyright {
    text-align: center;
    opacity: 0.5;
    font-size: 0.85rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .hero-layout {
        flex-direction: column-reverse;
    }
    .hero-visual {
        margin-bottom: 2rem;
    }
    .tabs-wrapper .tab-nav {
        flex-wrap: nowrap;
    }
}
