/* ============================================================
   影像与数据 · 样式表
   改配色只需要动 :root 里的变量
   ============================================================ */

:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #1a1d21;
  --text-soft: #545c68;
  --text-faint: #8b939e;
  --line: #e6e5e0;
  --line-soft: #efeee9;
  --accent: #2f5d8a;
  --accent-soft: #eef3f9;
  --code-bg: #f4f4f1;
  --radius: 10px;
  --prose-width: 660px;
  --wrap-width: 780px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141a;
    --surface: #191c23;
    --text: #e7eaef;
    --text-soft: #a3acb9;
    --text-faint: #727b88;
    --line: #272b33;
    --line-soft: #1f232a;
    --accent: #85b4e0;
    --accent-soft: #1b222c;
    --code-bg: #1c2027;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 10px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  z-index: 20;
}
.skip:focus { left: 10px; }

.wrap {
  max-width: var(--wrap-width);
  margin: 0 auto;
  padding: 0 24px;
}

.wrap.narrow { max-width: var(--prose-width); }

/* ---------------- 头部 ---------------- */

.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}

.logo {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .04em;
}
.logo:hover { text-decoration: none; color: var(--accent); }

.site-head nav {
  display: flex;
  gap: 20px;
  font-size: 14px;
}
.site-head nav a { color: var(--text-soft); }
.site-head nav a:hover { color: var(--text); text-decoration: none; }

/* ---------------- 首页 ---------------- */

.intro {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--line);
}

.intro h1 {
  margin: 0 0 12px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.intro p {
  margin: 0;
  max-width: 56ch;
  color: var(--text-soft);
  font-size: 15px;
}

.post-list { padding: 8px 0 64px; }

.post-item {
  padding: 30px 0;
  border-bottom: 1px solid var(--line-soft);
}
.post-item:last-child { border-bottom: 0; }

.post-item time {
  display: block;
  font-size: 13px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: .03em;
}

.post-item h2 {
  margin: 6px 0 8px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.45;
}
.post-item h2 a { color: var(--text); }
.post-item h2 a:hover { color: var(--accent); text-decoration: none; }

.post-item .summary {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
}

/* ---------------- 文章 ---------------- */

.post-head {
  padding: 52px 0 26px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.post-meta .dot { opacity: .6; }

.post-head h1 {
  margin: 0 0 16px;
  font-size: 30px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -.01em;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tags li {
  padding: 2px 10px;
  font-size: 12px;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.tags li a { color: inherit; }

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

.prose {
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--text);
  padding-bottom: 40px;
}

.prose > p { margin: 0 0 20px; }

.prose h2 {
  margin: 44px 0 16px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.5;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.prose h3 {
  margin: 32px 0 12px;
  font-size: 17px;
  font-weight: 600;
}

.prose h4 {
  margin: 24px 0 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-soft);
}

.prose ul, .prose ol {
  margin: 0 0 20px;
  padding-left: 1.4em;
}
.prose li { margin: 6px 0; }

.prose blockquote {
  margin: 0 0 20px;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--accent);
  color: var(--text-soft);
}
.prose blockquote p { margin: 8px 0; }

.prose code {
  padding: 1px 5px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .88em;
  background: var(--code-bg);
  border-radius: 4px;
}

.prose pre {
  margin: 0 0 22px;
  padding: 16px 18px;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  line-height: 1.6;
}

.prose pre code {
  padding: 0;
  background: none;
  font-size: 13.5px;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 24px auto;
  border-radius: var(--radius);
}

.prose hr {
  margin: 40px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.prose strong { font-weight: 600; }

/* ---------------- 翻页 ---------------- */

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  padding: 24px 0 72px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.pager-next { margin-left: auto; text-align: right; }

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

.site-foot {
  padding: 32px 0 44px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-faint);
}
.site-foot p { margin: 0 0 6px; }
.site-foot .muted { color: var(--text-faint); }

/* ---------------- 移动端 ---------------- */

@media (max-width: 620px) {
  .wrap { padding: 0 20px; }
  .intro { padding: 40px 0 30px; }
  .intro h1 { font-size: 25px; }
  .post-head { padding: 36px 0 20px; }
  .post-head h1 { font-size: 24px; }
  .prose { font-size: 16px; line-height: 1.8; }
  .prose h2 { margin-top: 36px; font-size: 19px; }
  .post-item h2 { font-size: 18px; }
}

/* ---------------- 评论区 ---------------- */

.comments {
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.comments h2 { font-size: 18px; margin: 0 0 8px; }
.comments .muted { font-size: 13px; margin: 0 0 16px; }
.comments .giscus { max-width: 100%; }

/* ---------------- 评论表单与列表 ---------------- */

.comments .comment-count {
  display: inline-block;
  margin-left: 8px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-faint);
}

.comment-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.comment-author { font-weight: 600; font-size: 14px; }
.comment-time { font-size: 12px; color: var(--text-faint); }
.comment-body {
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-soft);
}
.comment-empty { font-size: 14px; color: var(--text-faint); }

#comment-form { margin-top: 20px; }
.comment-field { margin-bottom: 10px; }
.comment-field input,
.comment-field textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  resize: vertical;
}
.comment-field input:focus,
.comment-field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: transparent;
}
.comment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.comment-msg { font-size: 13px; margin: 0; min-height: 1em; }
.comment-msg.ok { color: var(--accent); }
.comment-msg.err { color: #c0392b; }
#comment-submit {
  padding: 8px 20px;
  font: inherit;
  font-size: 14px;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}
#comment-submit:hover { opacity: 0.9; }
#comment-submit:disabled { opacity: 0.5; cursor: wait; }
