:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #1a1d21;
  --muted: #6b7280;
  --line: #e8eaed;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
}

[data-theme="dark"] {
  --bg: #0f1115;
  --card: #171a21;
  --text: #e8eaed;
  --muted: #9aa3b2;
  --line: #242832;
  --accent: #60a5fa;
  --accent-soft: #1b2436;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background .3s, color .3s;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

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

/* ===== 顶部导航 ===== */
.header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header .container {
  height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: grid; place-items: center; color: #fff; font-size: 15px;
}
.nav { display: flex; align-items: center; gap: 8px; }
.nav a {
  padding: 7px 14px; border-radius: 8px; font-size: 14px; color: var(--muted);
  transition: .2s;
}
.nav a:hover, .nav a.active { color: var(--accent); background: var(--accent-soft); }
.theme-btn {
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%;
  background: var(--card); cursor: pointer; font-size: 15px; color: var(--accent);
  display: grid; place-items: center; transition: .2s;
}
.theme-btn:hover { transform: rotate(30deg); }

/* ===== 个人卡片 ===== */
.hero {
  margin: 32px 0;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 40px; display: flex; gap: 28px; align-items: center;
}
.avatar {
  width: 96px; height: 96px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: grid; place-items: center; color: #fff; font-size: 34px; font-weight: 700;
  overflow: hidden; padding: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero h1 { font-size: 26px; margin-bottom: 8px; }
.hero p { color: var(--muted); font-size: 15px; max-width: 560px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag {
  font-size: 12.5px; padding: 4px 12px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent);
}

/* ===== 工具栏 ===== */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter {
  padding: 7px 16px; border-radius: 20px; font-size: 13.5px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--muted); cursor: pointer; transition: .2s;
}
.filter:hover { border-color: var(--accent); color: var(--accent); }
.filter.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.search {
  padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 13.5px; width: 240px;
  outline: none; transition: .2s;
}
.search:focus { border-color: var(--accent); }

/* ===== 文章网格 ===== */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px; padding-bottom: 48px;
}
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .25s, box-shadow .25s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); }

.card-cover {
  height: 200px; overflow: hidden; position: relative;
  background: var(--accent-soft);
}
.card-cover img {
  width: 100%; height: 100%; object-fit: cover; object-position: center;
  display: block; transition: transform .6s cubic-bezier(.2,.8,.2,1);
}
.card:hover .card-cover img { transform: scale(1.07); }
/* 封面底部压一层渐变，保证文字可读 */
.card-cover::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.38), transparent 55%);
  pointer-events: none;
}
.card-cover .cover-label {
  position: absolute; left: 18px; bottom: 14px; z-index: 2;
  color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .5px;
  text-shadow: 0 1px 6px rgba(0,0,0,.4);
}

.card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.card-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--muted); margin-bottom: 10px;
}
.card-cat { color: var(--accent); font-weight: 600; }
.card h3 { font-size: 17px; line-height: 1.5; margin-bottom: 10px; }
.card h3 a:hover { color: var(--accent); }
.card p { font-size: 14px; color: var(--muted); flex: 1; }
.card-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}
.read-more { color: var(--accent); font-weight: 600; }

/* ===== 文章详情 ===== */
.article {
  max-width: 780px; margin: 32px auto 56px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 48px;
}
.article h1 { font-size: 30px; line-height: 1.4; margin-bottom: 16px; }
.article-meta {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding-bottom: 22px; margin-bottom: 28px; border-bottom: 1px solid var(--line);
  font-size: 13.5px; color: var(--muted);
}
.article-hero {
  border-radius: 12px; overflow: hidden; margin-bottom: 28px;
  max-height: 420px; background: var(--accent-soft);
}
.article-hero img {
  width: 100%; height: 100%; max-height: 420px; object-fit: cover;
  object-position: center; display: block;
}
.article h2 { font-size: 21px; margin: 32px 0 14px; padding-left: 12px; border-left: 4px solid var(--accent); }
.article p { margin-bottom: 16px; color: var(--muted); font-size: 15.5px; }
.article ul { margin: 0 0 16px 22px; color: var(--muted); font-size: 15.5px; }
.article li { margin-bottom: 8px; }
.article blockquote {
  margin: 22px 0; padding: 16px 20px;
  background: var(--accent-soft); border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0; color: var(--text); font-size: 15px;
}
.article pre {
  background: #0f1115; color: #e6e6e6; padding: 18px;
  border-radius: 10px; overflow-x: auto; font-size: 13.5px; margin-bottom: 18px;
}
.article code { font-family: "SF Mono", Consolas, monospace; }
.article img { border-radius: 10px; margin: 20px 0; }
.article-foot {
  margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
}
.btn {
  padding: 9px 20px; border-radius: 10px; font-size: 14px;
  background: var(--accent); color: #fff; transition: .2s;
}
.btn:hover { opacity: .88; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }

/* ===== 关于页 ===== */
.section-title { font-size: 22px; margin: 36px 0 18px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 18px; }
.info-box {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.info-box h3 { font-size: 16px; margin-bottom: 10px; color: var(--accent); }
.info-box p { font-size: 14px; color: var(--muted); }

/* ===== 页脚 ===== */
.footer {
  border-top: 1px solid var(--line); padding: 28px 0;
  text-align: center; font-size: 13.5px; color: var(--muted);
}

/* ===== 响应式 ===== */
@media (max-width: 720px) {
  .hero { flex-direction: column; text-align: center; padding: 32px 24px; }
  .tags { justify-content: center; }
  .search { width: 100%; }
  .article { padding: 28px 22px; }
  .nav a { padding: 7px 10px; }
}
