:root {
  --bg: #eef1e8;
  --surface: #e3e8da;
  --ink: #1d2a21;
  --muted: #5d6b5f;
  --leaf: #5f7f4c;
  --line: #cdd5c3;
  --serif: "Iowan Old Style", "Palatino Linotype", "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a16;
    --surface: #1c241e;
    --ink: #e4eadf;
    --muted: #98a595;
    --leaf: #9dbb84;
    --line: #2c362e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

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

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 72px 24px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 头部 ---------- */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 56px;
}

.wordmark {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 11vw, 4.75rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

.intro {
  margin: 18px 0 0;
  max-width: 26em;
  color: var(--muted);
}

.mark {
  flex: none;
  width: 132px;
  height: 132px;
  color: var(--leaf);
}

.mark circle,
.mark path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

@media (prefers-reduced-motion: no-preference) {
  .mark circle,
  .mark path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: draw 1.6s cubic-bezier(.4, 0, .2, 1) forwards;
  }
  .mark :nth-child(2) { animation-delay: .08s; }
  .mark :nth-child(3) { animation-delay: .16s; }
  .mark :nth-child(4) { animation-delay: .24s; }
  .mark :nth-child(5) { animation-delay: .32s; }
  .mark :nth-child(6) { animation-delay: .40s; }
  .mark :nth-child(7) { animation-delay: .48s; }
}

@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- 模块入口 ---------- */
.modules {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

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

.entry {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 4px 20px;
  padding: 22px 16px;
  margin: 0 -16px;
  text-decoration: none;
  border-radius: 10px;
  transition: background-color .2s ease;
}

a.entry:hover { background: var(--surface); }

.entry-title {
  font-family: var(--serif);
  font-size: 1.375rem;
  line-height: 1.3;
}

.entry-desc {
  grid-column: 1;
  color: var(--muted);
  font-size: .9375rem;
}

.entry-dest {
  grid-column: 2;
  grid-row: 1;
  font-size: .8125rem;
  color: var(--muted);
  white-space: nowrap;
}

a.entry .entry-dest { color: var(--leaf); }

.entry-arrow {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  width: 20px;
  height: 20px;
  color: var(--muted);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s ease, color .2s ease;
}

a.entry:hover .entry-arrow {
  color: var(--leaf);
  transform: translateX(4px);
}

.entry.is-pending .entry-title { color: var(--muted); }

/* ---------- 子页面 ---------- */
.back {
  display: inline-block;
  margin-bottom: 48px;
  font-size: .9375rem;
  color: var(--muted);
  text-decoration: none;
}

.back:hover { color: var(--ink); }

.page-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.25rem, 8vw, 3rem);
  line-height: 1.15;
}

.page-lead {
  margin: 16px 0 0;
  max-width: 30em;
  color: var(--muted);
}

.empty {
  margin-top: 48px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

/* ---------- 页脚 ---------- */
.footer {
  margin-top: auto;
  padding-top: 72px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: .8125rem;
  color: var(--muted);
}

.footer a { text-decoration: none; }
.footer a:hover { color: var(--ink); }

@media (max-width: 520px) {
  .page { padding-top: 48px; }
  .hero { flex-direction: column-reverse; align-items: flex-start; margin-bottom: 40px; }
  .mark { width: 84px; height: 84px; }
  .posts .entry { grid-template-columns: 1fr; }
  .posts .entry-dest { grid-column: 1; grid-row: auto; margin-top: 4px; }
}

/* ---------- 随笔 ---------- */
.posts { margin-top: 48px; }
.posts .entry { padding-top: 18px; padding-bottom: 18px; }
.posts .entry-dest { font-variant-numeric: tabular-nums; }

.article-date {
  display: block;
  margin-top: 12px;
  font-size: .875rem;
  color: var(--muted);
}

.prose {
  margin-top: 40px;
  font-size: 1.0625rem;
  line-height: 1.85;
  overflow-wrap: break-word;
}

.prose > :first-child { margin-top: 0; }

.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.35;
  margin: 2em 0 .6em;
}
.prose h1 { font-size: 1.75rem; }
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.25rem; }
.prose h4 { font-size: 1.0625rem; font-weight: 600; }

.prose p, .prose ul, .prose ol, .prose blockquote,
.prose pre, .prose table, .prose figure { margin: 0 0 1.2em; }

.prose a { color: var(--leaf); text-underline-offset: 3px; }

.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .3em; }

.prose blockquote {
  margin-left: 0;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .875em;
  background: var(--surface);
  padding: .15em .35em;
  border-radius: 4px;
}

.prose pre {
  background: var(--surface);
  padding: 16px 18px;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.6;
}
.prose pre code { background: none; padding: 0; font-size: .875rem; }

.prose img { max-width: 100%; height: auto; border-radius: 6px; }

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

.prose table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: .9375rem;
}
.prose th, .prose td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.prose th { font-weight: 600; }

.prose input[type="checkbox"] { margin-right: .4em; }
