/*
Theme Name: BaohanWiki
Theme URI: https://longxia.work
Author: WorkBuddy
Description: 基于 Monobase 布局定制：左侧栏包含 Logo、简要介绍、联系小工具栏（电话/微信/二维码/链接）和菜单，右侧为内容区。文章页为三栏布局（左菜单 / 中同类文章标题 / 右正文）。首页置顶文章优先显示。手机端为抽屉菜单，联系方式显示在底部 footer 卡片。所有联系方式可在「外观→自定义」中配置。
Version: 1.2.0
Requires at least: 5.0
Tested up to: 6.7
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: baohanwiki
Tags: blog, custom-menu, custom-logo, featured-images, responsive-layout
*/

:root{
  --bg:#ffffff;
  --sidebar-bg:#fafafa;
  --border:#e5e5e5;
  --text:#222;
  --muted:#777;
  --accent:#c0392b;
  --accent-dark:#96281b;
}
*{margin:0;padding:0;box-sizing:border-box;}
body{
  font-family:"PingFang SC","Microsoft YaHei","Helvetica Neue",Arial,sans-serif;
  color:var(--text);background:var(--bg);
  display:flex;min-height:100vh;
}
a{color:inherit;}
img{max-width:100%;height:auto;}
.clearfix::after{content:"";display:table;clear:both;}

/* ========== 左侧栏 ========== */
.sidebar{
  width:280px;min-width:280px;
  background:var(--sidebar-bg);
  border-right:1px solid #ececec;
  display:flex;flex-direction:column;
  position:sticky;top:0;height:100vh;overflow-y:auto;
  scrollbar-width:thin;scrollbar-color:#ececec transparent;
}
.sidebar::-webkit-scrollbar{width:1px;}
.sidebar::-webkit-scrollbar-track{background:transparent;}
.sidebar::-webkit-scrollbar-thumb{background:#ececec;}

/* 1. 顶部：Logo + 简要介绍 */
.brand{
  padding:28px 24px 20px;
  border-bottom:1px dashed var(--border);
  display:flex;gap:14px;align-items:center;
}
.brand .logo-img{max-width:52px;max-height:52px;border-radius:10px;}
.brand .logo-text{
  width:52px;height:52px;border-radius:10px;
  background:linear-gradient(135deg,#c0392b,#e74c3c);
  color:#fff;font-size:24px;font-weight:700;
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;
}
.brand h1 a, .brand .site-title a{font-size:18px;line-height:1.3;text-decoration:none;color:var(--text);}
.brand .brand-text{min-width:0;}
.brand .desc{
  font-size:12px;color:var(--muted);line-height:1.6;
  margin-top:6px;
}

/* 2. 小工具栏 */
.widget-bar{
  padding:18px 24px;
  border-bottom:1px dashed var(--border);
  font-size:13px;
}
.widget-bar h3{
  font-size:12px;color:var(--muted);letter-spacing:2px;
  margin-bottom:10px;font-weight:normal;
}
.widget-item{display:flex;align-items:center;gap:8px;margin-bottom:8px;color:#444;}
.widget-item .ico{
  width:20px;height:20px;border-radius:50%;
  background:#eee;color:#666;font-size:11px;
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;
}
.widget-item a{color:var(--accent);text-decoration:none;}
.widget-bar .qr{
  margin-top:10px;display:flex;align-items:center;gap:12px;
}
.widget-bar .qr img{width:76px;height:76px;object-fit:contain;border:1px solid var(--border);border-radius:8px;}
.widget-bar .qr span{font-size:12px;color:var(--muted);line-height:1.6;}

/* 菜单 */
.main-nav{padding:14px 0;flex:1;}
.main-nav ul{list-style:none;}
.main-nav a{
  display:flex;justify-content:space-between;align-items:center;
  padding:12px 24px;text-decoration:none;color:var(--text);
  font-size:15px;transition:all .15s;
  border-left:3px solid transparent;
}
.main-nav a .count{font-size:12px;color:var(--muted);margin-left:auto;padding-left:8px;}
.main-nav ul ul a{padding-left:44px;font-size:13.5px;color:var(--muted);}
.main-nav a:hover,
.main-nav .current-menu-item > a,
.main-nav .current_page_item > a{
  background:#f0f0f0;border-left-color:var(--accent);color:var(--accent);
  padding-left:27px;
}

/* ========== 右侧主区 ========== */
.main{flex:1;min-width:0;}
.topbar{
  display:flex;align-items:center;justify-content:space-between;
  padding:14px 32px;border-bottom:1px solid var(--border);
  font-size:13px;color:var(--muted);
  position:sticky;top:0;background:rgba(255,255,255,.95);backdrop-filter:blur(4px);
  z-index:5;
}
.topbar .crumb b{color:var(--text);}
.topbar .phone{color:var(--accent);font-weight:600;text-decoration:none;}

.content{padding:36px 40px;max-width:1080px;}

/* 文章详情页：放开宽度限制，让正文占满剩余空间 */
.content.content-wide{max-width:none;padding:28px 40px 36px;}

.section-title{
  font-size:13px;color:var(--muted);letter-spacing:3px;
  margin-bottom:18px;display:flex;align-items:center;gap:10px;
}
.section-title::after{content:"";flex:1;height:1px;background:var(--border);}

/* 文章列表：左分类 中标题 右摘要/日期 */
.post-item{
  display:grid;grid-template-columns:110px 1fr 220px;
  gap:24px;padding:20px 0;border-bottom:1px solid var(--border);
}
.post-item a{text-decoration:none;}
.post-item:hover .entry-title a{color:var(--accent);}
.post-item .cat{font-size:13px;color:var(--accent);}
.post-item .cat a{color:var(--accent);text-decoration:none;}
.post-item .entry-title{font-size:16px;font-weight:600;line-height:1.5;transition:color .15s;}
.post-item .entry-title a{color:var(--text);text-decoration:none;}
.post-item .excerpt{
  font-size:13px;color:var(--muted);line-height:1.7;margin-top:6px;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
.post-item .meta{font-size:12.5px;color:var(--muted);text-align:right;line-height:1.9;}
.post-item .meta .arrow{color:var(--accent);}

/* 分页 */
.pagination{margin-top:30px;text-align:center;font-size:14px;}
.pagination .nav-links a,.pagination .nav-links span{
  display:inline-block;padding:6px 14px;margin:0 3px;
  border:1px solid var(--border);border-radius:6px;text-decoration:none;color:var(--muted);
}
.pagination .current,.pagination a:hover{background:var(--accent);color:#fff;border-color:var(--accent);}

/* 独立页面（无中栏）：单列铺满，不画分隔线 */
.article-layout.is-page{display:block;}
.article-layout.is-page::before{display:none;}
.article-layout.is-page .article{max-width:none;}
.article-layout{
  position:relative;
  display:grid;grid-template-columns:240px minmax(0,1fr);gap:64px;
  align-items:start;
  --nav-line:272px; /* 线落在间距正中间：240 + (64-1)/2 ≈ 272 */
}
/* 中栏与正文之间的通栏分隔线（与内容区等高，颜色与左侧栏分隔线一致） */
.article-layout::before{
  content:"";position:absolute;top:0;bottom:0;
  left:var(--nav-line);width:1px;background:#ececec;
}
@media (min-width:1400px){
  .article-layout{grid-template-columns:260px minmax(0,1fr);gap:80px;--nav-line:300px;}
}
@media (max-width:820px){
  .article-layout::before{display:none;}
}
.post-nav{
  position:sticky;top:76px;max-height:calc(100vh - 100px);overflow-y:auto;
  scrollbar-width:thin;scrollbar-color:#ececec transparent;
}
.post-nav::-webkit-scrollbar{width:1px;}
.post-nav::-webkit-scrollbar-track{background:transparent;}
.post-nav::-webkit-scrollbar-thumb{background:#ececec;}
.post-nav

/* 左侧栏滚动条同样细化 */
.sidebar{scrollbar-width:thin;scrollbar-color:#ececec transparent;}
.sidebar::-webkit-scrollbar{width:1px;}
.sidebar::-webkit-scrollbar-track{background:transparent;}
.sidebar::-webkit-scrollbar-thumb{background:#ececec;}
.post-nav-title{
  font-size:14px;font-weight:600;padding:4px 12px 10px;
  border-bottom:1px solid var(--border);margin-bottom:8px;
}
.post-nav-title a{color:var(--text);text-decoration:none;}
.post-nav-title a:hover{color:var(--accent);}
.post-nav ul{list-style:none;}
.post-nav li a{
  display:block;padding:9px 12px;font-size:13.5px;line-height:1.5;
  color:var(--muted);text-decoration:none;border-left:1px solid transparent;
  transition:color .15s,background .15s;
}
.post-nav li a:hover{color:var(--accent);background:#fafafa;}
.post-nav li.current a{
  color:var(--accent);font-weight:600;
}

/* 文章详情 */
.article .header-line{font-size:13px;color:var(--muted);margin-bottom:8px;}
.article h1.entry-title{font-size:24px;line-height:1.4;margin-bottom:14px;}
.article .entry-content p{font-size:14.5px;line-height:1.9;color:#444;margin-bottom:14px;}
.article .entry-content img{border-radius:8px;}
.article .entry-content h2,.article .entry-content h3{margin:22px 0 12px;}
.article .entry-content ul,.article .entry-content ol{margin:0 0 14px 24px;line-height:1.9;color:#444;}
.article .entry-content blockquote{
  border-left:3px solid var(--accent);background:#fafafa;
  padding:10px 16px;margin:14px 0;color:#666;
}

/* 侧边小工具（文章页右侧如果挂了小工具） */
.content ul.widget-list{list-style:none;}

/* ========== 底部联系 Footer（仅手机端显示） ========== */
.site-footer{display:none;}

/* Footer 内容样式（手机端生效） */
.site-footer{
  margin-top:34px;background:#f7f7f8;border-top:1px solid var(--border);
  padding:22px 16px calc(24px + env(safe-area-inset-bottom,0px));
}
.site-footer .inner{display:flex;flex-direction:column;gap:14px;}
.f-card{
  background:#fff;border:1px solid #ececec;border-radius:12px;
  padding:16px;box-shadow:0 1px 3px rgba(0,0,0,.03);
}
.f-card h3{
  font-size:12px;color:var(--muted);font-weight:normal;letter-spacing:2px;
  margin-bottom:12px;display:flex;align-items:center;gap:8px;
}
.f-card h3::after{content:"";flex:1;height:1px;background:#f0f0f0;}
.f-row{
  display:flex;align-items:center;gap:10px;padding:9px 0;
  text-decoration:none;color:var(--text);border-bottom:1px dashed #f0f0f0;
}
.f-row:last-of-type{border-bottom:none;}
.f-ico{
  width:26px;height:26px;border-radius:50%;flex-shrink:0;
  background:#fdf1ef;color:var(--accent);font-size:12px;
  display:flex;align-items:center;justify-content:center;
}
.f-val{font-size:15px;font-weight:600;line-height:1.3;min-width:0;}
.f-val em{
  display:block;font-style:normal;font-weight:normal;
  font-size:11.5px;color:var(--muted);margin-top:2px;
}
.site-footer .cta{
  display:block;margin-top:14px;background:var(--accent);color:#fff;
  text-align:center;padding:12px;border-radius:10px;
  font-size:15px;font-weight:600;text-decoration:none;
  box-shadow:0 4px 12px rgba(192,57,43,.24);
}
.site-footer .cta:active{background:var(--accent-dark);}

.f-qr{display:flex;align-items:center;gap:14px;}
.f-qr img{width:82px;height:82px;object-fit:contain;border-radius:8px;flex-shrink:0;}
.f-qr strong{display:block;font-size:14px;margin-bottom:4px;}
.f-qr span{font-size:12px;color:var(--muted);line-height:1.6;}

.f-links{display:flex;flex-wrap:wrap;gap:8px;}
.f-links a{
  font-size:13px;color:#555;text-decoration:none;
  padding:7px 12px;background:#f7f7f8;border-radius:8px;line-height:1;
}
.f-links a:active{background:#fdf1ef;color:var(--accent);}

.site-footer .copyright{
  text-align:center;font-size:11.5px;color:#aaa;margin-top:18px;line-height:1.8;
}
.site-footer .copyright span{font-size:11px;color:#c0c0c0;}

/* ========== 手机端公共元素 ========== */
.hamburger{
  display:none;
  width:40px;height:40px;border:none;border-radius:8px;
  background:#f0f0f0;cursor:pointer;font-size:20px;line-height:1;
  align-items:center;justify-content:center;
  flex-shrink:0;
}
.sidebar-mask{display:none;position:fixed;inset:0;background:rgba(0,0,0,.35);z-index:30;}
body.sidebar-open .sidebar-mask{display:block;}

/* 手机端首行：Logo + 简介（桌面端隐藏） */
.mobile-brand{display:none;}

/* ========== 响应式（<= 820px） ========== */
@media (max-width:820px){
  body{flex-direction:column;}
  .hamburger{display:flex;}

  /* 首行：Logo + 简介 + 菜单按钮 */
  .mobile-brand{
    display:flex;align-items:center;gap:10px;
    padding:14px 16px 12px;background:#fff;
    border-bottom:1px solid var(--border);
  }
  .mobile-brand .brand{
    flex:1;min-width:0;padding:0;border:none;
    display:flex;gap:10px;align-items:center;
  }
  .mobile-brand .brand .logo-img{max-width:44px;max-height:44px;border-radius:9px;}
  .mobile-brand .brand .logo-text{width:44px;height:44px;font-size:20px;border-radius:9px;}
  .mobile-brand .brand .brand-text{min-width:0;}
  .mobile-brand .site-title a{font-size:16px;font-weight:600;}
  .mobile-brand .desc{font-size:11.5px;line-height:1.5;margin-top:3px;}

  /* 抽屉内不再重复显示 Logo */
  .sidebar .brand{display:none;}

  .topbar{
    position:sticky;top:0;z-index:20;background:#fff;
    box-shadow:0 1px 4px rgba(0,0,0,.06);
    padding:10px 16px;
  }
  .topbar .phone{display:none;}
  .sidebar .widget-bar{display:none;}
  .sidebar{
    position:fixed;left:0;top:0;width:80%;max-width:320px;
    height:100vh;z-index:40;transform:translateX(-100%);
    transition:transform .25s ease;
    box-shadow:2px 0 12px rgba(0,0,0,.15);
  }
  body.sidebar-open .sidebar{transform:translateX(0);}
  .content{padding:20px 16px;}
  .post-item{grid-template-columns:1fr;gap:8px;padding:16px 0;}
  .post-item .meta{text-align:left;}
  .post-item .cat{font-size:12px;}
  .article h1.entry-title{font-size:20px;}
  .article-layout{grid-template-columns:1fr;gap:0;}
  .post-nav{display:none;}
  .site-footer{display:block;}
}
