/* ========== Reset & Base ========== */

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  line-height: 1.8;
  color: #333;
  background: #fafafa;
}

a {
  color: #1a73e8;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* ========== Layout ========== */

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ========== Header ========== */

.site-header {
  padding: 40px 0 20px;
  border-bottom: 1px solid #eee;
  margin-bottom: 30px;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #333;
}

.site-title:hover {
  text-decoration: none;
  color: #1a73e8;
}

.site-desc {
  margin-top: 4px;
  font-size: 0.9rem;
  color: #888;
}

/* ========== Article List ========== */

.article-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.card-link {
  display: flex;
  align-items: stretch;
  color: inherit;
  text-decoration: none;
}

.card-cover {
  flex-shrink: 0;
  width: 160px;
  min-height: 100px;
  overflow: hidden;
  background: #f0f0f0;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  flex: 1;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  color: #222;
  margin-bottom: 6px;
}

.card-meta {
  font-size: 0.85rem;
  color: #999;
}

.card-meta time {
  margin-right: 8px;
}

.card-account::before {
  content: "·";
  margin-right: 8px;
}

/* ========== Pagination ========== */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 40px 0;
  flex-wrap: wrap;
}

.page-link {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #555;
  background: #fff;
  border: 1px solid #ddd;
}

.page-link:hover {
  background: #f0f0f0;
  text-decoration: none;
}

.page-link.current {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}

/* ========== Post Detail ========== */

.post {
  background: #fff;
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-bottom: 40px;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: #888;
}

.back-link:hover {
  color: #1a73e8;
}

.post-title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
}

.post-meta {
  font-size: 0.9rem;
  color: #999;
  margin-bottom: 24px;
}

.post-meta time {
  margin-right: 8px;
}

.post-account::before {
  content: "·";
  margin-right: 8px;
}

.post-cover {
  margin-bottom: 24px;
  border-radius: 6px;
  overflow: hidden;
}

.post-cover img {
  display: block;
  width: 100%;
}

/* ========== Post Content ========== */

.post-content {
  font-size: 1rem;
  line-height: 1.8;
  letter-spacing: 0.02em;
  word-break: break-word;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  font-weight: 600;
  line-height: 1.4;
}

.post-content h1 { font-size: 1.5rem; }
.post-content h2 { font-size: 1.3rem; }
.post-content h3 { font-size: 1.15rem; }

.post-content p {
  margin-bottom: 1em;
}

.post-content img {
  display: block;
  margin: 1.2em auto;
  border-radius: 4px;
}

.post-content blockquote {
  margin: 1em 0;
  padding: 12px 20px;
  border-left: 4px solid #1a73e8;
  background: #f8f9fa;
  color: #555;
}

.post-content pre {
  margin: 1em 0;
  padding: 16px;
  background: #f5f5f5;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}

.post-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
}

.post-content :not(pre) > code {
  padding: 2px 6px;
  background: #f0f0f0;
  border-radius: 3px;
}

.post-content ul, .post-content ol {
  margin: 1em 0;
  padding-left: 2em;
}

.post-content li {
  margin-bottom: 0.3em;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

.post-content th, .post-content td {
  padding: 8px 12px;
  border: 1px solid #ddd;
  text-align: left;
}

.post-content th {
  background: #f5f5f5;
  font-weight: 600;
}

.post-content hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 2em 0;
}

/* ========== Post Nav (Prev / Next) ========== */

.post-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.post-nav-item {
  flex: 1;
  background: #fff;
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.post-nav-next {
  text-align: right;
}

.post-nav-label {
  font-size: 0.78rem;
  color: #aaa;
}

.post-nav-link {
  font-size: 0.95rem;
  color: #333;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-decoration: none;
  line-height: 1.5;
}

.post-nav-link:hover {
  color: #1a73e8;
  text-decoration: none;
}

/* ========== Related Posts ========== */

.related-posts {
  margin-bottom: 40px;
}

.related-title {
  font-size: 1rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 16px;
}

.related-list {
  display: flex;
  flex-direction: column;
}

.related-list .card {
  margin-bottom: 20px;
}

.related-list .card:last-child {
  margin-bottom: 0;
}

/* ========== Footer ========== */

.site-footer {
  padding: 20px 0;
  margin-top: 40px;
  border-top: 1px solid #eee;
  text-align: center;
  font-size: 0.85rem;
  color: #999;
}

/* ========== Responsive ========== */

@media (max-width: 600px) {
  .container {
    padding: 0 16px;
  }

  .site-header {
    padding: 24px 0 16px;
  }

  .card-link {
    flex-direction: column;
  }

  .card-cover {
    width: 100%;
    height: 180px;
  }

  .card-body {
    padding: 12px 16px;
  }

  .post {
    padding: 20px 16px;
  }

  .post-title {
    font-size: 1.3rem;
  }

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

  .post-nav-next {
    text-align: left;
  }
}
