/* =============================================
   迷你狗码农技术分享 - 全局样式
   ============================================= */

/* ----- CSS Variables ----- */
:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #dbeafe;
  --color-accent: #f59e0b;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --color-border: #e2e8f0;
  --color-code-bg: #1e293b;
  --color-success: #10b981;
  --color-danger: #ef4444;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --max-width: 1100px;
  --header-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-primary-dark);
}

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

/* ----- Container ----- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ----- Header ----- */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.92);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}

.header-brand:hover {
  color: var(--color-primary);
}

.header-brand .logo-icon {
  font-size: 1.6rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-nav a {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  padding: 4px 0;
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--color-primary);
}

.header-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: width 0.25s;
}

.header-nav a:hover::after,
.header-nav a.active::after {
  width: 100%;
}

/* ----- Main Content ----- */
.main-content {
  flex: 1;
  padding: 40px 0 60px;
}

/* ----- Hero Section (首页) ----- */
.hero {
  text-align: center;
  padding: 60px 20px 50px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 50%, #ecfdf5 100%);
  border-radius: var(--radius-lg);
  margin-bottom: 48px;
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.hero .highlight {
  background: linear-gradient(135deg, var(--color-primary), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto 28px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.hero-tags span {
  display: inline-block;
  padding: 4px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* ----- Page Header ----- */
.page-header {
  text-align: center;
  padding: 40px 20px;
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 8px;
}

.page-header p {
  color: var(--color-text-secondary);
  font-size: 1rem;
}

/* ----- Article Card (列表) ----- */
.article-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.article-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 28px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

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

.article-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), #7c3aed);
  transform: scaleX(0);
  transition: transform 0.3s;
}

.article-card:hover::before {
  transform: scaleX(1);
}

.article-card .card-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.cat-frontend { background: #dbeafe; color: #1e40af; }
.cat-backend  { background: #dcfce7; color: #166534; }
.cat-cloud    { background: #fef3c7; color: #92400e; }
.cat-python   { background: #e0e7ff; color: #3730a3; }
.cat-tools    { background: #fce7f3; color: #9d174d; }

.article-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--color-text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.7;
}

.article-card .card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  padding-top: 14px;
}

.article-card .card-meta .read-more {
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.85rem;
}

/* ----- Article Detail ----- */
.article-detail {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 48px 56px;
  max-width: 800px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .article-detail {
    padding: 28px 24px;
  }
}

.article-detail .article-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.article-detail h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 16px;
  color: var(--color-text);
}

.article-detail .article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.article-detail .article-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.article-detail .article-body {
  font-size: 1rem;
  line-height: 1.9;
  color: var(--color-text);
}

.article-detail .article-body h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-primary-light);
}

.article-detail .article-body h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 28px 0 12px;
}

.article-detail .article-body p {
  margin-bottom: 16px;
}

.article-detail .article-body ul,
.article-detail .article-body ol {
  margin: 12px 0 20px 24px;
}

.article-detail .article-body li {
  margin-bottom: 8px;
}

.article-detail .article-body pre {
  background: var(--color-code-bg);
  color: #e2e8f0;
  padding: 20px 24px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 20px 0;
}

.article-detail .article-body code {
  background: #f1f5f9;
  color: var(--color-primary-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.article-detail .article-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.article-detail .article-body blockquote {
  border-left: 4px solid var(--color-primary);
  padding: 8px 20px;
  margin: 20px 0;
  background: var(--color-primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #1e40af;
}

.article-detail .article-body .info-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 20px 0;
  color: #166534;
}

.article-detail .article-body .warning-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 20px 0;
  color: #92400e;
}

/* ----- Article Navigation ----- */
.article-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.article-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.back-to-home {
  text-align: center;
  margin-top: 32px;
}

.back-to-home a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  transition: color 0.2s;
}

.back-to-home a:hover {
  color: var(--color-primary);
}

/* ----- About Page ----- */
.about-section {
  max-width: 720px;
  margin: 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 48px;
}

.about-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 32px 0 14px;
}

.about-section h2:first-child {
  margin-top: 0;
}

.about-section p {
  color: var(--color-text-secondary);
  margin-bottom: 14px;
  line-height: 1.8;
}

.about-section ul {
  margin: 10px 0 20px 24px;
  color: var(--color-text-secondary);
  line-height: 2;
}

/* ----- Footer ----- */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 28px 0;
  text-align: center;
}

.site-footer .footer-info {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  line-height: 2;
}

.site-footer .footer-info a {
  color: var(--color-text-muted);
}

.site-footer .footer-info a:hover {
  color: var(--color-primary);
}

.site-footer .footer-info .divider {
  margin: 0 8px;
  color: var(--color-border);
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.7rem;
  }

  .article-list {
    grid-template-columns: 1fr;
  }

  .header-nav {
    gap: 16px;
  }

  .header-nav a {
    font-size: 0.85rem;
  }

  .header-brand {
    font-size: 1.05rem;
  }

  .article-detail h1 {
    font-size: 1.5rem;
  }

  .about-section {
    padding: 28px 22px;
  }
}

/* ----- Utility ----- */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
