/* === Spak 官网完整样式 === */

:root {
    --bg: #f8fafc;
    --card: #ffffff;
    --card-border: #e2e8f0;
    --text: #1e293b;
    --text-dim: #64748b;
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-bg: #eef2ff;
    --accent: #14b8a6;
    --accent-bg: #ccfbf1;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --max-width: 1120px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent); }

/* === 导航栏 === */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(248,250,252,.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    /* 默认隐藏（防闪现） */
    transform: translateY(-100%);
    opacity: 0;
}
nav.nav-enter {
    animation: navSlideIn .45s cubic-bezier(.22,1,.36,1) forwards;
}

nav .nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

nav .logo {
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
}
nav .logo:hover { color: var(--text); }
nav .logo span { color: var(--primary); }

.nav-links {
    display: flex;
    gap: 2px;
    list-style: none;
    align-items: center;
}

.nav-links a {
    color: var(--text-dim);
    font-weight: 500;
    font-size: .9rem;
    padding: 8px 14px;
    border-radius: 8px;
    transition: background .2s, color .2s;
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    background: var(--primary-bg);
}

/* 汉堡菜单按钮 */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
}

/* === 页脚 === */
footer {
    margin-top: auto;
    border-top: 1px solid var(--card-border);
    padding: 40px 0 24px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 32px;
}

.footer-grid h4 {
    font-weight: 600;
    margin-bottom: 12px;
    font-size: .9rem;
}

.footer-grid ul { list-style: none; }
.footer-grid li { margin-bottom: 6px; }
.footer-grid li a { font-size: .88rem; color: var(--text-dim); }
.footer-grid li a:hover { color: var(--primary); }

.footer-desc { color: var(--text-dim); font-size: .88rem; line-height: 1.6; }

.footer-bottom {
    text-align: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--card-border);
    font-size: .82rem;
    color: var(--text-dim);
}

/* === 通用组件 === */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 28px 32px;
    transition:
        opacity .5s cubic-bezier(.22,1,.36,1),
        transform .5s cubic-bezier(.22,1,.36,1),
        box-shadow .3s ease,
        border-color .3s ease,
        background .3s ease;
}
.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* ==========================================
   🃏 卡片组件状态动画
   进入 · 移入 · 移出 · 选中 · 未选中
   ========================================== */

/* 帧动画：进入：从下方浮起 */
@keyframes cardEnter {
    0%   { opacity: 0; transform: translateY(28px) scale(0.95); }
    60%  { opacity: 1; transform: translateY(-4px) scale(1.01); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
/* 帧动画：退出：下沉淡出 */
@keyframes cardLeave {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(20px) scale(0.94); }
}
/* 帧动画：选中脉冲 */
@keyframes cardSelectedPulse {
    0%   { box-shadow: 0 0 0 0 rgba(99,102,241,.4); }
    50%  { box-shadow: 0 0 0 4px rgba(99,102,241,.15); }
    100% { box-shadow: 0 0 0 2px rgba(99,102,241,.25); }
}

/* ---- 进入动画 ---- */
.card-enter {
    animation: cardEnter .5s cubic-bezier(.22,1,.36,1) forwards;
}
.card-enter:nth-child(1) { animation-delay: 0s; }
.card-enter:nth-child(2) { animation-delay: .08s; }
.card-enter:nth-child(3) { animation-delay: .16s; }
.card-enter:nth-child(4) { animation-delay: .24s; }
.card-enter:nth-child(5) { animation-delay: .32s; }
.card-enter:nth-child(6) { animation-delay: .40s; }
.card-enter:nth-child(7) { animation-delay: .48s; }
.card-enter:nth-child(8) { animation-delay: .56s; }

/* ---- 鼠标移入 ---- */
.card-hover-in {
    transform: translateY(-5px) scale(1.025) !important;
    box-shadow: 0 8px 25px rgba(99,102,241,.12), 0 2px 8px rgba(0,0,0,.06) !important;
    border-color: var(--primary-light) !important;
}

/* ---- 鼠标移出 ---- */
.card-hover-out {
    transform: translateY(0) scale(1) !important;
    box-shadow: var(--shadow) !important;
    border-color: var(--card-border) !important;
}

/* ---- 选中 ---- */
.card-selected {
    border-color: var(--primary) !important;
    background: var(--primary-bg) !important;
    animation: cardSelectedPulse .6s ease-out forwards;
    transform: translateY(-2px) scale(1.01) !important;
    box-shadow: 0 0 0 2px var(--primary-bg), 0 4px 14px rgba(99,102,241,.15) !important;
}

/* ---- 未选中：平滑退回 ---- */
.card-unselected {
    transform: translateY(0) scale(1) !important;
    box-shadow: var(--shadow) !important;
    border-color: var(--card-border) !important;
    background: var(--card) !important;
    opacity: .92 !important;
}

/* ---- 退出 ---- */
.card-exit {
    animation: cardLeave .35s cubic-bezier(.55,0,.1,1) forwards;
    pointer-events: none;
}

/* 手机上减缓动画 */
@media (max-width: 768px) {
    .card-enter { animation-duration: .4s; }
    .card-enter:nth-child(1) { animation-delay: 0s; }
    .card-enter:nth-child(2) { animation-delay: .06s; }
    .card-enter:nth-child(3) { animation-delay: .12s; }
    .card-enter:nth-child(4) { animation-delay: .18s; }
    .card-enter:nth-child(5) { animation-delay: .24s; }
    .card-enter:nth-child(6) { animation-delay: .30s; }
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .875em;
    color: #0f172a;
}

pre {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    overflow-x: auto;
    font-size: .85rem;
    line-height: 1.6;
}
pre code { background: none; color: inherit; padding: 0; }

.tag {
    display: inline-block;
    background: var(--primary-bg);
    color: var(--primary);
    font-size: .78rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 20px;
}

.section-title {
    font-size: 1.7rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.section-sub {
    color: var(--text-dim);
    font-size: 1.05rem;
    margin-bottom: 32px;
}

.page-section { padding: 48px 0; }
.page-section:first-of-type { padding-top: 40px; }

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 8px;
    transition: background .2s, transform .2s;
    cursor: pointer;
    border: none;
    font-size: .9rem;
}
.btn:hover {
    background: var(--primary-dark);
    color: #fff;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}
th, td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--card-border);
}
th {
    font-weight: 600;
    color: var(--text-dim);
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: #f8fafc;
}
tr:last-child td { border-bottom: none; }

/* === 网格布局 === */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 24px; }

/* === 响应式 === */

/* 平板竖屏起 */
@media (max-width: 992px) {
    .grid-4 { grid-template-columns: 1fr 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* 手机 */
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

    .nav-toggle { display: block; }

    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--card);
        border-bottom: 1px solid var(--card-border);
        flex-direction: column;
        padding: 8px 16px 16px;
        gap: 2px;
        box-shadow: var(--shadow-md);
    }
    .nav-links.open { display: flex; }

    .nav-links a {
        display: block;
        padding: 10px 14px;
        width: 100%;
    }

    .footer-grid { grid-template-columns: 1fr; gap: 24px; }

    .section-title { font-size: 1.4rem; }
    .section-sub { font-size: .95rem; }

    .page-section { padding: 32px 0; }

    .card { padding: 20px; }

    pre { font-size: .78rem; padding: 12px 14px; }
}

/* 小手机 */
@media (max-width: 480px) {
    .container { padding: 0 16px; }
    nav .nav-inner { padding: 0 16px; }
}

/* ==========================================
   🎞️ 页面切换动画系统
   ========================================== */

/* ---- 过渡遮罩层 ---- */
.page-transition {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 9999;
    pointer-events: none;
}
.page-transition.active { pointer-events: auto; }

/* ---- 共用帧动画 ---- */
@keyframes wipeInLeft {
    0%   { clip-path: inset(0 100% 0 0); }
    100% { clip-path: inset(0 0 0 0); }
}
@keyframes wipeOutLeft {
    0%   { clip-path: inset(0 0 0 0); }
    100% { clip-path: inset(0 100% 0 0); }
}
@keyframes wipeInRight {
    0%   { clip-path: inset(0 0 0 100%); }
    100% { clip-path: inset(0 0 0 0); }
}
@keyframes wipeOutRight {
    0%   { clip-path: inset(0 0 0 0); }
    100% { clip-path: inset(0 0 0 100%); }
}
@keyframes wipeInUp {
    0%   { clip-path: inset(100% 0 0 0); }
    100% { clip-path: inset(0 0 0 0); }
}
@keyframes wipeOutDown {
    0%   { clip-path: inset(0 0 0 0); }
    100% { clip-path: inset(100% 0 0 0); }
}
@keyframes slideInRight {
    0%   { transform: translateX(100%); }
    100% { transform: translateX(0); }
}
@keyframes slideOutLeft {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}
@keyframes slideInLeft {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(0); }
}
@keyframes slideOutRight {
    0%   { transform: translateX(0); }
    100% { transform: translateX(100%); }
}

/* ---- 动画类 ---- */

/* 横扫左 (新页从左滑入，旧页向左滑出) */
.transition-sweep-left .page-transition-out {
    animation: wipeOutLeft 0.35s ease-in forwards;
}
.transition-sweep-left .page-transition-in {
    animation: wipeInLeft 0.35s ease-out 0.15s forwards;
}

/* 横扫右 (新页从右滑入，旧页向右滑出) */
.transition-sweep-right .page-transition-out {
    animation: wipeOutRight 0.35s ease-in forwards;
}
.transition-sweep-right .page-transition-in {
    animation: wipeInRight 0.35s ease-out 0.15s forwards;
}

/* 扫页上 (新页从上扫入，旧页向下扫出) */
.transition-sweep-up .page-transition-out {
    animation: wipeOutDown 0.35s ease-in forwards;
}
.transition-sweep-up .page-transition-in {
    animation: wipeInUp 0.35s ease-out 0.15s forwards;
}

/* 平推左 (整页向左平移) */
.transition-slide-left .page-transition-out {
    animation: slideOutLeft 0.4s ease-in forwards;
}
.transition-slide-left .page-transition-in {
    animation: slideInRight 0.4s ease-out 0.2s forwards;
}

/* 平推右 (整页向右平移) */
.transition-slide-right .page-transition-out {
    animation: slideOutRight 0.4s ease-in forwards;
}
.transition-slide-right .page-transition-in {
    animation: slideInLeft 0.4s ease-out 0.2s forwards;
}

/* ---- 内容淡出辅助 ---- */
.transition-fade .page-transition-out {
    animation: fadeOut 0.2s ease forwards;
}
.transition-fade .page-transition-in {
    animation: fadeIn 0.25s ease 0.1s forwards;
}
@keyframes fadeOut {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}
@keyframes fadeIn {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

/* ---- 禁用交互 ---- */
.page-transitioning body {
    pointer-events: none;
    overflow: hidden;
}

/* ==========================================
   🚀 页面加载进入动画
   导航栏 + 英雄区分段时序
   ========================================== */

/* ---- 帧动画 ---- */
@keyframes navSlideIn {
    0%   { transform: translateY(-100%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}
@keyframes heroTagPop {
    0%   { transform: scale(0); opacity: 0; }
    70%  { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes heroTitleLeft {
    0%   { transform: translateX(-60px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}
@keyframes heroTitleRight {
    0%   { transform: translateX(60px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}
@keyframes heroFadeUp {
    0%   { transform: translateY(24px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}
@keyframes heroBtnPop {
    0%   { transform: scale(0.6); opacity: 0; }
    65%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes heroBadgeSlide {
    0%   { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* ---- 导航进入 ---- */
nav.nav-enter {
    animation: navSlideIn .45s cubic-bezier(.22,1,.36,1) forwards;
}

/* ==========================================
   📄 通用页面内容进入动画（所有页面共用）
   ========================================== */

/* 页面标题：从左滑入 */
.page-load-enter .section-title {
    animation: heroTitleLeft .55s cubic-bezier(.22,1,.36,1) both;
    animation-delay: .15s;
}

/* 页面副标题：从右滑入 */
.page-load-enter .section-sub {
    animation: heroTitleRight .5s cubic-bezier(.22,1,.36,1) both;
    animation-delay: .25s;
}

/* 第一层卡片：大动态飞入（同 hero 卡片） */
.page-load-enter .card {
    opacity: 0;
    transform: translateY(60px) scale(0.85);
}
.page-load-enter .card:nth-child(1) { animation: heroCardEnter .6s cubic-bezier(.22,1,.36,1) forwards; animation-delay: .4s; }
.page-load-enter .card:nth-child(2) { animation: heroCardEnter .6s cubic-bezier(.22,1,.36,1) forwards; animation-delay: .5s; }
.page-load-enter .card:nth-child(3) { animation: heroCardEnter .6s cubic-bezier(.22,1,.36,1) forwards; animation-delay: .6s; }
.page-load-enter .card:nth-child(4) { animation: heroCardEnter .6s cubic-bezier(.22,1,.36,1) forwards; animation-delay: .7s; }
.page-load-enter .card:nth-child(5) { animation: heroCardEnter .6s cubic-bezier(.22,1,.36,1) forwards; animation-delay: .8s; }
.page-load-enter .card:nth-child(6) { animation: heroCardEnter .6s cubic-bezier(.22,1,.36,1) forwards; animation-delay: .9s; }
.page-load-enter .card:nth-child(7) { animation: heroCardEnter .6s cubic-bezier(.22,1,.36,1) forwards; animation-delay: 1s; }
.page-load-enter .card:nth-child(8) { animation: heroCardEnter .6s cubic-bezier(.22,1,.36,1) forwards; animation-delay: 1.1s; }

/* 表格：淡入浮起 */
.page-load-enter .card table,
.page-load-enter table.card-style {
    animation: heroFadeUp .5s cubic-bezier(.22,1,.36,1) both;
    animation-delay: .5s;
}

/* 代码块 — 用 nth-of-type 确保无论前面有几个兄弟元素都能匹配 */
.page-load-enter pre {
    opacity: 0;
    transform: translateY(16px);
    animation: heroFadeUp .45s cubic-bezier(.22,1,.36,1) forwards;
}
.page-load-enter pre:nth-of-type(1) { animation-delay: .35s; }
.page-load-enter pre:nth-of-type(2) { animation-delay: .45s; }
.page-load-enter pre:nth-of-type(3) { animation-delay: .55s; }
.page-load-enter pre:nth-of-type(4) { animation-delay: .65s; }
.page-load-enter pre:nth-of-type(5) { animation-delay: .75s; }
.page-load-enter pre:nth-of-type(6) { animation-delay: .85s; }

/* 标签 tag */
.page-load-enter .tag {
    animation: heroTagPop .4s cubic-bezier(.34,1.56,.64,1) both;
    animation-delay: .05s;
}

/* 按钮组 */
.page-load-enter .btn {
    opacity: 0;
}
.page-load-enter .btn:nth-child(1) { animation: heroBtnPop .45s cubic-bezier(.34,1.56,.64,1) both; animation-delay: .35s; }
.page-load-enter .btn:nth-child(2) { animation: heroBtnPop .45s cubic-bezier(.34,1.56,.64,1) both; animation-delay: .45s; }

/* 手机上缩短延迟 */
@media (max-width: 768px) {
    .page-load-enter .section-title { animation-delay: .1s; }
    .page-load-enter .section-sub   { animation-delay: .18s; }
    .page-load-enter .card:nth-child(1) { animation-delay: .3s; }
    .page-load-enter .card:nth-child(2) { animation-delay: .38s; }
    .page-load-enter .card:nth-child(3) { animation-delay: .46s; }
    .page-load-enter .card:nth-child(4) { animation-delay: .54s; }
    .page-load-enter .card:nth-child(5) { animation-delay: .62s; }
    .page-load-enter .card:nth-child(6) { animation-delay: .7s; }
}

/* ---- 英雄区子元素各自动画 ---- */
.hero-enter .hero-tag {
    animation: heroTagPop .5s cubic-bezier(.34,1.56,.64,1) both;
    animation-delay: .1s;
}
.hero-enter .hero-title-line1 {
    animation: heroTitleLeft .55s cubic-bezier(.22,1,.36,1) both;
    animation-delay: .25s;
}
.hero-enter .hero-title-line2 {
    animation: heroTitleRight .55s cubic-bezier(.22,1,.36,1) both;
    animation-delay: .35s;
}
.hero-enter .hero-desc {
    animation: heroFadeUp .5s cubic-bezier(.22,1,.36,1) both;
    animation-delay: .5s;
}
.hero-enter .hero-btns {
    animation: heroBtnPop .5s cubic-bezier(.34,1.56,.64,1) both;
    animation-delay: .65s;
}
.hero-enter .hero-badges {
    animation: heroBadgeSlide .45s cubic-bezier(.22,1,.36,1) both;
    animation-delay: .85s;
}

/* ---- 英雄区卡片专用进入帧动画：更大幅度 ---- */
@keyframes heroCardEnter {
    0%   {
        opacity: 0;
        transform: translateY(60px) scale(0.85);
        box-shadow: none;
    }
    50%  {
        opacity: 1;
        transform: translateY(-8px) scale(1.03);
        box-shadow: 0 12px 40px rgba(99,102,241,.18);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        box-shadow: var(--shadow);
    }
}

/* 英雄区卡片（大动态飞入） */
.hero-enter .hero-cards .card {
    opacity: 0;
    transform: translateY(60px) scale(0.85);
}
.hero-enter .hero-cards .card:nth-child(1) {
    animation: heroCardEnter .6s cubic-bezier(.22,1,.36,1) forwards;
    animation-delay: 1s;
}
.hero-enter .hero-cards .card:nth-child(2) {
    animation: heroCardEnter .6s cubic-bezier(.22,1,.36,1) forwards;
    animation-delay: 1.12s;
}
.hero-enter .hero-cards .card:nth-child(3) {
    animation: heroCardEnter .6s cubic-bezier(.22,1,.36,1) forwards;
    animation-delay: 1.24s;
}

/* 手机上缩短延迟 */
@media (max-width: 768px) {
    .hero-enter .hero-tag     { animation-delay: .05s; }
    .hero-enter .hero-title-line1 { animation-delay: .15s; }
    .hero-enter .hero-title-line2 { animation-delay: .22s; }
    .hero-enter .hero-desc   { animation-delay: .32s; }
    .hero-enter .hero-btns   { animation-delay: .42s; }
    .hero-enter .hero-badges { animation-delay: .55s; }
    .hero-enter .hero-cards .card:nth-child(1) { animation-delay: .65s; }
    .hero-enter .hero-cards .card:nth-child(2) { animation-delay: .72s; }
    .hero-enter .hero-cards .card:nth-child(3) { animation-delay: .79s; }
}

/* ---- 各页面元素统一接收动画 ---- */
.page-transition-out {
    animation-fill-mode: forwards;
}
.page-transition-in {
    animation-fill-mode: forwards;
    opacity: 0;
}

/* ==========================================
   👁️ 滚动驱动视觉动画系统
   进入视口播进入，滚出视口播退出
   ========================================== */

/* 所有滚动监听元素默认隐藏 + 可过渡 */
[data-scroll],
.scroll-observe {
    opacity: 0;
    transition:
        opacity .5s cubic-bezier(.22,1,.36,1),
        transform .5s cubic-bezier(.22,1,.36,1);
}

/* 卡片不受 scroll-observe 影响（卡片有自己的 card-enter 动画） */
.card.scroll-observe,
.card[data-scroll] {
    opacity: 1 !important;
    transform: none !important;
}

/* ---- 进入动画变体: 通过 data-scroll-enter 控制 ---- */

/* 默认: 从下浮起 */
[data-scroll]:not([data-scroll-enter]),
[data-scroll-enter="up"],
.scroll-observe:not(.card) {
    transform: translateY(32px);
}

/* 从左滑入 */
[data-scroll-enter="left"] {
    transform: translateX(-40px);
}

/* 从右滑入 */
[data-scroll-enter="right"] {
    transform: translateX(40px);
}

/* 缩放进入 */
[data-scroll-enter="zoom"] {
    transform: scale(0.85);
}

/* 从上方降下 */
[data-scroll-enter="down"] {
    transform: translateY(-32px);
}

/* ---- 进入视口：可见 + 归位 ---- */
[data-scroll].scroll-visible,
.scroll-observe.scroll-visible {
    opacity: 1 !important;
    transform: translateX(0) translateY(0) scale(1) !important;
}

/* ---- 退出动画变体: 通过 data-scroll-exit 控制 ---- */

/* 默认: 下沉淡出（与 card-exit 一致） */
[data-scroll].scroll-hidden:not([data-scroll-exit]),
[data-scroll-exit="down"] {
    animation: cardLeave .35s cubic-bezier(.55,0,.1,1) forwards !important;
}

/* 向左滑出 */
[data-scroll-exit="left"] {
    animation: scrollExitLeft .35s cubic-bezier(.55,0,.1,1) forwards !important;
}

/* 向右滑出 */
[data-scroll-exit="right"] {
    animation: scrollExitRight .35s cubic-bezier(.55,0,.1,1) forwards !important;
}

/* 缩小消失 */
[data-scroll-exit="zoom"] {
    animation: scrollExitZoom .35s cubic-bezier(.55,0,.1,1) forwards !important;
}

/* 向上飘出 */
[data-scroll-exit="up"] {
    animation: scrollExitUp .35s cubic-bezier(.55,0,.1,1) forwards !important;
}

/* 退出帧动画 */
@keyframes scrollExitLeft {
    0%   { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(-30px); }
}
@keyframes scrollExitRight {
    0%   { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(30px); }
}
@keyframes scrollExitZoom {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.8); }
}
@keyframes scrollExitUp {
    0%   { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-30px); }
}

/* 卡片也在滚动观察范围内 —— 覆盖 card 原有样式 */
.card.scroll-hidden {
    pointer-events: none;
}

/* ---- stagger 延迟（每多一个子元素延迟递增） ---- */
[data-scroll-stagger] > [data-scroll],
[data-scroll-stagger] > .scroll-observe {
    transition-delay: calc(var(--scroll-i, 0) * 0.1s);
}

/* 手机上减缓 */
@media (max-width: 768px) {
    [data-scroll],
    .scroll-observe {
        transition-duration: .35s;
    }
}

/* ==========================================
   📖 文档系统布局
   左侧导航树 + 右侧内容区
   ========================================== */

.doc-layout {
    display: flex;
    gap: 0;
    min-height: calc(100vh - 60px - 200px);
}

/* 左侧栏 */
.doc-sidebar {
    width: 260px;
    flex-shrink: 0;
    border-right: 1px solid var(--card-border);
    padding: 24px 0;
    overflow-y: auto;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    background: var(--card);
}

/* 分类标题 */
.doc-category {
    padding: 6px 20px;
    font-weight: 600;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: color .2s;
}
.doc-category:hover { color: var(--primary); }
.doc-category .arrow {
    font-size: .7rem;
    transition: transform .25s;
}
.doc-category.open .arrow {
    transform: rotate(90deg);
}

/* 文章列表（默认隐藏，展开时显示） */
.doc-articles {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s cubic-bezier(.4,0,.2,1);
}
.doc-articles.open {
    max-height: 500px;
}

.doc-articles li a {
    display: block;
    padding: 6px 20px 6px 32px;
    font-size: .88rem;
    color: var(--text-dim);
    border-left: 3px solid transparent;
    transition: all .2s;
}
.doc-articles li a:hover {
    color: var(--primary);
    background: var(--primary-bg);
}
.doc-articles li a.active {
    color: var(--primary);
    border-left-color: var(--primary);
    background: var(--primary-bg);
    font-weight: 600;
}

/* 右侧内容区 */
.doc-content {
    flex: 1;
    padding: 32px 48px 60px;
    max-width: 800px;
}

.doc-content h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--card-border);
}

.doc-content h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 10px;
}

.doc-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 8px;
}

.doc-content p {
    margin-bottom: 12px;
    color: var(--text-dim);
    line-height: 1.8;
}

.doc-content ul, .doc-content ol {
    margin-bottom: 12px;
    padding-left: 24px;
    color: var(--text-dim);
}

.doc-content li { margin-bottom: 4px; }

.doc-content pre {
    margin-bottom: 16px;
}

.doc-content table {
    margin-bottom: 16px;
}

/* 文档内的 blockquote（提醒块） */
.doc-content blockquote {
    border-left: 4px solid var(--primary-light);
    background: var(--primary-bg);
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-dim);
    font-size: .9rem;
}

/* 上下章节导航 */
.doc-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--card-border);
}
.doc-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    font-size: .88rem;
    transition: all .25s;
    max-width: 45%;
}
.doc-nav a:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}
.doc-nav .nav-disabled {
    opacity: .3;
    pointer-events: none;
}
.doc-nav .nav-prev { margin-right: auto; }
.doc-nav .nav-next { margin-left: auto; }

/* 文章内容区切换动画 */
.doc-article-content {
    animation: docFadeIn .3s ease both;
}
@keyframes docFadeIn {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* 文档页移动端 */
@media (max-width: 768px) {
    .doc-layout {
        flex-direction: column;
    }
    .doc-sidebar {
        width: 100%;
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
        padding: 12px 0;
    }
    .doc-content {
        padding: 20px 16px 40px;
    }
    .doc-nav a { font-size: .8rem; padding: 6px 12px; }
}

