/* ============================================================
   个人笔记记录 · zuiixuexi.com
   博客样式：刊头 / 文章列表 / 文章正文 / 归档
   规则约定：卡片与图片圆角 10px，标签全圆角，单一朱砂强调色
   ============================================================ */

:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --ink: #1b1b1e;
  --muted: #5e5e66;
  --faint: #8a8a92;
  --line: #e3e3df;
  --line-strong: #d2d2cc;
  --accent: #b8401f;
  --accent-strong: #9c3417;
  --accent-soft: rgba(184, 64, 31, 0.07);
  --accent-line: rgba(184, 64, 31, 0.30);
  --heat-0: #e6e6e1;
  --heat-1: rgba(184, 64, 31, 0.22);
  --heat-2: rgba(184, 64, 31, 0.44);
  --heat-3: rgba(184, 64, 31, 0.68);
  --heat-4: rgba(184, 64, 31, 0.92);
  --font-sans: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas,
    "Courier New", monospace;
  --r: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141416;
    --surface: #1b1b1e;
    --ink: #e9e9e7;
    --muted: #a4a4ad;
    --faint: #77777f;
    --line: #2a2a2f;
    --line-strong: #3b3b42;
    --accent: #ff7a55;
    --accent-strong: #ff9273;
    --accent-soft: rgba(255, 122, 85, 0.10);
    --accent-line: rgba(255, 122, 85, 0.34);
    --heat-0: #26262b;
    --heat-1: rgba(255, 122, 85, 0.25);
    --heat-2: rgba(255, 122, 85, 0.47);
    --heat-3: rgba(255, 122, 85, 0.70);
    --heat-4: rgba(255, 122, 85, 0.94);
  }
}

:root[data-theme="dark"] {
  --bg: #141416;
  --surface: #1b1b1e;
  --ink: #e9e9e7;
  --muted: #a4a4ad;
  --faint: #77777f;
  --line: #2a2a2f;
  --line-strong: #3b3b42;
  --accent: #ff7a55;
  --accent-strong: #ff9273;
  --accent-soft: rgba(255, 122, 85, 0.10);
  --accent-line: rgba(255, 122, 85, 0.34);
  --heat-0: #26262b;
  --heat-1: rgba(255, 122, 85, 0.25);
  --heat-2: rgba(255, 122, 85, 0.47);
  --heat-3: rgba(255, 122, 85, 0.70);
  --heat-4: rgba(255, 122, 85, 0.94);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { flex: 1; }

::selection { background: var(--accent-line); }

a { color: inherit; }

img { display: block; max-width: 100%; height: auto; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 60;
  padding: 10px 16px;
  background: var(--accent);
  color: #ffffff;
  border-radius: 0 0 var(--r) 0;
  text-decoration: none;
}

.skip-link:focus { left: 0; }

.wrap {
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  padding: 0 24px;
}

.wrap-wide { max-width: 900px; }

/* ---------- 排版基元 ---------- */

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.005em;
}

p { margin: 0; }

.meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* ---------- 刊头 ---------- */

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

.site-head .wrap {
  padding-top: 20px;
  padding-bottom: 14px;
}

.head-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 17px;
}

.brand-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent);
  color: #ffffff;
  font-family: "Songti SC", "STSong", SimSun, Georgia, serif;
  font-size: 15px;
  line-height: 1;
  flex: none;
}

.site-nav { margin-left: auto; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-links a:hover { color: var(--ink); background: var(--accent-soft); }

.nav-links a[aria-current="page"] { color: var(--accent); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: 4px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: color 0.15s ease;
}

.theme-toggle:hover { color: var(--accent); }
.theme-toggle svg { width: 16px; height: 16px; }

.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

.site-tagline {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14.5px;
  max-width: 36em;
}

/* ---------- 页面容器 ---------- */

.page { padding: 44px 0 76px; }

.page-head { margin-bottom: 40px; }
.page-head h1 { font-size: clamp(1.5rem, 3vw, 1.85rem); }
.page-head .meta { margin-top: 10px; }

/* ---------- 文章列表 ---------- */

.group-label {
  margin: 34px 0 2px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list > li { border-bottom: 1px solid var(--line); }

.post-link {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 22px;
  padding: 20px 0 22px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.post-link .post-date { padding-top: 4px; }

.post-title {
  display: block;
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.55;
  transition: color 0.15s ease;
}

.post-link:hover .post-title { color: var(--accent); }

.post-excerpt {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.75;
  max-width: 40em;
}

.post-tags { display: flex; gap: 8px; margin-top: 10px; }

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

.article-head { margin-bottom: 26px; }
.article-head h1 { font-size: clamp(1.6rem, 3.2vw, 2.05rem); margin-top: 12px; }

.article-summary {
  margin-top: 14px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.8;
}

.post-cover {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  border-radius: var(--r);
  border: 1px solid var(--line);
  margin: 30px 0 6px;
}

.article-body {
  font-size: 1.03rem;
  line-height: 1.95;
}

.article-body > * + * { margin-top: 1.15em; }

.article-body h2 {
  font-size: 1.14rem;
  margin-top: 2.5em;
  padding-top: 6px;
}

.article-body h2 + * { margin-top: 0.65em; }

.article-body ul,
.article-body ol {
  margin: 0;
  padding-left: 1.3em;
}

.article-body li + li { margin-top: 0.55em; }

.article-body li > strong { font-weight: 600; }

.article-body blockquote {
  margin: 1.8em 0;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--accent-line);
}

.article-body blockquote p {
  font-size: 1.01rem;
  color: var(--ink);
}

.article-body blockquote cite,
.article-body blockquote .src {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-style: normal;
  color: var(--muted);
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 4px;
}

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.code-block {
  margin: 1.6em 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 22px;
  overflow-x: auto;
}

.code-block pre { margin: 0; }

.code-block code {
  background: none;
  padding: 0;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.75;
  white-space: pre;
}

.code-block .cm { color: var(--muted); }
.code-block .st { color: var(--accent); }
.code-block .kw { color: var(--accent-strong); font-weight: 600; }

.article-foot {
  margin-top: 60px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.article-foot a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14.5px;
}

.article-foot a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 手记条目 ---------- */

.entry {
  padding: 34px 0;
  border-bottom: 1px solid var(--line);
}

.entry:last-of-type { border-bottom: none; }

.entry-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.entry h2 { font-size: 1.12rem; }
.entry p + p { margin-top: 0.9em; }
.entry .body { margin-top: 12px; font-size: 1rem; line-height: 1.9; }

/* ---------- 关于 ---------- */

.about {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 22px;
  align-items: start;
}

.about img {
  width: 88px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--r);
  border: 1px solid var(--line);
}

.about h2 { font-size: 1.12rem; margin-bottom: 10px; }

.streak-note { margin-top: 30px; }

.heatmap-scroll { overflow-x: auto; padding: 2px 0 4px; }

.heatmap {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 12px);
  grid-auto-columns: 12px;
  gap: 4px;
  width: max-content;
}

.heat-cell {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--heat-0);
}

.heat-cell.l1 { background: var(--heat-1); }
.heat-cell.l2 { background: var(--heat-2); }
.heat-cell.l3 { background: var(--heat-3); }
.heat-cell.l4 { background: var(--heat-4); }

.heatmap-foot {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 22px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.legend { display: inline-flex; align-items: center; gap: 4px; }
.legend span { color: var(--faint); font-size: 12px; }
.legend .heat-cell { display: inline-block; }

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

.site-foot {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding: 24px 0 34px;
  font-size: 13.5px;
  color: var(--muted);
}

.site-foot .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
}

.site-foot a {
  color: var(--muted);
  text-decoration: none;
}

.site-foot a:hover { color: var(--accent); }

.beian { border-bottom: 1px solid transparent; }
.beian:hover { border-color: var(--accent-line); }

/* ---------- 动效 ---------- */

html.js-reveal .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

html.js-reveal .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js-reveal .reveal { opacity: 1; transform: none; transition: none; }
  * { animation: none !important; transition-duration: 0.01ms !important; }
}

/* ---------- 响应式 ---------- */

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .wrap { padding: 0 18px; }
  .site-head .wrap { padding-top: 20px; padding-bottom: 16px; }
  .brand span:not(.brand-seal) { display: none; }
  .head-row { gap: 8px; }
  .nav-links a { padding: 5px 8px; font-size: 13.5px; }
  .page { padding: 32px 0 56px; }
  .post-link { grid-template-columns: 1fr; gap: 6px; padding: 18px 0 20px; }
  .post-link .post-date { padding-top: 0; }
  .article-body { font-size: 1rem; line-height: 1.9; }
  .about { grid-template-columns: 64px 1fr; gap: 16px; }
  .about img { width: 64px; }
}

@media (max-width: 400px) {
  .nav-links a { padding: 5px 6px; font-size: 13px; }
}

/* 列表项标题/摘要（首页列表语义化后的补充） */
.post-title { margin: 0; }
.post-excerpt { margin-top: 6px; }

/* 关于区块标题 */
.about-head { margin: 62px 0 26px; }
.about-head h2 { font-size: 1.14rem; }
.about p + p { margin-top: 12px; }
