/* =========================================================
   style.css —— 个人主页前台统一样式（深色现代风）
   适用于：主页 index.html、博客列表 blog.html、文章详情 post.html
   ========================================================= */

:root {
  --bg: #0b0e1a;
  --bg-soft: #12162b;
  --card: rgba(255, 255, 255, 0.04);
  --card-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --text: #e8eaf6;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --primary: #7c5cff;
  --primary-2: #4dd0e1;
  --accent: #ffb86c;
  --grad: linear-gradient(135deg, #7c5cff 0%, #4dd0e1 100%);
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --nav-h: 64px;
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

/* 背景装饰光斑 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px 400px at 15% 10%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(700px 500px at 85% 25%, rgba(77, 208, 225, 0.12), transparent 60%),
    radial-gradient(500px 500px at 50% 90%, rgba(255, 184, 108, 0.07), transparent 60%),
    var(--bg);
}

::selection { background: rgba(124, 92, 255, 0.4); color: #fff; }

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

/* ---------------- 工具类 ---------------- */
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.section { padding: 96px 0; }
.section-head { text-align: center; margin-bottom: 56px; }
.section-head .tag {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--primary-2);
  background: rgba(77, 208, 225, 0.1);
  border: 1px solid rgba(77, 208, 225, 0.25);
  margin-bottom: 16px;
}
.section-head h2 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: 1px;
}
.section-head h2 .grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.section-head p { color: var(--text-2); margin-top: 10px; font-size: 15px; }

/* 滚动进场动画（默认可见；如需动画，加 .pending 后由 JS 在视口触发时移除并加 .visible） */
.fade-in.pending { opacity: 0; transform: translateY(28px); }
.fade-in { transition: opacity 0.7s ease, transform 0.7s ease; }

/* ---------------- 导航栏 ---------------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(11, 14, 26, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav .logo { font-weight: 800; font-size: 20px; letter-spacing: 1px; }
.nav .logo .dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--grad);
  margin-right: 8px;
  vertical-align: 2px;
}
.nav .links { display: flex; gap: 8px; align-items: center; }
.nav .links a {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-2);
  transition: all 0.25s ease;
}
.nav .links a:hover,
.nav .links a.active { color: #fff; background: rgba(124, 92, 255, 0.18); }
.nav .links a.btn-admin {
  color: var(--accent);
  border: 1px solid rgba(255, 184, 108, 0.35);
  background: rgba(255, 184, 108, 0.06);
}
.nav .links a.btn-admin:hover { background: rgba(255, 184, 108, 0.16); color: var(--accent); }

/* 移动端导航 */
.nav-toggle { display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 8px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: all 0.3s; }

/* ---------------- Hero 区 ---------------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 40px) 24px 60px;
  position: relative;
}
.hero .avatar-wrap {
  width: 148px; height: 148px;
  margin: 0 auto 28px;
  border-radius: 50%;
  padding: 5px;
  background: var(--grad);
  position: relative;
  animation: float 5s ease-in-out infinite;
}
.hero .avatar-wrap::before {
  content: "";
  position: absolute;
  inset: -22px;
  border-radius: 50%;
  background: var(--grad);
  opacity: 0.18;
  filter: blur(28px);
  z-index: -1;
}
.hero .avatar-wrap img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-soft);
  border: 3px solid var(--bg);
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.hero h1 {
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 900;
  letter-spacing: 2px;
}
.hero h1 .grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .subtitle {
  margin-top: 14px;
  font-size: clamp(16px, 2.4vw, 20px);
  color: var(--text-2);
  letter-spacing: 3px;
}
.hero .bio {
  max-width: 620px;
  margin: 22px auto 0;
  color: var(--text-2);
  font-size: 15px;
}
.hero .cta { margin-top: 36px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-block;
  padding: 13px 32px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 28px rgba(124, 92, 255, 0.35); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(124, 92, 255, 0.5); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--primary); color: #fff; background: rgba(124, 92, 255, 0.08); }

.hero .scroll-hint {
  position: absolute;
  bottom: 28px; left: 50%;
  transform: translateX(-50%);
  color: var(--text-3);
  font-size: 13px;
  animation: bounce 2s infinite;
}
@keyframes bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ---------------- 统计数字 ---------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-top: 56px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 18px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--grad);
  opacity: 0;
  transition: opacity 0.3s;
}
.stat-card:hover { transform: translateY(-4px); background: var(--card-hover); }
.stat-card:hover::after { opacity: 1; }
.stat-card .num {
  font-size: 40px;
  font-weight: 900;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-card .label { color: var(--text-2); font-size: 14px; margin-top: 4px; }

/* ---------------- 技能区 ---------------- */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.skill-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.3s ease;
}
.skill-card:hover {
  transform: translateY(-4px);
  background: var(--card-hover);
  border-color: rgba(124, 92, 255, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}
.skill-card .top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.skill-card .icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: rgba(124, 92, 255, 0.14);
  border: 1px solid rgba(124, 92, 255, 0.25);
  flex-shrink: 0;
}
.skill-card h3 { font-size: 17px; font-weight: 700; }
.skill-card .cat {
  font-size: 12px;
  color: var(--accent);
  background: rgba(255, 184, 108, 0.1);
  border: 1px solid rgba(255, 184, 108, 0.25);
  padding: 2px 10px;
  border-radius: 999px;
  display: inline-block;
  margin-top: 3px;
}
.skill-card .desc { color: var(--text-2); font-size: 13.5px; min-height: 42px; }
.skill-bar { height: 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 14px; }
.skill-bar .fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--grad);
  transition: width 1.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.skill-card .level-tip { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--text-3); }

/* ---------------- 联系方式 ---------------- */
.contact-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.contact-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.3s ease;
}
.contact-card:hover {
  transform: translateY(-3px) scale(1.01);
  background: var(--card-hover);
  border-color: rgba(77, 208, 225, 0.4);
}
.contact-card .c-icon {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(77, 208, 225, 0.12);
  border: 1px solid rgba(77, 208, 225, 0.25);
  flex-shrink: 0;
}
.contact-card .c-label { color: var(--text-3); font-size: 12px; }
.contact-card .c-value { font-size: 15px; font-weight: 600; word-break: break-all; color: var(--text); }

/* ---------------- 博客卡片 ---------------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 22px;
}
.blog-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.blog-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}
.blog-card:hover { transform: translateY(-5px); background: var(--card-hover); box-shadow: var(--shadow); }
.blog-card:hover::before { transform: scaleX(1); }
.blog-card .meta { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.blog-card .cat-tag {
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 999px;
  color: var(--primary-2);
  background: rgba(77, 208, 225, 0.1);
  border: 1px solid rgba(77, 208, 225, 0.25);
}
.blog-card .date { font-size: 12.5px; color: var(--text-3); }
.blog-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 10px; line-height: 1.5; }
.blog-card .summary { color: var(--text-2); font-size: 13.5px; flex: 1; }
.blog-card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.blog-card .views { font-size: 12.5px; color: var(--text-3); }
.blog-card .read-more { font-size: 13.5px; color: var(--primary-2); font-weight: 600; }
.blog-card .read-more:hover { color: #fff; }
.blog-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.blog-card .tags span {
  font-size: 11.5px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-3);
}

/* 分类筛选 */
.filter-bar { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px; }
.filter-bar button {
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--font);
}
.filter-bar button:hover { color: #fff; border-color: var(--primary); }
.filter-bar button.active {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(124, 92, 255, 0.35);
}

/* ---------------- 文章详情页 ---------------- */
.post-hero { padding: calc(var(--nav-h) + 60px) 0 30px; text-align: center; }
.post-hero h1 { font-size: clamp(24px, 4vw, 38px); font-weight: 800; line-height: 1.4; }
.post-hero .post-meta {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  color: var(--text-3);
  font-size: 13.5px;
  flex-wrap: wrap;
}
.post-body {
  max-width: 760px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 44px;
  margin-bottom: 80px;
}
.post-body h2 { font-size: 22px; margin: 30px 0 14px; }
.post-body h3 { font-size: 18px; margin: 24px 0 12px; }
.post-body p { margin: 14px 0; color: var(--text-2); }
.post-body ul, .post-body ol { margin: 14px 0 14px 24px; color: var(--text-2); }
.post-body li { margin: 6px 0; }
.post-body code {
  background: rgba(124, 92, 255, 0.14);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13.5px;
  font-family: Consolas, Monaco, monospace;
}
.post-body pre {
  background: #0d1020;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  overflow-x: auto;
  margin: 16px 0;
}
.post-body pre code { background: none; color: #c9d4ff; padding: 0; }
.post-body blockquote {
  border-left: 3px solid var(--primary);
  padding: 10px 18px;
  margin: 16px 0;
  color: var(--text-2);
  background: rgba(124, 92, 255, 0.06);
  border-radius: 0 10px 10px 0;
}
.post-back { text-align: center; margin: 0 0 60px; }

/* ---------------- 页脚 ---------------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 34px 0;
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
}
.footer a { color: var(--primary-2); }

/* ---------------- 空状态 ---------------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty .empty-icon { font-size: 46px; margin-bottom: 12px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 768px) {
  .section { padding: 64px 0; }
  .nav-toggle { display: flex; }
  .nav .links {
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    flex-direction: column;
    background: rgba(11, 14, 26, 0.97);
    backdrop-filter: blur(16px);
    padding: 16px 20px 22px;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    transform: translateY(-120%);
    transition: transform 0.3s ease;
  }
  .nav .links.open { transform: translateY(0); }
  .nav .links a { width: 100%; text-align: center; }
  .post-body { padding: 26px 20px; }
}
