:root {
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #64748b;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --soft: #f1f5ff;
  --radius: 12px;
  --font: system-ui, -apple-system, Segoe UI, Roboto, "PingFang SC", "Microsoft YaHei", "Noto Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); font: 16px/1.7 var(--font); text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; height: auto; }
.muted { color: var(--muted); }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.bar { }
.bar-top { border-bottom: 1px solid var(--line); }
.bar-top .container { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { font-weight: 800; font-size: 20px; color: var(--fg); white-space: nowrap; }

.search-form { margin-left: auto; display: flex; align-items: center; }
.search-form input {
  width: 220px; max-width: 40vw;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; font: inherit; font-size: 14px;
}

.lang-switch { display: flex; gap: 8px; margin-left: 12px; font-size: 13px; }
.lang-switch a { color: var(--muted); }
.lang-switch a.on, .lang-switch a[aria-current="true"] { color: var(--fg); font-weight: 700; }

.bar-nav { background: #f8fafc; }

/* Category nav: height wraps links, only horizontal scroll, hide scrollbars */
.cat-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;            /* prevent vertical scrollbar */
  scrollbar-width: none;         /* Firefox hide */
  -ms-overflow-style: none;      /* IE/Edge legacy */
  white-space: nowrap;
  height: auto;                  /* let it size to link height */
}
.cat-nav::-webkit-scrollbar { display: none; } /* WebKit hide */

.cat-link { color: var(--muted); padding: 10px 6px; border-bottom: 2px solid transparent; }
.cat-link.is-active { color: var(--fg); border-color: var(--accent); }

/* Page container */
.page-container { max-width: 1120px; margin: 0 auto; padding: 24px 20px 40px; }

/* Home */
.site-title { font-size: 28px; margin: 6px 0 6px; line-height: 1.3; }
.site-topic { margin: 0 0 16px; padding: 12px 14px; background: var(--soft); border-radius: var(--radius); color: #334155; }
.home-hero .hero-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 12px; }
.hero-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: #fff; display: flex; flex-direction: column; gap: 6px; }
.hero-title { font-size: 18px; margin: 0; line-height: 1.4; }
.hero-excerpt { margin: 4px 0 0; color: #374151; }
.more-link { align-self: start; margin-top: 6px; font-weight: 600; }

.section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 28px; }
.category-section { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 14px 16px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.section-title { font-size: 18px; margin: 0; }
.section-title a { color: var(--fg); }
.section-more { color: var(--accent); text-decoration: none; font-weight: 700; }
.lead-card { padding: 8px 0 4px; border-bottom: 1px dashed var(--line); }
.lead-title { font-size: 17px; margin: 0 0 4px; line-height: 1.4; }
.lead-excerpt { margin: 6px 0 10px; color: #374151; }

.posts-mini { list-style: none; margin: 8px 0 0; padding: 0; }
.list-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid rgba(229,231,235,.6); }
.list-row:last-child { border-bottom: 0; }
.list-title { color: var(--fg); min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-date { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* Breadcrumbs */
.breadcrumbs { font-size: 14px; color: var(--muted); margin: 0 0 10px; }
.breadcrumbs a { color: var(--muted); }
.page-title { font-size: 26px; margin: 0 0 10px; line-height: 1.35; }

/* List page cards */
.post-list { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 10px; }
.list-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: #fff; }
.list-card-title { font-size: 20px; margin: 0 0 6px; line-height: 1.4; }
.list-card-excerpt { margin: 6px 0 0; color: #374151; }

/* Article */
.article { max-width: 980px; margin: 0 auto; }
.article-head { margin-bottom: 12px; }
.article-title { font-size: 28px; margin: 0 0 4px; line-height: 1.3; }
.article-lead { font-size: 18px; color: #374151; margin: 8px 0 0; }
.post-meta { color: var(--muted); font-size: 14px; margin: 4px 0; }
.meta-link { color: var(--muted); }
.source-link { margin-top: 18px; padding-top: 10px; border-top: 1px dashed var(--line); }

.article-layout { display: grid; grid-template-columns: minmax(0,1fr) 260px; gap: 28px; }
.article-body { min-width: 0; }
.article-body h2 { font-size: 22px; margin: 22px 0 8px; }
.article-body h3 { font-size: 18px; margin: 16px 0 6px; }
.article-body p { margin: 10px 0; }
.article-body ul, .article-body ol { padding-left: 22px; }
.article-body blockquote { margin: 14px 0; padding: 10px 14px; border-left: 3px solid var(--line); background: #f8fafc; color: #374151; }

/* details/summary as FAQ */
.article-body details { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: #fff; }
.article-body summary { cursor: pointer; font-weight: 600; outline: none; list-style: none; }
.article-body details[open] { background: #f9fafb; }

/* ToC */
.toc { position: sticky; top: 90px; align-self: start; }
.toc-inner { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px; background: #fff; }
.toc-icon { display: block; width: 16px; height: 16px; color: var(--muted); margin-bottom: 8px; }
.toc-list { display: flex; flex-direction: column; gap: 6px; }
.toc-item { display: block; color: var(--fg); }
.toc-item.level-3 { padding-left: 12px; font-size: 14px; color: #374151; }

/* Promo */
.promo-block { margin-top: 24px; padding: 16px; border-radius: var(--radius); background: var(--soft); display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.promo-text { margin: 0; color: #334155; }
.promo-btn { display: inline-block; padding: 8px 16px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.promo-btn:hover { text-decoration: none; background: #1d4ed8; }

/* Related */
.related-block { margin-top: 28px; }
.related-title { font-size: 18px; margin: 0 0 10px; }
.related-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 6px; }
.related-list a { color: var(--fg); }
.related-list time { color: var(--muted); font-size: 13px; margin-left: 8px; }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 22px; }
.page-count { color: var(--muted); }
.page-link { color: var(--accent); font-weight: 600; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted); font-size: 14px; background: #fff; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px; }
.footer-sep { opacity: .5; }

/* Responsive */
@media (max-width: 960px) {
  .article-layout { grid-template-columns: 1fr; }
  .toc { position: relative; top: 0; }
}
@media (max-width: 720px) {
  .site-title { font-size: 24px; }
  .article-title { font-size: 24px; }
  .search-form input { width: 160px; }
}
@media (max-width: 420px) {
  .search-form input { width: 130px; }
  .list-title { white-space: normal; }
}
