/* ==========================================
   cyjbh 博客样式
   ========================================== */

:root {
    --bg: #dce8d5;
    --surface: #f2f7ef;
    --text: #2d4a3e;
    --text-secondary: #5a7a6a;
    --accent: #4f8a6b;
    --accent-light: #dcebe0;
    --border: #c2d3b9;
    --shadow-sm: 0 1px 3px rgba(40,70,40,0.06);
    --shadow-md: 0 8px 25px rgba(40,70,40,0.12);
    --radius: 12px;
}
[data-theme="light"] { --bg: #dce8d5; --surface: #f2f7ef; --text: #2d4a3e; --text-secondary: #5a7a6a; --accent: #4f8a6b; --accent-light: #dcebe0; --border: #c2d3b9; --shadow-sm: 0 1px 3px rgba(40,70,40,0.06); --shadow-md: 0 8px 25px rgba(40,70,40,0.12); }
[data-theme="dark"] { --bg: #090a12; --surface: #16182b; --text: #ffffff; --text-secondary: #c5cde6; --accent: #818cf8; --accent-light: #282d52; --border: #2e3355; --shadow-sm: 0 1px 3px rgba(0,0,0,0.5); --shadow-md: 0 8px 30px rgba(0,0,0,0.7); }
[data-theme="warm"] { --bg: #f3efe6; --surface: #fcf9f2; --text: #3d2e24; --text-secondary: #7a6856; --accent: #d46a3a; --accent-light: #f0e4d5; --border: #dbcebd; --shadow-sm: 0 1px 3px rgba(80,50,20,0.06); --shadow-md: 0 8px 25px rgba(80,50,20,0.10); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[data-font="md"] { font-size: 1.1rem; }
[data-font="lg"] { font-size: 1.2rem; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg); color: var(--text); line-height: 1.75;
    -webkit-font-smoothing: antialiased; overflow-x: hidden;
}

.container { max-width: 900px; margin: 0 auto; padding: 0 48px; }


/* ===== 导航 ===== */
.nav {
    position: sticky; top: 0; z-index: 100;
    background: rgba(248,249,251,0.85); backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: 720px; margin: 0 auto; padding: 10px 20px;
    display: flex; align-items: center;
}
.nav-brand {
    font-weight: 700; font-size: 1.1rem; color: var(--text);
    text-decoration: none; letter-spacing: -0.3px; flex-shrink: 0;
}
.nav-brand:hover { color: var(--accent); }
.nav-right {
    display: flex; align-items: center; gap: 10px; margin-left: auto;
}

/* 分类下拉 */
.nav-dropdown { position: relative; }
.dropdown-btn {
    padding: 6px 16px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); font-size: 0.84rem; cursor: pointer; color: var(--text);
    font-family: inherit; transition: all 0.15s;
}
.dropdown-btn:hover { background: var(--accent-light); color: var(--accent); }
.dropdown-menu {
    display: none; position: absolute; top: calc(100% + 4px); left: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: var(--shadow-md); padding: 6px 0; min-width: 150px; z-index: 200;
}
.nav-dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a {
    display: block; padding: 7px 18px; font-size: 0.84rem;
    color: var(--text); text-decoration: none; transition: background 0.1s;
}
.dropdown-menu a:hover { background: var(--accent-light); color: var(--accent); }

/* 搜索框 */
.search-form { display: flex; align-items: center; }
.search-form input {
    padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px 0 0 8px;
    font-size: 0.84rem; outline: none; width: 150px; font-family: inherit;
}
.search-form input:focus { border-color: var(--accent); }
.search-form button {
    padding: 6px 12px; border: 1px solid var(--border); border-left: none;
    border-radius: 0 8px 8px 0; background: var(--surface); cursor: pointer; font-size: 0.85rem;
}
.search-form button:hover { background: var(--accent-light); }

/* ===== Hero ===== */
.hero { text-align: center; padding: 20px 20px 28px; }
.hero-tags { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tag {
    display: inline-block; padding: 5px 16px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 20px; font-size: 0.85rem;
    color: var(--text-secondary); text-decoration: none; transition: all 0.15s;
}
.tag:hover { border-color: var(--accent); color: var(--accent); }
.tag-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tag-active:hover { color: #fff; background: #4f46e5; }
.tag-clear { font-size: 0.8rem; padding: 5px 12px; color: #e11d48; }



/* ===== 文章列表 ===== */
.post-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 60px; }
.post-card {
    display: flex; align-items: flex-start; gap: 16px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px 28px; text-decoration: none;
    color: var(--text); box-shadow: var(--shadow-sm); transition: all 0.2s ease;
    position: relative; overflow: hidden;
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.post-card-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.post-date { font-size: 0.8rem; color: var(--text-secondary); font-family: "SF Mono", "Fira Code", monospace; }
.post-category {
    font-size: 0.72rem; color: var(--accent); background: var(--accent-light);
    padding: 1px 8px; border-radius: 10px; font-weight: 500;
}
.post-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; line-height: 1.4; }
.post-summary {
    font-size: 0.92rem; color: var(--text-secondary); line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-arrow {
    position: absolute; right: 24px; top: 50%; transform: translateY(-50%);
    font-size: 1.2rem; opacity: 0; transition: all 0.2s ease; color: var(--accent);
}
.post-card:hover .post-arrow { opacity: 1; right: 20px; }
/* 卡片图片 */
.post-card-body { flex: 1; min-width: 0; }
.pcis { display: flex; gap: 8px; flex-shrink: 0; }
.pci { width: 130px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.post-card:hover .pci { border-color: var(--accent); }

/* ===== 空状态 ===== */
.empty { text-align: center; padding: 80px 0; color: var(--text-secondary); }
.empty-icon { font-size: 48px; display: block; margin-bottom: 16px; }
.empty-hint { font-size: 0.85rem; margin-top: 8px; opacity: 0.6; }

/* ===== 文章详情 ===== */
.back-link {
    display: inline-block; color: var(--text-secondary); text-decoration: none;
    font-size: 0.9rem; margin: 32px 0 16px; transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }
/* 行间距切换 */
.post-top-row { display: flex; justify-content: space-between; align-items: center; margin: 32px 0 16px; }
.post-top-row .back-link { margin: 0; }
.lh-toggles { display: flex; gap: 4px; }
.lh-btn { padding: 2px 8px; font-size: 0.72rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); cursor: pointer; color: var(--text-secondary); font-family: inherit; }
.lh-btn:hover { border-color: var(--accent); color: var(--accent); }
.lh-btn.lh-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.post-body.lh-normal { line-height: 1.3; }
.post-body.lh-wide { line-height: 1.5; }
.post-article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 32px 32px; box-shadow: var(--shadow-sm); }
.post-header { margin-bottom: 32px; }
.post-header h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 8px; }
.post-header-meta { display: flex; gap: 12px; align-items: center; }
.post-meta-date {
    font-size: 0.85rem; color: var(--text-secondary);
    font-family: "SF Mono", "Fira Code", monospace;
    background: var(--accent-light); padding: 2px 10px; border-radius: 4px;
}
.post-meta-cat {
    font-size: 0.78rem; color: var(--accent); text-decoration: none;
    border: 1px solid var(--accent); padding: 2px 10px; border-radius: 4px;
    transition: all 0.15s;
}
.post-meta-cat:hover { background: var(--accent); color: #fff; }

.post-body { font-size: 1rem; line-height: 1.0; color: var(--text); }
.post-body h1 { font-size: 1.8rem; margin: 36px 0 16px; }
.post-body h2 { font-size: 1.4rem; margin: 32px 0 12px; font-weight: 700; }
.post-body h3 { font-size: 1.15rem; margin: 24px 0 8px; font-weight: 600; }
.post-body p { margin-bottom: 18px; }
.post-body ul, .post-body ol { margin: 8px 0 18px 24px; }
.post-body li { margin-bottom: 6px; }
.post-body li::marker { color: var(--accent); }
.post-body a {
    color: var(--accent); text-decoration: none;
    border-bottom: 1px solid transparent; transition: border-color 0.15s;
}
.post-body a:hover { border-bottom-color: var(--accent); }
.post-body img { max-width: 100%; border-radius: var(--radius); margin: 8px 0; }
.post-body code {
    background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 0.88em;
    font-family: "SF Mono", "Fira Code", monospace; color: #e11d48;
}
.post-body pre {
    background: #1e293b; color: #e2e8f0; padding: 20px 24px;
    border-radius: var(--radius); overflow-x: auto; margin-bottom: 20px; line-height: 1.6;
}
.post-body pre code { background: none; padding: 0; color: inherit; font-size: 0.88rem; }
.post-body blockquote {
    border-left: 3px solid var(--accent); padding: 12px 20px; margin: 20px 0;
    background: var(--accent-light); border-radius: 0 8px 8px 0; color: var(--text-secondary);
}
.post-body blockquote p { margin-bottom: 0; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.post-body table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    margin: 20px 0; border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border);
}
.post-body th, .post-body td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.post-body th { background: #f8fafc; font-weight: 600; font-size: 0.9rem; }
.post-body tr:last-child td { border-bottom: none; }

/* B站视频 */
.video-wrapper { max-width: 100%; min-width: 420px;
    position: relative; padding-bottom: 56.25%; height: 0;
    margin: 20px 0; border-radius: var(--radius); overflow: hidden; background: #000;
}
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }

/* ===== 代码高亮（CodeHilite / Pygments monokai） ===== */
.codehilite { background: #1e293b; border-radius: var(--radius); margin-bottom: 20px; overflow-x: auto; }
.codehilite pre { background: none; padding: 20px 24px; margin: 0; }
.codehilite .hll { background-color: #49483e }
.codehilite .c { color: #75715e } /* 注释 */
.codehilite .err { color: #960050; background-color: #1e0010 }
.codehilite .k { color: #66d9ef } /* 关键字 */
.codehilite .l { color: #ae81ff }
.codehilite .n { color: #f8f8f2 }
.codehilite .o { color: #f92672 }
.codehilite .p { color: #f8f8f2 }
.codehilite .cm { color: #75715e }
.codehilite .cp { color: #75715e }
.codehilite .c1 { color: #75715e }
.codehilite .cs { color: #75715e }
.codehilite .kc { color: #66d9ef }
.codehilite .kd { color: #66d9ef }
.codehilite .kn { color: #f92672 }
.codehilite .kp { color: #66d9ef }
.codehilite .kr { color: #66d9ef }
.codehilite .kt { color: #66d9ef }
.codehilite .m { color: #ae81ff }
.codehilite .s { color: #e6db74 } /* 字符串 */
.codehilite .na { color: #a6e22e }
.codehilite .nb { color: #f8f8f2 }
.codehilite .nc { color: #a6e22e }
.codehilite .no { color: #66d9ef }
.codehilite .nd { color: #a6e22e }
.codehilite .ni { color: #f8f8f2 }
.codehilite .ne { color: #a6e22e }
.codehilite .nf { color: #a6e22e }
.codehilite .nl { color: #f8f8f2 }
.codehilite .nn { color: #f8f8f2 }
.codehilite .nx { color: #a6e22e }
.codehilite .py { color: #f8f8f2 }
.codehilite .nt { color: #f92672 }
.codehilite .nv { color: #f8f8f2 }
.codehilite .ow { color: #f92672 }
.codehilite .w { color: #f8f8f2 }
.codehilite .mf { color: #ae81ff }
.codehilite .mh { color: #ae81ff }
.codehilite .mi { color: #ae81ff }
.codehilite .mo { color: #ae81ff }
.codehilite .sb { color: #e6db74 }
.codehilite .sc { color: #e6db74 }
.codehilite .sd { color: #e6db74 }
.codehilite .s2 { color: #e6db74 }
.codehilite .se { color: #ae81ff }
.codehilite .sh { color: #e6db74 }
.codehilite .si { color: #e6db74 }
.codehilite .sx { color: #e6db74 }
.codehilite .sr { color: #e6db74 }
.codehilite .s1 { color: #e6db74 }
.codehilite .ss { color: #e6db74 }
.codehilite .bp { color: #f8f8f2 }
.codehilite .vc { color: #f8f8f2 }
.codehilite .vg { color: #f8f8f2 }
.codehilite .vi { color: #f8f8f2 }
.codehilite .il { color: #ae81ff }

/* ===== 搜索页 .sub ===== */
.sub { font-size: 0.9rem; color: var(--text-secondary); }

/* 赞助面板保持 fixed 定位（仅首页） */
.sponsor-sidebar { position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 900; }
.sponsor-toggle {
    width: 44px; height: 44px; border: 1px solid var(--border); border-right: none;
    border-radius: 10px 0 0 10px; background: var(--surface); font-size: 20px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-sm); position: absolute; right: 0; top: 0;
}
.sponsor-toggle:hover { background: var(--accent-light); }
.sponsor-panel {
    display: none; position: absolute; right: 44px; top: 50%; transform: translateY(-50%);
    width: 340px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius) 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-md); padding: 24px; max-height: 80vh; overflow-y: auto;
}
.sponsor-sidebar.open .sponsor-panel { display: block; }
.sponsor-panel h3 { font-size: 1.05rem; margin-bottom: 16px; text-align: center; }
.sponsor-top {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 10px; padding: 12px 16px; margin-bottom: 16px;
}
.sponsor-top h4 { font-size: 0.82rem; margin-bottom: 8px; color: #92400e; }
.sponsor-item-top { background: rgba(255,255,255,0.5); border-radius: 6px; padding: 4px 8px; margin-bottom: 4px; }
.sponsor-qr { margin-bottom: 12px; }
.qr-placeholder {
    width: 180px; height: 180px; margin: 0 auto; border: 2px dashed var(--border);
    border-radius: 12px; display: flex; flex-direction: column; align-items: center;
    justify-content: center; color: var(--text-secondary); font-size: 0.75rem; text-align: center; gap: 8px;
}
.qr-placeholder span { font-size: 40px; }
.qr-placeholder code {
    background: var(--accent-light); padding: 1px 6px; border-radius: 4px;
    font-size: 0.72rem; color: var(--accent);
}
.qr-image { width: 180px; max-width: 100%; height: auto; margin: 0 auto; display: block; border-radius: 12px; }
.sponsor-hint { font-size: 0.78rem; color: var(--text-secondary); text-align: center; margin-bottom: 16px; }
.sponsor-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.sponsor-form input, .sponsor-form textarea {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 0.85rem; font-family: inherit; outline: none;
}
.sponsor-form input:focus, .sponsor-form textarea:focus { border-color: var(--accent); }
.sponsor-form button {
    padding: 8px; border: none; border-radius: 8px; background: var(--accent);
    color: #fff; font-size: 0.85rem; cursor: pointer; font-weight: 600;
}
.sponsor-form button:hover { background: #4f46e5; }
.sponsor-list { border-top: 1px solid var(--border); padding-top: 12px; }
.sponsor-list h4 { font-size: 0.82rem; margin-bottom: 8px; color: var(--text-secondary); }
.sponsor-scroll { max-height: 160px; overflow-y: auto; }
.sponsor-item { padding: 6px 0; font-size: 0.82rem; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 4px 8px; }
.sponsor-item:last-child { border-bottom: none; }
.sponsor-item-new { animation: sponsorIn 0.4s ease-out; background: var(--accent-light); border-radius: 6px; padding: 6px; }
@keyframes sponsorIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.sponsor-name { font-weight: 600; color: var(--accent); }
.sponsor-amount { color: #e11d48; font-weight: 600; }
.sponsor-msg { color: var(--text-secondary); font-style: italic; width: 100%; }
.sponsor-time { color: #999; font-size: 0.7rem; font-family: "SF Mono", "Fira Code", monospace; }
.sponsor-meta { color: #999; font-size: 0.7rem; margin-left: auto; }

/* ===== 底栏 ===== */
.footer {
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 36px 0 24px; margin-top: 40px;
}
.footer-inner { display: flex; gap: 32px; justify-content: space-between; flex-wrap: wrap; }
.footer-col strong { font-size: 0.95rem; display: block; margin-bottom: 4px; }
.footer-col p { font-size: 0.82rem; color: var(--text-secondary); margin: 0; }
.footer-links a { font-size: 0.82rem; color: var(--text-secondary); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.footer-icons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.fi-icon { width: 22px; height: 22px; transition: transform 0.15s; vertical-align: middle; }
.fi-icon:hover { transform: scale(1.2); }
.footer-links { display: flex; flex-direction: column; gap: 4px; }
.footer-info { text-align: right; }
.footer-info span { color: var(--accent); font-weight: 500; }
.footer-beian { font-size: 0.75rem; color: #bbb; margin-top: 4px; }
.footer-beian a { color: #999; text-decoration: none; }
.footer-beian a:hover { color: var(--accent); }
.footer-gaba { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.gaba-icon { width: 14px; height: 14px; vertical-align: middle; }

/* 搜索高亮 */
mark { background: #fef08a; color: #000; padding: 1px 3px; border-radius: 2px; }

/* ===== 响应式 ===== */
@media (max-width: 680px) {
    .hero { padding: 16px; }
    .post-card { padding: 18px 20px; }
    .post-arrow { display: none; }
    .post-header h1 { font-size: 1.5rem; }
    .post-body pre { padding: 14px 16px; font-size: 0.82rem; }
    .container { padding: 0 16px; }
    .sponsor-panel { width: calc(100vw - 60px); max-width: 340px; }
    .footer-inner { flex-direction: column; gap: 16px; }
    .footer-info { text-align: left; }
    .search-form input { width: 100px; }
}
