/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计变量与色板 --- */
:root {
    /* 核心颜色 */
    --color-dark: #140E25;
    --color-paper: #F5F0E5;
    --color-text: #191523;
    --color-brand: #5214EB;
    --color-accent: #C8ED6E;

    /* 衍生颜色 (用于边框、次要背景等，不用于正文) */
    --color-border-subtle: rgba(25, 21, 35, 0.08);
    --color-border-strong: rgba(25, 21, 35, 0.15);
    --color-bg-secondary: #EDE8DD;

    /* 结构性 Token */
    --radius-card: 8px;
    --radius-btn: 6px;
    --card-border: 0;
    --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
    --section-y: clamp(2.5rem, 5vw, 4rem);
    --gap: clamp(0.75rem, 1.5vw, 1.25rem);
    --content-max: 1120px;

    /* 字体栈 */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- 基础排版与重置 --- */
*, *::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.55;
    color: var(--color-text);
    background-color: var(--color-paper);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

/* --- 布局容器 --- */
.container {
    width: 100%;
    max-width: var(--content-max);
    margin-inline: auto;
    padding-inline: var(--gap);
}

.section {
    padding-block: var(--section-y);
}

/* --- 标题系统 --- */
.section-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-brand);
    margin-bottom: var(--gap);
    display: inline-block;
}

.dark-section .section-label {
    color: var(--color-accent);
}

.card-light .section-label {
    color: var(--color-brand);
}

h1 {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.02em;
    text-wrap: balance;
    margin-bottom: var(--gap);
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0.01em;
    margin-bottom: var(--gap);
    text-wrap: balance;
}

h3 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

p {
    margin-bottom: 1em;
    max-width: 38em;
}

/* 高亮关键词 */
.hl {
    color: var(--color-brand);
}

.dark-section .hl {
    color: var(--color-accent);
}

/* --- 按钮组件 --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    height: 52px;
    padding-inline: 1.5em;
    border-radius: var(--radius-btn);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-dark);
    border: 2px solid var(--color-accent);
}

.btn-primary:hover {
    background-color: #d4f57e;
    border-color: #d4f57e;
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-text);
    border: 1.5px solid var(--color-text);
}

.dark-section .btn-secondary {
    color: var(--color-paper);
    border-color: var(--color-paper);
}

.btn-secondary:hover {
    background-color: rgba(25, 21, 35, 0.05);
}

.dark-section .btn-secondary:hover {
    background-color: rgba(245, 240, 229, 0.1);
}

/* --- 卡片与面板 --- */
.card {
    background-color: #fff;
    border-radius: var(--radius-card);
    border: var(--card-border);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.4);
}

.panel-dark {
    background-color: var(--color-dark);
    border-radius: 16px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

/* --- 表格 --- */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-card);
    border: 1px solid var(--color-border-subtle);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 400px;
}

th, td {
    text-align: left;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border-subtle);
}

th {
    background-color: var(--color-bg-secondary);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

tr:last-child th, tr:last-child td {
    border-bottom: none;
}

td:first-child {
    font-weight: 600;
}

/* --- FAQ (Details/Summary) --- */
.faq-item {
    border-bottom: 1px solid var(--color-border-subtle);
}

details summary {
    list-style: none;
    padding: 1.25rem 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s ease;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::after {
    content: "+";
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1;
    transition: transform 0.3s ease;
}

details[open] summary::after {
    transform: rotate(45deg);
}

details summary:hover {
    color: var(--color-brand);
}

details p {
    padding-bottom: 1.25rem;
    color: rgba(25, 21, 35, 0.8);
}

/* --- 页头与页脚 --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(245, 240, 229, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border-subtle);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.brand img {
    height: 28px;
    width: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--color-brand);
}

.nav-link[aria-current="page"] {
    color: var(--color-brand);
    font-weight: 700;
}

.site-footer {
    background-color: var(--color-dark);
    color: var(--color-paper);
    padding-block: 3rem;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.footer-nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-nav a {
    color: rgba(245, 240, 229, 0.7);
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-nav a:hover {
    color: var(--color-accent);
}

.footer-copy {
    font-size: 0.85rem;
    color: rgba(245, 240, 229, 0.5);
}

/* --- 响应式调整 --- */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding-block: 0.75rem;
    }
    
    .nav-links {
        order: 3;
        width: 100%;
        justify-content: space-between;
        padding-top: 0.75rem;
        border-top: 1px solid var(--color-border-subtle);
        margin-top: 0.5rem;
    }

    h1 {
        font-size: clamp(1.8rem, 7vw, 2.8rem);
    }
}

/* --- SVG 动效 (CSS Keyframes) --- */
@keyframes drawStroke {
    0% { stroke-dashoffset: 1; }
    100% { stroke-dashoffset: 0; }
}

@keyframes fadeFloat {
    0%, 100% { opacity: 0.6; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-6px); }
}

@keyframes slideInRight {
    0% { opacity: 0; transform: translateX(20px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes pulseDash {
    0% { stroke-dashoffset: 0.2; }
    50% { stroke-dashoffset: 0.8; }
    100% { stroke-dashoffset: 0.2; }
}

/* 动效类 */
.anim-draw {
    pathLength: 1;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: drawStroke 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.anim-float {
    animation: fadeFloat 4s ease-in-out infinite;
}

.anim-slide {
    animation: slideInRight 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.anim-pulse {
    pathLength: 1;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: pulseDash 3s ease-in-out infinite;
}

/* 旋转子元素修正 */
.anim-spin-center {
    transform-box: fill-box;
    transform-origin: center;
    animation: spinSlow 12s linear infinite;
}

@keyframes spinSlow {
    100% { transform: rotate(360deg); }
}

/* 减少动态效果支持 */
@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;
    }
    .anim-draw, .anim-float, .anim-slide, .anim-pulse, .anim-spin-center {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        stroke-dashoffset: 0 !important;
    }
}
