/* =========================================
   SafeW 全局共享样式 (style.css)
   ========================================= */

/* --- 设计 Token 与变量 --- */
:root {
    /* 色板 */
    --color-dark: #231334;
    --color-paper: #E9E8EA;
    --color-text: #1C1523;
    --color-brand: #7D14EB;
    --color-accent: #EDD26E;

    /* 默认取色（纸面模式） */
    --bg-page: var(--color-paper);
    --bg-surface: var(--color-dark);
    --text-main: var(--color-text);
    --text-highlight: var(--color-brand);
    --accent: var(--color-brand);

    /* 组件 Token */
    --radius-card: 20px;
    --radius-btn: 12px;
    --card-border: 2px solid var(--text-main);
    --card-shadow: 4px 4px 0 var(--text-main);
    
    --section-y: clamp(5rem, 10vw, 9rem);
    --gap: clamp(1.5rem, 3vw, 2.5rem);
    --content-max: 960px;

    /* 字体与排版 */
    --font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    --line-height: 1.75;
}

/* 深色面取色覆盖 */
.dark-surface {
    --bg-page: var(--color-dark);
    --text-main: var(--color-paper);
    --text-highlight: var(--color-accent);
    --accent: var(--color-accent);
}

/* 浅色卡片覆盖（在深色面上使用时恢复纸面取色） */
.light-card {
    --bg-page: var(--color-paper);
    --text-main: var(--color-text);
    --text-highlight: var(--color-brand);
    --accent: var(--color-brand);
    --card-border: 2px solid var(--text-main);
    --card-shadow: 4px 4px 0 var(--text-main);
}

/* --- 基础重置与排版 --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    color: var(--text-main);
    background-color: var(--bg-page);
    line-height: var(--line-height);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--text-highlight);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.85;
}

ul, ol {
    list-style: none;
}

img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* --- 布局容器 --- */
.container {
    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.08em;
    text-transform: uppercase;
    color: var(--text-highlight);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-label::before {
    content: "";
    display: inline-block;
    width: 1.2em;
    height: 2px;
    background-color: currentColor;
}

h1 {
    font-size: clamp(2.4rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    text-wrap: balance;
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    text-wrap: balance;
}

h3 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-main);
}

p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.hl {
    color: var(--text-highlight);
}

/* --- 按钮 --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    height: 48px;
    padding: 0 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
}

.btn:focus-visible {
    outline: 3px solid var(--text-highlight);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--color-dark);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 2px solid var(--text-main);
}

.btn-secondary:hover {
    background-color: rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

.dark-surface .btn-secondary {
    border-color: var(--color-paper);
    color: var(--color-paper);
}

.dark-surface .btn-secondary:hover {
    background-color: rgba(255,255,255,0.1);
}

/* --- 卡片与面板 --- */
.card {
    background-color: var(--bg-page);
    border: var(--card-border);
    border-radius: var(--radius-card);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.panel {
    background-color: var(--bg-surface);
    border-radius: var(--radius-card);
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    position: relative;
}

.dark-surface .panel {
    background-color: #1A0E28; /* 略深于品牌深底，增加层次 */
}

/* --- 表格 --- */
.table-wrapper {
    overflow-x: auto;
    border: var(--card-border);
    border-radius: var(--radius-card);
    box-shadow: var(--card-shadow);
    background: var(--bg-page);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

th, td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid rgba(128,128,128,0.2);
}

th {
    font-weight: 700;
    background-color: rgba(128,128,128,0.05);
}

tr:last-child td {
    border-bottom: none;
}

/* --- 步骤条 --- */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--gap);
}

.step-item {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.step-badge {
    width: 40px;
    height: 40px;
    background-color: var(--accent);
    color: var(--color-dark);
    font-weight: 800;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

/* --- FAQ --- */
details {
    border: var(--card-border);
    border-radius: var(--radius-card);
    margin-bottom: 1rem;
    background: var(--bg-page);
    box-shadow: 2px 2px 0 var(--text-main);
    overflow: hidden;
}

summary {
    padding: 1.25rem 1.5rem;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: "+";
    font-size: 1.5rem;
    font-weight: 300;
    transition: transform 0.3s;
}

details[open] summary::after {
    transform: rotate(45deg);
}

details > div {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-main);
}

/* --- 页头与页脚 --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-page);
    border-bottom: 1px solid rgba(128,128,128,0.2);
    backdrop-filter: blur(8px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-main);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-weight: 600;
    color: var(--text-main);
    opacity: 0.7;
}

.nav-link[aria-current="page"],
.nav-link:hover {
    opacity: 1;
    color: var(--text-highlight);
}

.site-footer {
    padding: 3rem 0;
    border-top: 1px solid rgba(128,128,128,0.2);
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

/* --- SVG 动效 Keyframes --- */
@keyframes blink {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.8; }
}

@keyframes dash {
    from { stroke-dashoffset: 1; }
    to { stroke-dashoffset: 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes slideIn {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- 动效类 --- */
.star {
    animation: blink 4s infinite ease-in-out;
}
.star:nth-child(even) {
    animation-delay: 2s;
}
.line-draw {
    pathLength: 1;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: dash 8s infinite linear;
}
.float-layer {
    animation: float 6s infinite ease-in-out;
}
.slide-in {
    animation: slideIn 1s ease-out forwards;
    opacity: 0; /* 初始隐藏，动画完成后显示 */
}

/* --- 响应式调整 --- */
@media (max-width: 768px) {
    .nav-links {
        display: none; /* 简化移动端展示，实际项目可加汉堡菜单 */
    }
    h1 { font-size: clamp(2rem, 8vw, 3rem); }
    .grid-2-col { grid-template-columns: 1fr !important; }
}

/* --- 减少动态效果 --- */
@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;
    }
}
