:root {
  --bg: #f8f9fa;
  --bg-card: #ffffff;
  --bg-nav: rgba(255,255,255,0.85);
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-nav: #1a1a2e;
  --accent: #4f46e5;
  --accent-light: #818cf8;
  --accent-dark: #3730a3;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 10px 25px rgba(0,0,0,0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --max-width: 1200px;
}

[data-theme="dark"] {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-nav: rgba(15,15,26,0.85);
  --text: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-nav: #e5e7eb;
  --border: #2d2d44;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-hover: 0 10px 25px rgba(0,0,0,0.5);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-nav);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-nav);
  transition: color var(--transition);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition);
}

.nav-links a:hover::after {
  width: 100%;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text);
  font-size: 1.1rem;
  transition: all var(--transition);
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.hero {
  padding: 120px 0 60px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79,70,229,0.08), transparent 70%);
  pointer-events: none;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 20px;
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  max-width: 700px;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin-bottom: 28px;
  line-height: 1.7;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.hero-meta .date {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hero-meta .read-time {
  display: flex;
  align-items: center;
  gap: 4px;
}

.read-article {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition);
}

.read-article:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79,70,229,0.3);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 36px;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-count {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
  padding-bottom: 80px;
}

.article-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-light);
}

.article-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.article-card-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-card-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.article-card-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  background: rgba(79,70,229,0.08);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.article-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.article-card-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 16px;
}

.article-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.footer-brand {
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Article page */
.article-page {
  padding: 120px 0 60px;
}

.article-header {
  max-width: 720px;
  margin: 0 auto 40px;
  text-align: center;
}

.article-header .article-card-tags {
  justify-content: center;
}

.article-title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.article-meta {
  display: flex;
  justify-content: center;
  gap: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.article-content {
  max-width: 720px;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.8;
}

.article-content p {
  margin-bottom: 1.5em;
}

.article-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2em 0 0.8em;
  letter-spacing: -0.01em;
}

.article-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.5em 0 0.6em;
}

.article-content ul, .article-content ol {
  margin-bottom: 1.5em;
  padding-left: 1.5em;
}

.article-content li {
  margin-bottom: 0.5em;
}

.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 16px 24px;
  margin: 1.5em 0;
  background: rgba(79,70,229,0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.article-content code {
  background: rgba(79,70,229,0.08);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.9em;
}

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content a:hover {
  color: var(--accent-dark);
}

.article-image {
  width: 100%;
  border-radius: var(--radius-sm);
  margin: 1.5em 0;
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 40px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color var(--transition);
}

.article-back:hover {
  color: var(--accent);
}

/* Section divider */
.section-divider {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* News feed */
.news-section {
  padding: 60px 0;
}

.news-feed {
  display: flex;
  flex-direction: column;
}

.news-item {
  display: flex;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  border-radius: 8px;
  margin: 0 -12px;
  padding: 18px 12px;
}

.news-item:last-child {
  border-bottom: none;
}

.news-item:hover {
  background: rgba(79,70,229,0.03);
}

.news-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
  position: relative;
}

.news-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color var(--transition);
}

.news-item:hover .news-dot::after {
  border-color: var(--accent-light);
}

.news-dot.purple { background: #8b5cf6; }
.news-dot.blue { background: #3b82f6; }
.news-dot.green { background: #10b981; }
.news-dot.orange { background: #f59e0b; }
.news-dot.red { background: #ef4444; }
.news-dot.teal { background: #14b8a6; }
.news-dot.pink { background: #ec4899; }

.news-content {
  flex: 1;
  min-width: 0;
}

.news-content-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.news-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.news-tag.purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.news-tag.blue { background: rgba(59,130,246,0.1); color: #3b82f6; }
.news-tag.green { background: rgba(16,185,129,0.1); color: #10b981; }
.news-tag.orange { background: rgba(245,158,11,0.1); color: #f59e0b; }
.news-tag.red { background: rgba(239,68,68,0.1); color: #ef4444; }
.news-tag.teal { background: rgba(20,184,166,0.1); color: #14b8a6; }
.news-tag.pink { background: rgba(236,72,153,0.1); color: #ec4899; }

.news-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.news-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 4px;
}

.news-title a {
  color: var(--text);
  transition: color var(--transition);
}

.news-title a:hover {
  color: var(--accent);
}

.news-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Projects showcase */
.projects-section {
  padding: 60px 0;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  transition: all var(--transition);
  display: block;
}

.project-card:hover {
  border-color: var(--accent-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.project-card-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-card-name .gh-icon {
  font-size: 0.85rem;
  opacity: 0.5;
  transition: opacity var(--transition);
}

.project-card:hover .project-card-name .gh-icon {
  opacity: 1;
  color: var(--accent);
}

.project-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.project-card-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(79,70,229,0.08);
  color: var(--accent);
  margin-top: 10px;
}

/* View all link */
.view-all {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap var(--transition);
}

.view-all:hover {
  gap: 10px;
}

/* Page header for secondary pages */
.page-header {
  padding: 120px 0 40px;
  text-align: center;
}

.page-header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.page-header p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
}

.project-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  padding-bottom: 80px;
}

.project-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all var(--transition);
}

.project-detail-card:hover {
  border-color: var(--accent-light);
  box-shadow: var(--shadow-hover);
}

.project-detail-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.project-detail-card .tag-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.project-detail-card .tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(79,70,229,0.08);
  color: var(--accent);
}

.project-detail-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
}

.project-detail-card .project-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.project-detail-card .project-link:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }

  .hero-desc {
    font-size: 1rem;
  }

  .hero {
    padding: 100px 0 40px;
  }

  .article-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .article-title {
    font-size: 1.6rem;
  }

  .article-content {
    font-size: 1rem;
  }

  .nav-links li:not(:last-child) {
    display: none;
  }

  .section-title {
    font-size: 1.3rem;
  }

  .news-item {
    flex-direction: column;
    gap: 8px;
  }

  .news-dot {
    display: none;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .project-detail-grid {
    grid-template-columns: 1fr;
  }

  .page-header h1 {
    font-size: 1.8rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .article-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .project-detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.footer-icp {
  margin-top: 0.45rem;
  font-size: 0.82rem;
}

.footer-icp a {
  color: inherit;
  opacity: 0.78;
  text-decoration: none;
}

.footer-icp a:hover {
  opacity: 1;
  text-decoration: underline;
}
