/* ===== CSS Variables ===== */
:root {
  --bg-primary: #0d0d14;
  --bg-secondary: #12121f;
  --bg-card: #16162a;
  --bg-card-hover: #1a1a32;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(139, 92, 246, 0.4);
  --text-primary: #f0f0f8;
  --text-secondary: #a0a0c0;
  --text-muted: #606080;
  --accent: #8b5cf6;
  --accent-2: #06b6d4;
  --accent-3: #f59e0b;
  --gradient: linear-gradient(135deg, #8b5cf6, #06b6d4);
  --glow: 0 0 40px rgba(139, 92, 246, 0.15);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f8f8fc;
  --bg-secondary: #f0f0f8;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f5ff;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(139, 92, 246, 0.4);
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #9090a0;
  --glow: 0 0 40px rgba(139, 92, 246, 0.08);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

/* ===== Navbar ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(13, 13, 20, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
[data-theme="light"] .navbar {
  background: rgba(248, 248, 252, 0.85);
}
.nav-container {
  max-width: 1100px; margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex; align-items: center; gap: 32px;
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
  font-weight: 700; font-size: 1.1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.logo-icon { color: var(--accent); font-size: 1.2rem; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 6px 14px; border-radius: 8px;
  text-decoration: none; font-size: 0.9rem; font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
  color: var(--accent);
  background: rgba(139, 92, 246, 0.1);
}
.theme-toggle {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px;
  cursor: pointer; font-size: 1rem;
  transition: var(--transition);
}
.theme-toggle:hover { border-color: var(--accent); }

/* ===== Main Content ===== */
.main-content {
  max-width: 1100px; margin: 0 auto;
  padding: 100px 24px 60px;
}

/* ===== Hero ===== */
.hero { margin-bottom: 60px; }
.hero-content {
  display: flex; align-items: center; gap: 48px;
  padding: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  position: relative; overflow: hidden;
}
.hero-content::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at top left, rgba(139,92,246,0.08) 0%, transparent 60%);
  pointer-events: none;
}
.hero-avatar { position: relative; flex-shrink: 0; }
.avatar-ring {
  width: 96px; height: 96px;
  border-radius: 50%;
  padding: 3px;
  background: var(--gradient);
}
.avatar-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.05em;
}
.status-dot {
  position: absolute; bottom: 4px; right: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #22c55e;
  border: 3px solid var(--bg-card);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.8; }
}
.hero-title {
  font-size: 2rem; font-weight: 700;
  letter-spacing: -0.03em; margin-bottom: 8px;
}
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1.05rem; color: var(--text-secondary);
  margin-bottom: 12px;
}
.hero-desc {
  font-size: 0.9rem; color: var(--text-muted);
  margin-bottom: 20px; line-height: 1.7;
}
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-tag {
  padding: 5px 12px; border-radius: 20px;
  background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.2);
  font-size: 0.8rem; color: var(--accent);
  font-weight: 500;
}

/* ===== Stats ===== */
.stats-section { margin-bottom: 60px; }
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.stat-num {
  display: block;
  font-size: 2rem; font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.05em;
}
.stat-label {
  font-size: 0.85rem; color: var(--text-muted); margin-top: 4px;
}

/* ===== Posts Section ===== */
.posts-section { margin-bottom: 80px; }
.section-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 32px;
}
.section-title {
  font-size: 1.3rem; font-weight: 700;
  white-space: nowrap;
}
.section-line {
  flex: 1; height: 1px;
  background: var(--border);
}
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer; position: relative; overflow: hidden;
  transition: var(--transition);
}
.post-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--glow), var(--shadow-card);
}
.post-card.featured {
  grid-column: span 2;
}
.post-card-glow {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 0% 0%, rgba(139,92,246,0.06) 0%, transparent 60%);
  opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}
.post-card:hover .post-card-glow { opacity: 1; }
.post-card-inner { padding: 24px; }
.post-meta-top {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.post-tag {
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
}
.tag-tech { background: rgba(139,92,246,0.15); color: #a78bfa; }
.tag-cloud { background: rgba(6,182,212,0.15); color: #22d3ee; }
.tag-tool { background: rgba(245,158,11,0.15); color: #fbbf24; }
.tag-think { background: rgba(34,197,94,0.15); color: #4ade80; }
.post-featured-badge {
  margin-left: auto;
  font-size: 0.75rem; color: var(--text-muted);
}
.post-title {
  font-size: 1.05rem; font-weight: 600;
  line-height: 1.4; margin-bottom: 10px;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-excerpt {
  font-size: 0.85rem; color: var(--text-secondary);
  line-height: 1.6; margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-meta-bottom {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.post-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.mini-tag {
  padding: 2px 8px; border-radius: 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  font-size: 0.72rem; color: var(--text-muted);
}
.post-date { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }

/* ===== Footer ===== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 40px 24px 24px;
}
.footer-content {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 32px;
}
.footer-logo {
  font-size: 1.1rem; font-weight: 700;
  color: var(--text-primary); display: block; margin-bottom: 8px;
}
.footer-desc { font-size: 0.85rem; color: var(--text-muted); }
.footer-right { display: flex; gap: 20px; }
.footer-link {
  font-size: 0.9rem; color: var(--text-secondary);
  text-decoration: none; transition: var(--transition);
}
.footer-link:hover { color: var(--accent); }
.footer-bottom {
  max-width: 1100px; margin: 0 auto;
  padding-top: 20px; border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.82rem; color: var(--text-muted);
}
.footer-domain {
  color: var(--accent); text-decoration: none;
}
.footer-domain:hover { text-decoration: underline; }

/* ===== Article Page ===== */
.article-layout {
  max-width: 1100px; margin: 0 auto;
  padding: 100px 24px 60px;
  display: grid; grid-template-columns: 1fr 260px; gap: 40px;
  align-items: start;
}
.article-main {}
.article-sidebar { position: sticky; top: 80px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); text-decoration: none;
  font-size: 0.85rem; transition: var(--transition);
  margin-bottom: 32px;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }
.article-header { margin-bottom: 40px; }
.article-tags { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.article-title {
  font-size: 2rem; font-weight: 700; line-height: 1.3;
  letter-spacing: -0.03em; margin-bottom: 16px;
}
.article-info {
  display: flex; align-items: center; gap: 16px;
  font-size: 0.85rem; color: var(--text-muted);
}
.article-divider {
  height: 1px; background: var(--border); margin: 32px 0;
}
.article-body {
  font-size: 1rem; line-height: 1.85; color: var(--text-secondary);
}
.article-body h2 {
  font-size: 1.4rem; font-weight: 700;
  color: var(--text-primary); margin: 40px 0 16px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.article-body h3 {
  font-size: 1.15rem; font-weight: 600;
  color: var(--text-primary); margin: 28px 0 12px;
}
.article-body p { margin-bottom: 16px; }
.article-body code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(139,92,246,0.1);
  color: #a78bfa; padding: 2px 6px; border-radius: 4px;
  font-size: 0.88em;
}
.article-body pre {
  background: #0a0a14; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  overflow-x: auto; margin: 20px 0;
}
.article-body pre code {
  background: none; color: #e0e0f8; padding: 0; border-radius: 0;
  font-size: 0.9em;
}
.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 20px; margin: 20px 0;
  color: var(--text-muted);
}
.article-body ul, .article-body ol {
  padding-left: 24px; margin-bottom: 16px;
}
.article-body li { margin-bottom: 6px; }
.article-body a { color: var(--accent); text-decoration: none; }
.article-body a:hover { text-decoration: underline; }
.toc-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.toc-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }
.toc-list { list-style: none; }
.toc-item { margin-bottom: 6px; }
.toc-link {
  font-size: 0.82rem; color: var(--text-muted);
  text-decoration: none; transition: var(--transition);
  display: block; padding: 2px 0;
}
.toc-link:hover { color: var(--accent); }

/* ===== Tags Page ===== */
.tags-layout {
  max-width: 900px; margin: 0 auto;
  padding: 100px 24px 60px;
}
.page-title { font-size: 2rem; font-weight: 700; margin-bottom: 8px; }
.page-desc { color: var(--text-muted); margin-bottom: 48px; }
.tags-cloud { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 60px; }
.tag-bubble {
  padding: 8px 18px; border-radius: 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 0.9rem; font-weight: 500; cursor: pointer;
  transition: var(--transition); text-decoration: none;
  color: var(--text-secondary);
  display: inline-flex; align-items: center; gap: 6px;
}
.tag-bubble:hover, .tag-bubble.active {
  background: rgba(139,92,246,0.1);
  border-color: var(--accent); color: var(--accent);
}
.tag-count {
  font-size: 0.75rem; color: var(--text-muted);
  background: var(--bg-secondary); padding: 1px 6px; border-radius: 10px;
}

/* ===== About Page ===== */
.about-layout {
  max-width: 800px; margin: 0 auto;
  padding: 100px 24px 60px;
}
.about-hero {
  display: flex; align-items: center; gap: 32px;
  margin-bottom: 60px;
  padding: 40px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 24px;
}
.about-section { margin-bottom: 48px; }
.about-section-title {
  font-size: 1.2rem; font-weight: 700;
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
.about-section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.skill-list { display: flex; flex-wrap: wrap; gap: 10px; }
.skill-item {
  padding: 6px 14px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 0.85rem; color: var(--text-secondary);
  transition: var(--transition);
}
.skill-item:hover { border-color: var(--border-hover); color: var(--accent); }
.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding: 0 0 28px 24px; }
.timeline-item::before {
  content: ''; position: absolute; left: -5px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg-primary);
}
.timeline-year { font-size: 0.78rem; color: var(--accent); font-weight: 600; margin-bottom: 4px; }
.timeline-title { font-weight: 600; margin-bottom: 4px; }
.timeline-desc { font-size: 0.85rem; color: var(--text-muted); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero-content { flex-direction: column; text-align: center; padding: 32px 24px; }
  .hero-tags { justify-content: center; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .posts-grid { grid-template-columns: 1fr; }
  .post-card.featured { grid-column: span 1; }
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { display: none; }
  .footer-content { flex-direction: column; gap: 20px; }
  .about-hero { flex-direction: column; text-align: center; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
