/* ===== 主题变量（高仿 blog.xrbk.cn 淡绿主题） ===== */
:root {
  --primary: #43b083;
  --primary-deep: #2f9b6f;
  --primary-soft: #e8f6f0;
  --primary-glow: rgba(67, 176, 131, 0.16);

  --bg: #f4f7f5;
  --bg-deep: #eef3f0;
  --card: #ffffff;
  --card-2: #fbfdfc;
  --text: #2c3a33;
  --text-secondary: #6c7d75;
  --text-faint: #9aa8a1;
  --border: #e6ede9;
  --border-soft: #eef3f0;
  --shadow: 0 6px 22px rgba(47, 155, 111, 0.08);
  --shadow-hover: 0 12px 34px rgba(47, 155, 111, 0.16);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --maxw: 1180px;
  --nav-h: 64px;
}

[data-theme="dark"] {
  --primary: #54c795;
  --primary-deep: #43b083;
  --primary-soft: #1d2c26;
  --primary-glow: rgba(84, 199, 149, 0.18);

  --bg: #151a18;
  --bg-deep: #101513;
  --card: #1e2522;
  --card-2: #232b27;
  --text: #dce6e0;
  --text-secondary: #94a59c;
  --text-faint: #6b7a73;
  --border: #2c3531;
  --border-soft: #252e2a;
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 12px 34px rgba(0, 0, 0, 0.5);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Hiragino Sans GB", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  transition: background 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary); }
img { max-width: 100%; display: block; }
ul { list-style: none; }

::selection { background: var(--primary-soft); color: var(--primary-deep); }

/* ===== 顶部导航 ===== */
.nav-container {
  position: sticky;
  top: 14px;
  z-index: 50;
  max-width: var(--maxw);
  margin: 14px auto 0;
  padding: 0 16px;
}
.nav-card {
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--nav-h);
  padding: 0 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.site-brand-wrapper { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.logo-wrapper {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.site-title { font-weight: 800; font-size: 17px; letter-spacing: 0.5px; }
.site-sub { font-size: 11px; color: var(--text-faint); margin-top: -2px; }

.nav-menu { display: flex; gap: 4px; margin-left: 8px; flex: 1; }
.nav-menu a {
  padding: 8px 14px; border-radius: 10px; font-size: 14px; font-weight: 600;
  color: var(--text-secondary);
}
.nav-menu a:hover, .nav-menu a.active { color: var(--primary-deep); background: var(--primary-soft); }

.nav-actions { display: flex; align-items: center; gap: 6px; }
.nav-icon-btn {
  width: 38px; height: 38px; border: none; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--text-secondary); display: grid; place-items: center;
  transition: all 0.2s;
}
.nav-icon-btn:hover { background: var(--primary-soft); color: var(--primary-deep); }
.nav-icon-btn svg { width: 20px; height: 20px; }

/* ===== 搜索弹窗 ===== */
.search-modal {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(20, 30, 26, 0.45); backdrop-filter: blur(3px);
  align-items: flex-start; justify-content: center; padding-top: 12vh;
}
.search-modal.open { display: flex; }
.search-container {
  width: min(640px, 92vw); background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-hover); overflow: hidden;
}
.search-header { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
.search-input-wrapper { flex: 1; display: flex; align-items: center; gap: 10px; }
.search-input-wrapper svg { width: 18px; height: 18px; color: var(--text-faint); }
.search-input {
  flex: 1; border: none; outline: none; background: transparent; font-size: 16px;
  color: var(--text); font-family: inherit;
}
.search-close { background: none; border: none; cursor: pointer; color: var(--text-faint); font-size: 22px; padding: 0 6px; }
.search-results { max-height: 50vh; overflow-y: auto; padding: 8px; }
.search-result-item { padding: 12px 14px; border-radius: 10px; display: block; }
.search-result-item:hover { background: var(--primary-soft); }
.search-result-item .sr-title { font-weight: 700; font-size: 14px; }
.search-result-item .sr-desc { font-size: 12px; color: var(--text-faint); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.search-empty { padding: 26px; text-align: center; color: var(--text-faint); font-size: 13px; }

/* ===== 主布局两栏 ===== */
.main-layout {
  max-width: var(--maxw);
  margin: 22px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}
.content-area { min-width: 0; }

/* ===== 轮播 ===== */
.carousel {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  height: 300px; margin-bottom: 26px; box-shadow: var(--shadow);
}
.carousel-track { display: flex; height: 100%; transition: transform 0.6s cubic-bezier(.2,.8,.2,1); }
.carousel-slide {
  position: relative; min-width: 100%; height: 100%;
  background-size: cover; background-position: center;
}
.carousel-slide::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.55));
}
.carousel-content {
  position: absolute; left: 32px; bottom: 32px; right: 32px; z-index: 2; color: #fff;
}
.carousel-content .c-tag {
  display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 20px;
  background: rgba(255,255,255,0.22); backdrop-filter: blur(4px); margin-bottom: 10px;
}
.carousel-content .c-title { font-size: 26px; font-weight: 800; text-shadow: 0 2px 12px rgba(0,0,0,0.4); }
.carousel-content .c-desc { font-size: 14px; opacity: 0.92; margin-top: 6px; max-width: 640px; }
.carousel-dots {
  position: absolute; bottom: 16px; right: 24px; z-index: 3; display: flex; gap: 7px;
}
.carousel-dots button {
  width: 9px; height: 9px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,0.5); transition: all 0.3s;
}
.carousel-dots button.active { background: #fff; width: 22px; border-radius: 5px; }

/* ===== 区块标题 ===== */
.section-title {
  display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800;
  margin: 4px 0 16px;
}
.section-title::before {
  content: ""; width: 5px; height: 20px; border-radius: 3px;
  background: linear-gradient(var(--primary), var(--primary-deep));
}

/* ===== 文章卡片网格 ===== */
.post-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.card-link {
  display: flex; gap: 16px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s;
  overflow: hidden;
}
.card-link:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--primary); }
.card-cover {
  width: 200px; height: 134px; flex-shrink: 0; border-radius: var(--radius-sm);
  overflow: hidden; background: var(--bg-deep); object-fit: cover;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.card-link:hover .card-cover img { transform: scale(1.06); }
.card-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.card-title { font-size: 17px; font-weight: 800; line-height: 1.4; }
.card-link:hover .card-title { color: var(--primary-deep); }
.card-desc {
  font-size: 13.5px; color: var(--text-secondary); margin-top: 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-footer { margin-top: auto; padding-top: 10px; display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--text-faint); align-items: center; }
.card-cat { color: var(--primary-deep); font-weight: 700; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.card-tags span { background: var(--primary-soft); color: var(--primary-deep); padding: 2px 9px; border-radius: 20px; font-size: 11px; }
.card-pinned { background: var(--primary); color: #fff; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 28px 0 8px; }
.pagination a, .pagination span {
  min-width: 36px; height: 36px; padding: 0 10px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--border); background: var(--card);
  font-size: 13px; color: var(--text-secondary); cursor: pointer; transition: all 0.2s;
}
.pagination a:hover, .pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 侧边栏 ===== */
.sidebar { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 18px; }
.sidebar-widget {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.widget-header { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; margin-bottom: 14px; }
.widget-header::before { content: ""; width: 4px; height: 15px; border-radius: 2px; background: var(--primary); }

.profile-widget { text-align: center; }
.profile-avatar {
  width: 84px; height: 84px; border-radius: 50%; margin: 4px auto 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  display: grid; place-items: center; color: #fff; font-size: 30px; font-weight: 800;
  box-shadow: 0 6px 16px var(--primary-glow);
}
.profile-name { font-size: 18px; font-weight: 800; }
.profile-bio { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.profile-stats { display: flex; justify-content: center; gap: 22px; margin-top: 14px; }
.profile-stats div { font-size: 12px; color: var(--text-faint); }
.profile-stats b { display: block; font-size: 18px; color: var(--text); font-weight: 800; }
.profile-contact { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.profile-contact a {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--bg-deep); color: var(--text-secondary); transition: all 0.2s;
}
.profile-contact a:hover { background: var(--primary-soft); color: var(--primary-deep); }

.performance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.performance-item { background: var(--bg-deep); border-radius: 10px; padding: 10px 12px; }
.performance-item b { font-size: 17px; color: var(--text); }
.performance-item span { font-size: 11px; color: var(--text-faint); display: block; }

.welcome-content { font-size: 13.5px; color: var(--text-secondary); line-height: 1.8; }
.welcome-content .greeting-tip { color: var(--primary-deep); font-weight: 600; }
.welcome-time { font-size: 22px; font-weight: 800; color: var(--text); margin-top: 4px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
  font-size: 12px; padding: 5px 12px; border-radius: 20px;
  background: var(--bg-deep); color: var(--text-secondary); transition: all 0.2s;
}
.tag-cloud a:hover { background: var(--primary); color: #fff; }

.random-post-list { display: flex; flex-direction: column; gap: 12px; }
.random-post-item { display: flex; gap: 10px; align-items: center; }
.random-post-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--bg-deep); }
.random-post-info { min-width: 0; }
.random-post-info .rp-title { font-size: 13px; font-weight: 700; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.random-post-info .rp-cat { font-size: 11px; color: var(--text-faint); margin-top: 3px; }

/* ===== 页脚 ===== */
.footer-container {
  max-width: var(--maxw); margin: 40px auto 24px; padding: 22px 16px 0;
  border-top: 1px solid var(--border); display: flex; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--text-faint);
}
.footer-container a:hover { color: var(--primary-deep); }

/* ===== 文章详情页 ===== */
.post-article { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 30px; box-shadow: var(--shadow); }
.post-header { margin-bottom: 18px; }
.post-title { font-size: 28px; font-weight: 800; line-height: 1.35; }
.post-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--text-faint); margin-top: 12px; align-items: center; }
.post-meta .pm-cat { color: var(--primary-deep); font-weight: 700; }
.post-meta .pm-tags { display: flex; gap: 6px; }
.post-meta .pm-tags span { background: var(--primary-soft); color: var(--primary-deep); padding: 2px 9px; border-radius: 20px; font-size: 11px; }
.post-cover {
  width: 100%; height: 280px; object-fit: cover; border-radius: var(--radius);
  margin: 18px 0; background: var(--bg-deep);
}
.post-body { font-size: 15.5px; line-height: 1.9; color: var(--text); }
.post-body h2 { font-size: 21px; margin: 26px 0 12px; padding-left: 12px; border-left: 4px solid var(--primary); }
.post-body h3 { font-size: 18px; margin: 20px 0 10px; }
.post-body p { margin: 12px 0; }
.post-body ul, .post-body ol { margin: 12px 0 12px 22px; }
.post-body li { margin: 6px 0; }
.post-body blockquote {
  border-left: 4px solid var(--primary); background: var(--primary-soft);
  padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 16px 0; color: var(--text-secondary);
}
.post-body code { background: var(--bg-deep); padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.post-body pre { background: #1c2421; color: #dce6e0; padding: 16px; border-radius: 12px; overflow-x: auto; margin: 16px 0; }
.post-body pre code { background: transparent; padding: 0; }
.post-body img { border-radius: 12px; margin: 16px 0; }
.post-body a { color: var(--primary-deep); text-decoration: underline; text-underline-offset: 3px; }
.post-copyright {
  margin-top: 26px; padding: 14px 16px; border-radius: 12px; background: var(--bg-deep);
  font-size: 12.5px; color: var(--text-faint); line-height: 1.7;
}

/* ===== 归档/列表页 ===== */
.archive-list { display: flex; flex-direction: column; gap: 10px; }
.archive-group-title { font-size: 16px; font-weight: 800; margin: 18px 0 4px; color: var(--primary-deep); }
.archive-item { display: flex; gap: 14px; align-items: baseline; padding: 10px 4px; border-bottom: 1px dashed var(--border); }
.archive-item .ai-date { font-size: 12px; color: var(--text-faint); width: 96px; flex-shrink: 0; }
.archive-item .ai-title { font-weight: 600; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  padding: 8px 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-weight: 600; font-size: 14px; transition: all 0.2s;
}
.chip:hover, .chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip b { color: var(--primary-deep); margin-left: 6px; font-size: 12px; }
.chip:hover b, .chip.active b { color: #fff; }

/* ===== 响应式 ===== */
@media (max-width: 920px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .card-cover { width: 150px; height: 110px; }
  .nav-menu { display: none; }
}
@media (max-width: 560px) {
  .card-link { flex-direction: column; }
  .card-cover { width: 100%; height: 170px; }
  .carousel { height: 220px; }
  .carousel-content .c-title { font-size: 20px; }
  .post-article { padding: 20px 16px; }
}
