/* ==========================================================================
   NexT 主题 · Gemini 方案
   容器 960px / 侧栏 240px / 正文 708px，卡片式双栏，居中留白
   用于「木鱼琐语」静态站点
   ========================================================================== */

:root {
  --body-bg: #eee;
  --card-bg: #fff;
  --text-color: #555;
  --title-color: #333;
  --link-color: #2690d4;
  --link-hover-color: #222;
  --border-color: #eee;
  --muted-color: #999;
  --code-bg: #f7f7f7;
  --accent: #2690d4;
  --dark-bg: #222;
  --dark-text: #eee;
  --font-sans: "Rosario", "Monda", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "WenQuanYi Micro Hei", -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-mono: "PT Mono", "SF Mono", "Consolas", "Monaco", "Menlo", monospace;
  --shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.06),
    0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 -1px 0.5px 0 rgba(0, 0, 0, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--body-bg);
  color: var(--text-color);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

a {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

a:hover {
  color: var(--link-hover-color);
  border-bottom-color: var(--link-hover-color);
}

img {
  max-width: 100%;
  height: auto;
}

/* ---------- 顶部细线 ---------- */

.head-top-line {
  height: 3px;
  background: var(--dark-bg);
}

.box-shadow-wrapper {
  box-shadow: var(--shadow);
}

/* ---------- 容器 ---------- */

.main-container {
  width: 960px;
  max-width: 100%;
  min-height: calc(100vh - 150px);
  margin: 0 auto;
  padding: 0 0 12px;
}

.section-layout-wrapper {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin: 0 auto;
}

/* ---------- 侧栏 ---------- */

.sidebar {
  flex: 0 0 240px;
  width: 240px;
  position: sticky;
  top: 12px;
  font-size: 13px;
}

/* 站名（深色块，Gemini 的标志性位置） */
.blog-header {
  background: var(--dark-bg);
  padding: 22px 0 20px;
  text-align: center;
}

.blog-header .site-title {
  display: block;
  font-size: 24px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 2px;
  color: var(--dark-text);
  border-bottom: 0;
}

.blog-header .site-title:hover {
  color: #fff;
  border-bottom: 0;
}

.blog-header .subtitle {
  margin: 8px 10px 0;
  font-size: 13px;
  font-weight: 400;
  color: #ddd;
  letter-spacing: 1px;
}

/* 侧栏卡片通用 */
.sidebar-box {
  background: var(--card-bg);
  margin-top: 10px;
}

/* 导航 */
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

.nav-item {
  position: relative;
}

.nav-item a {
  display: block;
  padding: 7px 20px;
  font-size: 13px;
  line-height: 1.5;
  color: #555;
  border-bottom: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-item a:hover {
  color: var(--dark-bg);
  background: #f5f5f5;
  border-bottom: 0;
}

.nav-item .nav-icon {
  width: 14px;
  height: 14px;
  margin-right: 10px;
  vertical-align: -2px;
  opacity: 0.7;
}

.nav-item-active a {
  color: var(--dark-bg);
  font-weight: 600;
  background: #f7f7f7;
}

.nav-item-active a::after {
  content: " ";
  position: absolute;
  top: 50%;
  margin-top: -3px;
  right: 15px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #bbb;
}

/* 作者与统计 */
.site-overview {
  padding: 20px 16px 16px;
  text-align: center;
}

.site-author-image {
  display: block;
  margin: 0 auto;
  padding: 2px;
  width: 110px;
  height: auto;
  background-color: #fff;
  border: 1px solid #eee;
}

.site-author-name {
  margin: 12px 0 4px;
  color: var(--dark-bg);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 1px;
}

.site-state {
  display: flex;
  justify-content: space-around;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f2f2f2;
}

.site-state-item {
  flex: 1 1 0;
  min-width: 0;
}

.site-state-item + .site-state-item {
  border-left: 1px solid #f2f2f2;
}

.site-state-count {
  display: block;
  font-size: 17px;
  line-height: 1.4;
  color: var(--dark-bg);
  font-weight: 600;
}

.site-state-label {
  display: block;
  font-size: 11.5px;
  color: var(--muted-color);
  letter-spacing: 1px;
}

.site-state-item a {
  border-bottom: 0;
  color: inherit;
  display: block;
}

.site-state-item a:hover .site-state-count {
  color: var(--accent);
}

/* 侧栏目录 */
.post-toc {
  padding: 14px 0 12px;
}

.post-toc .sidebar-title {
  margin: 0 0 8px;
  padding: 0 20px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 2px;
  color: var(--muted-color);
  text-transform: uppercase;
}

.post-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 52vh;
  overflow-y: auto;
}

.post-toc a {
  display: block;
  padding: 3px 16px 3px 20px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #666;
  border-left: 2px solid transparent;
  border-bottom: 0;
}

.post-toc .toc-h3 a {
  padding-left: 32px;
  color: #888;
}

.post-toc a:hover,
.post-toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: #fafafa;
}

/* ---------- 内容区 ---------- */

.content {
  flex: 1 1 auto;
  min-width: 0;
  width: 708px;
}

.post {
  background: var(--card-bg);
  border-radius: 3px;
  box-shadow: var(--shadow);
  padding: 24px 40px 28px;
  margin-bottom: 20px;
}

.post:last-child {
  margin-bottom: 0;
}

/* 标题区 */
.post-header {
  text-align: center;
  margin-bottom: 6px;
}

.post-title,
.page-title {
  margin: 0;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--title-color);
  word-break: break-word;
}

.post-title a,
.post-title a:hover {
  position: relative;
  display: inline-block;
  color: inherit;
  border-bottom: 0;
}

.post-title a::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 100%;
  height: 2px;
  background-color: var(--title-color);
  visibility: hidden;
  transform: scaleX(0);
  transition: transform 0.25s ease, visibility 0.25s ease;
}

.post-title a:hover::before {
  visibility: visible;
  transform: scaleX(1);
}

.post-meta {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted-color);
  text-align: center;
  letter-spacing: 0.5px;
}

.post-meta .meta-item {
  margin: 0 6px;
  white-space: nowrap;
}

.post-meta .meta-icon {
  width: 12px;
  height: 12px;
  margin-right: 4px;
  vertical-align: -1px;
  opacity: 0.75;
}

.post-meta a {
  color: var(--muted-color);
  border-bottom: 0;
}

.post-meta a:hover {
  color: var(--accent);
}

/* ---------- 正文排版 ---------- */

.article-wrapper {
  margin-top: 18px;
  font-size: 14.5px;
  color: var(--text-color);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.article-wrapper p {
  margin: 0 0 16px;
  line-height: 2;
  text-align: justify;
}

.article-wrapper h1,
.article-wrapper h2,
.article-wrapper h3,
.article-wrapper h4,
.article-wrapper h5 {
  color: var(--title-color);
  font-weight: 600;
  line-height: 1.5;
  margin: 30px 0 14px;
  scroll-margin-top: 20px;
}

.article-wrapper h1 {
  font-size: 22px;
}

.article-wrapper h2 {
  font-size: 19px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border-color);
}

.article-wrapper h3 {
  font-size: 16.5px;
}

.article-wrapper h4,
.article-wrapper h5 {
  font-size: 15px;
}

.article-wrapper ul,
.article-wrapper ol {
  margin: 0 0 16px;
  padding-left: 26px;
}

.article-wrapper li {
  margin: 5px 0;
  line-height: 1.9;
}

.article-wrapper li > ul,
.article-wrapper li > ol {
  margin: 4px 0;
}

.article-wrapper blockquote {
  margin: 16px 0;
  padding: 10px 18px;
  border-left: 4px solid #dfe6ec;
  background: #f9fafb;
  color: #666;
}

.article-wrapper blockquote p:last-child {
  margin-bottom: 0;
}

.article-wrapper hr {
  border: 0;
  border-top: 1px dashed #ddd;
  margin: 28px 0;
}

.article-wrapper img {
  display: block;
  margin: 18px auto;
  max-width: 100%;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.article-wrapper code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: #f5f5f5;
  color: #555;
  padding: 1px 5px;
  border: 1px solid #eaeaea;
}

.article-wrapper pre {
  margin: 16px 0;
  padding: 14px 16px;
  background: var(--code-bg);
  border: 1px solid #eaeaea;
  overflow-x: auto;
  line-height: 1.7;
}

.article-wrapper pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 12.5px;
  color: #444;
  white-space: pre;
}

.article-wrapper table {
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 13.5px;
  max-width: 100%;
  display: block;
  overflow-x: auto;
}

.article-wrapper table th,
.article-wrapper table td {
  border: 1px solid #e3e3e3;
  padding: 8px 13px;
  text-align: left;
  vertical-align: top;
}

.article-wrapper table th {
  background: #fafafa;
  font-weight: 600;
  color: var(--title-color);
  white-space: nowrap;
}

.article-wrapper table tr:nth-child(even) td {
  background: #fcfcfc;
}

.article-wrapper strong {
  color: var(--title-color);
  font-weight: 600;
}

/* ---------- 阅读全文 ---------- */

.post-more {
  margin-top: 6px;
  text-align: center;
}

.btn-more {
  display: inline-block;
  padding: 5px 18px;
  font-size: 12.5px;
  color: var(--link-color);
  background: #fff;
  border: 1px solid #d7e7f2;
  letter-spacing: 1px;
}

.btn-more:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- 文章页脚：标签与上下篇 ---------- */

.post-footer {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--muted-color);
}

.post-tags a {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 9px;
  font-size: 12px;
  color: #666;
  background: #f5f6f7;
  border: 1px solid #ececec;
}

.post-tags a:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 24px 0 0;
}

.post-nav-item {
  flex: 1 1 0;
  min-width: 0;
  font-size: 13px;
  line-height: 1.6;
}

.post-nav-item.next {
  text-align: right;
}

.post-nav-item .nav-label {
  display: block;
  margin-bottom: 2px;
  font-size: 11.5px;
  color: var(--muted-color);
  letter-spacing: 1px;
}

.post-nav-item a {
  color: #555;
  border-bottom: 0;
}

.post-nav-item a:hover {
  color: var(--accent);
}

.back-home {
  margin: 0 0 20px;
  text-align: center;
  font-size: 13px;
}

/* ---------- 页面标题（归档 / 标签） ---------- */

.page-header {
  text-align: center;
  margin-bottom: 26px;
}

.page-subtitle {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted-color);
}

/* ---------- 归档页 ---------- */

.archive-year {
  margin: 26px 0 10px;
  padding-bottom: 6px;
  font-size: 17px;
  font-weight: 600;
  color: var(--title-color);
  border-bottom: 1px solid var(--border-color);
}

.archive-year:first-of-type {
  margin-top: 0;
}

.archive-year .count {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted-color);
}

.archive-post {
  display: flex;
  align-items: baseline;
  padding: 7px 0;
  font-size: 14px;
  border-bottom: 1px dashed #f0f0f0;
}

.archive-post .date {
  flex: 0 0 82px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted-color);
}

.archive-post .title {
  flex: 1;
  min-width: 0;
}

.archive-post .title a {
  color: #555;
  border-bottom: 0;
}

.archive-post .title a:hover {
  color: var(--accent);
}

/* ---------- 标签页 ---------- */

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 6px 0 4px;
}

.tag-cloud-item {
  display: inline-block;
  padding: 5px 14px;
  font-size: 14px;
  color: #555;
  background: #f6f7f8;
  border: 1px solid #ececec;
}

.tag-cloud-item:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.tag-cloud-item .count {
  margin-left: 6px;
  font-size: 11.5px;
  color: var(--muted-color);
}

.tag-cloud-item:hover .count {
  color: rgba(255, 255, 255, 0.85);
}

/* ---------- 页脚 ---------- */

.footer {
  padding: 26px 20px 34px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--muted-color);
}

.footer a {
  color: var(--muted-color);
  border-bottom: 0;
}

.footer a:hover {
  color: var(--accent);
}

.footer .footer-sep {
  margin: 0 7px;
  color: #ccc;
}

/* ---------- 返回顶部 ---------- */

#back2top {
  position: fixed;
  right: 24px;
  bottom: 28px;
  width: 40px;
  height: 40px;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #999;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, color 0.2s ease;
  z-index: 200;
}

#back2top.show {
  opacity: 1;
  visibility: visible;
}

#back2top:hover {
  color: var(--accent);
  border-color: #cfe3ef;
}

/* ---------- 响应式 ---------- */

@media (max-width: 991px) {
  .main-container {
    width: auto;
    padding: 0 10px 10px;
  }

  .section-layout-wrapper {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .sidebar {
    position: static;
    width: auto;
    flex: 0 0 auto;
  }

  .content {
    width: auto;
    flex: 1 1 auto;
  }

  /* 侧栏转为顶部横条 */
  .blog-header {
    padding: 16px 0 14px;
  }

  .blog-header .site-title {
    font-size: 21px;
  }

  .blog-header .subtitle {
    margin-top: 5px;
    font-size: 12px;
  }

  .site-nav {
    margin-top: 0;
  }

  .site-nav ul {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0;
  }

  .nav-item a {
    padding: 10px 16px;
  }

  .nav-item .nav-icon {
    display: none;
  }

  .nav-item-active a {
    background: transparent;
  }

  .nav-item-active a::after {
    top: auto;
    bottom: 6px;
    right: 50%;
    margin: 0 3px 0 0;
    width: 5px;
    height: 5px;
  }

  .site-overview {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    text-align: left;
  }

  .site-author-image {
    width: 52px;
    flex: 0 0 52px;
    margin: 0;
  }

  .site-author-name {
    margin: 0;
    flex: 1 1 auto;
  }

  .site-state {
    flex: 0 0 auto;
    gap: 16px;
    margin: 0;
    padding: 0;
    border-top: 0;
  }

  .site-state-item {
    flex: 0 0 auto;
    text-align: center;
  }

  .site-state-item + .site-state-item {
    border-left: 0;
  }

  .site-state-count {
    font-size: 15px;
  }

  .site-state-label {
    font-size: 11px;
  }

  .post-toc {
    display: none;
  }

  .post {
    padding: 20px 24px 22px;
  }
}

@media (max-width: 640px) {
  .post {
    padding: 18px 16px 20px;
  }

  .post-title,
  .page-title {
    font-size: 20px;
  }

  .article-wrapper {
    font-size: 14.5px;
  }

  .article-wrapper h2 {
    font-size: 17px;
  }

  .article-wrapper h3 {
    font-size: 15.5px;
  }

  .site-overview {
    flex-wrap: wrap;
    gap: 10px;
  }

  .site-author-name {
    flex: 1 1 60px;
  }

  .site-state {
    flex: 1 1 100%;
    justify-content: space-around;
    padding-top: 8px;
    border-top: 1px solid #f2f2f2;
  }

  .site-state-item {
    flex: 1 1 0;
    border-left: 0 !important;
  }

  .archive-post {
    flex-direction: column;
    gap: 2px;
  }

  .archive-post .date {
    flex: none;
  }

  .post-nav {
    flex-direction: column;
  }

  .post-nav-item.next {
    text-align: left;
  }
}

@media print {
  .sidebar,
  .footer,
  .head-top-line,
  #back2top,
  .post-nav {
    display: none;
  }

  body {
    background: #fff;
  }

  .post {
    box-shadow: none;
    padding: 0;
  }
}
