/* ===== CSS Variables ===== */
:root {
  --primary: #4a6fa5;
  --primary-light: #6b8fc5;
  --bg: #f9f9f9;
  --card-bg: #ffffff;
  --text: #333333;
  --text-light: #666666;
  --border: #e0e0e0;
  --tag-bg: #eef2f7;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 8px;
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-light);
}

/* ===== Header ===== */
.header {
  background: var(--card-bg);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
}

.nav {
  display: flex;
  gap: 24px;
}

.nav a {
  color: var(--text-light);
  font-size: 0.95rem;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.nav a.active,
.nav a:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===== Main Container ===== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px;
  width: 100%;
  flex: 1;
}

/* ===== Hero / Welcome ===== */
.hero {
  text-align: center;
  padding: 48px 0 32px;
}

.hero h1 {
  font-size: 2rem;
  margin-bottom: 12px;
  color: var(--primary);
}

.hero p {
  color: var(--text-light);
  font-size: 1.05rem;
}

/* ===== Article Cards ===== */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.article-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.article-card h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
  color: var(--text);
}

.article-card h2 a:hover {
  color: var(--primary);
}

.article-meta {
  display: flex;
  gap: 16px;
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.article-summary {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.6;
}

.article-tags {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.tag {
  background: var(--tag-bg);
  color: var(--primary);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
}

.tag:hover {
  background: var(--primary);
  color: white;
}

/* ===== Article Detail ===== */
.article-detail {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
}

.article-detail-header {
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 24px;
}

.article-detail-header h1 {
  font-size: 1.8rem;
  margin-bottom: 12px;
  line-height: 1.3;
}

.article-detail-body {
  line-height: 1.9;
  font-size: 1.05rem;
}

/* Markdown 渲染样式 */
.article-detail-body h1,
.article-detail-body h2,
.article-detail-body h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--text);
}

.article-detail-body h1 { font-size: 1.5rem; }
.article-detail-body h2 { font-size: 1.3rem; }
.article-detail-body h3 { font-size: 1.1rem; }

.article-detail-body p {
  margin-bottom: 1em;
}

.article-detail-body code {
  background: #f4f4f4;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.article-detail-body pre {
  background: #282c34;
  color: #abb2bf;
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1em;
}

.article-detail-body pre code {
  background: none;
  color: inherit;
  padding: 0;
}

.article-detail-body blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 16px;
  color: var(--text-light);
  margin: 1em 0;
}

.article-detail-body ul,
.article-detail-body ol {
  padding-left: 1.5em;
  margin-bottom: 1em;
}

.article-detail-body img {
  max-width: 100%;
  border-radius: var(--radius);
}

.article-detail-body a {
  word-break: break-all;
}

/* ===== Tags Page ===== */
.tags-section {
  margin-bottom: 32px;
}

.tags-section h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
  color: var(--text);
}

.tags-cloud {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tags-cloud .tag {
  font-size: 0.9rem;
  padding: 6px 14px;
}

.tags-cloud .tag.active {
  background: var(--primary);
  color: white;
}

.tag-result-title {
  font-size: 1.1rem;
  margin-bottom: 20px;
  color: var(--text-light);
}

/* ===== About Page ===== */
.about-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
}

.about-section h1 {
  font-size: 1.6rem;
  margin-bottom: 20px;
  color: var(--primary);
}

.about-section p {
  margin-bottom: 1em;
  line-height: 1.8;
}

.about-section .avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3rem;
  margin: 0 auto 24px;
}

/* ===== Back Button ===== */
.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--primary);
  font-size: 0.95rem;
}

.back-link::before {
  content: "← ";
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-light);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ===== Empty State ===== */
.empty {
  text-align: center;
  padding: 60px 0;
  color: var(--text-light);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    gap: 12px;
  }
  .article-detail {
    padding: 24px;
  }
  .about-section {
    padding: 24px;
  }
  .hero h1 {
    font-size: 1.5rem;
  }
}
