/* ========== CSS Variables ========== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --green: #059669;
  --amber: #d97706;
  --purple: #7c3aed;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --max-width: 1040px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.7;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--primary); text-decoration: none; transition: all var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
code { background: var(--primary-light); padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.9em; }
pre { background: #1e293b; color: #e2e8f0; padding: 1.2rem; border-radius: var(--radius-sm); overflow-x: auto; margin: 1.2rem 0; }
pre code { background: none; padding: 0; font-size: 0.88em; line-height: 1.65; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }

/* ========== Header ========== */
.header {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; color: var(--text) !important; }
.logo-icon { font-size: 1.4rem; }
.nav { display: flex; gap: 0.15rem; }
.nav-link {
  padding: 0.45rem 0.9rem; border-radius: 8px; color: var(--text-secondary);
  font-weight: 500; font-size: 0.92rem; transition: all var(--transition);
}
.nav-link:hover { background: var(--primary-light); color: var(--primary); }
.nav-link.active { background: var(--primary); color: white; }
.nav-link.lang-switch { font-size: 0.82rem; margin-left: 0.5rem; padding: 0.4rem 0.85rem; border: 1.5px solid var(--primary); border-radius: 20px; white-space: nowrap; color: var(--primary); font-weight: 600; transition: all 0.25s; background: var(--primary-light); }
.nav-link.lang-switch:hover { background: var(--primary); color: white; border-color: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 2px 10px rgba(37,99,235,0.25); }
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.nav-toggle span { width: 24px; height: 2.5px; background: var(--text); border-radius: 2px; transition: var(--transition); }

/* ==================== HOMEPAGE ==================== */
.home {
  min-height: calc(100vh - 64px);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #f8fafc 0%, #eff6ff 40%, #f0f9ff 70%, #f8fafc 100%);
  padding: 2rem 1rem;
}

/* 动态粒子背景 */
.home-particles {
  position: absolute; inset: 0; pointer-events: none;
}
.home-particle {
  position: absolute;
  width: 4px; height: 4px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat linear infinite;
}
@keyframes particleFloat {
  0%   { opacity: 0; transform: translateY(100vh) scale(0); }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1.5); }
}

/* 中心容器 */
.home-center {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  gap: 1.25rem;
  max-width: 700px; width: 100%;
}

/* 头像 */
.home-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 1.3rem;
  box-shadow: 0 8px 32px rgba(37,99,235,0.3);
  animation: avatarIn 0.7s ease-out;
}
@keyframes avatarIn {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

.home-name {
  font-size: 2rem; font-weight: 800; letter-spacing: 0.02em;
  animation: fadeUp 0.7s 0.1s ease-out both;
}
.home-role {
  font-size: 0.92rem; color: var(--text-secondary);
  display: flex; align-items: center; gap: 0.4rem;
  animation: fadeUp 0.7s 0.15s ease-out both;
}
.home-role-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
  display: inline-block; box-shadow: 0 0 6px #22c55e88;
}
.home-meta {
  font-size: 0.82rem; color: var(--text-muted);
  animation: fadeUp 0.7s 0.2s ease-out both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 数据条 */
.home-stats {
  display: flex; gap: 1.5rem;
  animation: fadeUp 0.7s 0.25s ease-out both;
}
.home-stat {
  text-align: center;
  padding: 0.4rem 0.9rem;
  background: rgba(255,255,255,0.7);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.home-stat b   { display: block; font-size: 1.1rem; color: var(--primary); }
.home-stat span { display: block; font-size: 0.68rem; color: var(--text-muted); }

/* 四入口卡片 */
.home-grid {
  display: flex; gap: 0.75rem; width: 100%;
  animation: fadeUp 0.7s 0.3s ease-out both;
}
.home-card {
  flex: 1; display: flex; align-items: center; gap: 0.6rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.8rem 1rem;
  color: var(--text) !important; transition: all 0.25s ease;
  position: relative; overflow: hidden;
}
.home-card::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: var(--accent); transform: scaleX(0);
  transition: transform 0.25s ease; transform-origin: left;
}
.home-card:hover {
  box-shadow: var(--shadow-lg); transform: translateY(-3px);
}
.home-card:hover::after { transform: scaleX(1); }
.home-card-icon { font-size: 1.3rem; flex-shrink: 0; }
.home-card strong { font-size: 0.85rem; }

/* 联系行 */
.home-links {
  display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center;
  animation: fadeUp 0.7s 0.35s ease-out both;
}
.home-link {
  font-size: 0.82rem; color: var(--text-secondary);
}

/* 文章预览 */
.home-posts {
  display: flex; gap: 2rem; width: 100%; text-align: left;
  animation: fadeUp 0.7s 0.4s ease-out both;
}
.home-posts-col { flex: 1; min-width: 0; }
.home-posts-col h4 {
  font-size: 0.82rem; margin-bottom: 0.4rem;
  padding-bottom: 0.35rem; border-bottom: 2px solid var(--border);
}
.home-posts-col a {
  display: block; font-size: 0.8rem; color: var(--text-secondary);
  padding: 0.3rem 0; transition: 0.2s;
}
.home-posts-col a:hover { color: var(--primary); padding-left: 0.3rem; }

/* 技能标签 */
.home-tags {
  display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center;
  animation: fadeUp 0.7s 0.45s ease-out both;
}
.home-tags span {
  padding: 0.25rem 0.6rem; border-radius: 6px;
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 0.72rem; color: var(--text-secondary);
  transition: 0.2s;
}
.home-tags span:hover { border-color: var(--primary); color: var(--primary); }

.home-footer-text {
  font-size: 0.72rem; color: var(--text-muted);
  animation: fadeUp 0.7s 0.5s ease-out both;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .home-grid { flex-direction: column; }
  .home-posts { flex-direction: column; gap: 1rem; }
  .home-name { font-size: 1.5rem; }
  .home-stats { flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
  .home-avatar { width: 70px; height: 70px; font-size: 1rem; }
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.65rem 1.4rem; border-radius: 8px;
  font-weight: 600; font-size: 0.93rem;
  transition: all var(--transition); border: 2px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-outline { background: white; color: var(--primary); border-color: var(--border); }
.btn-outline:hover { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }
.btn-block { display: flex; width: 100%; }

/* ========== Page Header (sub pages) ========== */
.page-header {
  padding: 3.5rem 1.5rem 2rem; text-align: center;
  background: linear-gradient(180deg, #f0f4ff 0%, #f8fafc 100%);
}
.page-header h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.4rem; }
.page-header p { color: var(--text-secondary); font-size: 1rem; }

/* ========== Sections ========== */
.section { padding: 3rem 1.5rem; }
.section-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; }

/* ========== Posts List ========== */
.posts-list { display: flex; flex-direction: column; gap: 1rem; max-width: 800px; margin: 0 auto; }
.post-item {
  display: flex; align-items: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  transition: all var(--transition); color: var(--text) !important; gap: 1.25rem;
}
.post-item:hover { box-shadow: var(--shadow-md); border-color: var(--primary-light); transform: translateX(4px); }
.post-item-thumb { width: 120px; height: 80px; border-radius: var(--radius-sm); overflow: hidden; flex-shrink: 0; background: #f1f5f9; }
.post-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-item-info { flex: 1; min-width: 0; }
.post-item-info h3 { font-size: 1.08rem; margin-bottom: 0.2rem; }
.post-item-info p { color: var(--text-secondary); font-size: 0.88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-date { font-size: 0.78rem; color: var(--text-muted); }
.post-item-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; margin: 0.4rem 0; }
.post-arrow { font-size: 1.5rem; color: var(--text-muted); flex-shrink: 0; transition: var(--transition); }
.post-item:hover .post-arrow { color: var(--primary); transform: translateX(3px); }
.tag { background: var(--primary-light); color: var(--primary-dark); padding: 0.18rem 0.55rem; border-radius: 20px; font-size: 0.75rem; font-weight: 500; }

/* ========== Article ========== */
.article { padding: 2.5rem 1.5rem; flex: 1; }
.article > .container { max-width: 780px; }
.article-header { margin-bottom: 2rem; }
.article-header h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.6rem; line-height: 1.3; }
.article-meta { display: flex; gap: 1.25rem; flex-wrap: wrap; color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0.75rem; }
.article-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.article-cover { border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; }
.article-cover img { width: 100%; display: block; }
.article-video-wrap { margin-bottom: 1.5rem; }
.article-video-wrap video { width: 100%; border-radius: var(--radius-sm); background: #000; }

.article-content { line-height: 1.9; font-size: 1.02rem; }
.article-content h1 { font-size: 1.7rem; margin: 2.2rem 0 1rem; }
.article-content h2 { font-size: 1.4rem; margin: 2rem 0 0.8rem; padding-bottom: 0.4rem; border-bottom: 2px solid var(--border); }
.article-content h3 { font-size: 1.15rem; margin: 1.5rem 0 0.6rem; }
.article-content p { margin-bottom: 1rem; }
.article-content ul, .article-content ol { margin: 0.75rem 0; padding-left: 1.5rem; }
.article-content li { margin-bottom: 0.35rem; }
.article-content blockquote {
  border-left: 4px solid var(--primary); padding: 0.75rem 1.25rem;
  margin: 1.25rem 0; background: var(--primary-light);
  border-radius: 0 8px 8px 0; color: var(--text-secondary);
}
.article-content table { width: 100%; border-collapse: collapse; margin: 1.25rem 0; font-size: 0.93rem; }
.article-content th, .article-content td { border: 1px solid var(--border); padding: 0.55rem 0.9rem; text-align: left; }
.article-content th { background: #f8fafc; font-weight: 600; }
.article-content img { max-width: 100%; border-radius: var(--radius-sm); margin: 0.75rem 0; }
.article-content video { max-width: 100%; border-radius: var(--radius-sm); margin: 0.75rem 0; }
.article-content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* Gallery */
.article-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.gallery-item { border-radius: var(--radius-sm); overflow: hidden; }
.gallery-item img { width: 100%; height: 220px; object-fit: cover; display: block; transition: transform 0.35s ease; border-radius: 0; margin: 0; }
.gallery-item:hover img { transform: scale(1.04); }

.article-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.back-link { display: inline-block; margin-bottom: 0.75rem; color: var(--text-secondary); font-size: 0.9rem; }
.back-link:hover { color: var(--primary); }

/* ========== Resume Layout ========== */
.resume-layout { display: grid; grid-template-columns: 1fr 320px; gap: 2rem; align-items: start; }
.resume-article { padding: 0; }
.resume-content h1 { font-size: 1.5rem; }
.resume-content h2 { font-size: 1.2rem; }

/* Sidebar */
.resume-sidebar { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 1.25rem; }
.sidebar-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.sidebar-card h3 { font-size: 0.95rem; margin-bottom: 0.75rem; }
.sidebar-links { display: flex; flex-direction: column; gap: 0.4rem; }
.sidebar-link { display: block; padding: 0.6rem 0.75rem; border-radius: 8px; color: var(--text) !important; font-size: 0.88rem; transition: all var(--transition); }
.sidebar-link:hover { background: var(--primary-light); }
.sidebar-link-title { display: block; font-weight: 500; }
.sidebar-link-tags { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ========== About Page ========== */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
.about-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.about-card h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.about-card-body p { font-size: 0.92rem; color: var(--text-secondary); margin-bottom: 0.3rem; line-height: 1.7; }
.tech-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tech-tag { background: linear-gradient(135deg, #eff6ff, #dbeafe); color: var(--primary-dark); padding: 0.3rem 0.7rem; border-radius: 8px; font-size: 0.82rem; font-weight: 500; }
.award-list, .skill-list { list-style: none; padding: 0; }
.award-list li, .skill-list li { padding: 0.35rem 0; font-size: 0.9rem; border-bottom: 1px solid #f8fafc; }
.award-list li:last-child, .skill-list li:last-child { border-bottom: none; }
.contact-inline { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.contact-inline span { font-size: 0.95rem; }
.contact-inline a { color: var(--primary); }

/* ========== Empty State ========== */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-secondary); }
.empty-state code { background: var(--primary-light); padding: 0.15rem 0.4rem; border-radius: 4px; }

/* ========== Footer ========== */
.footer { background: #0f172a; color: #94a3b8; padding: 2.5rem 1.5rem; margin-top: auto; }
.footer-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1.5rem; }
.footer-info p { margin-bottom: 0.1rem; font-size: 0.88rem; }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: #64748b; font-size: 0.88rem; }
.footer-links a:hover { color: white; }
.footer-copy p { font-size: 0.82rem; color: #475569; }

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .home-grid { flex-direction: column; }
  .home-posts { flex-direction: column; gap: 1rem; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: white; flex-direction: column; padding: 0.75rem; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md); }
  .nav.open { display: flex; }
  .nav-toggle { display: flex; }
  .resume-layout { grid-template-columns: 1fr; }
  .resume-sidebar { position: static; }
  .about-grid { grid-template-columns: 1fr; }
  .article-header h1 { font-size: 1.5rem; }
  .footer-content { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
  .post-item { flex-direction: column; align-items: flex-start; }
  .post-item-thumb { width: 100%; height: 160px; }
}
@media (max-width: 480px) {
  .home { padding: 1rem 0.75rem; }
  .home-name { font-size: 1.4rem; }
  .home-stats { gap: 0.4rem; }
  .home-stat { padding: 0.3rem 0.6rem; }
  .home-stat b { font-size: 0.9rem; }
  .home-card strong { font-size: 0.78rem; }
}
