/* 旁注 — 站点样式
   只用系统字体；颜色变量集中在 :root，深色模式覆盖同一组变量。 */

:root {
  --bg: #f7f5f0;
  --fg: #26231f;
  --muted: #7b756c;
  --faint: #d9d4ca;
  --accent: #a8432c;
  --code-bg: #eeebe3;
  --sel: #ecd8c9;

  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Helvetica Neue",
    Arial, sans-serif;
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong",
    "Georgia", "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  --measure: 35rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18;
    --fg: #dedad2;
    --muted: #8f897f;
    --faint: #39362f;
    --accent: #d98a70;
    --code-bg: #25231f;
    --sel: #4a3a30;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.85;
  text-spacing-trim: trim-start;
  text-autospace: normal;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--sel); }

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- header / footer ---------- */

.site-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.75rem 0 2.25rem;
}

.site-name {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--fg);
  text-decoration: none;
}

.site-name::before {
  content: "";
  display: inline-block;
  width: .42em;
  height: .42em;
  margin-right: .5em;
  vertical-align: .18em;
  background: var(--accent);
}

.site-nav a {
  margin-left: 1.1rem;
  font-size: .88rem;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--fg); }

.site-foot {
  margin-top: 5rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--faint);
  font-size: .8rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 1.5rem;
}

/* ---------- links ---------- */

a { color: inherit; }

main a {
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
  transition: text-decoration-color .15s;
}

main a:hover { text-decoration-color: var(--accent); }

/* ---------- index ---------- */

.intro {
  margin: 0 0 3rem;
  color: var(--muted);
  font-size: .94rem;
}

.year {
  margin: 2.5rem 0 .6rem;
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 400;
  letter-spacing: .08em;
  color: var(--muted);
}

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

.posts li {
  display: grid;
  grid-template-columns: 3.6rem 1fr auto;
  align-items: baseline;
  gap: 0 1rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--faint);
}

.posts time {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.posts a {
  text-decoration: none;
  line-height: 1.6;
}

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

.posts .cat {
  font-size: .76rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- article ---------- */

.post-head { margin-bottom: 2.25rem; }

.post-head h1,
.page-title {
  margin: 0 0 .6rem;
  font-family: var(--serif);
  font-size: 1.62rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: .02em;
}

.meta {
  font-size: .8rem;
  color: var(--muted);
}

.meta span + span::before {
  content: "·";
  margin: 0 .5em;
  color: var(--faint);
}

.prose p { margin: 0 0 1.15em; }

.prose h2 {
  margin: 2.4em 0 .8em;
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: .03em;
}

.prose h2::before {
  content: "§";
  margin-right: .45em;
  color: var(--accent);
  font-weight: 400;
}

.prose ul,
.prose ol { margin: 0 0 1.15em; padding-left: 1.4em; }

.prose li { margin: .2em 0; }
.prose li::marker { color: var(--muted); }

.prose blockquote {
  margin: 1.6em 0;
  padding: .1em 0 .1em 1.1em;
  border-left: 2px solid var(--accent);
  font-family: var(--serif);
  color: var(--muted);
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose hr {
  border: 0;
  margin: 2.5em 0;
  text-align: center;
}

.prose hr::after {
  content: "* * *";
  letter-spacing: .6em;
  color: var(--muted);
  font-size: .8rem;
}

code,
pre { font-family: var(--mono); font-size: .84em; }

:not(pre) > code {
  padding: .1em .35em;
  background: var(--code-bg);
  border-radius: 3px;
}

pre {
  margin: 1.4em 0;
  padding: .95rem 1.1rem;
  background: var(--code-bg);
  border-radius: 4px;
  overflow-x: auto;
  line-height: 1.6;
  tab-size: 2;
}

.prose table {
  width: 100%;
  margin: 1.4em 0;
  border-collapse: collapse;
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
}

.prose th,
.prose td {
  padding: .45em .6em;
  text-align: left;
  border-bottom: 1px solid var(--faint);
}

.prose th {
  font-weight: 600;
  border-bottom-color: var(--muted);
}

.table-scroll { overflow-x: auto; }

.note {
  font-size: .86rem;
  color: var(--muted);
}

.footnotes {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--faint);
  font-size: .84rem;
  color: var(--muted);
}

.footnotes ol { padding-left: 1.2em; }

sup a { text-decoration: none; color: var(--accent); }

.updated {
  margin-top: 2.5rem;
  font-size: .82rem;
  color: var(--muted);
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 3.5rem;
  font-size: .86rem;
}

.pager a {
  text-decoration: none;
  color: var(--muted);
  max-width: 48%;
}

.pager a:hover { color: var(--fg); }
.pager .next { margin-left: auto; text-align: right; }

/* ---------- small screens ---------- */

@media (max-width: 34rem) {
  html { font-size: 16px; }
  .wrap { padding: 0 1rem; }
  .site-head { padding: 1.75rem 0 1.75rem; }
  .post-head h1,
  .page-title { font-size: 1.42rem; }
  .posts li { grid-template-columns: 3.2rem 1fr; }
  .posts .cat { display: none; }
}

@media print {
  .site-nav,
  .pager,
  .site-foot { display: none; }
  body { background: #fff; color: #000; }
}
