/* ==========================================================================
   全局样式 — 个人博客
   修改主题色 / 字号：调整 :root 里的 CSS 变量即可。
   ========================================================================== */

:root {
  --color-bg: #ffffff;
  --color-text: #333333;
  --color-text-light: #666666;
  --color-primary: #2563eb;
  --color-border: #e5e7eb;
  --color-bg-alt: #f9fafb;
  --max-width: 760px;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

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

html { font-size: 16px; }

body {
  font-family: var(--font-stack);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  width: 100%;
}

/* Header / Nav */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.site-name { font-size: 1.2rem; font-weight: 700; color: var(--color-text); }
.site-name:hover { text-decoration: none; }

.nav { display: flex; gap: 1.5rem; align-items: center; }
.nav a { color: var(--color-text); }
.nav a:hover { color: var(--color-primary); }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text);
  line-height: 1;
}

/* Main */
main { flex: 1; padding: 2.5rem 0; }

/* Hero (首页) */
.hero { text-align: center; padding: 2rem 0 3rem; }
.avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  margin: 0 auto 1rem;
  display: block;
  object-fit: cover;
}
.hero h1 { font-size: 1.8rem; margin-bottom: .5rem; }
.hero .tagline { color: var(--color-text-light); }
.hero .links {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Section title */
.section-title {
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--color-border);
}

/* Article list (首页) */
.article-list { list-style: none; }
.article-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--color-border);
}
.article-item:last-child { border-bottom: none; }
.article-item h3 { font-size: 1.15rem; margin-bottom: .35rem; }
.article-item h3 a { color: var(--color-text); }
.article-item h3 a:hover { color: var(--color-primary); text-decoration: none; }
.article-meta {
  color: var(--color-text-light);
  font-size: .875rem;
  margin-bottom: .5rem;
}
.article-summary { color: var(--color-text-light); }

.empty-state {
  color: var(--color-text-light);
  text-align: center;
  padding: 2rem 0;
  list-style: none;
}

/* Article (详情页) */
.post-header { margin-bottom: 1.5rem; }
.post-title { font-size: 1.8rem; margin-bottom: .5rem; }
.post-date { color: var(--color-text-light); font-size: .9rem; }

.post-content h2 { margin: 1.5rem 0 .75rem; font-size: 1.35rem; }
.post-content h3 { margin: 1.25rem 0 .5rem; font-size: 1.15rem; }
.post-content p { margin-bottom: 1rem; }
.post-content ul,
.post-content ol { margin: 0 0 1rem 1.5rem; }
.post-content li { margin-bottom: .25rem; }
.post-content blockquote {
  border-left: 3px solid var(--color-primary);
  padding: .25rem 0 .25rem 1rem;
  margin: 0 0 1rem;
  color: var(--color-text-light);
  background: var(--color-bg-alt);
}
.post-content pre {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  font-size: .9rem;
}
.post-content code { font-family: Consolas, "Courier New", monospace; }
.post-content :not(pre) > code {
  background: var(--color-bg-alt);
  padding: .1em .35em;
  border-radius: 3px;
  font-size: .9em;
}
.post-content img { max-width: 100%; height: auto; }

/* 表格（文章内） */
.post-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 1rem;
  font-size: .95rem;
  display: block;
  overflow-x: auto; /* 窄屏可横向滚动，避免撑破布局 */
}
.post-content th,
.post-content td {
  border: 1px solid var(--color-border);
  padding: .5rem .75rem;
  text-align: left;
  vertical-align: top;
}
.post-content thead th {
  background: var(--color-bg-alt);
  font-weight: 600;
}
.post-content tbody tr:nth-child(even) {
  background: var(--color-bg-alt);
}

/* 水平分隔线 */
.post-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.5rem 0;
}

/* 列表项内的代码也保留圆角背景 */
.post-content li code { background: var(--color-bg-alt); padding: .1em .35em; border-radius: 3px; font-size: .9em; }

.post-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

/* About page */
.about-content p { margin-bottom: 1rem; }
.about-content h2 {
  font-size: 1.25rem;
  margin: 1.5rem 0 .75rem;
}
.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  list-style: none;
  margin: 1rem 0;
}
.skill-list li {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: .25rem .9rem;
  font-size: .875rem;
}

/* Footer（所有页面共享，含备案信息） */
.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-alt);
  padding: 1.5rem 0;
  font-size: .85rem;
  color: var(--color-text-light);
  text-align: center;
}
.site-footer .icp { margin-top: .25rem; }
.site-footer .icp a { color: var(--color-text-light); }
.site-footer .icp .gongan { margin-left: .5rem; }

/* Responsive */
@media (max-width: 768px) {
  .nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 1.25rem;
    gap: 1rem;
  }
  .nav.open { display: flex; }
  .nav-toggle { display: block; }
}
