/* ========================================
   devcfg - Modern Tech Blog Theme
   Light Modern Style with Blue Accent
   ======================================== */

/* CSS Variables */
:root {
  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --secondary: #6366F1;
  --background: #FFFFFF;
  --surface: #F9FAFB;
  --text-primary: #1F2937;
  --text-secondary: #6B7280;
  --text-tertiary: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --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 -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 8px;
  --radius-lg: 12px;
  
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-code: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

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

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

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background-color: var(--background);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

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

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 700;
  font-size: 20px;
  color: var(--text-primary);
}

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

.logo-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.main-nav {
  display: flex;
  gap: 32px;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s ease;
  position: relative;
}

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

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -18px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

.search-toggle,
.mobile-menu-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.search-toggle:hover,
.mobile-menu-toggle:hover {
  opacity: 1;
}

.mobile-menu-toggle {
  display: none;
}

/* Hero Section */
.hero {
  position: relative;
  padding: 120px 24px 80px;
  overflow: hidden;
  text-align: center;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
}

.hero-background svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(48px, 8vw, 72px);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 24px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
}

.hero-description {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

.hero-cta {
  display: inline-block;
  padding: 12px 32px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
}

.hero-cta:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: white;
}

/* Features Section */
.features {
  padding: 60px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
}

.feature-card {
  text-align: center;
  padding: 32px 24px;
  background: var(--background);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
}

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

a.feature-card.hub-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

a.feature-card.hub-card:hover {
  color: inherit;
}

.feature-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 16px;
}

.feature-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.feature-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Posts Section */
.posts-section {
  padding: 80px 0;
}

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

.section-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
}

.posts-section-more {
  margin-top: 40px;
  text-align: center;
  font-size: 15px;
}

.posts-section-more a {
  color: var(--primary);
  font-weight: 600;
}

.posts-section-more a:hover {
  text-decoration: underline;
}

.category-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Post Card */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 32px;
}

.post-card {
  background: var(--background);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.post-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 0;
  background: linear-gradient(to bottom, var(--primary), var(--secondary));
  transition: height 0.3s ease;
}

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

.post-card:hover::before {
  height: 100%;
}

.post-meta-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 13px;
}

.post-category {
  padding: 4px 12px;
  background: #EEF2FF;
  color: var(--primary);
  border-radius: 12px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.post-date {
  color: var(--text-tertiary);
}

.post-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 12px;
}

.post-title a {
  color: var(--text-primary);
}

.post-title a:hover {
  color: var(--primary);
}

.post-excerpt {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 20px;
  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;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.post-read-time {
  font-weight: 500;
}

.post-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.post-tag {
  color: var(--text-tertiary);
  font-size: 12px;
  transition: color 0.2s;
}

.post-tag:hover {
  color: var(--primary);
}

.post-link {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  transition: all 0.2s ease;
}

.post-link:hover {
  transform: translateX(4px);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border-light);
}

.pagination-prev,
.pagination-next {
  padding: 10px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

.pagination-prev:hover,
.pagination-next:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.pagination-info {
  color: var(--text-tertiary);
  font-size: 14px;
}

/* Post Article Page */
.post-article {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 24px 80px;
}

.post-header {
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-light);
}

.post-title-single {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.2;
  margin: 20px 0;
  letter-spacing: -0.02em;
}

.post-meta-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.meta-divider {
  color: var(--border);
}

.post-tags-list {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.post-tags-list .post-tag {
  padding: 4px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.post-tags-list .post-tag:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Post Content Typography */
.post-body-wrapper {
  display: flex;
  gap: 40px;
  position: relative;
}

.post-toc {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
}

.toc-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text-primary);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

#tocNav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#tocNav li {
  margin: 8px 0;
}

#tocNav a {
  display: block;
  padding: 6px 10px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#tocNav a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

#tocNav a.active {
  background: var(--primary);
  color: white;
  font-weight: 500;
}

#tocNav ul ul {
  padding-left: 16px;
  margin-top: 4px;
}

.post-content {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-primary);
}

.post-content h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 48px 0 20px;
  color: var(--text-primary);
  line-height: 1.3;
}

.post-content h3 {
  font-size: 22px;
  font-weight: 600;
  margin: 36px 0 16px;
  color: var(--text-primary);
}

.post-content p {
  margin-bottom: 20px;
}

.post-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

.post-content ul,
.post-content ol {
  margin: 20px 0;
  padding-left: 28px;
}

.post-content li {
  margin-bottom: 10px;
}

.post-content blockquote {
  margin: 28px 0;
  padding: 16px 24px;
  background: var(--surface);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.post-content blockquote a {
  color: var(--primary);
  font-style: normal;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-content blockquote a:hover {
  opacity: 0.85;
}

.post-content a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.post-content img {
  margin: 32px 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.post-content .mermaid {
  margin: 28px 0;
  padding: 20px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fafbfc;
  overflow-x: auto;
  text-align: center;
}

.post-content .mermaid svg {
  max-width: 100%;
  height: auto;
}

.post-content .mermaid.mermaid-error {
  color: #8a4b2a;
  text-align: left;
  font-family: var(--font-code);
  font-size: 0.85rem;
  white-space: pre-wrap;
}

.post-content .mermaid-error-msg {
  margin: 12px 0 0;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: #b54708;
}

/* Code Blocks */
.post-content pre:not(figure pre) {
  margin: 28px 0;
  border-radius: var(--radius);
  overflow-x: auto;
  background: #F6F8FA !important;
  border: 1px solid var(--border);
  position: relative;
}

.post-content code:not(figure code) {
  font-family: var(--font-code);
  font-size: 0.9em;
  color: #E74C3C;
  line-height: 1.6;
  background: #F6F8FA;
  padding: 2px 6px;
  border-radius: 4px;
}

.post-content pre:not(figure pre) code {
  background: none;
  padding: 20px;
  color: var(--text-primary);
  display: block;
}

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  font-size: 15px;
}

.post-content th,
.post-content td {
  padding: 12px 16px;
  border: 1px solid var(--border);
  text-align: left;
}

.post-content th {
  background: var(--surface);
  font-weight: 600;
  color: var(--text-primary);
}

.post-content tr:nth-child(even) {
  background: var(--surface);
}

/* 文章页系列导航条（系列目录页样式见 css/series.css） */
.series-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 14px 18px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius);
}

.series-bar-parent {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
}

.series-bar-parent:hover {
  color: var(--primary);
}

.series-bar-sep {
  color: var(--text-tertiary);
  margin: 0 4px;
}

.series-bar-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.series-bar-progress {
  font-size: 13px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Post Footer */
.post-footer {
  margin-top: 64px;
  padding-top: 40px;
  border-top: 1px solid var(--border-light);
}

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 48px;
}

.post-nav-link {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.post-nav-link:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.post-nav-link.empty {
  visibility: hidden;
}

.nav-label {
  display: block;
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  font-weight: 500;
}

.nav-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Related Posts */
.related-posts h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.related-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.related-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.related-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  line-height: 1.4;
}

.related-card time {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* Search Modal */
.search-modal {
  display: none;
  pointer-events: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.search-modal.active {
  display: flex;
  pointer-events: auto;
  align-items: flex-start;
  justify-content: center;
  padding-top: 120px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.search-container {
  width: 90%;
  max-width: 640px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

#searchInput {
  width: 100%;
  padding: 20px 24px;
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-family: var(--font-body);
  outline: none;
  background: var(--background);
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 12px;
}

.search-result-item {
  padding: 12px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
}

.search-result-item:hover {
  background: var(--surface);
}

.search-result-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.search-result-excerpt {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Footer */
.site-footer {
  position: relative;
  z-index: 2;
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  padding: 40px 24px;
  margin-top: 80px;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-content {
  text-align: center;
  flex: 1;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 2px;
  margin: 0 0 16px;
  font-size: 14px;
}

.footer-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 8px;
  margin: -6px -8px;
  position: relative;
  z-index: 1;
}

.footer-nav a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.footer-sep {
  color: var(--text-tertiary);
  user-select: none;
  margin: 0 4px;
}

.footer-copyright {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 6px 0;
}

.footer-icp {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 4px 0;
}

.footer-icp a {
  color: var(--text-tertiary);
  text-decoration: none;
}

.footer-icp a:hover {
  color: var(--text-secondary);
  text-decoration: underline;
}

.footer-content p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 4px 0;
}

.footer-powered {
  font-size: 13px;
  color: var(--text-tertiary);
}

.social-links {
  display: flex;
  gap: 16px;
}

.social-links a {
  color: var(--text-secondary);
  transition: color 0.2s;
}

.social-links a:hover {
  color: var(--primary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 20px 24px;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }

  .main-nav.active {
    display: flex;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .hero {
    padding: 80px 24px 60px;
  }

  .hero-subtitle {
    font-size: 20px;
  }

  .hero-description {
    font-size: 16px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-body-wrapper {
    flex-direction: column;
  }

  .post-toc {
    display: none;
  }

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

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

  .footer-container {
    flex-direction: column;
    text-align: center;
  }

  .pagination {
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .container {
    padding: 0 16px;
  }

  .post-card {
    padding: 24px;
  }

  .post-article {
    padding: 40px 16px 60px;
  }

  .category-filters {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
  }
}