:root {
  --bg: #f6f3ee;
  --ink: #2c2b29;
  --muted: #6d6861;
  --accent: #b35c2e;
  --card: #fffaf2;
  --border: #e3dbcf;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Serif SC", "Source Han Serif SC", "PingFang SC", "Songti SC", serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f6f3ee 0%, #efe6da 100%);
}

.wrap {
  width: min(920px, 92vw);
  margin: 0 auto;
}

.site-header {
  padding: 40px 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.site-title {
  display: inline-block;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.site-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  font-weight: 600;
}

.site-nav a {
  color: var(--ink);
  text-decoration: none;
}

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

.site-desc {
  margin: 8px 0 0;
  color: var(--muted);
}

main {
  padding: 32px 0 48px;
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 220px;
  gap: 24px;
  align-items: start;
}

.content {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 20px;
  align-self: start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}

.sidebar-archive {
  justify-self: start;
}

.sidebar-random {
  justify-self: end;
}

.sidebar-section h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--ink);
}

.archive-years,
.archive-months {
  list-style: none;
  padding: 0;
  margin: 0;
}

.archive-years > li {
  margin-bottom: 10px;
}

.archive-years a,
.archive-months a {
  color: var(--ink);
  text-decoration: none;
}

.archive-months {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

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

.random-posts li {
  margin-bottom: 8px;
  display: grid;
  gap: 4px;
}

.random-posts a {
  color: var(--ink);
  text-decoration: none;
}

.random-posts time {
  font-size: 0.85rem;
  color: var(--muted);
}

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

.post-list li {
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
}

.post-list a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.post-list time {
  color: var(--muted);
  font-size: 0.9rem;
}

.pagination {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.pagination a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.page-jump {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  flex-wrap: wrap;
}

.page-jump input {
  width: 90px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
}

.page-jump button {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.post {
  background: var(--card);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.post-header h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.post-header time {
  color: var(--muted);
}

.post-body img {
  max-width: 100%;
  height: auto;
}

.post-body p,
.post-body ul,
.post-body ol,
.post-body blockquote,
.post-body pre,
.post-body table,
.post-body hr {
  margin: 0 0 1rem;
  line-height: 1.8;
}

.post-body p + p {
  margin-top: 0.8rem;
}

.post-body h2,
.post-body h3,
.post-body h4 {
  margin: 1.6rem 0 0.8rem;
}

.post-body ul,
.post-body ol {
  padding-left: 1.4rem;
}

.post-body blockquote {
  border-left: 3px solid var(--border);
  padding-left: 12px;
  color: var(--muted);
}

.post-body > h1:first-child {
  display: none;
}

.post-nav {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.site-footer {
  padding: 24px 0 36px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

@media (max-width: 640px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .sidebar {
    position: static;
    width: 100%;
  }

  .sidebar-archive {
    order: 2;
  }

  .content {
    order: 1;
  }

  .sidebar-random {
    order: 3;
    margin-top: 4px;
  }

  .archive-months {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .post-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .post-list a {
    order: 1;
  }

  .post-list time {
    order: 2;
  }

  .post-header time {
    display: block;
    margin-top: 6px;
  }

  .post {
    padding: 20px;
  }

  .pagination {
    flex-direction: column;
  }

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