/* ===== 森瑞实验室 · 技术博客样式 ===== */
:root {
    --brand: #3380C8;
    --brand-dark: #1f5fa8;
    --brand-light: #e8f1fb;
    --bg: #eef3f9;
    --panel: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --shadow-sm: 0 1px 3px rgba(15,23,42,.08);
    --shadow-md: 0 8px 24px rgba(15,23,42,.10);
    --shadow-lg: 0 18px 48px rgba(15,23,42,.14);
    --radius: 14px;
    --nav-h: 64px;
    --sidebar-w: 308px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ===== 顶部导航 ===== */
.navbar {
    position: sticky; top: 0; z-index: 1000;
    background: rgba(255,255,255,.86);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.nav-container {
    max-width: 1240px; margin: 0 auto; height: var(--nav-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
}
.nav-logo { display: flex; align-items: center; gap: 10px; }
.logo-img { height: 32px; width: auto; }
.logo-text { font-weight: 800; font-size: 1.05rem; letter-spacing: .3px; }
.logo-text em { font-style: normal; color: var(--brand); font-weight: 700; font-size: .8rem; margin-left: 2px; }
.nav-list { display: flex; align-items: center; gap: 6px; }
.nav-link {
    padding: 8px 14px; border-radius: 8px; font-weight: 500; font-size: .95rem; color: var(--muted);
    transition: .2s;
}
.nav-link:hover { color: var(--brand); background: var(--brand-light); }
.nav-link.active { color: var(--brand); background: var(--brand-light); font-weight: 600; }
.nav-cta { color: #fff !important; background: var(--brand); }
.nav-cta:hover { background: var(--brand-dark); }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); cursor: pointer; }

/* ===== 博客头图 ===== */
.blog-header {
    background:
        radial-gradient(1200px 400px at 85% -10%, rgba(51,128,200,.18), transparent 60%),
        linear-gradient(180deg, #ffffff 0%, #eef3f9 100%);
    border-bottom: 1px solid var(--border);
}
.blog-header-inner {
    max-width: 1240px; margin: 0 auto; padding: 44px 24px 36px;
    display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; flex-wrap: wrap;
}
.blog-kicker {
    display: inline-block; font-family: var(--mono); font-size: .76rem; letter-spacing: 1px;
    color: var(--brand); background: var(--brand-light); padding: 4px 12px; border-radius: 999px; margin-bottom: 14px;
}
.blog-titles h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -.5px; margin-bottom: 10px; }
.blog-titles p { color: var(--muted); max-width: 640px; font-size: 1rem; }
.blog-search {
    position: relative; display: flex; align-items: center; flex: 0 0 320px; max-width: 100%;
    background: #fff; border: 1px solid var(--border-strong); border-radius: 999px; padding: 0 14px;
    box-shadow: var(--shadow-sm); transition: .2s;
}
.blog-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(51,128,200,.15); }
.search-ico { color: var(--muted); flex: 0 0 auto; }
.blog-search input {
    border: 0; outline: 0; padding: 13px 8px; font-size: 1rem; font-family: var(--font); width: 100%; background: transparent; color: var(--text);
}
.search-clear { border: 0; background: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; line-height: 1; padding: 0 4px; }

/* ===== 布局 ===== */
.blog-layout {
    max-width: 1240px; margin: 0 auto; display: flex; gap: 28px;
    padding: 28px 24px 60px; align-items: flex-start;
}
.blog-sidebar {
    position: sticky; top: calc(var(--nav-h) + 18px);
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    max-height: calc(100vh - var(--nav-h) - 40px); overflow-y: auto;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 14px 10px;
}
.sidebar-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 10px 12px; font-size: .82rem; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.sidebar-collapse-all {
    border: 1px solid var(--border); background: #fff; color: var(--muted);
    border-radius: 6px; padding: 2px 10px; font-size: .74rem; cursor: pointer; transition: .2s;
}
.sidebar-collapse-all:hover { color: var(--brand); border-color: var(--brand); }

.blog-main { flex: 1 1 auto; min-width: 0; }

/* ===== 侧边树 ===== */
.tree-mod { margin-bottom: 2px; }
.tree-mod > .mod-row {
    display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 9px; cursor: pointer;
    font-weight: 700; font-size: .96rem; transition: .15s; user-select: none;
}
.tree-mod > .mod-row:hover { background: var(--brand-light); }
.mod-ico {
    width: 26px; height: 26px; flex: 0 0 26px; border-radius: 7px; display: grid; place-items: center; color: #fff;
}
.mod-ico svg { width: 15px; height: 15px; }
.mod-name { flex: 1 1 auto; }
.mod-count { font-size: .74rem; color: var(--muted); font-weight: 600; background: #f1f5f9; padding: 1px 8px; border-radius: 999px; }
.mod-caret { transition: transform .2s; color: var(--muted); }
.tree-mod.open > .mod-row .mod-caret { transform: rotate(90deg); }

.tree-albums { display: none; padding: 2px 0 6px 12px; border-left: 1px dashed var(--border-strong); margin-left: 18px; }
.tree-mod.open > .tree-albums { display: block; }

.tree-album > .alb-row {
    display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 8px; cursor: pointer;
    font-size: .9rem; color: #334155; transition: .15s;
}
.tree-album > .alb-row:hover { background: #f1f5f9; color: var(--brand-dark); }
.alb-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); flex: 0 0 6px; }
.alb-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alb-count { font-size: .72rem; color: var(--muted); }
.alb-caret { transition: transform .2s; color: var(--muted); font-size: .7rem; }
.tree-album.open > .alb-row .alb-caret { transform: rotate(90deg); }
.tree-album.active > .alb-row { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }

.tree-arts { display: none; padding: 2px 0 4px 8px; }
.tree-album.open > .tree-arts { display: block; }
.tree-art {
    display: block; padding: 6px 10px 6px 16px; border-radius: 7px; cursor: pointer; font-size: .85rem;
    color: var(--muted); border-left: 2px solid transparent; transition: .15s; line-height: 1.35;
}
.tree-art:hover { color: var(--brand-dark); background: #f8fafc; }
.tree-art.active { color: var(--brand); border-left-color: var(--brand); background: var(--brand-light); font-weight: 600; }

/* ===== 主内容：通用 ===== */
.sidebar-open {
    display: none; align-items: center; gap: 6px; margin-bottom: 14px; padding: 8px 14px;
    border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; color: var(--brand); font-weight: 600;
}
.section-eyebrow { font-family: var(--mono); font-size: .76rem; color: var(--brand); letter-spacing: 1px; text-transform: uppercase; }

/* 首页概览 */
.home-hero { padding: 8px 4px 28px; }
.home-hero h2 { font-size: 1.6rem; font-weight: 800; margin: 6px 0 8px; }
.home-hero p { color: var(--muted); max-width: 720px; }
.module-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; margin-top: 22px;
}
.module-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow-sm); cursor: pointer; transition: .2s; position: relative; overflow: hidden;
}
.module-card::before {
    content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--mc, var(--brand));
}
.module-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.mc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.mc-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.mc-ico svg { width: 21px; height: 21px; }
.mc-title { font-size: 1.1rem; font-weight: 700; }
.mc-meta { font-size: .78rem; color: var(--muted); }
.mc-desc { color: var(--muted); font-size: .9rem; margin-bottom: 14px; min-height: 48px; }
.mc-albums { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-chip {
    font-size: .76rem; padding: 3px 10px; border-radius: 999px; background: #f1f5f9; color: #475569; transition: .2s; cursor: pointer;
}
.mc-chip:hover { background: var(--brand-light); color: var(--brand-dark); }

/* 面包屑 */
.breadcrumb { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { color: var(--border-strong); }
.breadcrumb .cur { color: var(--text); font-weight: 600; }

/* 专辑视图 */
.album-head { border-bottom: 1px solid var(--border); padding-bottom: 18px; margin-bottom: 22px; }
.album-head h2 { font-size: 1.7rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.album-head .alb-tag { font-size: .76rem; font-weight: 700; color: #fff; background: var(--brand); padding: 3px 10px; border-radius: 999px; }
.album-head p { color: var(--muted); margin-top: 8px; max-width: 760px; }
.album-head .alb-stat { font-size: .82rem; color: var(--muted); margin-top: 10px; font-family: var(--mono); }

/* 文章卡片网格 */
.art-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.art-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow-sm); cursor: pointer; transition: .2s; display: flex; flex-direction: column; gap: 10px;
    border-left: 4px solid var(--accent, var(--brand));
}
.art-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.art-card h3 { font-size: 1.05rem; font-weight: 700; line-height: 1.4; }
.art-card .art-meta { display: flex; align-items: center; gap: 12px; font-size: .78rem; color: var(--muted); margin-top: auto; }
.art-card .art-meta .src { font-family: var(--mono); padding: 1px 8px; border-radius: 999px; background: #f1f5f9; }
.art-card .art-meta .src.kb { color: var(--brand-dark); }
.art-card .art-meta .src.cur { color: #b45309; background: #fef3c7; }
.art-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.art-tag { font-size: .72rem; color: #475569; background: #f1f5f9; padding: 2px 8px; border-radius: 6px; }

/* 文章阅读器 */
.reader { max-width: 860px; margin: 0 auto; }
.reader-head { margin-bottom: 26px; }
.reader-head h1 { font-size: 2rem; font-weight: 800; line-height: 1.25; letter-spacing: -.4px; margin-bottom: 12px; }
.reader-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.reader-meta .pill { font-family: var(--mono); font-size: .76rem; padding: 2px 10px; border-radius: 999px; background: #f1f5f9; }
.reader-meta .pill.kb { color: var(--brand-dark); }
.reader-meta .pill.cur { color: #b45309; background: #fef3c7; }
.reader-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.reader-nav { display: flex; justify-content: space-between; gap: 12px; margin: 34px 0 8px; }
.reader-nav a {
    flex: 1 1 0; min-width: 0; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; transition: .2s; background: #fff;
}
.reader-nav a:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.reader-nav .rn-dir { font-size: .72rem; color: var(--muted); margin-bottom: 3px; }
.reader-nav .rn-title { font-size: .88rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-nav .rn-next { text-align: right; }

/* 文章正文排版 */
.article-body { font-size: 1.02rem; color: #1e293b; }
.article-body h2 { font-size: 1.45rem; font-weight: 800; margin: 34px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--brand-light); }
.article-body h3 { font-size: 1.18rem; font-weight: 700; margin: 26px 0 10px; color: var(--brand-dark); }
.article-body h4 { font-size: 1.02rem; font-weight: 700; margin: 20px 0 8px; }
.article-body p { margin: 14px 0; line-height: 1.85; }
.article-body strong { color: #0f172a; font-weight: 700; }
.article-body ul, .article-body ol { margin: 14px 0; padding-left: 26px; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li { margin: 7px 0; line-height: 1.8; }
.article-body li::marker { color: var(--brand); }
.article-body a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.article-body blockquote {
    margin: 18px 0; padding: 12px 18px; border-left: 4px solid var(--brand); background: var(--brand-light);
    border-radius: 0 10px 10px 0; color: #334155;
}
.article-body code {
    font-family: var(--mono); font-size: .88em; background: #f1f5f9; padding: 2px 6px; border-radius: 5px; color: #be123c;
}
.article-body pre {
    background: #0f172a; color: #e2e8f0; padding: 16px 18px; border-radius: 12px; overflow-x: auto; margin: 18px 0;
    font-family: var(--mono); font-size: .86rem; line-height: 1.6;
}
.article-body pre code { background: none; color: inherit; padding: 0; }
.article-body table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .92rem; overflow: hidden; border-radius: 10px; box-shadow: var(--shadow-sm); }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.article-body th { background: var(--brand-light); color: var(--brand-dark); font-weight: 700; }
.article-body tr:nth-child(even) td { background: #f8fafc; }
.article-body img { max-width: 100%; border-radius: 10px; margin: 16px 0; box-shadow: var(--shadow-sm); }
.article-body hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }

/* 搜索结果 */
.search-summary { color: var(--muted); margin-bottom: 18px; font-size: .92rem; }
.search-group { margin-bottom: 26px; }
.search-group h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 12px; color: var(--brand-dark); display: flex; align-items: center; gap: 8px; }
.search-group h3 .g-count { font-size: .76rem; color: var(--muted); font-family: var(--mono); }
mark.hl { background: #fde68a; color: #7c2d12; padding: 0 2px; border-radius: 3px; }

/* 空状态 */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state svg { width: 54px; height: 54px; color: var(--border-strong); margin-bottom: 14px; }

/* 页脚 */
.site-footer { background: #0f172a; color: #cbd5e1; margin-top: 30px; }
.footer-inner { max-width: 1240px; margin: 0 auto; padding: 30px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; }
.footer-brand img { height: 28px; }
.footer-copy { font-size: .82rem; color: #94a3b8; }

/* ===== 响应式 ===== */
@media (max-width: 980px) {
    .nav-list { display: none; }
    .nav-toggle { display: block; }
    .blog-layout { flex-direction: column; }
    .blog-sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 1100; width: 86%; max-width: 340px;
        border-radius: 0; max-height: 100vh; transform: translateX(-105%); transition: transform .25s ease;
        box-shadow: var(--shadow-lg);
    }
    .blog-sidebar.open { transform: translateX(0); }
    .sidebar-open { display: inline-flex; }
    .blog-titles h1 { font-size: 1.7rem; }
    .blog-search { flex-basis: 100%; }
}
@media (max-width: 560px) {
    .blog-header-inner { padding: 30px 18px 26px; }
    .blog-layout { padding: 18px 14px 50px; }
    .reader-head h1 { font-size: 1.5rem; }
    .art-grid, .module-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
    .nav-list.open {
        display: flex; flex-direction: column; gap: 2px;
        position: absolute; top: var(--nav-h); left: 0; right: 0;
        background: #fff; border-bottom: 1px solid var(--border);
        padding: 10px 16px; box-shadow: var(--shadow-md);
    }
    .nav-list.open .nav-link { padding: 11px 12px; }
}

/* ===== 博客独立导航/页脚（仅 LOGO + 返回官网） ===== */
.nav-actions { display: flex; align-items: center; }
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, #0284c7, #4f46e5);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(2, 132, 199, .28);
    transition: all .3s ease;
    white-space: nowrap;
}
.btn-back:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(2, 132, 199, .4); color: #fff; }
.footer-back { color: #7dd3fc; font-size: .85rem; font-weight: 600; }
.footer-back:hover { color: #fff; }

/* ===== P1：深色模式（文章页基础层） ===== */
:root[data-theme="dark"] {
    --brand: #5ba3e6; --brand-dark: #7db9ee; --brand-light: rgba(51,128,200,.18);
    --bg: #0b1220; --panel: #101a2e; --text: #e5edf7; --muted: #94a3b8;
    --border: #1e293b; --border-strong: #334155;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.5); --shadow-md: 0 8px 24px rgba(0,0,0,.5); --shadow-lg: 0 18px 48px rgba(0,0,0,.6);
}
:root[data-theme="dark"] .navbar { background: rgba(11,18,32,.88); }
:root[data-theme="dark"] .nav-list.open { background: #101a2e; }
:root[data-theme="dark"] .mod-count, :root[data-theme="dark"] .art-tag,
:root[data-theme="dark"] .reader-meta .pill { background: rgba(148,163,184,.15); color: #cbd5e1; }
:root[data-theme="dark"] .tree-album > .alb-row:hover, :root[data-theme="dark"] .tree-art:hover { background: rgba(148,163,184,.12); color: #7db9ee; }
:root[data-theme="dark"] mark.hl { background: rgba(253,230,138,.2); color: #fde68a; }
:root[data-theme="dark"] .article-body code { color: #f0abfc; }

/* ===== P1：主题切换按钮（文章页导航） ===== */
.theme-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--panel, #fff);
    color: var(--muted); cursor: pointer; transition: all .3s ease; flex-shrink: 0;
}
.theme-btn:hover { color: var(--brand); border-color: var(--brand); }
.theme-btn svg { width: 17px; height: 17px; }
