/* =========================================
   SafeW Design System & Global Styles
   ========================================= */

/* --- Variables & Tokens --- */
:root {
    /* Colors */
    --color-dark-bg: #21163C;
    --color-paper-bg: #F4F3F7;
    --color-text-main: #191523;
    --color-brand: #5214EB;
    --color-accent: #ED926E;
    --color-white: #FFFFFF;

    /* Typography */
    --font-sans: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: "JetBrains Mono", monospace;

    /* Spacing & Layout */
    --content-max: 960px;
    --section-y: clamp(5rem, 10vw, 9rem);
    --gap: clamp(1.5rem, 3vw, 2.5rem);
    
    /* Radius & Shadows */
    --radius-card: 20px;
    --radius-btn: 12px;
    --card-border: 0;
    --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
    
    /* Animation Timing */
    --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text-main);
    background-color: var(--color-paper-bg);
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img, svg {
    display: block;
    max-width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

ul, ol {
    list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--color-text-main);
}

h1 {
    font-size: clamp(2.6rem, 6.4vw, 5rem);
    margin-bottom: 1.5rem;
}

h2 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin-bottom: 2rem;
    position: relative;
    padding-left: 1rem;
}

h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.2em;
    bottom: 0.2em;
    width: 4px;
    background-color: var(--color-brand);
    border-radius: 2px;
}

.dark-section h2::before {
    background-color: var(--color-accent);
}

h3 {
    font-size: clamp(1.4rem, 2.5vw, 1.8rem);
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 4px solid var(--color-brand);
}

.dark-section h3 {
    border-left-color: var(--color-accent);
}

p {
    margin-bottom: 1.25rem;
    max-width: 38em;
}

.highlight {
    color: var(--color-brand);
    font-weight: 600;
}

.dark-section .highlight {
    color: var(--color-accent);
}

/* --- 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;
    gap: var(--gap);
    grid-template-columns: 1fr 1fr;
    align-items: center;
}

@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
    .reverse-mobile {
        order: -1;
    }
}

/* --- Header & Footer --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background-color: rgba(244, 243, 247, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(25, 21, 35, 0.05);
    height: 64px;
    display: flex;
    align-items: center;
}

.dark-header {
    background-color: rgba(33, 22, 60, 0.9);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--gap);
}

.logo img {
    height: 32px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-main);
}

.dark-nav .nav-links a {
    color: var(--color-white);
}

.nav-links a:hover, .nav-links a[aria-current="page"] {
    color: var(--color-brand);
}

.dark-nav .nav-links a:hover, .dark-nav .nav-links a[aria-current="page"] {
    color: var(--color-accent);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--color-brand);
    color: var(--color-white);
}

.btn-primary:hover {
    background-color: #430fc4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(82, 20, 235, 0.3);
}

.btn-accent {
    background-color: var(--color-accent);
    color: var(--color-dark-bg);
}

.btn-accent:hover {
    background-color: #d67e5c;
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--color-text-main);
    color: var(--color-text-main);
}

.dark-section .btn-outline {
    border-color: var(--color-white);
    color: var(--color-white);
}

.btn-outline:hover {
    background-color: rgba(25, 21, 35, 0.05);
}

.site-footer {
    background-color: var(--color-dark-bg);
    color: var(--color-white);
    padding: 4rem 0;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.footer-col h4 {
    color: var(--color-white);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.footer-col a {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.footer-col a:hover {
    color: var(--color-accent);
}

/* --- Components: Cards & Panels --- */
.card {
    background-color: var(--color-white);
    border-radius: var(--radius-card);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    border: var(--card-border);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
}

.panel-dark {
    background-color: var(--color-dark-bg);
    border-radius: var(--radius-card);
    padding: 3rem;
    color: var(--color-white);
    position: relative;
    overflow: hidden;
}

.panel-light {
    background-color: var(--color-white);
    border-radius: var(--radius-card);
    padding: 2rem;
    box-shadow: var(--card-shadow);
}

/* --- Components: Tables --- */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-card);
    box-shadow: var(--card-shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--color-white);
    text-align: left;
}

th, td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}

th {
    background-color: rgba(82, 20, 235, 0.05);
    font-weight: 600;
    color: var(--color-brand);
}

td:first-child {
    font-weight: 600;
    color: var(--color-text-main);
}

/* --- Components: FAQ --- */
.faq-item {
    border-bottom: 1px solid rgba(25, 21, 35, 0.1);
    margin-bottom: 1rem;
}

details summary {
    padding: 1.25rem 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    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.5rem;
    font-weight: 300;
    transition: transform 0.3s ease;
}

details[open] summary::after {
    transform: rotate(45deg);
}

details p {
    padding-bottom: 1.5rem;
    color: rgba(25, 21, 35, 0.8);
    margin-bottom: 0;
}

/* --- Components: Timeline --- */
.timeline {
    position: relative;
    padding-left: 2rem;
    border-left: 2px solid rgba(82, 20, 235, 0.2);
}

.timeline-item {
    position: relative;
    margin-bottom: 2.5rem;
    padding-left: 1.5rem;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -2.6rem;
    top: 0.2rem;
    width: 12px;
    height: 12px;
    background-color: var(--color-brand);
    border-radius: 50%;
    border: 3px solid var(--color-paper-bg);
}

.timeline-time {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-brand);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    display: block;
}

/* --- Components: Steps --- */
.steps-container {
    display: flex;
    gap: 2rem;
    counter-reset: step-counter;
}

.step-item {
    flex: 1;
    counter-increment: step-counter;
    position: relative;
}

.step-number {
    display: inline-block;
    width: 40px;
    height: 40px;
    background-color: var(--color-accent);
    color: var(--color-dark-bg);
    font-weight: 700;
    border-radius: 8px;
    text-align: center;
    line-height: 40px;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.step-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .steps-container {
        flex-direction: column;
    }
}

/* --- SVG Animation Styles --- */
.svg-anim {
    width: 100%;
    height: auto;
    overflow: visible;
}

/* Hero: Geometric Rotation */
@keyframes spin-cw {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spin-ccw {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

@keyframes float-up {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.geo-shape-1 {
    animation: spin-cw 20s linear infinite;
    transform-origin: center;
    transform-box: fill-box;
}

.geo-shape-2 {
    animation: spin-ccw 25s linear infinite;
    transform-origin: center;
    transform-box: fill-box;
}

.geo-shape-3 {
    animation: float-up 6s ease-in-out infinite;
}

/* Feature: Draw Stroke */
@keyframes draw-stroke {
    0% { stroke-dashoffset: 1; opacity: 0.5; }
    20% { opacity: 1; }
    50% { stroke-dashoffset: 0; opacity: 1; }
    80% { stroke-dashoffset: 0; opacity: 1; }
    100% { stroke-dashoffset: 1; opacity: 0.5; }
}

.draw-path {
    pathLength: 1;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: draw-stroke 6s ease-in-out infinite;
}

/* Feature: Pulse Opacity */
@keyframes pulse-opacity {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.pulse-el {
    animation: pulse-opacity 4s 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;
    }
}

/* --- Focus States --- */
:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

.dark-section :focus-visible {
    outline-color: var(--color-accent);
}

/* --- Misc --- */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: rgba(82, 20, 235, 0.1);
    color: var(--color-brand);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.dark-section .badge {
    background-color: rgba(237, 146, 110, 0.15);
    color: var(--color-accent);
}

.news-card {
    background-color: var(--color-white);
    border-radius: var(--radius-card);
    padding: 1.5rem;
    border: 1px solid rgba(25, 21, 35, 0.05);
    transition: transform 0.2s ease;
}

.news-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-brand);
}

.news-date {
    font-size: 0.85rem;
    color: rgba(25, 21, 35, 0.5);
    margin-bottom: 0.5rem;
    display: block;
}

.news-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    color: var(--color-text-main);
}

.news-excerpt {
    font-size: 0.95rem;
    color: rgba(25, 21, 35, 0.7);
    line-height: 1.6;
}

/* Grid for News */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--gap);
}
