:root {
  --bg: #f6f8fa;
  --card: #ffffff;
  --border: #d0d7de;
  --border-soft: #eaeef2;
  --text: #1f2328;
  --text-muted: #59636e;
  --accent: #0969da;
  --accent-strong: #0757b0;
  --accent-soft: #ddf4ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(31,35,40,.04), 0 8px 24px rgba(140,149,159,.10);
  --shadow-hover: 0 4px 10px rgba(31,35,40,.06), 0 16px 40px rgba(140,149,159,.16);
  --maxw: 1120px;
  --header-h: 60px;
  --code: #eef1f4;
}
[data-theme="dark"] {
  --bg: #0d1117;
  --card: #161b22;
  --border: #30363d;
  --border-soft: #21262d;
  --text: #e6edf3;
  --text-muted: #9198a1;
  --accent: #4493f8;
  --accent-strong: #71b7ff;
  --accent-soft: #102a44;
  --shadow: 0 1px 2px rgba(1,4,9,.4), 0 8px 24px rgba(1,4,9,.5);
  --shadow-hover: 0 4px 10px rgba(1,4,9,.5), 0 16px 40px rgba(1,4,9,.6);
  --code: #1c2129;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; gap: 18px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, #0969da, #4da3ff);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.nav { display: flex; align-items: center; gap: 4px; margin-left: 6px; }
.nav a {
  color: var(--text-muted); padding: 6px 11px; border-radius: 8px; font-size: 14.5px; font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--border-soft); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; font-size: 15px;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.menu-toggle { display: none; }

/* ---------- Layout ---------- */
.page { padding: 28px 0 64px; }
.hero { padding: 42px 0 30px; }
.hero-inner { display: flex; flex-direction: column; gap: 14px; }
.hero-kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--accent); font-weight: 600; }
.hero h1 { font-size: clamp(28px, 5vw, 42px); margin: 6px 0; line-height: 1.2; letter-spacing: -.5px; }
.hero .lead { font-size: 17px; color: var(--text-muted); max-width: 720px; margin: 0; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border); color: var(--text-muted); font-size: 13px;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 15px; border: 1px solid transparent;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--accent-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--border-soft); }

/* ---------- Sections ---------- */
.section { margin-top: 42px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 22px; margin: 0; letter-spacing: -.2px; }
.section-head .more { font-size: 14px; font-weight: 500; white-space: nowrap; }

/* ---------- Language chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border); color: var(--text); font-size: 14px; font-weight: 500;
}
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dot, #8b949e); }
.chip .count { color: var(--text-muted); font-size: 12px; font-weight: 400; }

/* ---------- Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 10px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); transition: box-shadow .18s, transform .18s, border-color .18s;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: var(--accent); }
.card .thumb {
  border-radius: var(--radius-sm); overflow: hidden; background: var(--code); aspect-ratio: 16/10;
  border: 1px solid var(--border-soft);
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 13px; }
.card-top { display: flex; align-items: center; gap: 8px; }
.lang-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: #fff; background: var(--lang, #8b949e);
}
.lang-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.85); }
.issue-tag { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.card h3 { margin: 0; font-size: 16.5px; line-height: 1.35; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--accent); text-decoration: none; }
.card .desc {
  color: var(--text-muted); font-size: 14px; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card .contrib { font-size: 12.5px; color: var(--text-muted); margin-top: auto; padding-top: 4px; border-top: 1px dashed var(--border-soft); }
.card .contrib a { color: var(--accent); }

/* ---------- Issue detail ---------- */
.issue-layout { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
.toc { position: sticky; top: calc(var(--header-h) + 20px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); padding: 14px; }
.toc h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }
.toc a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; color: var(--text); font-size: 14px; }
.toc a:hover { background: var(--border-soft); text-decoration: none; }
.toc a .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.toc a .n { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.cat-block { margin-bottom: 34px; }
.cat-title { display: flex; align-items: center; gap: 10px; font-size: 19px; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); scroll-margin-top: 80px; }
.cat-title .dot { width: 11px; height: 11px; border-radius: 50%; }
.cat-title .count { color: var(--text-muted); font-size: 13px; font-weight: 400; }
.cat-block .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ---------- Projects filter ---------- */
.filter-bar { position: sticky; top: var(--header-h); z-index: 30; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); padding: 12px 0; }
.filter-inner { display: flex; flex-direction: column; gap: 10px; }
.search-row { display: flex; gap: 10px; }
.search-input {
  flex: 1; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 15px; outline: none;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 14px; outline: none; }
.result-info { font-size: 13px; color: var(--text-muted); }
.load-more-wrap { text-align: center; margin-top: 26px; }

/* ---------- Archive timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 8px; }
.timeline-year { font-weight: 700; color: var(--text-muted); margin-top: 18px; font-size: 15px; }
.timeline-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tl-item { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--card); }
.tl-item:hover { border-color: var(--accent); text-decoration: none; }
.tl-item b { color: var(--text); font-size: 14px; }
.tl-item span { color: var(--text-muted); font-size: 12px; }

/* ---------- About ---------- */
.prose { max-width: 760px; }
.prose h2 { margin-top: 34px; }
.prose p, .prose li { color: var(--text); }
.notice { border: 1px solid #d4a72c; background: #fff8c5; color: #6a5200; border-radius: var(--radius); padding: 16px 18px; font-size: 14.5px; }
[data-theme="dark"] .notice { background: #2b2410; color: #eac54f; border-color: #6a5200; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 60px; padding: 28px 0 40px; color: var(--text-muted); font-size: 13.5px; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .issue-layout { grid-template-columns: 1fr; }
  .toc { position: static; }
  .menu-toggle { display: inline-flex; }
  .nav { position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px 14px 14px; display: none; }
  .nav.open { display: flex; }
  .nav a { padding: 11px 12px; }
  .header-right .github-link { display: none; }
}

/* ---------- 卡片底部外链 ---------- */
.card-foot { margin-top: auto; padding-top: 4px; }
.card-gh { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.card-gh:hover { color: var(--accent); text-decoration: none; }

/* ---------- 详情页 ---------- */
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13.5px; color: var(--text-muted); margin-bottom: 20px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); text-decoration: none; }
.breadcrumb span { color: var(--text); font-weight: 500; }
.detail-head { display: flex; flex-direction: column; gap: 16px; margin-bottom: 22px; }
.detail-title h1 { font-size: clamp(24px, 4vw, 34px); margin: 0 0 10px; letter-spacing: -.4px; line-height: 1.25; }
.detail-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; }
.detail-sub .muted { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.detail-figure { margin: 0 0 22px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--code); }
.detail-figure img { width: 100%; height: auto; max-height: 520px; object-fit: contain; }
.detail-figure.ph { min-height: 180px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.meta-strip { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; }
.meta-item { display: inline-flex; align-items: baseline; gap: 7px; background: var(--card); border: 1px solid var(--border); border-radius: 9px; padding: 8px 13px; }
.meta-label { font-size: 12px; color: var(--text-muted); }
.meta-value { font-size: 15px; font-weight: 650; }
.meta-strip.muted { border: none; background: none; padding: 0; }
.topics { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 2px; }
.topic { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.detail-desc { max-width: 820px; }
.desc-full { margin: 0 0 14px; line-height: 1.75; font-size: 15.5px; }
.code-block { margin: 0 0 14px; padding: 14px 16px; background: var(--code); border: 1px solid var(--border-soft); border-radius: 9px; overflow-x: auto; }
.code-block code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; white-space: pre; }
.detail-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--border-soft); }
.detail-pager .btn { max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
