:root {
  --bg: #fdfdfc;
  --fg: #24292f;
  --muted: #6a737d;
  --accent: #2f6fed;
  --border: #ececec;
  --code-bg: #f6f8fa;
  --card: #ffffff;
  --max: 1060px;
  --reading: 720px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --fg: #d7dbe0;
    --muted: #8b949e;
    --accent: #6ea8fe;
    --border: #2a2e35;
    --code-bg: #1e2228;
    --card: #1a1d21;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
.wrapper { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  padding: 36px 0 20px; margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.site-title {
  font-size: 1.5rem; font-weight: 700; color: var(--fg);
  text-decoration: none; letter-spacing: .3px;
}
.site-subtitle { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.site-nav a {
  color: var(--muted); text-decoration: none; margin-left: 18px; font-size: .95rem;
  transition: color .15s;
}
.site-nav a:hover { color: var(--accent); }

/* Content */
.content { min-height: 60vh; }
.intro { color: var(--muted); margin: 0 0 30px; font-size: 1.05rem; }
.section-heading { font-size: 1.15rem; border-left: 3px solid var(--accent); padding-left: 10px; margin: 30px 0 18px; }

/* Minimal archive list (homepage + list pages) */
.archive-heading { font-size: 1.2rem; font-weight: 500; margin: 6px 0 20px; }
.archive-total { color: var(--muted); font-size: .85rem; font-weight: 400; }
.list-intro { color: var(--muted); margin: -8px 0 16px; }
.archive-list { list-style: disc; margin: 0; padding-left: 22px; }
.archive-item { padding: 7px 0; line-height: 1.7; }
.archive-item::marker { color: var(--border); }
.archive-date {
  color: var(--muted); font-size: .9rem;
  font-family: "SFMono-Regular", Consolas, monospace; white-space: nowrap;
}
.archive-date::after { content: "："; }
.archive-title { color: var(--accent); text-decoration: none; }
.archive-title:hover { text-decoration: underline; }

/* Pager */
.pager {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  margin: 34px 0 0; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: .9rem;
}
.pager-link { color: var(--accent); text-decoration: none; }
.pager-link:hover { text-decoration: underline; }
.pager-link.disabled { color: var(--muted); opacity: .45; cursor: default; }
.pager-info { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; }

@media (max-width: 520px) {
  .archive-date::after { content: " "; }
  .archive-item { line-height: 1.6; }
}

/* ===== Two-column layout + sidebar ===== */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 216px; gap: 34px; align-items: start; }
.content-narrow { max-width: var(--reading); margin: 0 auto; }
.sidebar { position: sticky; top: 24px; }

.widget { margin-bottom: 30px; }
.widget-title {
  font-size: .8rem; font-weight: 500; letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

/* Archive tree */
.arc-tree { font-size: .9rem; }
.arc-year { border-bottom: 1px dashed var(--border); }
.arc-year > summary {
  cursor: pointer; padding: 7px 2px; list-style: none; user-select: none;
  display: flex; align-items: center; color: var(--fg);
}
.arc-year > summary::-webkit-details-marker { display: none; }
.arc-year > summary::before { content: "▸"; color: var(--muted); margin-right: 8px; font-size: .8rem; transition: transform .15s; }
.arc-year[open] > summary::before { transform: rotate(90deg); }
.arc-year > summary:hover { color: var(--accent); }
.arc-months { list-style: none; margin: 2px 0 8px; padding: 0 0 0 20px; }
.arc-months li { padding: 3px 0; }
.arc-months a { color: var(--muted); text-decoration: none; display: flex; justify-content: space-between; }
.arc-months a:hover { color: var(--accent); }
.arc-count {
  margin-left: auto; color: var(--muted); font-size: .72rem; background: var(--code-bg);
  min-width: 30px; text-align: center; padding: 0 7px; border-radius: 9px;
  line-height: 1.6; font-family: Consolas, monospace;
}
.widget-more { display: inline-block; margin-top: 12px; font-size: .82rem; color: var(--accent); text-decoration: none; }
.widget-more:hover { text-decoration: underline; }

/* Tag cloud */
.tag-cloud { line-height: 2.1; }
.tag-cloud a {
  color: var(--accent); text-decoration: none; margin-right: 10px; white-space: nowrap;
  opacity: .9; transition: opacity .15s;
}
.tag-cloud a:hover { opacity: 1; text-decoration: underline; }
.tag-cloud sup { color: var(--muted); font-size: .6em; margin-left: 1px; }

/* About widget */
.widget-about { font-size: .88rem; color: var(--muted); margin: 0 0 8px; line-height: 1.7; }
.widget-about-meta { font-size: .82rem; color: var(--muted); margin: 0; font-family: Consolas, monospace; }

/* ===== Homepage hero ===== */
.hero { padding: 6px 0 22px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.hero-desc { font-size: 1.08rem; color: var(--fg); margin: 0 0 14px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 18px; align-items: baseline; }
.hero-stat { font-size: .85rem; color: var(--muted); }
.hero-stat strong { color: var(--accent); font-size: 1.15rem; font-weight: 500; margin-right: 3px; }
.hero-link { color: var(--accent); text-decoration: none; margin-left: auto; }
.hero-link:hover { text-decoration: underline; }

/* ===== Enhanced pager ===== */
.pager { gap: 8px; flex-wrap: wrap; }
.pager-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--border);
  border-radius: 6px; color: var(--accent); text-decoration: none; font-size: 1rem;
  transition: background .15s, border-color .15s;
}
.pager-btn:hover { background: var(--code-bg); border-color: var(--accent); }
.pager-btn.disabled { color: var(--muted); opacity: .4; pointer-events: none; }
.pager-mid { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; margin: 0 4px; }
.pager-input {
  width: 56px; height: 34px; text-align: center; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg); color: var(--fg); font-size: .9rem;
  font-family: Consolas, monospace;
}
.pager-input:focus { outline: none; border-color: var(--accent); }
.pager-go {
  height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--code-bg); color: var(--accent); cursor: pointer; font-size: .85rem;
}
.pager-go:hover { border-color: var(--accent); }

/* ===== Archives page ===== */
.arc-year-block { margin: 0 0 36px; scroll-margin-top: 20px; }
.arc-year-title {
  font-size: 1.5rem; font-weight: 500; margin: 0 0 14px; padding-bottom: 8px;
  border-bottom: 2px solid var(--accent); display: flex; align-items: baseline; justify-content: space-between;
}
.arc-month-block { margin: 0 0 18px; padding-left: 4px; scroll-margin-top: 20px; }
.arc-month-title { font-size: 1rem; font-weight: 500; color: var(--muted); margin: 0 0 6px; }

/* ===== Responsive: stack sidebar ===== */
@media (max-width: 640px) {
  .layout { grid-template-columns: 1fr; gap: 30px; }
  .sidebar { position: static; border-top: 1px solid var(--border); padding-top: 20px; }
  .tag-cloud { line-height: 2.4; }
}

/* Post list */
.post-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.post-item h3 { margin: 0 0 6px; font-size: 1.2rem; }
.post-item h3 a { color: var(--fg); text-decoration: none; }
.post-item h3 a:hover { color: var(--accent); }
.post-meta { color: var(--muted); font-size: .85rem; margin: 0 0 8px; }
.post-summary { color: var(--muted); margin: 0; font-size: .95rem; }
.tag {
  display: inline-block; color: var(--accent); text-decoration: none;
  font-size: .8rem; background: var(--code-bg); padding: 1px 8px; border-radius: 10px;
}

/* Single post */
.post-header { margin-bottom: 26px; }
.post-header h1 { font-size: 1.9rem; line-height: 1.3; margin: 0 0 10px; }
.post-content { font-size: 1.02rem; }
.post-content h2 { font-size: 1.35rem; margin: 38px 0 14px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.post-content h3 { font-size: 1.15rem; margin: 28px 0 12px; }
.post-content p { margin: 16px 0; }
.post-content a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
.post-content a:hover { border-bottom-color: var(--accent); }
.post-content img { max-width: 100%; border-radius: 6px; }
.post-content blockquote {
  margin: 18px 0; padding: 4px 16px; border-left: 3px solid var(--border);
  color: var(--muted);
}

/* Code */
code {
  font-family: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .9em;
}
.post-content > p code, li code {
  background: var(--code-bg); padding: 2px 6px; border-radius: 4px;
}
.post-content pre {
  background: var(--code-bg); padding: 16px; border-radius: 8px;
  overflow-x: auto; border: 1px solid var(--border); line-height: 1.55;
}
.post-content pre code { background: none; padding: 0; font-size: .85rem; }

/* Footers */
.post-footer { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); }
.back-link { color: var(--accent); text-decoration: none; }
.site-footer {
  margin-top: 60px; padding: 28px 0; border-top: 1px solid var(--border);
  color: var(--muted); font-size: .85rem; text-align: center;
}
.site-footer a { color: var(--muted); }
.site-footer .footer-note { margin: 6px 0 0; font-size: .8rem; opacity: .8; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .site-header { padding-top: 24px; }
  .post-header h1 { font-size: 1.5rem; }
}
