/*
Theme Name: Jay Theme
Theme URI: https://blog.jmfqy.top/
Author: Jay's 折腾笔记
Author URI: https://blog.jmfqy.top/
Description: 轻量、移动端优先的 WordPress 博客主题。卡片式文章流、抽屉导航、深色模式、点赞/阅读量，全部手写无重型框架。
Version: 1.0.7
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: jay-theme
Tags: blog, mobile-first, responsive, dark-mode, customizer
*/

/* ============ 基础重置 ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px; line-height: 1.7; color: var(--text);
  background: var(--bg); transition: background .3s, color .3s;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
ul, ol { list-style: none; }

/* ============ CSS 变量（浅色默认） ============ */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --link: #2563eb;
  --link-hover: #1d4ed8;
  --primary: #2563eb;
  --primary-text: #ffffff;
  --border: #e5e7eb;
  --header-bg: rgba(255,255,255,.92);
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --radius: 12px;
  --code-bg: #f3f4f6;
}
/* 深色模式 */
[data-theme="dark"] {
  --bg: #111827;
  --card: #1f2937;
  --text: #e5e7eb;
  --text-2: #9ca3af;
  --text-3: #6b7280;
  --link: #60a5fa;
  --link-hover: #93c5fd;
  --primary: #3b82f6;
  --border: #374151;
  --header-bg: rgba(17,24,39,.92);
  --shadow: 0 1px 3px rgba(0,0,0,.3);
  --code-bg: #111827;
}

/* ============ 布局容器 ============ */
.container { max-width: 1080px; margin: 0 auto; padding: 0 14px; }
.main { padding: 14px 0 40px; min-height: 60vh; }

/* ============ 顶部导航栏 ============ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--header-bg); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 14px;
  height: 56px; display: flex; align-items: center; gap: 12px;
}
.site-logo { font-size: 20px; font-weight: 800; color: var(--text); white-space: nowrap; }
.site-logo img { height: 32px; width: auto; }
.site-logo .custom-logo-link { display: inline-flex; align-items: center; }
/* 汉堡菜单按钮（仅移动端显示） */
.hamburger {
  width: 36px; height: 36px; border: none; background: transparent;
  color: var(--text); font-size: 20px; cursor: pointer;
  display: none; align-items: center; justify-content: center; flex-shrink: 0;
  border-radius: 8px;
}
.hamburger:hover { background: var(--bg); }
@media (max-width: 767px) { .hamburger { display: inline-flex; } }
.header-search { flex: 1; position: relative; }
.header-search input {
  width: 100%; height: 36px; border: 1px solid var(--border);
  border-radius: 18px; padding: 0 36px 0 14px;
  background: var(--bg); color: var(--text); font-size: 14px; outline: none;
}
.header-search input:focus { border-color: var(--primary); }
.header-search button {
  position: absolute; right: 4px; top: 4px; width: 28px; height: 28px;
  border: none; border-radius: 50%; background: transparent;
  color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.header-search button:hover { color: var(--primary); }
.theme-toggle {
  width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 50%;
  background: var(--card); color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--primary); }

/* ============ 文章卡片流 ============ */
.post-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.post-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  display: flex; gap: 12px; padding: 14px;
  transition: transform .2s, box-shadow .2s;
}
@media (hover: hover) {
  .post-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.12); }
}
.post-card:active { transform: scale(.99); }
.post-card-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.post-card-title { font-size: 16px; font-weight: 700; line-height: 1.5; margin-bottom: 6px; }
.post-card-title a { color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-title a:hover { color: var(--primary); }
.post-card-excerpt {
  font-size: 13px; color: var(--text-2); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 8px; flex: 1;
}
.post-card-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-3); }
.post-card-meta span { display: inline-flex; align-items: center; gap: 3px; }
.post-card-meta svg { flex-shrink: 0; }
.post-card-meta .cat-tag {
  background: var(--primary); color: var(--primary-text);
  padding: 1px 8px; border-radius: 10px; font-size: 11px;
}
.post-card-thumb { width: 110px; height: 82px; flex-shrink: 0; border-radius: 8px; overflow: hidden; background: var(--bg); }
.post-card-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* 智能默认图（关键词 + 渐变 SVG，深浅色通用） */
.smart-thumb { display: block; width: 100%; height: 100%; }
.smart-thumb svg { width: 100%; height: 100%; display: block; }
.smart-thumb text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* 大图模式（首篇或置顶） */
.post-card.featured { flex-direction: column; padding: 0; }
.post-card.featured .post-card-thumb { width: 100%; height: 180px; border-radius: 0; }
.post-card.featured .post-card-content { padding: 14px; }
.post-card.featured .post-card-title { font-size: 18px; }

/* ============ 分页 ============ */
.pagination { display: flex; justify-content: center; gap: 8px; margin: 24px 0; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 36px; height: 36px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--card); color: var(--text-2);
  font-size: 14px; box-shadow: var(--shadow);
}
.pagination a:hover { color: var(--primary); }
.pagination .current { background: var(--primary); color: var(--primary-text); font-weight: 600; }

/* ============ 文章页 ============ */
.reading-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--primary); z-index: 200; transition: width .1s;
}
.single-article {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 16px; margin-top: 14px;
}
.single-title { font-size: 22px; font-weight: 800; line-height: 1.5; margin-bottom: 10px; }
.single-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; color: var(--text-3); margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.single-meta span { display: inline-flex; align-items: center; gap: 4px; }
.single-meta svg { flex-shrink: 0; }
.single-content { font-size: 16px; line-height: 1.85; word-wrap: break-word; }
.single-content p { margin: 1em 0; }
.single-content h2, .single-content h3, .single-content h4 { margin: 1.4em 0 .6em; line-height: 1.5; font-weight: 700; }
.single-content h2 { font-size: 20px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.single-content h3 { font-size: 18px; }
.single-content h4 { font-size: 16px; }
.single-content ul, .single-content ol { margin: 1em 0; padding-left: 1.6em; }
.single-content ul { list-style: disc; }
.single-content ol { list-style: decimal; }
.single-content li { margin: .4em 0; }
.single-content blockquote {
  margin: 1em 0; padding: 10px 16px; border-left: 3px solid var(--primary);
  background: var(--bg); border-radius: 0 8px 8px 0; color: var(--text-2);
}
.single-content code {
  background: var(--code-bg); padding: 2px 6px; border-radius: 4px;
  font-family: "SF Mono", Consolas, monospace; font-size: .88em;
}
.single-content pre {
  background: var(--code-bg); padding: 14px; border-radius: 8px;
  overflow-x: auto; margin: 1em 0; -webkit-overflow-scrolling: touch;
}
.single-content pre code { background: none; padding: 0; }
.single-content img { border-radius: 8px; margin: 1em auto; }
.single-content table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 14px; display: block; overflow-x: auto; }
.single-content th, .single-content td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.single-content th { background: var(--bg); }
.single-tags { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.single-tags a { font-size: 13px; padding: 4px 12px; border: 1px solid var(--border); border-radius: 14px; color: var(--text-2); }
.single-tags a:hover { border-color: var(--primary); color: var(--primary); }

/* 目录 */
.toc-box {
  background: var(--bg); border-radius: 8px; padding: 14px 16px; margin: 0 0 18px;
  font-size: 14px;
}
.toc-box > strong { display: block; margin-bottom: 8px; font-size: 15px; }
.toc-box ul { padding-left: 0; }
.toc-box li { margin: 4px 0; }
.toc-box li.toc-h3 { padding-left: 1em; }
.toc-box li.toc-h4 { padding-left: 2em; }
.toc-box a { color: var(--text-2); }
.toc-box a:hover, .toc-box a.active { color: var(--primary); }

/* 相关文章 */
.related-posts { margin-top: 24px; }
.related-posts > h3 { font-size: 17px; margin-bottom: 12px; padding-left: 4px; border-left: 3px solid var(--primary); padding-left: 10px; }
.related-list { display: flex; flex-direction: column; gap: 10px; }

/* ============ 归档/分类页头 ============ */
.archive-header {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-top: 14px; margin-bottom: 4px;
}
.archive-header h1 { font-size: 20px; font-weight: 800; }
.archive-header p { font-size: 13px; color: var(--text-2); margin-top: 6px; }

/* ============ 搜索页 ============ */
.search-header { margin: 14px 0 4px; font-size: 15px; color: var(--text-2); }
.search-header strong { color: var(--primary); }

/* ============ 404 ============ */
.error-404 { text-align: center; padding: 60px 20px; background: var(--card); border-radius: var(--radius); margin-top: 14px; }
.error-404 h1 { font-size: 72px; font-weight: 800; color: var(--primary); }
.error-404 p { color: var(--text-2); margin: 12px 0 20px; }
.btn {
  display: inline-block; padding: 10px 24px; border-radius: 8px;
  background: var(--primary); color: var(--primary-text); font-size: 15px; font-weight: 600;
  transition: opacity .2s, transform .15s;
}
.btn:hover { color: var(--primary-text); opacity: .92; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* ============ 页脚 ============ */
.site-footer { margin-top: 30px; border-top: 1px solid var(--border); background: var(--card); }
.footer-inner { max-width: 1080px; margin: 0 auto; padding: 22px 14px; text-align: center; font-size: 13px; color: var(--text-3); }
.footer-inner p { margin: 4px 0; }
.footer-inner a { color: var(--text-2); }
.footer-inner a:hover { color: var(--primary); }
.theme-credit { font-size: 12px; }
.site-uptime { font-size: 12px; color: var(--text-2); }
.site-uptime span { font-weight: 700; color: var(--primary); }

/* 回到顶部 */
.back-to-top {
  position: fixed; right: 16px; bottom: 24px; width: 44px; height: 44px;
  border-radius: 50%; border: 1px solid var(--border);
  background: var(--card); color: var(--text-2); font-size: 18px;
  cursor: pointer; box-shadow: var(--shadow); z-index: 150;
  display: none; align-items: center; justify-content: center;
}
.back-to-top.show { display: flex; }

/* ============ 面包屑导航 ============ */
.breadcrumb { font-size: 13px; color: var(--text-3); margin: 14px 0 0; }
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .breadcrumb-sep { margin: 0 6px; color: var(--text-3); }
.breadcrumb .current { color: var(--text-3); }

/* ============ 抽屉导航（移动端） ============ */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 290; opacity: 1; transition: opacity .25s;
}
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 84vw);
  background: var(--card); z-index: 300;
  transform: translateX(-102%); transition: transform .28s ease;
  display: flex; flex-direction: column; box-shadow: 2px 0 12px rgba(0,0,0,.15);
}
.drawer.open { transform: translateX(0); }
body.drawer-open { overflow: hidden; }
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.drawer-title { font-weight: 800; font-size: 16px; color: var(--text); }
.drawer-close {
  width: 32px; height: 32px; border: none; border-radius: 8px;
  background: transparent; color: var(--text-2); font-size: 16px; cursor: pointer;
}
.drawer-close:hover { background: var(--bg); color: var(--text); }
.drawer-search { display: flex; gap: 8px; padding: 14px 16px 6px; }
.drawer-search input {
  flex: 1; height: 36px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 12px; background: var(--bg); color: var(--text); font-size: 14px; outline: none;
  min-width: 0;
}
.drawer-search input:focus { border-color: var(--primary); }
.drawer-search button {
  height: 36px; padding: 0 14px; border: none; border-radius: 8px;
  background: var(--primary); color: var(--primary-text); font-size: 14px; cursor: pointer;
  flex-shrink: 0;
}
.drawer-nav { flex: 1; overflow-y: auto; padding: 10px 8px 20px; -webkit-overflow-scrolling: touch; }
.drawer-group-title { font-size: 12px; color: var(--text-3); padding: 12px 10px 4px; }
.drawer-link {
  display: flex; align-items: center; gap: 8px;
  padding: 10px; border-radius: 8px; font-size: 15px; color: var(--text);
}
.drawer-link:hover { background: var(--bg); color: var(--primary); }
.drawer-link svg { flex-shrink: 0; }
.drawer-link .count { margin-left: auto; font-size: 12px; color: var(--text-3); }

/* ============ 首页双栏布局（PC 端侧边栏） ============ */
.theme-promo-card { background: linear-gradient(135deg,#1a2a4a,#2d5aa0); border-radius: 12px; margin-bottom: 20px; color: #fff; }
.theme-promo-inner { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 20px 24px; flex-wrap: wrap; }
.theme-promo-text h2 { font-size: 20px; margin-bottom: 6px; color: #fff; }
.theme-promo-text h2.promo-title { display: flex; align-items: center; gap: 8px; }
.theme-promo-text h2.promo-title svg { flex-shrink: 0; }
.theme-promo-text p { font-size: 14px; opacity: .85; margin: 0; }
.theme-promo-btn { background: #fff; color: #1a2a4a !important; padding: 10px 24px; border-radius: 8px; font-weight: bold; text-decoration: none; white-space: nowrap; transition: background .2s, transform .15s; }
.theme-promo-btn:hover { background: #f0f0f0; text-decoration: none; transform: translateY(-1px); }
.home-layout { display: block; }
.home-main { min-width: 0; }
.home-sidebar { display: none; }
@media (min-width: 768px) {
  .home-layout { display: flex; gap: 20px; align-items: flex-start; }
  .home-main { flex: 1; min-width: 0; }
  .home-sidebar { display: block; width: 280px; flex-shrink: 0; margin-top: 14px; position: sticky; top: 76px; }
}
.widget {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px;
}
.widget-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; padding-left: 10px; border-left: 3px solid var(--primary); }
.popular-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.popular-list li:last-child { border-bottom: none; }
.popular-list .rank {
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px;
  background: var(--bg); color: var(--text-2); font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.popular-list .rank-1 { background: #ef4444; color: #fff; }
.popular-list .rank-2 { background: #f59e0b; color: #fff; }
.popular-list .rank-3 { background: #10b981; color: #fff; }
.popular-list a { flex: 1; min-width: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popular-list a:hover { color: var(--primary); }
.popular-list .views { flex-shrink: 0; font-size: 12px; color: var(--text-3); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
  font-size: 13px; padding: 4px 12px; border: 1px solid var(--border);
  border-radius: 14px; color: var(--text-2);
}
.tag-cloud a:hover { border-color: var(--primary); color: var(--primary); }
.tag-cloud a span { color: var(--text-3); font-size: 11px; }

/* ============ 文章点赞 ============ */
.single-actions { margin: 22px 0 6px; text-align: center; }
.like-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 26px; border-radius: 24px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--primary); background: transparent; color: var(--primary);
  cursor: pointer; transition: all .2s;
}
.like-btn:hover:not(:disabled) { background: var(--primary); color: var(--primary-text); }
.like-btn.liked, .like-btn:disabled { background: var(--primary); color: var(--primary-text); opacity: .85; cursor: default; }
.like-btn .like-count { font-variant-numeric: tabular-nums; }
.like-btn svg, .fav-btn svg { flex-shrink: 0; }
.like-btn:hover:not(:disabled) svg { transform: scale(1.12); }
.like-btn svg { transition: transform .15s; }

/* ============ 评论区 ============ */
.comments-area {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 16px; margin-top: 20px;
}
.comments-title { font-size: 17px; margin-bottom: 14px; padding-left: 10px; border-left: 3px solid var(--primary); }
.comment-list { padding: 0; }
.comment-list .comment { margin-bottom: 16px; }
.comment-list .children { margin: 12px 0 0 20px; padding-left: 12px; border-left: 2px solid var(--border); }
.comment-body { background: var(--bg); border-radius: 8px; padding: 12px 14px; }
.comment-author { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.comment-author img { border-radius: 50%; }
.comment-author .fn { font-style: normal; font-weight: 600; font-size: 14px; color: var(--text); }
.comment-author .says { display: none; }
.comment-meta { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.comment-meta a { color: var(--text-3); }
.comment-content { font-size: 14px; color: var(--text); line-height: 1.7; }
.comment-content p { margin: .5em 0; }
.reply { margin-top: 6px; font-size: 13px; }
.comment-reply-link { color: var(--primary); }
.comment-respond { margin-top: 20px; }
.comment-reply-title { font-size: 16px; margin-bottom: 12px; }
.comment-form label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; background: var(--bg); color: var(--text);
  outline: none; margin-bottom: 10px; font-family: inherit;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--primary); }
.comment-form .form-submit { margin: 6px 0 0; }
.comment-form input[type="submit"] {
  padding: 10px 28px; border: none; border-radius: 8px; cursor: pointer;
  background: var(--primary); color: var(--primary-text); font-size: 15px; font-weight: 600;
}
.comment-form input[type="submit"]:hover { opacity: .9; }
.comment-form .required { color: #ef4444; }
.no-comments { color: var(--text-3); font-size: 14px; margin: 10px 0; }
.comment-navigation { display: flex; justify-content: space-between; margin: 12px 0; font-size: 14px; }
@media (min-width: 768px) { .comments-area { padding: 28px 32px; } }

/* ============ 顶部通知栏 ============ */
.notice-bar {
  background: var(--primary); color: #fff;
  display: flex; align-items: center;
  font-size: 13px; overflow: hidden; position: relative; z-index: 120;
}
.notice-track {
  flex: 1; display: flex; white-space: nowrap; overflow: hidden;
  animation: notice-scroll 20s linear infinite;
}
.notice-track span { padding: 8px 40px 8px 0; flex-shrink: 0; }
@keyframes notice-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.notice-close {
  flex-shrink: 0; border: none; background: transparent; color: #fff;
  font-size: 14px; cursor: pointer; padding: 8px 12px; opacity: .8;
}
.notice-close:hover { opacity: 1; }

/* ============ 热门搜索关键词 ============ */
.hot-keys {
  position: absolute; top: 42px; left: 0; right: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 10px 12px; display: none; z-index: 110;
}
.header-search:focus-within .hot-keys { display: block; }
.hot-keys-label { font-size: 12px; color: var(--text-3); margin-right: 4px; }
.hot-keys button {
  font-size: 13px; margin: 3px 4px 3px 0; padding: 4px 12px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg); color: var(--text-2); cursor: pointer;
}
.hot-keys button:hover { border-color: var(--primary); color: var(--primary); }
.drawer-hotkeys { padding: 4px 16px 10px; font-size: 13px; }
.drawer-hotkeys .hot-keys-label { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.drawer-hotkeys button {
  font-size: 13px; margin: 0 6px 6px 0; padding: 4px 12px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg); color: var(--text-2); cursor: pointer;
}
.drawer-hotkeys button:hover { border-color: var(--primary); color: var(--primary); }

/* ============ 代码高亮 ============ */
.tok-k { color: var(--hl-k); }
.tok-s { color: var(--hl-s); }
.tok-c { color: var(--hl-c); font-style: italic; }
.tok-n { color: var(--hl-n); }
.tok-f { color: var(--hl-f); }
.tok-v { color: var(--hl-v); }
:root {
  --hl-k: #d73a49; --hl-s: #032f62; --hl-c: #6a737d;
  --hl-n: #005cc5; --hl-f: #6f42c1; --hl-v: #e36209;
}
[data-theme="dark"] {
  --hl-k: #ff7b72; --hl-s: #a5d6ff; --hl-c: #8b949e;
  --hl-n: #79c0ff; --hl-f: #d2a8ff; --hl-v: #ffa657;
}
pre.hl-light {
  --hl-k: #d73a49; --hl-s: #032f62; --hl-c: #6a737d;
  --hl-n: #005cc5; --hl-f: #6f42c1; --hl-v: #e36209;
}
pre.hl-dark {
  --hl-k: #ff7b72; --hl-s: #a5d6ff; --hl-c: #8b949e;
  --hl-n: #79c0ff; --hl-f: #d2a8ff; --hl-v: #ffa657;
}
pre.jay-hl { position: relative; padding-top: 30px; }
pre.jay-hl::before {
  content: attr(data-lang);
  position: absolute; top: 8px; right: 12px;
  font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 1px;
}

/* ============ 图片灯箱 ============ */
.lightbox {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.9);
  display: flex; align-items: center; justify-content: center;
}
.lightbox[hidden] { display: none; }
.lb-img { max-width: 92vw; max-height: 86vh; border-radius: 8px; object-fit: contain; }
.lb-close, .lb-prev, .lb-next {
  position: absolute; border: none; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.15); color: #fff; font-size: 20px;
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.3); }
.lb-close { top: 18px; right: 18px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-count {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 13px; opacity: .8;
}

/* ============ 收藏按钮 ============ */
.fav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 26px; border-radius: 24px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--text-2);
  cursor: pointer; transition: all .2s; margin-left: 10px;
}
.fav-btn:hover { border-color: #f59e0b; color: #f59e0b; }
.fav-btn.faved { border-color: #f59e0b; background: #f59e0b; color: #fff; }

/* ============ 友情链接页 ============ */
.links-page {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px 18px; margin-top: 14px;
}
.links-title { font-size: 22px; font-weight: 800; margin-bottom: 16px; }
.links-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px;
  margin-bottom: 20px;
}
.link-card {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  transition: border-color .2s, transform .2s;
}
.link-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.link-name { font-weight: 700; font-size: 15px; color: var(--text); }
.link-desc { font-size: 13px; color: var(--text-2); }
.link-url { font-size: 12px; color: var(--text-3); }
.links-empty { color: var(--text-3); font-size: 14px; margin-bottom: 16px; }
.links-content { margin-top: 8px; }
@media (min-width: 768px) { .links-page { padding: 32px 36px; } }

/* ============ PC 端增强（≥768px） ============ */
@media (min-width: 768px) {
  .post-list { gap: 14px; }
  .post-card { padding: 18px; }
  .post-card-thumb { width: 200px; height: 134px; }
  .post-card-title { font-size: 18px; }
  .post-card.featured .post-card-thumb { height: 280px; }
  .single-article { padding: 32px 36px; }
  .single-title { font-size: 28px; }
  /* PC 端双栏：内容 + 侧边目录 */
  .single-layout { display: flex; gap: 20px; align-items: flex-start; }
  .single-layout .single-article { flex: 1; min-width: 0; margin-top: 14px; }
  .single-sidebar { width: 260px; flex-shrink: 0; position: sticky; top: 76px; margin-top: 14px; }
  .single-sidebar .toc-box { margin-bottom: 0; }
  .toc-box { max-height: 60vh; overflow-y: auto; }
}

/* ============ 移动端底部 TAB 导航 ============ */
.tab-bar { display: none; }
@media (max-width: 767px) {
  .tab-bar {
    display: flex;
    position: fixed; left: 12px; right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 160;
    background: var(--card); /* 不支持 color-mix 的兜底 */
    background: color-mix(in srgb, var(--card) 85%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border: 1px solid var(--border); border-radius: 20px;
    box-shadow: 0 4px 18px rgba(0,0,0,.13);
    padding: 6px 4px;
  }
  .tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 0; border: none; background: transparent; border-radius: 14px;
    color: var(--text-3); font-size: 11px; cursor: pointer; font-family: inherit;
  }
  .tab-item:hover { color: var(--text-2); }
  .tab-item:active { background: var(--bg); }
  .tab-icon { display: inline-flex; line-height: 1; }
  .tab-icon svg { display: block; transition: transform .15s; }
  .tab-item.active { color: var(--primary); font-weight: 600; }
  .tab-item.active .tab-icon svg { transform: scale(1.15); }
  /* 底部留白，避免内容被 TAB 栏遮挡 */
  body { padding-bottom: 88px; }
  .back-to-top { bottom: 100px; right: 14px; }
}

/* 移动端隐藏 PC 目录（文章内目录已显示） */
@media (max-width: 767px) {
  .single-sidebar { display: none; }
}
