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

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --text-primary: #eaeaef;
  --text-secondary: #9898aa;
  --accent: #ff3c6c;
  --accent-blue: #3c8cff;
  --accent-green: #3cff8c;
  --accent-purple: #a03cff;
  --accent-cyan: #3cffd4;
  --accent-glow: 0 0 20px rgba(255, 60, 108, 0.4);
  --border-color: #222230;
  --font-mono: 'Courier New', 'Consolas', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ===== PARTICLE CANVAS ===== */
#particle-canvas {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}

/* ===== NAVBAR ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s ease;
}
.nav-container {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.nav-logo {
  font-size: 1.25rem; font-weight: 800; font-family: var(--font-mono);
  letter-spacing: 1px; position: relative;
}
.logo-bracket { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-link {
  padding: 8px 16px; border-radius: 8px; font-size: 0.9rem;
  font-weight: 500; transition: all 0.25s ease; cursor: pointer;
  background: none; border: none; color: var(--text-secondary);
}
.nav-link:hover, .nav-link.active {
  color: var(--text-primary); background: rgba(255, 255, 255, 0.06);
}
.nav-login-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-purple));
  color: #fff !important; margin-left: 8px;
}
.nav-login-btn:hover {
  box-shadow: 0 0 24px rgba(255, 60, 108, 0.35);
  transform: translateY(-1px);
}

/* ===== HERO ===== */
.hero {
  position: relative; min-height: 100vh; display: flex;
  align-items: center; justify-content: center; padding: 120px 24px 80px;
  overflow: hidden;
}
.hero-content { position: relative; z-index: 2; text-align: center; max-width: 700px; }
.hero-badge {
  display: inline-block; padding: 6px 16px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 2px;
  background: rgba(255, 60, 108, 0.12); color: var(--accent);
  border: 1px solid rgba(255, 60, 108, 0.25); margin-bottom: 24px;
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 900;
  line-height: 1.15; margin-bottom: 16px;
  background: linear-gradient(135deg, #fff 20%, #c0c0d0 50%, var(--accent-blue) 80%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.accent-dot { color: var(--accent); -webkit-text-fill-color: var(--accent); }
.hero-subtitle {
  font-size: 1.15rem; color: var(--text-secondary); margin-bottom: 40px;
  line-height: 1.8;
}
.hero-stats { display: flex; justify-content: center; gap: 48px; }
.stat { text-align: center; }
.stat-num { display: block; font-size: 2rem; font-weight: 800; color: var(--text-primary); }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); }
.hero-orb {
  position: absolute; top: -300px; right: -200px; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(160, 60, 255, 0.15), transparent 70%);
  border-radius: 50%; z-index: 0; filter: blur(60px);
}

/* ===== MAIN CONTENT ===== */
.main-content { position: relative; z-index: 2; max-width: 1200px; margin: 0 auto; padding: 0 24px; }

.section-header { margin-bottom: 40px; }
.section-title {
  font-size: 1.75rem; font-weight: 700; margin-bottom: 12px;
}
.section-line {
  width: 60px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-purple));
}

/* ===== ARTICLE CARDS ===== */
.articles-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px; margin-bottom: 48px;
}
.article-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 16px; padding: 28px; cursor: pointer;
  transition: all 0.3s ease; position: relative; overflow: hidden;
}
.article-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-purple), var(--accent-blue));
  opacity: 0; transition: opacity 0.3s;
}
.article-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 60, 108, 0.3);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.article-card:hover::before { opacity: 1; }

.card-tag {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 0.72rem; font-weight: 600; margin-bottom: 14px;
  font-family: var(--font-mono);
}
.tag-rust { background: rgba(255, 60, 108, 0.12); color: var(--accent); }
.tag-go { background: rgba(60, 200, 255, 0.12); color: #3cc8ff; }
.tag-k8s { background: rgba(60, 140, 255, 0.12); color: var(--accent-blue); }
.tag-wasm { background: rgba(160, 60, 255, 0.12); color: var(--accent-purple); }
.tag-ebpf { background: rgba(60, 255, 140, 0.12); color: var(--accent-green); }
.tag-db { background: rgba(255, 200, 60, 0.12); color: #ffc83c; }
.tag-linux { background: rgba(255, 140, 60, 0.12); color: #ff8c3c; }
.tag-perf { background: rgba(60, 255, 212, 0.12); color: var(--accent-cyan); }

.card-title {
  font-size: 1.15rem; font-weight: 700; margin-bottom: 10px;
  line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card-excerpt {
  font-size: 0.9rem; color: var(--text-secondary);
  margin-bottom: 16px; line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.8rem; color: var(--text-secondary);
}

.articles-more { text-align: center; margin-bottom: 80px; }

/* ===== BUTTONS ===== */
.btn-outline {
  display: inline-block; padding: 10px 28px; border-radius: 10px;
  border: 1px solid var(--border-color); font-size: 0.9rem; font-weight: 500;
  transition: all 0.3s; color: var(--text-primary);
}
.btn-outline:hover {
  border-color: var(--accent); color: var(--accent);
  box-shadow: var(--accent-glow);
}
.btn-primary {
  display: inline-block; padding: 12px 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-purple));
  color: #fff; font-weight: 600; font-size: 1rem; border: none; cursor: pointer;
  transition: all 0.3s;
}
.btn-primary:hover { box-shadow: 0 4px 30px rgba(255, 60, 108, 0.4); transform: translateY(-1px); }
.btn-full { width: 100%; }

/* ===== TOPICS CLOUD ===== */
.topics-section { margin-bottom: 80px; }
.topics-cloud { display: flex; flex-wrap: wrap; gap: 12px; }
.topic-pill {
  padding: 8px 20px; border-radius: 20px; font-size: 0.85rem; font-weight: 500;
  background: var(--bg-card); border: 1px solid var(--border-color);
  transition: all 0.3s; cursor: default;
}
.topic-pill:hover {
  border-color: var(--accent); color: var(--accent);
  box-shadow: 0 0 16px rgba(255, 60, 108, 0.15);
}

/* ===== FOOTER ===== */
.footer {
  position: relative; z-index: 2; border-top: 1px solid var(--border-color);
  background: var(--bg-secondary); padding: 40px 24px 20px;
}
.footer-content {
  max-width: 1200px; margin: 0 auto; display: flex;
  justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px; flex-wrap: wrap; gap: 24px;
}
.footer-logo {
  font-size: 1.1rem; font-weight: 800; font-family: var(--font-mono);
  color: var(--accent);
}
.footer-brand p { color: var(--text-secondary); font-size: 0.85rem; margin-top: 8px; }
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--text-secondary); font-size: 0.9rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  max-width: 1200px; margin: 0 auto; padding-top: 16px;
  border-top: 1px solid var(--border-color); text-align: center;
  font-size: 0.8rem; color: var(--text-secondary);
}
.footer-bottom p { margin-bottom: 4px; }
.icp-link { color: var(--text-secondary); transition: color 0.2s; }
.icp-link:hover { color: var(--accent); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: all 0.3s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 20px; padding: 40px; width: 90%; max-width: 420px;
  position: relative; transform: translateY(20px);
  transition: transform 0.3s;
}
.modal-overlay.active .modal-card { transform: translateY(0); }
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 32px; height: 32px;
  border-radius: 8px; background: none; border: none; color: var(--text-secondary);
  font-size: 1.5rem; cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all 0.2s;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }
.modal-header { margin-bottom: 28px; }
.modal-header h3 { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.modal-header p { font-size: 0.85rem; color: var(--text-secondary); }

/* ===== FORM ===== */
.input-group { margin-bottom: 18px; }
.input-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }
.input-group input {
  width: 100%; padding: 12px 16px; border-radius: 10px;
  background: var(--bg-primary); border: 1px solid var(--border-color);
  color: var(--text-primary); font-size: 0.95rem; transition: all 0.3s; outline: none;
}
.input-group input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 60, 108, 0.1);
}
.modal-footer-text {
  text-align: center; margin-top: 20px; font-size: 0.78rem; color: var(--text-secondary);
  opacity: 0.7;
}

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(100px);
  z-index: 3000; padding: 12px 28px; border-radius: 10px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  font-size: 0.9rem; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  transition: transform 0.4s cubic-bezier(.4,0,.2,1); pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--accent-green); }
.toast.error { border-color: var(--accent); }

/* ===== ARTICLES PAGE ===== */
.articles-page { padding-top: 100px; min-height: 100vh; }
.article-detail { padding-top: 100px; min-height: 100vh; max-width: 800px; margin: 0 auto; padding: 100px 24px 80px; }
.article-detail h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 16px; line-height: 1.3; }
.article-detail .article-meta { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 32px; }
.article-detail .article-body { font-size: 1.05rem; line-height: 1.85; }
.article-detail .article-body h2 { font-size: 1.4rem; margin: 32px 0 12px; }
.article-detail .article-body p { margin-bottom: 16px; color: #c8c8d4; }
.article-detail .article-body pre {
  background: #0d0d14; border: 1px solid var(--border-color); border-radius: 12px;
  padding: 20px 24px; overflow-x: auto; margin: 20px 0; font-size: 0.85rem;
  font-family: var(--font-mono); line-height: 1.7;
}
.article-detail .article-body code { font-family: var(--font-mono); background: rgba(255,255,255,0.05); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }
.article-detail .article-body pre code { background: none; padding: 0; }
.back-link { display: inline-block; margin-bottom: 32px; color: var(--text-secondary); font-size: 0.9rem; transition: color 0.2s; }
.back-link:hover { color: var(--accent); }

/* ===== ABOUT PAGE ===== */
.about-page { padding-top: 120px; min-height: 100vh; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .articles-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 24px; }
  .nav-links { gap: 0; }
  .nav-link { padding: 6px 10px; font-size: 0.8rem; }
}
