@import url("https://fonts.googleapis.com/css2?family=BIZ+Plex+Sans:wght@400;500;600;700&family=BIZ+Plex+Mono:wght@400;500;600&display=swap");

:root {
    --font-sans: "BIZ Plex Sans", "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
    --font-mono: "BIZ Plex Mono", "SFMono-Regular", Consolas, monospace;
    --radius-xl: 26px;
    --radius-lg: 16px;
    --radius-md: 8px;
    --radius-sm: 4px;
    --max-width: 1220px;
    --transition-standard: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme (dijin Gradient) */
[data-theme="light"] {
    --bg: #edf3f8;
    --surface: rgba(255, 255, 255, 0.65);
    --surface26: rgba(255, 255, 255, 0.26);
    --surface-hover: rgba(255, 255, 255, 0.6);
    --text: #142033;
    --text-surface: #424750;
    --text-muted: #5a6982;
    --line: rgba(16, 34, 57, 0.15);
    --accent: #0f62fe;
    --accent-strong: #0043ce;
    --dijin-border: rgba(99, 154, 255, 0.8);
    --dijin-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(237, 243, 248, 0.95));
    --wave-glow: rgba(255, 255, 255, 0.9);
}

/* Dark Theme (dijin Gradient) */
[data-theme="dark"] {
    --bg: #121619; /* BIZ Dark */
    --surface: rgba(30, 35, 41, 0.65);
    --surface26: rgba(30, 35, 41, 0.55);
    --surface-hover: rgba(45, 50, 56, 0.7);
    --text: #f4f4f4;
    --text-surface: #c2c5c9;
    --text-muted: #a8b2c1;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #4778cd; 
    --accent-strong: #a6c8ff;
    --dijin-border: rgba(255, 255, 255, 0.35);
    --dijin-gradient: linear-gradient(180deg, rgba(30, 35, 41, 0.8), rgba(18, 22, 25, 0.95));
    --wave-glow: rgba(255, 255, 255, 0.1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg) var(--dijin-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0s, color 0.3s; /* 背景突变配合 Glitch，文字平滑 */
}

/* 网格背景 */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: 
        linear-gradient(to right, var(--line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--line) 1px, transparent 1px);
    background-size: 64px 64px;
    opacity: 0.5;
    z-index: -1;
}

/* 布局与通用 */
a { color: inherit; text-decoration: none; }
.shell { width: min(calc(100% - 32px), var(--max-width)); margin: 0 auto; padding: 20px 0 80px; }

/* 头部导航 */
.site-header {
    position: sticky; top: 12px; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    backdrop-filter: blur(20px) saturate(150%);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 14px; height: 14px; background: var(--accent); }
.brand-stack strong { font-size: 1.1rem; letter-spacing: -0.02em; }
.brand-stack span { font-size: 0.8rem; color: var(--text-muted); font-family: var(--font-mono); }

.site-nav { display: flex; gap: 12px; align-items: center; }
.nav-link { padding: 6px 12px; border-radius: var(--radius-sm); font-size: 0.9rem; transition: var(--transition-standard); }
.nav-link:hover, .nav-link.is-active { background: var(--dijin-border); color: var(--text-surface); }

/* 主题切换按钮 */
.theme-btn {
    background: transparent; border: 1px solid var(--line); color: var(--text);
    padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer;
    font-family: var(--font-mono); font-size: 0.8rem;
}

/* wave Design 卡片 (核心实现) */
.wave-card {
    position: relative;
    border: 1px solid var(--line);
    background: var(--surface);
    overflow: hidden;
    padding: 24px;
    /* 应用硬阴影 */
    box-shadow: var(--hard-shadow);
    transition: transform 0.2s, box-shadow 0.1s linear;
}

.wave-card:hover {
    background: var(--surface-hover);
    color: var(--text-surface);
}

/* 高光悬浮光斑 - 边缘也是白色 */
.wave-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(600px circle at var(--mouse-x, 0) var(--mouse-y, 0), var(--wave-glow), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 0;
    border: 2px solid var(--dijin-border); /* 强制边缘高光 */
    mask-image: radial-gradient(600px circle at var(--mouse-x, 0) var(--mouse-y, 0), black 20%, transparent 70%);
}
.wave-card:hover::before { opacity: 1; }
.wave-card > * { position: relative; z-index: 1; }
.button::before{z-index: 11;}

/* Hero 区域 */
.hero { margin-top: 40px; text-align: center; padding: 60px 20px; }
.eyebrow { font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.1em; }
.hero h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); margin: 16px 0; letter-spacing: -0.04em; }
.hero p { max-width: 600px; margin: 0 auto 30px; color: var(--text-muted); line-height: 1.6; }
.hero .highlight {
  background: linear-gradient(-135deg, var(--accent), var(--accent), var(--accent-strong));
  -webkit-background-clip: text;-webkit-text-fill-color: transparent;background-clip: text;
}

/* 按钮 */
.button {
    display: inline-flex; padding: 10px 20px; border-radius: var(--radius-sm);
    font-weight: 500; transition: var(--transition-standard); border: 1px solid var(--line);
}
.button.is-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.button.is-primary:hover { background: var(--accent-strong); }

/* 网格布局 */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; margin-top: 40px; }

/* 滚动显示 */
[data-reveal] { opacity: 0; transform: translateY(20px); transition: all 600ms ease; }
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

/* =========================================
   核心样式
   ========================================= */
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-sans); color: var(--text); background: var(--bg); transition: background 0.3s, color 0.3s; }

/* 硬阴影通用类 */
.hard-shadowed {
    box-shadow: var(--hard-shadow);
    transition: box-shadow 0.1s linear; /* 阴影随时间平滑移动 */
}

/* 导航栏 - 融合 BIZ 严谨与硬阴影 */
.site-header {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    /* 导航栏作为底层组件，不一定需要阴影，保持干净 */
}
.site-header::before{
    border-radius: 17px;
}

/* --- Stutter 3.5: 逻辑修正版 --- */

/* 1. 退出态：蓄能感 */
.reconfig-exit {
    animation: reconfig-charge 0.4s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes reconfig-charge {
    0% { transform: scale(1); filter: brightness(1) blur(0); }
    100% { 
        transform: scale(0.92) translateY(10px); 
        filter: brightness(0) blur(10px); /* 坠入黑暗，准备爆发 */
        opacity: 0;
    }
}

/* 2. 进入态：从极度拉伸中“砸”回原位 */
.reconfig-enter {
    animation: reconfig-snap 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes reconfig-snap {
    0% { 
        transform: scaleX(1.5) scaleY(0.1) translateY(-100px); 
        filter: brightness(3) contrast(2); 
        opacity: 0;
    }
    100% { 
        transform: scale(1) translateY(0); 
        filter: brightness(1) contrast(1); 
        opacity: 1;
    }
}

/* 模拟 Reconfig 过程中的元素缺失 */
.reconfig-glitch-hidden {
    visibility: hidden !important;
    /* 或者使用 display: none，但 visibility 会保留布局空间，减少抖动 */
}

/* 切镜闪烁控制 */
.reconfig-flash {
    position: fixed; inset: 0; z-index: 9999;
    pointer-events: none;
    opacity: 0;
}

/* 深 -> 浅：爆发白光 */
[data-theme="light"] .reconfig-flash {
    background: #fff;
    animation: flash-burst 0.6s step-end;
}

/* 浅 -> 深：瞬间黑屏 */
[data-theme="dark"] .reconfig-flash {
    background: #000;
    animation: flash-burst 0.6s step-end;
}

@keyframes flash-burst {
    0% { opacity: 0; }
    50% { opacity: 1; } /* 刚好在 JS 切换主题的那一帧达到最值 */
    55% { opacity: 0; }
}

.docs-api section{ margin: 2em 0px; }
.docs-api .wave-card { color: var(--text); }

/* 启动画面基础容器 */
.splash-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.splash-overlay.theme-transition {
    animation: fade-to-theme 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.splash-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brain-icon {
 font-size: 3.5rem;
}

 .splash-thinking.is-minified .brain-icon {
 font-size: 1.4rem;
}

/* 🧠 Thinking 初始抬起动画 */
.splash-thinking {
    font-size: 2.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 16px;
    opacity: 0;
    transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    animation: slide-up-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.splash-thinking.is-rising {
    animation: thinking-rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.brain-icon { font-size: 3.2rem; }

/* Thinking 缩小并移到右下角 */
.splash-thinking.is-minified {
    position: fixed;
    right: 40px;
    bottom: 120px;
    font-size: 1.2rem;
    gap: 8px;
    opacity: 0.8;
    /* animation: mind-in-out 2s; */
    /* animation: thinking-minify 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; */
}
.splash-thinking.is-minified .brain-icon { font-size: 1.5rem; }

/* 信息列表：初始隐藏，Reconfig 时复位弹出 */
.splash-info {
    margin-top: 32px;
    font-family: var(--font-mono);
    font-size: 1rem;
    line-height: 2;
    color: var(--text-muted);
    /* transform: translateY(-20px); */
}

/* 核心：复用 Reconfig-snap 动效 */
.splash-info.is-visible {
    opacity: 1;
    /* 应用你定义的从拉伸到复位的动效 */
    animation: reconfig-snap 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.info-item {
 opacity: 0;
 transform: translateY(-20px);
}

.info-item .highlight {
    color: var(--accent);
    font-weight: 600;
}

.info-item.is-visible {
 animation: item-slide-in 2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 整体退出 */
.splash-exit {
    opacity: 0;
    filter: blur(20px);
    animation: splash-fade-out 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* 关键帧：初始进入 */
@keyframes slide-up-in {
    0% { transform: translateY(60px); opacity: 0; filter: blur(5px); }
    100% { transform: translateY(0); opacity: 1; filter: blur(0); }
}

@keyframes fade-to-theme {
    0% { background: #1a1a2e;}
    100% { background: var(--bg);}
}

 @keyframes thinking-rise {
 0% {
 transform: translateY(80px);
 opacity: 0;
 filter: blur(8px);
}
 100% {
 transform: translateY(0);
 opacity: 1;
 filter: blur(0);
}
}

 @keyframes thinking-minify {
 0% {
 font-size: 3rem;
 gap: 12px;
}
 100% {
 font-size: 1.1rem;
 gap: 8px;
 opacity: 0.7;
}
}

/* 复用/补充你的 reconfig-snap */
@keyframes reconfig-snap {
    0% { 
        transform: scaleX(1.3) scaleY(0.1) translateY(20px); 
        filter: brightness(2); 
        opacity: 0;
    }
    100% { 
        transform: scale(1) translateY(0); 
        filter: brightness(1); 
        opacity: 1;
    }
}
 @keyframes item-slide-in {
 0% {
 transform: translateY(60px);
 opacity: 0;
}
 100% {
 transform: translateY(0);
 opacity: 1;
}
}

/* 强制显隐 */
@keyframes op-in-out {
    0% { opacity: 0; }
    60% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes mind-in-out {
    0% { transform: translateY(80px);opacity: 0; }
    60% { opacity: 0; }
    100% { transform: translateY(0px);opacity: 1; }
}

/* 加载指示器 */
 .loading-dots {
 display: inline-block;
}
 .loading-dots::after {
 content: '';
 animation: dots 1.5s steps(4, end) infinite;
}
 @keyframes dots {
 0%, 20% { content: '';}
 40% { content: '.';}
 60% { content: '..';}
 80%, 100% { content: '...';}
}