:root {
  --bg: #faf8f5;
  --panel: #ffffff;
  --text: #33302c;
  --soft: #7a756c;
  --line: #e9e4db;
  --accent: #b5533c;
  --accent-soft: #f6e9e4;
  --code-bg: #f3f0ea;
  --radius: 12px;
  --maxw: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a;
    --panel: #1e2023;
    --text: #dcd8d2;
    --soft: #98928a;
    --line: #2c2f33;
    --accent: #e08e73;
    --accent-soft: #2b2421;
    --code-bg: #242629;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.75 ui-sans-serif, -apple-system, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

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

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

a:hover {
  text-decoration: underline;
}

.muted {
  color: var(--soft);
}

.dot {
  opacity: 0.55;
}

/* ---------- 页头 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  flex-wrap: wrap;
}

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

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.brand-mark {
  display: block;
  flex: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 15px;
}

.nav a {
  color: var(--soft);
}

.nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav a.active {
  color: var(--text);
  font-weight: 600;
}

.nav a.rss {
  font-size: 13.5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}

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

.hero {
  padding: 46px 0 26px;
}

.hero-title {
  font-size: 30px;
  line-height: 1.35;
  margin: 0 0 10px;
  letter-spacing: 0.5px;
}

.hero-desc {
  margin: 0 0 6px;
  color: var(--soft);
  font-size: 16.5px;
}

.hero-meta {
  margin: 0;
  color: var(--soft);
  font-size: 14px;
}

.section {
  margin: 26px 0 44px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 4px;
}

.section-head h2 {
  font-size: 17px;
  letter-spacing: 0.5px;
  margin: 0;
}

.more {
  font-size: 14px;
}

.empty {
  color: var(--soft);
  padding: 22px 0;
}

/* ---------- 日记列表 ---------- */

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

.post-item {
  padding: 20px 0;
  border-bottom: 1px dashed var(--line);
}

.post-item:last-child {
  border-bottom: 0;
}

.post-link {
  display: block;
  color: inherit;
}

.post-link:hover {
  text-decoration: none;
}

.post-title {
  margin: 0 0 6px;
  font-size: 18.5px;
  font-weight: 600;
  transition: color 0.15s;
}

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

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

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--soft);
}

.post-list.compact .post-item.row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 13px 0;
}

.row-date {
  flex: none;
  width: 84px;
  color: var(--soft);
  font-size: 13px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
}

.row-title {
  flex: 1;
  color: inherit;
  font-size: 16.5px;
}

.row-title:hover {
  color: var(--accent);
  text-decoration: none;
}

.row-tags {
  flex: none;
  font-size: 12.5px;
  opacity: 0.85;
}

/* ---------- 归档 ---------- */

.archive-year {
  margin-top: 26px;
}

.archive-year-title {
  margin: 0;
  padding-bottom: 8px;
  font-size: 17px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
}

.archive-year-title .muted {
  font-size: 13.5px;
  font-weight: 400;
}

/* ---------- 标签 ---------- */

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 13.5px;
}

.tag .count {
  background: rgba(0, 0, 0, 0.07);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 12px;
}

a.tag:hover {
  text-decoration: none;
  filter: brightness(0.95);
}

/* ---------- 日记正文 ---------- */

.post {
  padding: 36px 0 16px;
}

.post-header {
  margin-bottom: 28px;
}

.post-title-lg {
  margin: 0 0 12px;
  font-size: 27px;
  line-height: 1.45;
  letter-spacing: 0.3px;
}

.post-body {
  font-size: 17px;
  line-height: 2;
  word-break: break-word;
}

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

.post-body p {
  margin: 0 0 1.15em;
}

.post-body h2 {
  font-size: 21px;
  margin: 1.8em 0 0.7em;
}

.post-body h3 {
  font-size: 18.5px;
  margin: 1.6em 0 0.6em;
}

.post-body h4,
.post-body h5,
.post-body h6 {
  font-size: 17px;
  margin: 1.5em 0 0.5em;
}

.post-body img {
  display: block;
  max-width: 100%;
  margin: 1.4em auto;
  border-radius: var(--radius);
}

.post-body blockquote {
  margin: 1.3em 0;
  padding: 4px 18px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--accent-soft);
  color: var(--soft);
}

.post-body code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--code-bg);
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 0.9em;
}

.post-body pre {
  margin: 0 0 1.15em;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: auto;
  line-height: 1.65;
}

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

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

.post-body li {
  margin: 0.35em 0;
}

.post-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.2em 0;
}

.post-footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 14.5px;
}

.post-nav {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.post-nav-item {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
}

.post-nav-item .muted {
  font-size: 12.5px;
}

.post-nav-item:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.post-nav-item.right {
  align-items: flex-end;
  text-align: right;
}

/* ---------- 相关日记 ---------- */

.related {
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.related-title {
  margin: 0 0 6px;
  font-size: 16px;
  letter-spacing: 0.5px;
}

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

.related-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 15px;
}

.related-list li:last-child {
  border-bottom: 0;
}

.related-list .muted {
  flex: none;
  font-size: 12.5px;
}

/* ---------- 分页 ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  font-size: 14.5px;
}

.pager-link {
  padding: 6px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

.pager-link.disabled {
  color: var(--soft);
  opacity: 0.55;
}

.pager-link.disabled:hover {
  text-decoration: none;
}

.pager-info {
  color: var(--soft);
  font-size: 13.5px;
}

/* ---------- 404 ---------- */

.notfound {
  padding: 70px 0 40px;
  text-align: center;
}

.nf-code {
  margin: 0;
  color: var(--accent);
  font-size: 64px;
  letter-spacing: 4px;
}

.nf-text {
  margin: 8px 0 26px;
  color: var(--soft);
}

.btn {
  display: inline-block;
  padding: 8px 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

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

.site-footer {
  margin-top: 40px;
  padding: 26px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: 13.5px;
  text-align: center;
}

.footer-line {
  margin: 6px 0;
}

.filing a {
  margin: 0 5px;
}

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

@media (max-width: 560px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 0 8px;
    min-height: 0;
  }

  .nav {
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 14px;
    width: 100%;
  }

  .nav a {
    padding: 2px 0;
  }

  .row-tags {
    display: none;
  }

  .hero {
    padding: 30px 0 18px;
  }

  .hero-title {
    font-size: 24px;
  }

  .post-title-lg {
    font-size: 22px;
  }

  .post-body {
    font-size: 16.5px;
    line-height: 1.95;
  }

  .row-date {
    width: auto;
  }

  .post-nav {
    flex-direction: column;
  }

  .post-list.compact .post-item.row {
    gap: 10px;
  }
}
