/* ============================================
   技术博客 - 公共样式
   响应式断点：1200px / 768px / 480px
   支持暗色模式（可选）
   ============================================ */

/* 全局重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 基础变量 */
:root {
  --bg-color: #fafbfc;
  --text-color: #1a202c;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --primary: #667eea;
  --primary-dark: #5a67d8;
  --primary-light: #eef2ff;
  --gradient-start: #667eea;
  --gradient-end: #764ba2;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 12px 24px rgba(0, 0, 0, 0.1);
  --footer-bg: #1e293b;
  --footer-text: #cbd5e1;
}

/* 暗色模式（可选，跟随系统） */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0f172a;
    --text-color: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --card-bg: #1e293b;
    --border-color: #334155;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 12px 24px rgba(0, 0, 0, 0.4);
    --footer-bg: #0f172a;
    --footer-text: #94a3b8;
  }
}

/* 基础样式 */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* 导航栏 */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

@media (prefers-color-scheme: dark) {
  .navbar {
    background: rgba(15, 23, 42, 0.95);
  }
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo span {
  font-size: 0.9rem;
  font-weight: normal;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
}

/* Hero 区域 */
.hero {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  padding: 60px 0;
  margin-bottom: 48px;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.95;
  max-width: 600px;
  margin: 0 auto;
}

/* 分类页头部 */
.page-header {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  padding: 60px 0;
  margin-bottom: 48px;
  text-align: center;
}

.page-header h1 {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.page-header p {
  font-size: 1.1rem;
  opacity: 0.95;
  max-width: 600px;
  margin: 0 auto;
}

/* 文章头部 */
.article-header {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  padding: 60px 0;
  margin-bottom: 48px;
}

.article-header h1 {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.article-header .meta {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-top: 16px;
}

/* 区块标题 */
.section-title {
  font-size: 1.8rem;
  margin-bottom: 32px;
  color: var(--text-color);
  border-left: 4px solid var(--primary);
  padding-left: 16px;
}

/* 文章卡片网格 */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 32px;
  margin-bottom: 48px;
}

/* 卡片样式 */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card-image {
  height: 160px;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.card-content {
  padding: 20px;
}

.card-tag {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-color);
  line-height: 1.4;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
}

/* 文章内容区 */
.article-content {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 48px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 48px;
}

.article-content h2 {
  font-size: 1.5rem;
  margin: 32px 0 16px 0;
  color: var(--text-color);
  border-left: 4px solid var(--primary);
  padding-left: 16px;
}

.article-content h2:first-of-type {
  margin-top: 0;
}

.article-content h3 {
  font-size: 1.2rem;
  margin: 24px 0 12px 0;
  color: var(--text-color);
}

.article-content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.article-content ul,
.article-content ol {
  margin: 16px 0 16px 24px;
  color: var(--text-secondary);
}

.article-content li {
  margin: 8px 0;
}

.article-content code {
  background: var(--primary-light);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  color: #e11d48;
}

.article-content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 16px 0;
}

.article-content pre code {
  background: none;
  color: #e2e8f0;
  padding: 0;
}

.article-content .tip {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 16px;
  border-radius: 12px;
  margin: 16px 0;
}

.article-content .tip p {
  margin: 0;
  color: var(--text-color);
}

.article-content .warning {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  padding: 16px;
  border-radius: 12px;
  margin: 16px 0;
}

/* 文章底部 */
.article-footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.article-footer a {
  color: var(--primary);
  text-decoration: none;
}

.article-footer .back-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--text-muted);
}

/* 关于页面 */
.about-section {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 48px;
  margin: 48px 0;
  box-shadow: var(--shadow-sm);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-top: 24px;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.stat {
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.about-content {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 48px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 80px;
}

.about-content h2 {
  font-size: 1.5rem;
  margin: 32px 0 16px 0;
  color: var(--text-color);
  border-left: 4px solid var(--primary);
  padding-left: 16px;
}

.about-content h2:first-of-type {
  margin-top: 0;
}

.about-content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0;
}

.tech-tag {
  background: var(--primary-light);
  color: var(--primary);
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 500;
}

.contact-info {
  background: var(--bg-color);
  border-radius: 16px;
  padding: 24px;
  margin-top: 24px;
}

/* 页脚 */
.footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 48px 0 24px;
  margin-top: 64px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.footer h4 {
  color: white;
  margin-bottom: 16px;
  font-size: 1rem;
}

.footer a {
  color: var(--footer-text);
  text-decoration: none;
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.footer a:hover {
  color: white;
}

.copyright {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid #334155;
  font-size: 0.85rem;
}

.beian {
  margin-top: 8px;
}

.beian a {
  display: inline-block;
  color: var(--footer-text);
  text-decoration: none;
}

.beian a:hover {
  color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  
  .hero h1,
  .page-header h1,
  .article-header h1 {
    font-size: 1.8rem;
  }
  
  .hero p,
  .page-header p {
    font-size: 1rem;
  }
  
  .nav-links {
    gap: 16px;
  }
  
  .nav-links a {
    font-size: 0.9rem;
  }
  
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .card-image {
    height: 140px;
    font-size: 2.5rem;
  }
  
  .card-content {
    padding: 16px;
  }
  
  .card-title {
    font-size: 1.1rem;
  }
  
  .article-content,
  .about-section,
  .about-content {
    padding: 24px;
  }
  
  .about-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .hero,
  .page-header,
  .article-header {
    padding: 40px 0;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }
  
  .hero h1,
  .page-header h1,
  .article-header h1 {
    font-size: 1.5rem;
  }
  
  .hero p,
  .page-header p {
    font-size: 0.9rem;
  }
  
  .section-title {
    font-size: 1.4rem;
  }
  
  .card-title {
    font-size: 1rem;
  }
  
  .card-desc {
    font-size: 0.85rem;
  }
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    padding: 8px 14px;
    font-size: 0.75rem;
  }
}