/* 
  SafeW 全站共享样式
  包含：设计变量、基础排版、组件样式、SVG 动效、响应式适配
*/

/* ========================
   1. 设计变量 (Design Tokens)
   ======================== */
:root {
    /* 颜色系统 */
    --color-dark-surface: #121531;
    --color-paper: #E8E9EA;
    --color-paper-light: #F5F6F7; /* 浅一档纸面，用于交替区块 */
    --color-body-text: #151723;
    --color-brand: #142CEB;
    --color-accent: #ED7D6E;
    
    /* 状态颜色 (基于色板派生，用于边框等装饰) */
    --border-color: #151723;
    --border-dark: #E8E9EA;

    /* 尺寸与间距 */
    --radius-card: 24px;
    --radius-btn: 999px;
    --radius-badge: 8px;
    
    --card-border: 2px solid var(--color-body-text);
    --card-shadow: 4px 4px 0 var(--color-body-text);
    --card-shadow-dark: 4px 4px 0 var(--color-dark-surface); /* 针对深色面上的卡片调整阴影 */

    --section-y: clamp(5rem, 10vw, 9rem);
    --gap: clamp(1.5rem, 3vw, 2.5rem);
    --content-max: 960px;

    /* 字体 */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    
    /* 动效时长 */
    --duration-fast: 0.2s;
    --duration-normal: 0.4s;
}

/* ========================
   2. 基础排版 (Base 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);
    background-color: var(--color-paper);
    color: var(--color-body-text);
    line-height: 1.75;
    font-size: 16px;
    overflow-x: hidden;
    width: 100%;
}

/* 容器 */
.container {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--gap);
    width: 100%;
    overflow-x: hidden;
}

/* 标题系统 */
.section-label {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    color: var(--color-brand);
}

.dark-section .section-label {
    color: var(--color-accent);
}

h1 {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    word-break: keep-all;
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: var(--gap);
    word-break: keep-all;
}

h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
    word-break: keep-all;
}

p {
    margin-bottom: 1.25rem;
    max-width: 38em;
}

strong {
    font-weight: 700;
}

a {
    color: var(--color-brand);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color var(--duration-fast);
}

.dark-section a {
    color: var(--color-accent);
}

a:hover {
    text-decoration-thickness: 2px;
}

/* 高亮关键词 */
.hl {
    color: var(--color-brand);
    position: relative;
    z-index: 1;
}

.dark-section .hl {
    color: var(--color-accent);
}

/* 文本对齐辅助 */
.text-center { text-align: center; }
.text-left { text-align: left; }

/* ========================
   3. 通用组件 (Components)
   ======================== */

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 52px;
    padding: 0 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-btn);
    text-decoration: none;
    transition: transform var(--duration-fast), box-shadow var(--duration-fast), filter var(--duration-fast);
    cursor: pointer;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-dark-surface);
    border: none;
    box-shadow: 0 4px 12px rgba(237, 125, 110, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-body-text);
    border: 2px solid var(--color-body-text);
}

.dark-section .btn-secondary {
    color: var(--color-paper);
    border-color: var(--color-paper);
}

.btn-secondary:hover {
    background-color: rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

.dark-section .btn-secondary:hover {
    background-color: rgba(255,255,255,0.1);
}

/* 图标 SVG */
.icon-svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 卡片 */
.card {
    background-color: var(--color-paper);
    border: var(--card-border);
    border-radius: var(--radius-card);
    box-shadow: var(--card-shadow);
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dark-section .card {
    background-color: var(--color-paper); /* 卡片内部保持纸面 */
    border-color: var(--color-body-text);
    box-shadow: var(--card-shadow);
}

/* 网格系统 */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: var(--gap);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: var(--gap);
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.data-table th, .data-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.data-table th {
    font-weight: 700;
    background-color: rgba(0,0,0,0.03);
}

.dark-section .data-table th {
    background-color: rgba(255,255,255,0.05);
}

/* FAQ Details */
details.faq-item {
    border: var(--card-border);
    border-radius: var(--radius-card);
    margin-bottom: 1rem;
    background-color: var(--color-paper);
    overflow: hidden;
}

summary.faq-summary {
    padding: 1.25rem 1.5rem;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(0,0,0,0.02);
}

summary.faq-summary::-webkit-details-marker {
    display: none;
}

summary.faq-summary::after {
    content: "+";
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--color-brand);
}

details.faq-item[open] summary.faq-summary::after {
    content: "-";
}

details.faq-item[open] summary.faq-summary {
    background-color: rgba(0,0,0,0.05);
}

.faq-answer {
    padding: 1.5rem;
    border-top: 1px solid rgba(0,0,0,0.1);
    color: var(--color-body-text);
}

/* 编号徽标 */
.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--color-accent);
    color: var(--color-dark-surface);
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 8px;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* 分割条 */
.divider-bar {
    height: 8px;
    background-color: var(--color-body-text);
    width: 64px;
    border-radius: 4px;
    margin: 2rem 0;
}

/* ========================
   4. 页面布局 (Layout)
   ======================== */

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--color-paper);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding: 16px 0;
    transition: background-color 0.3s;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--color-body-text);
    font-weight: 800;
    font-size: 1.2rem;
}

.brand-logo img {
    height: 32px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--color-body-text);
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-link:hover, .nav-link[aria-current="page"] {
    color: var(--color-brand);
}

/* Footer */
.site-footer {
    background-color: var(--color-dark-surface);
    color: var(--color-paper);
    padding: 64px 0 32px;
    margin-top: var(--section-y);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 48px;
    margin-bottom: 48px;
}

.footer-col h4 {
    color: var(--color-accent);
    margin-bottom: 16px;
    font-size: 1rem;
    font-weight: 700;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 10px;
}

.footer-col a {
    color: var(--color-paper);
    text-decoration: none;
    opacity: 0.8;
    font-size: 0.9rem;
}

.footer-col a:hover {
    opacity: 1;
    text-decoration: underline;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 24px;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.6;
}

/* ========================
   5. 区块样式 (Sections)
   ======================== */

/* Hero Section */
.hero-section {
    background-color: var(--color-dark-surface);
    color: var(--color-paper);
    padding: calc(var(--section-y) * 1.5) 0 var(--section-y);
    position: relative;
    overflow: hidden;
}

/* 修复 Hero 区域按钮对比度 */
.hero-section .btn-secondary {
    color: #ffffff;
    border-color: #ffffff;
}

.hero-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-actions {
    display: flex;
    gap: 16px;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.hero-facts {
    margin-top: 2rem;
    font-size: 0.9rem;
    opacity: 0.8;
    display: flex;
    gap: 24px;
}

.hero-visual {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: #0f122b;
    border-radius: 16px;
    border: 2px solid rgba(255,255,255,0.1);
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* 通用 Section */
.section-block {
    padding: var(--section-y) 0;
}

.paper-light {
    background-color: var(--color-paper-light);
}

.dark-section {
    background-color: var(--color-dark-surface);
    color: var(--color-paper);
}

/* ========================
   6. SVG 动效 (Animations)
   ======================== */

/* 基础 SVG 设置 */
.svg-anim-container {
    width: 100%;
    height: 100%;
    position: relative;
}

svg.anim-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* 轨道呼吸动画 */
@keyframes orbit-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes orbit-pulse {
    0%, 100% { transform: scale(0.95); opacity: 0.3; }
    50% { transform: scale(1.05); opacity: 0.6; }
}

.anim-orbit-ring {
    animation: orbit-pulse 6s ease-in-out infinite;
    transform-origin: center;
    transform-box: fill-box;
}

.anim-orbit-ring:nth-child(2) {
    animation-delay: 2s;
}

/* 气泡浮动动画 */
@keyframes float-bubble {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.anim-float {
    animation: float-bubble 4s ease-in-out infinite;
}

.anim-float-delayed {
    animation: float-bubble 4s ease-in-out infinite;
    animation-delay: 2s;
}

/* 连接线流动动画 */
@keyframes flow-line {
    to { stroke-dashoffset: -20; }
}

.anim-flow {
    stroke-dasharray: 10 10;
    animation: flow-line 1s linear infinite;
}

/* 输入框光标呼吸 */
@keyframes blink-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.anim-blink {
    animation: blink-cursor 1.2s step-end infinite;
}

/* 通知滑入 */
@keyframes slide-in-card {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.anim-slide-in {
    animation: slide-in-card 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* 减少动态效果媒体查询 */
@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;
    }
}

/* ========================
   7. 响应式适配 (Responsive)
   ======================== */

@media (max-width: 768px) {
    :root {
        --section-y: clamp(3rem, 8vw, 5rem);
        --gap: 1.5rem;
    }

    .hero-layout {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .hero-visual {
        order: -1; /* 图片在上方 */
        aspect-ratio: 16/9;
    }
    
    .nav-links {
        display: none; /* 简化移动端头部，实际项目应加汉堡菜单 */
    }
    
    /* 简单的移动端导航替代 */
    .header-inner::after {
        content: 'Menu';
        font-size: 0.9rem;
        font-weight: 600;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    h1 {
        font-size: 2.2rem;
    }
}
