/* ========================================
   AI 技术博客 — 浅色极简风格
   ======================================== */

:root {
  --bg: #fafbfc;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #dbeafe;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
  --font-mono: 'SF Mono', 'Consolas', 'Monaco', monospace;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ========== 导航栏 ========== */
.navbar {
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.navbar__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar__logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar__logo-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
}

.navbar__nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.navbar__link {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.navbar__link:hover { color: var(--text); background: var(--border-light); }
.navbar__link--active { color: var(--text); background: var(--border-light); }

.navbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar__search-input {
  width: 200px;
  padding: 7px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.navbar__search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ========== 容器 ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

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

/* ========== 主布局 ========== */
.layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

.layout__main { min-width: 0; }
.layout__sidebar { min-width: 0; }

/* ========== 卡片 ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

/* ========== 文章卡片 ========== */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: box-shadow 0.2s, transform 0.2s;
  display: block;
  color: var(--text);
}

.post-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  color: var(--text);
}

.post-card__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.post-card__category {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-card__date {
  font-size: 12px;
  color: var(--text-light);
}

.post-card__title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 10px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.post-card__summary {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.post-card__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.post-card__views {
  font-size: 12px;
  color: var(--text-light);
}

/* ========== 精选文章（大卡片） ========== */
.featured-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.featured-card:hover { box-shadow: var(--shadow-lg); }

.featured-card__cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
}

.featured-card__cover-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

.featured-card__body {
  padding: 20px;
}

.featured-badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  border-radius: 999px;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}

/* ========== 标签 ========== */
.tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--border-light);
  border-radius: 999px;
  transition: all 0.2s;
}

.tag:hover {
  background: var(--accent-light);
  color: var(--accent);
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn--primary { background: var(--accent); color: white; }
.btn--primary:hover { background: var(--accent-hover); color: white; }
.btn--secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn--secondary:hover { background: var(--border-light); }
.btn--sm { padding: 6px 12px; font-size: 13px; }

/* ========== 分页 ========== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
}

.pagination__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.2s;
}

.pagination__item:hover { border-color: var(--accent); color: var(--accent); }
.pagination__item--active { background: var(--accent); border-color: var(--accent); color: white; }
.pagination__item--active:hover { color: white; }

/* ========== 侧边栏组件 ========== */
.sidebar-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.sidebar-widget__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  color: var(--text);
  transition: color 0.2s;
}

.sidebar-category:last-child { border-bottom: none; }
.sidebar-category:hover { color: var(--accent); }

.sidebar-category__count {
  font-size: 12px;
  color: var(--text-light);
  background: var(--border-light);
  padding: 2px 8px;
  border-radius: 999px;
}

/* ========== Hero 区域 ========== */
.hero {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 64px 24px;
  text-align: center;
}

.hero__title {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #1a1a1a 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__subtitle {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.hero__search {
  display: flex;
  max-width: 480px;
  margin: 0 auto;
  gap: 0;
}

.hero__search-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s;
}

.hero__search-input:focus { border-color: var(--accent); }

.hero__search-btn {
  padding: 12px 20px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  transition: background 0.2s;
}

.hero__search-btn:hover { background: var(--accent-hover); }

/* ========== 文章详情 ========== */
.post-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.post-header__category {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.post-header__title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 16px;
}

.post-header__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.post-header__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ========== Markdown 内容 ========== */
.prose {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
}

.prose h1, .prose h2, .prose h3, .prose h4 {
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 2em;
  margin-bottom: 0.75em;
  line-height: 1.3;
}

.prose h1 { font-size: 28px; }
.prose h2 { font-size: 22px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.prose h3 { font-size: 18px; }
.prose h4 { font-size: 16px; }

.prose p { margin-bottom: 1.25em; }

.prose a { color: var(--accent); border-bottom: 1px solid var(--accent-light); }
.prose a:hover { border-bottom-color: var(--accent); }

.prose ul, .prose ol {
  padding-left: 1.5em;
  margin-bottom: 1.25em;
}

.prose li { margin-bottom: 0.4em; }

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 1.5em 0;
  background: var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-style: italic;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--border-light);
  padding: 2px 6px;
  border-radius: 3px;
  color: #e11d48;
}

.prose pre {
  background: #1e1e2e;
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
  margin: 1.5em 0;
}

.prose pre code {
  background: none;
  color: #cdd6f4;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
}

.prose img {
  border-radius: var(--radius);
  margin: 1.5em 0;
  box-shadow: var(--shadow);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 14px;
}

.prose th, .prose td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
}

.prose th {
  background: var(--border-light);
  font-weight: 600;
}

.prose tr:nth-child(even) { background: var(--bg); }

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

/* ========== 评论区 ========== */
.comments-section {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}

.comments-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 24px;
}

.comment {
  padding: 20px 0;
  border-bottom: 1px solid var(--border-light);
}

.comment:last-child { border-bottom: none; }

.comment__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.comment__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.comment__author { font-size: 14px; font-weight: 600; }
.comment__date { font-size: 12px; color: var(--text-light); }
.comment__content { font-size: 14px; line-height: 1.7; color: var(--text-muted); }

.comment__replies {
  margin-top: 12px;
  padding-left: 24px;
  border-left: 2px solid var(--border-light);
}

.comment-form {
  margin-top: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.comment-form__title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.form-textarea { resize: vertical; min-height: 120px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ========== Flash 消息 ========== */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}

.flash--success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash--error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash--info { background: var(--accent-light); color: #1e40af; border: 1px solid #bfdbfe; }

/* ========== 页脚 ========== */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  margin-top: 80px;
}

.footer__container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer__copy {
  font-size: 13px;
  color: var(--text-light);
}

.footer__links {
  display: flex;
  gap: 20px;
}

.footer__link {
  font-size: 13px;
  color: var(--text-light);
  transition: color 0.2s;
}

.footer__link:hover { color: var(--text-muted); }

/* ========== 工具类 ========== */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mt-5 { margin-top: 48px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .layout__sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .navbar__container { padding: 0 16px; }
  .navbar__search { display: none; }
  .navbar__nav { gap: 4px; }
  .navbar__link { padding: 6px 8px; font-size: 13px; }

  .hero { padding: 40px 16px; }
  .hero__title { font-size: 28px; }
  .hero__subtitle { font-size: 16px; }

  .layout { padding: 24px 16px; }

  .post-header__title { font-size: 26px; }

  .form-row { grid-template-columns: 1fr; }

  .footer__container { flex-direction: column; gap: 16px; text-align: center; }
}
