/* ===================================================
   极简实用 · 博客园全自定义主题
   支持深色/浅色手动切换，无冗余装饰
   =================================================== */

/* ---- 主题变量（亮色默认） ---- */
:root {
  --bg-body: #f6f5f3;
  --bg-card: #ffffff;
  --bg-input: #f0eeea;
  --border-color: #e2dfda;
  --text-primary: #1f1d1b;
  --text-secondary: #4b4742;
  --text-muted: #8a857f;
  --accent: #2b6f9e;
  --accent-soft: rgba(43, 111, 158, 0.10);
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
  --radius: 8px;
  --transition: 0.2s ease;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;
}

/* ---- 深色模式 ---- */
body.dark-mode {
  --bg-body: #1b1a18;
  --bg-card: #292724;
  --bg-input: #37342f;
  --border-color: #3d3a36;
  --text-primary: #e8e3dd;
  --text-secondary: #b8b2aa;
  --text-muted: #7a756e;
  --accent: #7ba9d0;
  --accent-soft: rgba(123, 169, 208, 0.15);
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ---- 全局重置 ---- */
* { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  background: var(--bg-body);
  color: var(--text-primary);
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

/* ---- 隐藏博客园原生 UI ---- */
#top, #header, #blogTitle, #navigator, .blogStats,
#leftmenu, #rightmenu, #footer, .postSeparator,
#post_next_prev, .entrylist, .under_post_news, .under_post_comment,
.comment_tb, .commentform, #commentform, .feedbackList,
.feedbackItem, .feedbackManage, .feedbackCon, .comment_actions {
  display: none !important;
}
/* 保留必要容器 */
#main, #mainContent, #sideBar, #footer {
  display: revert !important;
}

/* ---- 容器 ---- */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 5vw;
}
@media (max-width: 640px) {
  .container { padding: 0 4vw; }
}

/* ---- 自定义页首 ---- */
#custom-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0.8rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background var(--transition);
}
#custom-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
}
#custom-header .blog-title h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}
#custom-header .blog-title h1 a {
  color: var(--text-primary);
  text-decoration: none;
}
#custom-header .blog-title h2 {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  margin: 0.1rem 0 0;
}
#custom-header nav {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}
#custom-header .nav-list {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}
#custom-header .nav-list a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
#custom-header .nav-list a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
#custom-header .header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
#custom-header .search-box input {
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 0.3rem 0.8rem 0.3rem 1.2rem;
  font-size: 0.85rem;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
  width: 130px;
}
#custom-header .search-box input:focus {
  border-color: var(--accent);
  width: 180px;
}
.theme-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.theme-toggle:hover {
  border-color: var(--accent);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  font-size: 0.9rem;
}
body.dark-mode .theme-toggle .icon-sun { display: none; }
body:not(.dark-mode) .theme-toggle .icon-moon { display: none; }

@media (max-width: 640px) {
  #custom-header .container { flex-direction: column; align-items: stretch; }
  #custom-header nav { flex-wrap: wrap; justify-content: center; }
  #custom-header .nav-list { gap: 1rem; }
  #custom-header .search-box input { width: 100%; }
  #custom-header .search-box input:focus { width: 100%; }
}

/* ---- 主体 ---- */
#main {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 2rem 0;
}
#mainContent {
  flex: 1;
  min-width: 0;
}
#sideBar {
  flex: 0 0 250px;
  min-width: 200px;
}
@media (max-width: 900px) {
  #sideBar {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
}
@media (max-width: 640px) {
  #sideBar { grid-template-columns: 1fr; gap: 1rem; }
}

/* ---- 文章卡片 ---- */
.post {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.post:hover {
  border-color: var(--accent-soft);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.postTitle {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.3rem;
}
.postTitle a {
  color: var(--text-primary);
  text-decoration: none;
}
.postTitle a:hover {
  color: var(--accent);
}
.postMeta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}
.postMeta a {
  color: var(--text-muted);
  text-decoration: none;
}
.postMeta a:hover {
  color: var(--accent);
}
.postBody {
  font-size: 0.98rem;
  color: var(--text-secondary);
  line-height: 1.8;
}
.postBody p { margin: 0 0 0.8rem; }
.postBody img { max-width: 100%; border-radius: 4px; }
.postBody blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.3rem 1.2rem;
  background: var(--bg-input);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 0.8rem 0;
}
.postBody code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-input);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
.postBody pre {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.9rem;
}
.postBody pre code { background: transparent; padding: 0; }
.postDesc {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.postDesc a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.postDesc a:hover {
  border-bottom-color: var(--accent);
}

/* ---- 分页 ---- */
.pager {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 2rem 0 1rem;
}
.pager a, .pager span {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: all var(--transition);
  text-decoration: none;
}
.pager a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pager .current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---- 侧边栏 ---- */
.sidebar-block {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.2rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}
.sidebar-block h3 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-color);
}
.sidebar-block ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-block ul li {
  margin-bottom: 0.3rem;
  font-size: 0.92rem;
}
.sidebar-block ul li a {
  color: var(--text-secondary);
  text-decoration: none;
}
.sidebar-block ul li a:hover {
  color: var(--accent);
}
.sidebar-block ul li .count {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: 0.2rem;
}
.sidebar-block input[type="text"] {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: border var(--transition);
}
.sidebar-block input[type="text"]:focus {
  border-color: var(--accent);
}
.sidebar-block .btn {
  margin-top: 0.4rem;
  width: 100%;
  border: none;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  padding: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity var(--transition);
}
.sidebar-block .btn:hover {
  opacity: 0.8;
}

/* 头像 */
.avatar-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.avatar-box .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--border-color);
}
.avatar-box .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-box .name {
  font-weight: 600;
  font-size: 1rem;
}
.avatar-box .bio {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* 标签云 */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
}
.tag-cloud a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-decoration: none;
  padding: 0.1rem 0.5rem;
  border-radius: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  transition: all var(--transition);
}
.tag-cloud a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---- 页脚 ---- */
#custom-footer {
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 0;
  margin-top: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  background: var(--bg-card);
}
#custom-footer a {
  color: var(--text-muted);
  text-decoration: none;
}
#custom-footer a:hover {
  color: var(--accent);
}
#custom-footer .powered {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---- 滚动条 ---- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 12px; }

::selection { background: var(--accent); color: #fff; }