/* ====== reset + base ====== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Helvetica, Arial, "Source Han Sans CN", sans-serif;
  color: #222226;
  background: #f5f6f7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: #fc5531; text-decoration: none; }
a:hover { color: #e84a21; }
img, svg { max-width: 100%; vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }
hr { border: none; border-top: 1px solid #eceef1; margin: 24px 0; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ====== header ====== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid #eceef1;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}
.site-header-inner {
  display: flex;
  align-items: center;
  height: 56px;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #1b1b1b;
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fc5531, #ff7e4a);
  color: #fff;
  font-weight: 800;
}
.site-nav {
  display: flex;
  gap: 6px;
  flex: 1;
}
.site-nav a {
  display: inline-block;
  padding: 8px 14px;
  color: #3a3a3d;
  font-size: 15px;
  border-radius: 6px;
}
.site-nav a:hover { background: #f3f4f6; color: #fc5531; }
.site-nav a.active { color: #fc5531; font-weight: 600; }
.site-search {
  position: relative;
  display: flex;
  align-items: center;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 0 12px 0 32px;
  height: 34px;
  width: 260px;
}
.site-search svg {
  position: absolute;
  left: 10px;
  top: 8px;
  color: #9aa0a6;
}
.site-search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 14px;
}

/* ====== home grid ====== */
.grid-home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  padding: 20px 16px;
}
@media (max-width: 960px) {
  .grid-home { grid-template-columns: 1fr; }
  .side-rail { order: 2; }
}

/* ====== post cards ====== */
.post-list { display: flex; flex-direction: column; gap: 12px; }
.post-card {
  display: flex;
  gap: 20px;
  padding: 20px;
  background: #fff;
  border: 1px solid #eceef1;
  border-radius: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.post-card:hover {
  border-color: #ffd7c9;
  box-shadow: 0 4px 16px rgba(252, 85, 49, 0.06);
}
.post-card-cover {
  flex: 0 0 200px;
  display: block;
  overflow: hidden;
  border-radius: 6px;
  background: #f1f2f4;
  aspect-ratio: 16/9;
}
.post-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.post-card-body { flex: 1; min-width: 0; }
.post-card-title { margin: 0 0 10px; font-size: 18px; font-weight: 700; line-height: 1.4; }
.post-card-title a { color: #1b1b1b; }
.post-card-title a:hover { color: #fc5531; }
.post-card-summary {
  margin: 0 0 12px;
  color: #555a64;
  font-size: 14px;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-summary mark { background: #fff2b8; color: inherit; padding: 0 2px; }
.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: #8a8f98;
  font-size: 13px;
}
.meta-dot { color: #c5c9d0; }
.meta-chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 20px;
}
.meta-category { background: #fff1ec; color: #fc5531; }
.meta-category:hover { background: #fc5531; color: #fff !important; }
.meta-tag { background: #f1f2f4; color: #5f646d; }
.meta-tag:hover { background: #e1e3e7; }

/* ====== side rail ====== */
.side-rail { display: flex; flex-direction: column; gap: 16px; }
.card-pane {
  background: #fff;
  border: 1px solid #eceef1;
  border-radius: 8px;
  padding: 16px;
}
.pane-title {
  font-size: 15px;
  font-weight: 600;
  color: #1b1b1b;
  margin-bottom: 12px;
  padding-left: 10px;
  border-left: 3px solid #fc5531;
  line-height: 1;
}
.pane-list { list-style: none; padding: 0; margin: 0; }
.pane-list li {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dashed #eceef1;
  font-size: 14px;
}
.pane-list li:last-child { border-bottom: 0; }
.pane-list a { color: #3a3a3d; }
.pane-list a:hover { color: #fc5531; }
.pane-list .count { color: #9aa0a6; font-size: 12px; }
.pane-list.num { counter-reset: n; padding-left: 0; }
.pane-list.num li { counter-increment: n; position: relative; padding-left: 24px; }
.pane-list.num li::before {
  content: counter(n);
  position: absolute;
  left: 0; top: 8px;
  width: 18px; height: 18px;
  background: #f1f2f4;
  color: #6b7079;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  text-align: center;
  line-height: 18px;
}
.pane-list.num li:nth-child(-n+3)::before { background: #fc5531; color: #fff; }
.pane-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pane-tags a {
  display: inline-block;
  padding: 3px 10px;
  background: #f1f2f4;
  color: #3a3a3d;
  border-radius: 12px;
  font-size: 12px;
}
.pane-tags a:hover { background: #fc5531; color: #fff; }

/* ====== article page ====== */
.article-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 260px;
  gap: 24px;
  padding: 20px 16px;
}
@media (max-width: 1100px) {
  .article-layout { grid-template-columns: minmax(0, 1fr) 260px; }
  .article-side.left { display: none; }
}
@media (max-width: 880px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-side.right { display: none; }
}
.article-side.left { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 80px); overflow: auto; }
.article-side.right { position: sticky; top: 72px; align-self: start; }

.article-main {
  background: #fff;
  border: 1px solid #eceef1;
  border-radius: 8px;
  padding: 36px 40px;
}
@media (max-width: 640px) { .article-main { padding: 24px 18px; } }
.article-header { border-bottom: 1px solid #eceef1; padding-bottom: 16px; margin-bottom: 28px; }
.article-title {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.35;
  color: #1b1b1b;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: #8a8f98;
  font-size: 13px;
}
.article-meta .author { color: #fc5531; font-weight: 600; }
.article-tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }

/* TOC */
.article-toc {
  background: #fff;
  border: 1px solid #eceef1;
  border-radius: 8px;
  padding: 16px;
  font-size: 13px;
}
.toc-title {
  font-weight: 600;
  color: #1b1b1b;
  margin-bottom: 10px;
  padding-left: 8px;
  border-left: 3px solid #fc5531;
  line-height: 1;
}
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-item { padding: 4px 0; }
.toc-item a { color: #55595f; display: block; line-height: 1.5; }
.toc-item a:hover { color: #fc5531; }
.toc-level-1 a { font-weight: 600; color: #1b1b1b; }
.toc-level-2 { padding-left: 10px; }
.toc-level-3 { padding-left: 20px; font-size: 12.5px; }
.toc-level-4 { padding-left: 30px; font-size: 12.5px; color: #767a83; }
.toc-level-5, .toc-level-6 { padding-left: 40px; font-size: 12px; }

/* ====== markdown body (CSDN-like) ====== */
.markdown-body {
  font-size: 15.5px;
  line-height: 1.88;
  color: #2d2d33;
  word-break: break-word;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 28px 0 14px;
  font-weight: 700;
  line-height: 1.45;
  color: #1b1b1b;
  scroll-margin-top: 72px;
}
.markdown-body h1 { font-size: 26px; border-bottom: 1px solid #eceef1; padding-bottom: 8px; }
.markdown-body h2 { font-size: 22px; border-bottom: 1px solid #eceef1; padding-bottom: 6px; }
.markdown-body h3 { font-size: 19px; }
.markdown-body h4 { font-size: 17px; }
.markdown-body h5, .markdown-body h6 { font-size: 15px; }

.markdown-body p { margin: 0 0 14px; }
.markdown-body ul, .markdown-body ol { margin: 0 0 14px; padding-left: 26px; }
.markdown-body ul li { list-style: disc; }
.markdown-body ol li { list-style: decimal; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body blockquote {
  margin: 16px 0;
  padding: 10px 18px;
  color: #565b64;
  background: #fafafb;
  border-left: 4px solid #fc5531;
  border-radius: 0 4px 4px 0;
}
.markdown-body blockquote p:last-child { margin-bottom: 0; }
.markdown-body img { display: block; max-width: 100%; margin: 16px auto; border-radius: 4px; }
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14.5px;
  overflow-x: auto;
  display: block;
}
.markdown-body thead { background: #f6f7f8; }
.markdown-body th, .markdown-body td {
  padding: 10px 14px;
  border: 1px solid #e6e8eb;
  text-align: left;
}
.markdown-body th { font-weight: 600; color: #1b1b1b; }
.markdown-body a { color: #fc5531; border-bottom: 1px solid transparent; }
.markdown-body a:hover { border-bottom-color: #fc5531; }
.markdown-body :not(pre) > code {
  padding: 2px 6px;
  font-size: 0.92em;
  color: #d63384;
  background: #f6f7f8;
  border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
.markdown-body pre {
  position: relative;
  margin: 16px 0;
  padding: 0;
  background: #282c34;
  border-radius: 8px;
  overflow: hidden;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13.5px;
  line-height: 1.6;
}
.markdown-body pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  right: 0;
  padding: 4px 12px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.18);
  border-bottom-left-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.markdown-body pre code { display: block; padding: 40px 20px 20px; background: transparent; color: #abb2bf; overflow-x: auto; }
.markdown-body hr { margin: 24px 0; border: 0; border-top: 1px solid #eceef1; }
.markdown-body kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 12px;
  font-family: "SFMono-Regular", Consolas, monospace;
  color: #444;
  background: #fafbfc;
  border: 1px solid #d1d5da;
  border-radius: 4px;
  box-shadow: inset 0 -1px 0 #d1d5da;
}

/* Article nav (prev / next) */
.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 32px;
}
.article-nav .adj {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  background: #f7f8fa;
  border: 1px solid #eceef1;
  border-radius: 6px;
  transition: border-color .15s;
}
.article-nav .adj:hover { border-color: #fc5531; }
.article-nav .adj.next { text-align: right; }
.article-nav .adj-label { font-size: 12px; color: #8a8f98; margin-bottom: 4px; }
.article-nav .adj-title { color: #1b1b1b; font-weight: 600; font-size: 14px; }

/* Author side card */
.author-card { text-align: center; }
.author-avatar {
  display: inline-grid; place-items: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fc5531, #ff9466);
  color: #fff; font-size: 24px; font-weight: 700;
  margin-bottom: 8px;
}
.author-name { font-weight: 600; color: #1b1b1b; }
.author-bio { color: #6b7079; font-size: 13px; margin-top: 6px; line-height: 1.6; }

/* ====== tag / category lists ====== */
.page-title { font-size: 22px; margin: 22px 0 14px; color: #1b1b1b; }
.page-title small { font-size: 13px; color: #8a8f98; font-weight: 400; margin-left: 8px; }
.page-desc { color: #6b7079; margin-bottom: 18px; }

.tag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.tag-card {
  display: flex; flex-direction: column;
  padding: 20px;
  background: #fff;
  border: 1px solid #eceef1;
  border-radius: 8px;
  color: #1b1b1b;
  transition: transform .15s, border-color .15s;
}
.tag-card:hover { transform: translateY(-2px); border-color: #fc5531; }
.tag-card-name { font-size: 17px; font-weight: 700; }
.tag-card-count { font-size: 12px; color: #8a8f98; margin-top: 4px; }
.tag-card-desc { font-size: 12.5px; color: #6b7079; margin-top: 10px; }

.tag-cloud {
  display: flex; flex-wrap: wrap; gap: 10px 14px;
  padding: 20px; background: #fff; border: 1px solid #eceef1; border-radius: 8px;
}
.tag-cloud-item { color: #3a3a3d; }
.tag-cloud-item sup { color: #8a8f98; font-size: 10px; margin-left: 2px; }
.tag-cloud-item:hover { color: #fc5531; }

/* ====== archive ====== */
.archive { background: #fff; border: 1px solid #eceef1; border-radius: 8px; padding: 20px 28px; }
.archive-year { margin: 14px 0 22px; }
.archive-year h2 {
  font-size: 22px; color: #fc5531; margin: 0 0 12px;
  padding-bottom: 6px; border-bottom: 1px solid #eceef1;
}
.archive-year ul { list-style: none; padding: 0; margin: 0; }
.archive-year li {
  display: flex; align-items: baseline; gap: 14px;
  padding: 6px 0;
  border-bottom: 1px dashed #eceef1;
}
.archive-year li:last-child { border-bottom: none; }
.archive-year time { flex: 0 0 90px; color: #8a8f98; font-size: 13px; font-family: "SFMono-Regular", monospace; }
.archive-year a { color: #1b1b1b; flex: 1; }
.archive-year a:hover { color: #fc5531; }

/* ====== pagination ====== */
.pagination {
  display: flex; justify-content: center; gap: 6px;
  margin: 28px 0 12px;
}
.pg-link {
  min-width: 32px; padding: 0 12px; height: 32px;
  display: inline-grid; place-items: center;
  background: #fff; border: 1px solid #e6e8eb;
  color: #3a3a3d; font-size: 13px;
  border-radius: 4px;
}
.pg-link:hover { border-color: #fc5531; color: #fc5531; }
.pg-link.current { background: #fc5531; color: #fff; border-color: #fc5531; }
.pg-link.disabled { color: #c5c9d0; background: #fafafb; cursor: not-allowed; }
.pg-ellipsis { padding: 0 6px; color: #8a8f98; align-self: center; }

/* ====== search page ====== */
.search-form-big {
  display: flex; gap: 10px; margin: 16px 0 20px;
}
.search-form-big input {
  flex: 1; padding: 10px 14px; height: 42px;
  border: 1px solid #e6e8eb; border-radius: 6px;
  font-size: 14px; outline: none;
}
.search-form-big input:focus { border-color: #fc5531; }
.search-form-big button {
  padding: 0 24px; height: 42px;
  background: #fc5531; color: #fff;
  border: 0; border-radius: 6px; cursor: pointer; font-weight: 600;
}
.search-form-big button:hover { background: #e84a21; }

/* ====== footer ====== */
.site-footer {
  margin-top: 40px;
  padding: 22px 0;
  color: #8a8f98;
  font-size: 13px;
  text-align: center;
  border-top: 1px solid #eceef1;
  background: #fff;
}

/* ====== about ====== */
.about p { color: #3a3a3d; line-height: 1.85; }
.empty { padding: 40px; text-align: center; color: #8a8f98; background: #fff; border: 1px dashed #dde1e5; border-radius: 8px; }
.empty h1 { font-size: 52px; color: #fc5531; margin: 0; }
