/* === 设计变量 === */
:root {
    /* 色板 */
    --bg-dark: #141838;
    --bg-paper: #F7F5F3;
    --text-body: #151723;
    --color-brand: #142CEB;
    --color-accent: #6EAFED;
    
    /* 结构变量 */
    --radius-card: 8px;
    --radius-btn: 6px;
    --card-border: 0;
    --card-shadow: none;
    --section-y: clamp(2.5rem, 5vw, 4rem);
    --gap: clamp(0.75rem, 1.5vw, 1.25rem);
    --content-max: 1120px;
    
    /* 排版变量 */
    --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
    --line-height-tight: 1.15;
    --line-height-body: 1.55;
}

/* === 基础重置与排版 === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    color: var(--text-body);
    background-color: var(--bg-paper);
    line-height: var(--line-height-body);
    font-size: 16px;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* === 布局系统 === */
.layout-grid {
    display: flex;
    min-height: 100vh;
}

/* 左侧吸顶品牌栏（桌面端） */
.sidebar-brand {
    width: 240px;
    position: sticky;
    top: 0;
    height: 100vh;
    background-color: var(--bg-dark);
    color: var(--bg-paper);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    flex-shrink: 0;
    z-index: 100;
}

.sidebar-brand .logo-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.sidebar-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-nav a {
    display: block;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-btn);
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a[aria-current="page"] {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

/* 右侧主内容区 */
.main-content {
    flex: 1;
    max-width: 100%;
    overflow: hidden; /* 防止横向溢出 */
}

.content-scroll-wrapper {
    height: 100vh;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.section-container {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--section-y) var(--gap);
}

/* 区块背景交替 */
.section-container.bg-dark {
    background-color: var(--bg-dark);
    color: var(--bg-paper);
}

.section-container.bg-paper {
    background-color: var(--bg-paper);
    color: var(--text-body);
}

/* === 组件：按钮 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    height: 48px;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--bg-dark);
}

.btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid currentColor;
    color: inherit;
}

.section-container.bg-paper .btn-secondary {
    border-color: var(--text-body);
    color: var(--text-body);
}

.section-container.bg-dark .btn-secondary {
    border-color: var(--bg-paper);
    color: var(--bg-paper);
}

/* === 组件：卡片 === */
.card {
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-card);
    padding: 1.25rem;
    border: var(--card-border);
    box-shadow: var(--card-shadow);
}

.section-container.bg-dark .card {
    background-color: rgba(255, 255, 255, 0.05);
}

/* === 组件：眉标与标题 === */
.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
}

.section-container.bg-paper .badge {
    color: var(--color-brand);
}

.section-container.bg-dark .badge {
    color: var(--color-accent);
}

h1, h2, h3, h4 {
    font-weight: 500;
    line-height: var(--line-height-tight);
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2.6rem, 6.4vw, 5rem);
    margin-bottom: 1rem;
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.hl {
    /* 高亮关键词样式 */
}

.section-container.bg-paper .hl {
    color: var(--color-brand);
}

.section-container.bg-dark .hl {
    color: var(--color-accent);
}

/* === 组件：表格 === */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-card);
    border: 1px solid rgba(0,0,0,0.1);
}

.section-container.bg-dark .table-responsive {
    border-color: rgba(255,255,255,0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th, td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.section-container.bg-dark th,
.section-container.bg-dark td {
    border-bottom-color: rgba(255,255,255,0.08);
}

th {
    font-weight: 700;
    background-color: rgba(0,0,0,0.03);
}

.section-container.bg-dark th {
    background-color: rgba(255,255,255,0.05);
}

tr:last-child td {
    border-bottom: none;
}

/* === 组件：FAQ (Details/Summary) === */
details {
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding: 1rem 0;
}

.section-container.bg-dark details {
    border-bottom-color: rgba(255,255,255,0.1);
}

summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: "+";
    font-size: 1.2rem;
    font-weight: 400;
}

details[open] summary::after {
    content: "−";
}

details p {
    margin-top: 0.75rem;
    color: inherit;
    opacity: 0.9;
}

/* === 组件：步骤条 === */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--gap);
}

.step-item {
    position: relative;
    padding-left: 2.5rem;
}

.step-number {
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    background-color: var(--color-accent);
    color: var(--bg-dark);
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === 组件：场景标签 === */
.scenario-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.tag-problem { background: rgba(255, 80, 80, 0.15); color: #d64040; }
.tag-action { background: rgba(20, 44, 235, 0.15); color: var(--color-brand); }
.tag-result { background: rgba(110, 175, 237, 0.15); color: #3a8fd1; }

.section-container.bg-dark .tag-problem { background: rgba(255, 80, 80, 0.2); color: #ff8888; }
.section-container.bg-dark .tag-action { background: rgba(110, 175, 237, 0.2); color: var(--color-accent); }
.section-container.bg-dark .tag-result { background: rgba(110, 175, 237, 0.2); color: #a0cfeb; }

/* === SVG 动效关键帧 === */
@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

@keyframes draw-line {
    0% { stroke-dashoffset: 1; }
    100% { stroke-dashoffset: 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes pulse-dot {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* === SVG 动效类 === */
.star {
    animation: twinkle 4s infinite ease-in-out;
}
.star:nth-child(odd) { animation-delay: 1s; }
.star:nth-child(even) { animation-delay: 2.5s; }

.draw-path {
    pathLength: 1;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: draw-line 3s ease forwards;
}

.float-element {
    animation: float 6s infinite ease-in-out;
}

.pulse-dot {
    animation: pulse-dot 2s infinite ease-in-out;
}

/* 减少动态效果 */
@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;
    }
    .star, .draw-path, .float-element, .pulse-dot {
        animation: none !important;
        opacity: 1 !important;
        stroke-dashoffset: 0 !important;
    }
}

/* === 响应式适配 === */
@media (max-width: 900px) {
    .layout-grid {
        flex-direction: column;
    }
    
    .sidebar-brand {
        position: relative;
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.5rem;
        position: sticky;
        top: 0;
    }
    
    .sidebar-brand h1 {
        margin-bottom: 0;
        font-size: 1.1rem;
    }
    
    .sidebar-nav ul {
        flex-direction: row;
        gap: 0.25rem;
    }
    
    .sidebar-nav a {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .content-scroll-wrapper {
        height: auto;
        overflow-y: visible;
    }
    
    .steps-grid,
    .feature-grid,
    .news-grid,
    .checklist-grid,
    .nav-links-grid,
    .toc-list {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        min-width: 0;
    }
}

/* === 页面特定微调 === */
.hero-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

@media (max-width: 900px) {
    .hero-layout {
        grid-template-columns: 1fr;
    }
}

.feature-group {
    margin-bottom: 2rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--gap);
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--gap);
}

.scenario-block {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border-left: 3px solid var(--color-accent);
    background-color: rgba(0,0,0,0.02);
}

.section-container.bg-dark .scenario-block {
    background-color: rgba(255,255,255,0.03);
}

/* 辅助文字 */
.lead-text {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
    max-width: 65ch;
}

.text-small {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: 1rem;
}

/* 链接样式 */
a.link-highlight {
    color: var(--color-brand);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.section-container.bg-dark a.link-highlight {
    color: var(--color-accent);
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
