/* ============================================================
   个人空间 - 统一样式表
   现代简约风格，响应式设计，移动端优先
   ============================================================ */

/* --- CSS 变量 --- */
:root {
  --primary: #5b6af0;
  --primary-light: #8b95f5;
  --primary-dark: #3d4dc7;
  --accent: #f0a05b;
  --bg: #f8f9fb;
  --bg-card: #ffffff;
  --bg-nav: rgba(255,255,255,0.9);
  --text: #2c3e50;
  --text-light: #6b7c93;
  --text-lighter: #9aa8b8;
  --border: #e8ecf1;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --success: #10b981;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --max-width: 1100px;
  --nav-height: 64px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* --- 容器 --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ==================== 导航栏 ==================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  transition: box-shadow var(--transition);
}
.navbar.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text) !important;
  letter-spacing: -0.5px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-light);
  transition: all var(--transition);
}
.nav-link:hover { color: var(--primary); background: rgba(91,106,240,0.06); }
.nav-link.active { color: var(--primary); background: rgba(91,106,240,0.08); font-weight: 600; }
.nav-link.nav-admin { color: var(--accent); }
.nav-link.nav-admin:hover { background: rgba(240,160,91,0.1); }

/* 汉堡按钮 */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 101;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}
.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ==================== Hero 区域 ==================== */
.hero {
  text-align: center;
  padding: 60px 20px 48px;
  background: linear-gradient(180deg, rgba(91,106,240,0.03) 0%, transparent 100%);
}

.hero-content {
  max-width: 600px;
  margin: 0 auto;
}

.hero-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 24px;
  border: 4px solid var(--bg-card);
  box-shadow: var(--shadow-lg);
}
.hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-title {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
  color: var(--text);
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-light);
  margin-bottom: 24px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
}

.stat-item {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-lighter);
}

/* ==================== 区块 ==================== */
.section {
  padding: 48px 0;
}

.section-alt {
  background: rgba(91,106,240,0.02);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.section-more {
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 500;
  transition: all var(--transition);
}
.section-more:hover { color: var(--primary-dark); transform: translateX(4px); }

/* ==================== 文章卡片网格 ==================== */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.post-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.post-card-image {
  width: 100%;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: linear-gradient(135deg, #e8ecf1, #dde3ed);
}
.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.post-card:hover .post-card-image img { transform: scale(1.05); }

.post-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.post-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.4;
}
.post-card-title a {
  color: var(--text);
  transition: color var(--transition);
}
.post-card-title a:hover { color: var(--primary); }

.post-card-summary {
  font-size: 0.93rem;
  color: var(--text-light);
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-lighter);
  margin-top: 12px;
  flex-wrap: wrap;
}

/* --- 标签 --- */
.tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.78rem;
  background: rgba(91,106,240,0.08);
  color: var(--primary);
  border-radius: 20px;
  font-weight: 500;
}

/* ==================== 照片网格 ==================== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.photo-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #e8ecf1, #dde3ed);
  transition: all var(--transition);
}
.photo-card:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-lg);
}

.photo-card-image {
  width: 100%;
  height: 100%;
}
.photo-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.photo-card:hover .photo-card-image img { transform: scale(1.1); }

.photo-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 40%, rgba(0,0,0,0.65));
  display: flex;
  align-items: flex-end;
  padding: 16px;
  opacity: 0;
  transition: opacity var(--transition);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
}
.photo-card:hover .photo-card-overlay { opacity: 1; }

/* ==================== 按钮 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  font-family: inherit;
  line-height: 1.4;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(91,106,240,0.35);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-light);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
}
.btn-danger:hover { background: #fecaca; }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* ==================== 表单 ==================== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,106,240,0.1);
}

.form-group textarea { min-height: 200px; line-height: 1.7; }

.form-group .help-text {
  font-size: 0.8rem;
  color: var(--text-lighter);
  margin-top: 4px;
}

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

/* 图片上传区域 */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-light);
  background: var(--bg);
}
.upload-area:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(91,106,240,0.03);
}
.upload-area.has-image { padding: 12px; }
.upload-area.has-image img {
  max-height: 240px;
  border-radius: var(--radius-sm);
  margin: 0 auto;
}

.upload-area-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}
.upload-area p { font-size: 0.9rem; }

/* ==================== 页面头部 ==================== */
.main-content {
  min-height: calc(100vh - var(--nav-height) - 80px);
}

.page-header {
  padding: 40px 0 28px;
}

.page-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.page-description {
  color: var(--text-light);
  font-size: 1rem;
  margin-bottom: 20px;
}

/* 搜索栏 */
.search-bar { margin-bottom: 16px; }

.search-input {
  width: 100%;
  max-width: 480px;
  padding: 12px 20px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-card);
  transition: all var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,106,240,0.1);
}

/* 标签筛选 */
.tag-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag-btn {
  padding: 6px 16px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text-light);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
}
.tag-btn:hover { border-color: var(--primary); color: var(--primary); }
.tag-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ==================== 文章详情 ==================== */
.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 0 48px;
}

.article-header {
  text-align: center;
  margin-bottom: 36px;
}

.article-cover {
  width: 100%;
  max-height: 420px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  margin-bottom: 36px;
}
.article-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 12px;
  line-height: 1.3;
}

.article-meta {
  color: var(--text-lighter);
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.article-body {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text);
}

.article-body h1 { font-size: 1.8rem; margin: 40px 0 16px; font-weight: 700; }
.article-body h2 { font-size: 1.5rem; margin: 36px 0 14px; font-weight: 700; }
.article-body h3 { font-size: 1.2rem; margin: 28px 0 10px; font-weight: 700; }
.article-body p { margin-bottom: 16px; }
.article-body img { border-radius: var(--radius-sm); margin: 24px auto; }
.article-body strong { font-weight: 700; color: var(--text); }
.article-body em { font-style: italic; }
.article-body code {
  background: rgba(91,106,240,0.08);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  color: var(--primary-dark);
}
.article-body pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 20px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 20px 0;
  font-size: 0.88rem;
  line-height: 1.6;
}
.article-body blockquote {
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  margin: 20px 0;
  background: rgba(91,106,240,0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-light);
}
.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
.article-body ul, .article-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
}
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li { margin-bottom: 6px; }

.article-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ==================== 管理后台 ==================== */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  min-height: calc(100vh - var(--nav-height) - 80px);
  padding-top: 32px;
  padding-bottom: 48px;
}

.admin-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 24px);
  align-self: start;
}

.admin-menu {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.admin-menu-item:last-child { border-bottom: none; }
.admin-menu-item:hover { background: rgba(91,106,240,0.04); color: var(--primary); }
.admin-menu-item.active {
  background: rgba(91,106,240,0.08);
  color: var(--primary);
  font-weight: 600;
  border-right: 3px solid var(--primary);
}

.admin-panel {
  display: none;
}
.admin-panel.active { display: block; }

.admin-panel-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
}

/* 文章列表项 */
.post-list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  transition: all var(--transition);
}
.post-list-item:hover { box-shadow: var(--shadow-sm); }

.post-list-cover {
  width: 80px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #e8ecf1, #dde3ed);
}
.post-list-cover img { width: 100%; height: 100%; object-fit: cover; }

.post-list-info { flex: 1; min-width: 0; }
.post-list-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.post-list-info span {
  font-size: 0.8rem;
  color: var(--text-lighter);
}

.post-list-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* 照片管理列表 */
.photo-manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.photo-manage-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(135deg, #e8ecf1, #dde3ed);
}
.photo-manage-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-manage-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}
.photo-manage-item:hover .photo-manage-delete { opacity: 1; }

/* ==================== 登录弹窗 ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.modal-box h2 { margin-bottom: 20px; font-size: 1.3rem; }
.modal-box .form-group { text-align: left; }
.modal-box .btn { width: 100%; justify-content: center; margin-top: 12px; }

/* ==================== Toast 提示 ==================== */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 28px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 300;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-lighter);
  grid-column: 1 / -1;
}

.empty-state p {
  font-size: 1rem;
  margin-bottom: 8px;
}

.empty-state a {
  font-weight: 600;
}

/* ==================== 图片灯箱 ==================== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }

/* ==================== 页脚 ==================== */
.footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-lighter);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* ============================================================
   响应式设计
   ============================================================ */

@media (max-width: 768px) {
  :root { --nav-height: 56px; }

  /* 导航 */
  .nav-toggle { display: flex; }
  .nav-menu {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg-card);
    flex-direction: column;
    padding: 12px;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .nav-menu.active { display: flex; }
  .nav-menu .nav-link {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
  }

  /* Hero */
  .hero { padding: 40px 16px 32px; }
  .hero-title { font-size: 2rem; }
  .hero-avatar { width: 96px; height: 96px; }
  .hero-stats { gap: 24px; }
  .stat-number { font-size: 1.6rem; }

  /* 卡片网格 */
  .post-grid { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* 页面 */
  .page-header { padding: 28px 0 20px; }
  .page-title { font-size: 1.6rem; }
  .article-title { font-size: 1.6rem; }

  .section { padding: 36px 0; }
  .section-header { flex-direction: column; align-items: flex-start; }

  .container { padding: 0 16px; }

  /* 管理后台 */
  .admin-layout { grid-template-columns: 1fr; gap: 20px; }
  .admin-sidebar { position: static; }
  .admin-menu { display: flex; overflow-x: auto; border-radius: var(--radius-sm); }
  .admin-menu-item {
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid var(--border);
    padding: 12px 16px;
    font-size: 0.85rem;
  }
  .admin-menu-item.active { border-right: none; border-bottom: 3px solid var(--primary); }
  .form-row { grid-template-columns: 1fr; }
  .post-list-item { flex-wrap: wrap; }
  .post-list-actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 400px) {
  .photo-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.6rem; }
  .hero-subtitle { font-size: 1rem; }
}

/* ==================== 暗黑模式 ==================== */
.dark {
  --primary: #818cf8;
  --primary-light: #a5b4fc;
  --primary-dark: #6366f1;
  --accent: #f59e0b;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-nav: rgba(15,23,42,0.92);
  --text: #e2e8f0;
  --text-light: #94a3b8;
  --text-lighter: #64748b;
  --border: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
}

.dark img { opacity: 0.9; }
.dark .hero { background: var(--bg-card) !important; }
.dark .footer { background: var(--bg-card) !important; }
.dark .section-alt { background: var(--bg-card) !important; }

/* 暗黑模式切换按钮 */
.dark-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
}
.dark-toggle:hover { background: var(--bg); }

/* ==================== 项目卡片 ==================== */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.project-card {
  display: block;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all var(--transition);
  text-decoration: none;
  color: var(--text);
}
.project-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}
.project-card-cover {
  height: 180px;
  overflow: hidden;
}
.project-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.project-card:hover .project-card-cover img { transform: scale(1.05); }
.project-card-body { padding: 16px 20px; }
.project-card-title { font-size: 1.1rem; margin-bottom: 6px; color: var(--text); }
.project-card-desc {
  font-size: 0.9rem;
  color: var(--text-light);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.project-card-tags { margin-top: 10px; }
.project-card-links { margin-top: 12px; display: flex; gap: 8px; }

/* ==================== 评论 ==================== */
.comments-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}
.comment-item { transition: background var(--transition); }
.comment-item:hover { background: var(--bg); }

/* ==================== Markdown 内容 ==================== */
.markdown-body h1 { font-size: 1.8rem; margin: 24px 0 16px; }
.markdown-body h2 { font-size: 1.5rem; margin: 22px 0 14px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.markdown-body h3 { font-size: 1.2rem; margin: 18px 0 10px; }
.markdown-body p { margin-bottom: 14px; line-height: 1.8; }
.markdown-body li { margin-bottom: 6px; margin-left: 20px; list-style: disc; }
.markdown-body code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.markdown-body pre { background: var(--bg); padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; margin-bottom: 14px; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.markdown-body a { color: var(--primary); text-decoration: underline; }

/* ==================== 响应式补充 ==================== */
@media (max-width: 640px) {
  .project-grid { grid-template-columns: 1fr; }
  .project-card-cover { height: 160px; }
}
