:root { --sidebar-w: 340px; }
    .wrap { max-width: 1200px; margin: 0 auto; padding: 2rem 1rem; display: grid; grid-template-columns: 1fr var(--sidebar-w); gap: 24px; }
    @media (max-width: 1060px) { .wrap { grid-template-columns: 1fr; } }
    .article-container { background: transparent; }
    .article-header { text-align: center; margin-bottom: 2rem; padding-top: 96px; }
    .article-meta { color: var(--text-secondary); font-size: .95rem; margin-bottom: .75rem; }
    .article-title { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; color: var(--text-primary); line-height: 1.15; margin: 0 0 1rem; }
    .article-description { font-size: 1.125rem; color: var(--text-secondary); margin-bottom: 1.5rem; }
    .back-button { display: inline-flex; align-items: center; gap: .5rem; background: var(--accent-gradient); color: #fff; text-decoration: none; padding: .7rem 1.2rem; border-radius: 999px; font-weight: 600; margin-top: 1rem; }
    .article-content { line-height: 1.8; font-size: 1.05rem; }
    .article-content h2 { color: var(--accent-primary); font-size: 1.8rem; margin: 2rem 0 1rem; }
    .article-content h3 { color: var(--text-primary); font-size: 1.3rem; margin: 1.4rem 0 .6rem; }
    .code-block { background: var(--bg-tertiary); padding: 1rem 1.2rem; border-radius: .6rem; margin: 1.2rem 0; border-left: 4px solid var(--accent-primary); overflow-x: auto; }
    .toc { background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: .6rem; padding: 1rem; margin: 1.5rem 0; display:none }
    aside { position: sticky; top: 96px; align-self: start; }
    .side-title { font-weight: 700; margin-bottom: 10px; }
    .side-list { display: flex; flex-direction: column; gap: 12px; }
    .side-card { border:1px solid var(--border-color); background: var(--bg-tertiary); border-radius: 12px; padding: 12px; }
    .side-card a { text-decoration: none; color: inherit; display:block; }
    .side-card h4 { margin: 6px 0 4px; font-size: 1rem; line-height: 1.2; }
    .side-meta { color: var(--text-secondary); font-size: .85rem; margin-bottom: 6px; }
    .side-desc { color: var(--text-secondary); font-size: .9rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
    .tag-row { margin-top: 8px; display:flex; flex-wrap:wrap; gap:6px; }
    .pill { display:inline-block; padding:2px 8px; border-radius:999px; border:1px solid var(--border-color); font-size:.75rem; color: var(--text-secondary); }
    
    /* ===== BLOG READER SPECIFIC STYLES ===== */

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--bg-tertiary);
  z-index: 1001;
}

.reading-progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  width: 0%;
  transition: width 0.3s ease;
}

/* ===== ARTICLE LISTING STYLES ===== */

/* Hide sidebar for listing pages */
.wrap:has(.featured-section) aside,
.wrap:has(.all-articles-section) aside {
  display: none;
}

.wrap:has(.featured-section),
.wrap:has(.all-articles-section) {
  grid-template-columns: 1fr;
  max-width: 1000px;
}

/* Section Titles */
.section-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 3rem 0 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.section-title:first-child {
  margin-top: 1rem;
}

/* Featured Articles Grid */
.featured-section {
  margin-bottom: 3rem;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

/* All Articles Grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

/* Article Cards */
.article-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

.featured-card {
  border: 2px solid var(--accent-primary);
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.featured-card:hover {
  box-shadow: 0 20px 40px -10px rgba(59, 130, 246, 0.3);
}

/* Card Image */
.card-image {
  height: 200px;
  overflow: hidden;
  position: relative;
}

.featured-card .card-image {
  height: 240px;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background-size: cover;
  background-position: center;
}

.category-badge {
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Card Content */
.card-content {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.featured-card .card-content {
  padding: 2rem;
}

.card-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 0.75rem;
  transition: color var(--transition-base);
}

.featured-card .card-title {
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.article-card:hover .card-title {
  color: var(--accent-primary);
}

.card-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-card .card-description {
  font-size: 1rem;
  -webkit-line-clamp: 4;
}

/* Card Footer */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-full);
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: all var(--transition-base);
}

.article-card:hover .tag {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.read-more {
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.article-card:hover .read-more {
  transform: translateX(4px);
}

/* Empty and Error States */
.empty-state,
.error-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.empty-state h3,
.error-state h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.empty-state p,
.error-state p {
  font-size: 1.1rem;
  max-width: 400px;
  margin: 0 auto;
}

/* Article Layout Improvements */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 1060px) {
  .wrap {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* Article Content Improvements */
.article-content {
  line-height: 1.8;
  font-size: 1.05rem;
  max-width: none;
}

.article-content h2 {
  color: var(--accent-primary);
  font-size: 1.8rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.article-content h3 {
  color: var(--text-primary);
  font-size: 1.4rem;
  margin: 2rem 0 0.8rem;
}

.article-content h4 {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin: 1.5rem 0 0.6rem;
}

.article-content p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

.article-content ul,
.article-content ol {
  margin: 1.5rem 0;
  padding-left: 2rem;
}

.article-content li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.article-content blockquote {
  border-left: 4px solid var(--accent-primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-tertiary);
  border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
  font-style: italic;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius-md);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-md);
}

/* Code Block Improvements */
.code-block, 
pre.code-block {
  background: var(--bg-tertiary);
  padding: 1.5rem;
  border-radius: var(--border-radius-md);
  margin: 1.5rem 0;
  border-left: 4px solid var(--accent-primary);
  overflow-x: auto;
  position: relative;
}

.code-block pre {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  overflow: visible;
}

.code-block code,
pre.code-block code {
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: transparent;
  padding: 0;
  border-radius: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.article-content p code,
.article-content li code,
.inline-code {
  background: var(--bg-tertiary);
  padding: 0.2rem 0.4rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.9em;
  color: var(--accent-primary);
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
}

/* TOC Improvements - APENAS SUBSTITUINDO A VERSÃO ANTIGA */
.toc {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.75rem;
  max-width: 280px;
  max-height: 60vh;
  overflow-y: auto;
  z-index: 100;
  opacity: 0.7;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
  display: none;
}

.toc:hover {
  opacity: 1;
  box-shadow: var(--shadow-lg);
  transform: translateY(-50%) scale(1.02);
}

.toc strong {
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  display: block;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin-bottom: 0.25rem;
}

.toc-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-base);
  font-size: 0.8rem;
  line-height: 1.3;
  display: block;
  padding: 0.25rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.5rem;
}

.toc-link:hover {
  color: var(--accent-primary);
  border-left-color: var(--accent-primary);
}

/* TOC collapsed state */
.toc.collapsed {
  width: 40px;
  height: 40px;
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
}

.toc.collapsed strong,
.toc.collapsed ul {
  display: none;
}

.toc.collapsed::before {
  content: "📋";
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Hide TOC on mobile and tablets */
@media (max-width: 1024px) {
  .toc {
    display: none !important;
  }
}

/* Sidebar Improvements */
aside {
  position: sticky;
  top: 120px;
  align-self: start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

/* Custom scrollbar for sidebar */
aside::-webkit-scrollbar {
  width: 4px;
}

aside::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

aside::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

aside::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

.side-title {
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.side-card {
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-md);
  padding: 1rem;
  transition: all var(--transition-base);
}

.side-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.side-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.side-card h4 {
  margin: 0.5rem 0;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--text-primary);
  transition: color var(--transition-base);
}

.side-card:hover h4 {
  color: var(--accent-primary);
}

.side-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.side-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.tag-row {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: var(--border-radius-full);
  border: 1px solid var(--border-color);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-primary);
  transition: all var(--transition-base);
}

.pill:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* Article Header Improvements */
.article-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-top: 120px;
}

.article-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.article-title {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin: 0 0 1.5rem;
}

.article-description {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-gradient);
  color: white;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-full);
  font-weight: 600;
  margin-top: 1rem;
  transition: all var(--transition-base);
}

.back-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Navigation improvements for article pages */
.navbar {
  background: rgba(var(--bg-primary-rgb, 255, 255, 255), 0.95);
  backdrop-filter: blur(10px);
}

[data-theme="dark"] .navbar {
  background: rgba(15, 23, 42, 0.95);
}

/* Article links styling */
.article-content a {
  color: var(--accent-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all var(--transition-base);
}

.article-content a:hover {
  border-bottom-color: var(--accent-primary);
}

/* Table styling */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-md);
  overflow: hidden;
}

.article-content th,
.article-content td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.article-content th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.article-content td {
  color: var(--text-secondary);
}

/* Mobile Optimizations for Article Listing */
@media (max-width: 768px) {
  .featured-grid,
  .articles-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .section-title {
    font-size: 1.5rem;
    margin: 2rem 0 1.5rem;
  }
  
  .card-image,
  .featured-card .card-image {
    height: 160px;
  }
  
  .card-content,
  .featured-card .card-content {
    padding: 1rem;
  }
  
  .card-title {
    font-size: 1.1rem;
  }
  
  .featured-card .card-title {
    font-size: 1.2rem;
  }
  
  .card-description {
    font-size: 0.9rem;
    -webkit-line-clamp: 2;
  }
  
  .card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .read-more {
    align-self: flex-end;
  }
}

@media (max-width: 480px) {
  .wrap:has(.featured-section),
  .wrap:has(.all-articles-section) {
    padding: 1rem 0.5rem;
  }
  
  .card-content,
  .featured-card .card-content {
    padding: 0.75rem;
  }
  
  .card-title,
  .featured-card .card-title {
    font-size: 1rem;
  }
  
  .card-image,
  .featured-card .card-image {
    height: 140px;
  }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .wrap {
    padding: 1rem;
    gap: 1.5rem;
  }
  
  .article-header {
    padding-top: 100px;
    margin-bottom: 2rem;
  }
  
  .article-title {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
  }
  
  .article-description {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .article-content {
    font-size: 1rem;
  }
  
  .article-content h2 {
    font-size: 1.5rem;
    margin: 2rem 0 0.8rem;
  }
  
  .article-content h3 {
    font-size: 1.2rem;
    margin: 1.5rem 0 0.6rem;
  }
  
  .code-block {
    padding: 1rem;
    font-size: 0.8rem;
  }
  
  .toc {
    position: static;
    margin: 1rem 0;
    padding: 1rem;
  }
  
  aside {
    position: static;
    max-height: none;
    margin-top: 2rem;
  }
  
  .side-card {
    padding: 0.75rem;
  }
  
  .side-card h4 {
    font-size: 0.9rem;
  }
  
  .side-desc {
    font-size: 0.8rem;
    -webkit-line-clamp: 2;
  }
}

@media (max-width: 480px) {
  .wrap {
    padding: 0.5rem;
  }
  
  .article-header {
    padding-top: 80px;
    margin-bottom: 1.5rem;
  }
  
  .article-content {
    font-size: 0.95rem;
  }
  
  .code-block {
    padding: 0.75rem;
    margin: 1rem 0;
  }
  
  .article-content h2 {
    font-size: 1.3rem;
  }
  
  .article-content h3 {
    font-size: 1.1rem;
  }
  
  .back-button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
}

/* Print Styles for Articles */
@media print {
  .reading-progress,
  .navbar,
  aside,
  .back-button,
  .toc {
    display: none !important;
  }
  
  .wrap {
    grid-template-columns: 1fr;
    max-width: none;
    padding: 0;
  }
  
  .article-header {
    padding-top: 0;
    margin-bottom: 2rem;
  }
  
  .article-content {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  .article-content h2 {
    page-break-after: avoid;
    margin-top: 1.5rem;
  }
  
  .code-block {
    page-break-inside: avoid;
    border: 1px solid #ccc;
    background: #f5f5f5 !important;
  }
}

/* Dark theme specific adjustments */
[data-theme="dark"] {
  --bg-primary-rgb: 15, 23, 42;
}

[data-theme="dark"] .code-block {
  background: #1e293b;
  border-left-color: #60a5fa;
}

[data-theme="dark"] .article-content blockquote {
  background: #1e293b;
  border-left-color: #60a5fa;
}

[data-theme="dark"] .toc {
  background: #1e293b;
  border-color: #334155;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Accessibility improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for better keyboard navigation */
.toc-link:focus,
.side-card a:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  border-radius: var(--border-radius-sm);
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
  .article-content {
    line-height: 2;
  }
  
  .code-block {
    border: 2px solid var(--text-primary);
  }
  
  .side-card {
    border: 2px solid var(--text-primary);
  }
}
.article-meta { color: var(--text-secondary); font-size: .95rem; margin-bottom: .75rem; }
.article-title { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; color: var(--text-primary); line-height: 1.15; margin: 0 0 1rem; }
.article-description { font-size: 1.125rem; color: var(--text-secondary); margin-bottom: 1.5rem; }
.back-button { display: inline-flex; align-items: center; gap: .5rem; background: var(--accent-gradient); color: #fff; text-decoration: none; padding: .7rem 1.2rem; border-radius: 999px; font-weight: 600; margin-top: 1rem; }
.article-content { line-height: 1.8; font-size: 1.05rem; }
.article-content h2 { color: var(--accent-primary); font-size: 1.8rem; margin: 2rem 0 1rem; }
.article-content h3 { color: var(--text-primary); font-size: 1.3rem; margin: 1.4rem 0 .6rem; }
.code-block { background: var(--bg-tertiary); padding: 1rem 1.2rem; border-radius: .6rem; margin: 1.2rem 0; border-left: 4px solid var(--accent-primary); overflow-x: auto; }
aside { position: sticky; top: 96px; align-self: start; }
.side-title { font-weight: 700; margin-bottom: 10px; }
.side-list { display: flex; flex-direction: column; gap: 12px; }
.side-card { border:1px solid var(--border-color); background: var(--bg-tertiary); border-radius: 12px; padding: 12px; }
.side-card a { text-decoration: none; color: inherit; display:block; }
.side-card h4 { margin: 6px 0 4px; font-size: 1rem; line-height: 1.2; }
.side-meta { color: var(--text-secondary); font-size: .85rem; margin-bottom: 6px; }
.side-desc { color: var(--text-secondary); font-size: .9rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tag-row { margin-top: 8px; display:flex; flex-wrap:wrap; gap:6px; }
.pill { display:inline-block; padding:2px 8px; border-radius:999px; border:1px solid var(--border-color); font-size:.75rem; color: var(--text-secondary); }

/* ===== BLOG READER SPECIFIC STYLES ===== */

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--bg-tertiary);
  z-index: 1001;
}

.reading-progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  width: 0%;
  transition: width 0.3s ease;
}

/* ===== ARTICLE LISTING STYLES ===== */

/* Hide sidebar for listing pages */
.wrap:has(.featured-section) aside,
.wrap:has(.all-articles-section) aside {
  display: none;
}

.wrap:has(.featured-section),
.wrap:has(.all-articles-section) {
  grid-template-columns: 1fr;
  max-width: 1000px;
}

/* Section Titles */
.section-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 3rem 0 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.section-title:first-child {
  margin-top: 1rem;
}

/* Featured Articles Grid */
.featured-section {
  margin-bottom: 3rem;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

/* All Articles Grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

/* Article Cards */
.article-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

.featured-card {
  border: 2px solid var(--accent-primary);
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.featured-card:hover {
  box-shadow: 0 20px 40px -10px rgba(59, 130, 246, 0.3);
}

/* Card Image */
.card-image {
  height: 200px;
  overflow: hidden;
  position: relative;
}

.featured-card .card-image {
  height: 240px;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background-size: cover;
  background-position: center;
}

.category-badge {
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Card Content */
.card-content {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.featured-card .card-content {
  padding: 2rem;
}

.card-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 0.75rem;
  transition: color var(--transition-base);
}

.featured-card .card-title {
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.article-card:hover .card-title {
  color: var(--accent-primary);
}

.card-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-card .card-description {
  font-size: 1rem;
  -webkit-line-clamp: 4;
}

/* Card Footer */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-full);
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: all var(--transition-base);
}

.article-card:hover .tag {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.read-more {
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.article-card:hover .read-more {
  transform: translateX(4px);
}

/* Empty and Error States */
.empty-state,
.error-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.empty-state h3,
.error-state h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.empty-state p,
.error-state p {
  font-size: 1.1rem;
  max-width: 400px;
  margin: 0 auto;
}

/* Article Layout Improvements */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 1060px) {
  .wrap {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* Article Content Improvements */
.article-content {
  line-height: 1.8;
  font-size: 1.05rem;
  max-width: none;
}

.article-content h2 {
  color: var(--accent-primary);
  font-size: 1.8rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.article-content h3 {
  color: var(--text-primary);
  font-size: 1.4rem;
  margin: 2rem 0 0.8rem;
}

.article-content h4 {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin: 1.5rem 0 0.6rem;
}

.article-content p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

.article-content ul,
.article-content ol {
  margin: 1.5rem 0;
  padding-left: 2rem;
}

.article-content li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.article-content blockquote {
  border-left: 4px solid var(--accent-primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-tertiary);
  border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
  font-style: italic;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius-md);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-md);
}

/* Code Block Improvements */
.code-block {
  background: var(--bg-tertiary);
  padding: 1.5rem;
  border-radius: var(--border-radius-md);
  margin: 1.5rem 0;
  border-left: 4px solid var(--accent-primary);
  overflow-x: auto;
  position: relative;
}

.code-block code {
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.article-content p code,
.article-content li code {
  background: var(--bg-tertiary);
  padding: 0.2rem 0.4rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.9em;
  color: var(--accent-primary);
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
}

/* TOC Improvements - Fixed at top next to title */
.toc {
  position: fixed;
  top: 100px;
  left: 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.75rem;
  max-width: 280px;
  max-height: 60vh;
  overflow-y: auto;
  z-index: 100;
  opacity: 0.8;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
  display: none;
}

.toc:hover {
  opacity: 1;
  box-shadow: var(--shadow-lg);
  transform: scale(1.02);
}

.toc strong {
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  display: block;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin-bottom: 0.25rem;
}

.toc-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-base);
  font-size: 0.8rem;
  line-height: 1.3;
  display: block;
  padding: 0.25rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.5rem;
}

.toc-link:hover {
  color: var(--accent-primary);
  border-left-color: var(--accent-primary);
}

/* TOC collapsed state */
.toc.collapsed {
  width: 40px;
  height: 40px;
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
}

.toc.collapsed strong,
.toc.collapsed ul {
  display: none;
}

.toc.collapsed::before {
  content: "📋";
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Hide TOC on mobile and tablets */
@media (max-width: 1024px) {
  .toc {
    display: none !important;
  }
}

/* Sidebar Improvements */
aside {
  position: sticky;
  top: 120px;
  align-self: start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

/* Custom scrollbar for sidebar */
aside::-webkit-scrollbar {
  width: 4px;
}

aside::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

aside::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

aside::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

.side-title {
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.side-card {
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-md);
  padding: 1rem;
  transition: all var(--transition-base);
}

.side-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.side-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.side-card h4 {
  margin: 0.5rem 0;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--text-primary);
  transition: color var(--transition-base);
}

.side-card:hover h4 {
  color: var(--accent-primary);
}

.side-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.side-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.tag-row {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: var(--border-radius-full);
  border: 1px solid var(--border-color);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-primary);
  transition: all var(--transition-base);
}

.pill:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* Article Header Improvements */
.article-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-top: 120px;
}

.article-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.article-title {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin: 0 0 1.5rem;
}

.article-description {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-gradient);
  color: white;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-full);
  font-weight: 600;
  margin-top: 1rem;
  transition: all var(--transition-base);
}

.back-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Navigation improvements for article pages */
.navbar {
  background: rgba(var(--bg-primary-rgb, 255, 255, 255), 0.95);
  backdrop-filter: blur(10px);
}

[data-theme="dark"] .navbar {
  background: rgba(15, 23, 42, 0.95);
}

/* Article links styling */
.article-content a {
  color: var(--accent-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all var(--transition-base);
}

.article-content a:hover {
  border-bottom-color: var(--accent-primary);
}

/* Table styling */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-md);
  overflow: hidden;
}

.article-content th,
.article-content td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.article-content th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.article-content td {
  color: var(--text-secondary);
}

/* Mobile Optimizations for Article Listing */
@media (max-width: 768px) {
  .featured-grid,
  .articles-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .section-title {
    font-size: 1.5rem;
    margin: 2rem 0 1.5rem;
  }
  
  .card-image,
  .featured-card .card-image {
    height: 160px;
  }
  
  .card-content,
  .featured-card .card-content {
    padding: 1rem;
  }
  
  .card-title {
    font-size: 1.1rem;
  }
  
  .featured-card .card-title {
    font-size: 1.2rem;
  }
  
  .card-description {
    font-size: 0.9rem;
    -webkit-line-clamp: 2;
  }
  
  .card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .read-more {
    align-self: flex-end;
  }
  
  .wrap {
    padding: 1rem;
    gap: 1.5rem;
  }
  
  .article-header {
    padding-top: 100px;
    margin-bottom: 2rem;
  }
  
  .article-title {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
  }
  
  .article-description {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .article-content {
    font-size: 1rem;
  }
  
  .article-content h2 {
    font-size: 1.5rem;
    margin: 2rem 0 0.8rem;
  }
  
  .article-content h3 {
    font-size: 1.2rem;
    margin: 1.5rem 0 0.6rem;
  }
  
  .code-block {
    padding: 1rem;
    font-size: 0.8rem;
  }
  
  aside {
    position: static;
    max-height: none;
    margin-top: 2rem;
  }
  
  .side-card {
    padding: 0.75rem;
  }
  
  .side-card h4 {
    font-size: 0.9rem;
  }
  
  .side-desc {
    font-size: 0.8rem;
    -webkit-line-clamp: 2;
  }
}

@media (max-width: 480px) {
  .wrap:has(.featured-section),
  .wrap:has(.all-articles-section) {
    padding: 1rem 0.5rem;
  }
  
  .card-content,
  .featured-card .card-content {
    padding: 0.75rem;
  }
  
  .card-title,
  .featured-card .card-title {
    font-size: 1rem;
  }
  
  .card-image,
  .featured-card .card-image {
    height: 140px;
  }
  
  .wrap {
    padding: 0.5rem;
  }
  
  .article-header {
    padding-top: 80px;
    margin-bottom: 1.5rem;
  }
  
  .article-content {
    font-size: 0.95rem;
  }
  
  .code-block {
    padding: 0.75rem;
    margin: 1rem 0;
  }
  
  .article-content h2 {
    font-size: 1.3rem;
  }
  
  .article-content h3 {
    font-size: 1.1rem;
  }
  
  .back-button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
}

/* Print Styles for Articles */
@media print {
  .reading-progress,
  .navbar,
  aside,
  .back-button,
  .toc {
    display: none !important;
  }
  
  .wrap {
    grid-template-columns: 1fr;
    max-width: none;
    padding: 0;
  }
  
  .article-header {
    padding-top: 0;
    margin-bottom: 2rem;
  }
  
  .article-content {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  .article-content h2 {
    page-break-after: avoid;
    margin-top: 1.5rem;
  }
  
  .code-block {
    page-break-inside: avoid;
    border: 1px solid #ccc;
    background: #f5f5f5 !important;
  }
}

/* Dark theme specific adjustments */
[data-theme="dark"] {
  --bg-primary-rgb: 15, 23, 42;
}

[data-theme="dark"] .code-block {
  background: #1e293b;
  border-left-color: #60a5fa;
}

[data-theme="dark"] .article-content blockquote {
  background: #1e293b;
  border-left-color: #60a5fa;
}

[data-theme="dark"] .toc {
  background: #1e293b;
  border-color: #334155;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Accessibility improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for better keyboard navigation */
.toc-link:focus,
.side-card a:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  border-radius: var(--border-radius-sm);
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
  .article-content {
    line-height: 2;
  }
  
  .code-block {
    border: 2px solid var(--text-primary);
  }
  
  .side-card {
    border: 2px solid var(--text-primary);
  }
} {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 3rem 0 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.section-title:first-child {
  margin-top: 1rem;
}

/* Featured Articles Grid */
.featured-section {
  margin-bottom: 3rem;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

/* All Articles Grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

/* Article Cards */
.article-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

.featured-card {
  border: 2px solid var(--accent-primary);
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.featured-card:hover {
  box-shadow: 0 20px 40px -10px rgba(59, 130, 246, 0.3);
}

/* Card Image */
.card-image {
  height: 200px;
  overflow: hidden;
  position: relative;
}

.featured-card .card-image {
  height: 240px;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background-size: cover;
  background-position: center;
}

.category-badge {
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Card Content */
.card-content {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.featured-card .card-content {
  padding: 2rem;
}

.card-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 0.75rem;
  transition: color var(--transition-base);
}

.featured-card .card-title {
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.article-card:hover .card-title {
  color: var(--accent-primary);
}

.card-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-card .card-description {
  font-size: 1rem;
  -webkit-line-clamp: 4;
}

/* Card Footer */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-full);
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: all var(--transition-base);
}

.article-card:hover .tag {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.read-more {
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.article-card:hover .read-more {
  transform: translateX(4px);
}

/* Empty and Error States */
.empty-state,
.error-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.empty-state h3,
.error-state h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.empty-state p,
.error-state p {
  font-size: 1.1rem;
  max-width: 400px;
  margin: 0 auto;
}

/* Article Content Improvements */
.article-content {
  line-height: 1.8;
  font-size: 1.05rem;
  max-width: none;
}

.article-content h2 {
  color: var(--accent-primary);
  font-size: 1.8rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.article-content h3 {
  color: var(--text-primary);
  font-size: 1.4rem;
  margin: 2rem 0 0.8rem;
}

.article-content h4 {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin: 1.5rem 0 0.6rem;
}

.article-content p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

.article-content ul,
.article-content ol {
  margin: 1.5rem 0;
  padding-left: 2rem;
}

.article-content li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.article-content blockquote {
  border-left: 4px solid var(--accent-primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-tertiary);
  border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
  font-style: italic;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius-md);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-md);
}

/* Code Block Improvements */
.code-block {
  background: var(--bg-tertiary);
  padding: 1.5rem;
  border-radius: var(--border-radius-md);
  margin: 1.5rem 0;
  border-left: 4px solid var(--accent-primary);
  overflow-x: auto;
  position: relative;
}

.code-block code {
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.article-content p code,
.article-content li code {
  background: var(--bg-tertiary);
  padding: 0.2rem 0.4rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.9em;
  color: var(--accent-primary);
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
}

/* TOC Improvements - Compact side version */
.toc {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.75rem;
  max-width: 280px;
  max-height: 60vh;
  overflow-y: auto;
  z-index: 100;
  opacity: 0.7;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
}

.toc:hover {
  opacity: 1;
  box-shadow: var(--shadow-lg);
  transform: translateY(-50%) scale(1.02);
}

.toc strong {
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  display: block;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin-bottom: 0.25rem;
}

.toc-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-base);
  font-size: 0.8rem;
  line-height: 1.3;
  display: block;
  padding: 0.25rem 0;
  border-left: 2px solid transparent;
  padding-left: 0.5rem;
}

.toc-link:hover {
  color: var(--accent-primary);
  border-left-color: var(--accent-primary);
}

/* TOC collapsed state */
.toc.collapsed {
  width: 40px;
  height: 40px;
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
}

.toc.collapsed strong,
.toc.collapsed ul {
  display: none;
}

.toc.collapsed::before {
  content: "📋";
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Hide TOC on mobile and tablets */
@media (max-width: 1024px) {
  .toc {
    display: none !important;
  }
}

/* Sidebar Improvements */
aside {
  position: sticky;
  top: 120px;
  align-self: start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

/* Custom scrollbar for sidebar */
aside::-webkit-scrollbar {
  width: 4px;
}

aside::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

aside::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

aside::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

.side-title {
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.side-card {
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-md);
  padding: 1rem;
  transition: all var(--transition-base);
}

.side-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.side-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.side-card h4 {
  margin: 0.5rem 0;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--text-primary);
  transition: color var(--transition-base);
}

.side-card:hover h4 {
  color: var(--accent-primary);
}

.side-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.side-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.tag-row {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: var(--border-radius-full);
  border: 1px solid var(--border-color);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-primary);
  transition: all var(--transition-base);
}

.pill:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* Article Header Improvements */
.article-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-top: 120px;
}

.article-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.article-title {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin: 0 0 1.5rem;
}

.article-description {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-gradient);
  color: white;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-full);
  font-weight: 600;
  margin-top: 1rem;
  transition: all var(--transition-base);
}

.back-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Article links styling */
.article-content a {
  color: var(--accent-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all var(--transition-base);
}

.article-content a:hover {
  border-bottom-color: var(--accent-primary);
}

/* Table styling */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-md);
  overflow: hidden;
}

.article-content th,
.article-content td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.article-content th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.article-content td {
  color: var(--text-secondary);
}

/* Mobile Optimizations for Article Listing */
@media (max-width: 768px) {
  .featured-grid,
  .articles-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .section-title {
    font-size: 1.5rem;
    margin: 2rem 0 1.5rem;
  }
  
  .card-image,
  .featured-card .card-image {
    height: 160px;
  }
  
  .card-content,
  .featured-card .card-content {
    padding: 1rem;
  }
  
  .card-title {
    font-size: 1.1rem;
  }
  
  .featured-card .card-title {
    font-size: 1.2rem;
  }
  
  .card-description {
    font-size: 0.9rem;
    -webkit-line-clamp: 2;
  }
  
  .card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .read-more {
    align-self: flex-end;
  }
  
  .wrap {
    padding: 1rem;
    gap: 1.5rem;
  }
  
  .article-header {
    padding-top: 100px;
    margin-bottom: 2rem;
  }
  
  .article-title {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
  }
  
  .article-description {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .article-content {
    font-size: 1rem;
  }
  
  .article-content h2 {
    font-size: 1.5rem;
    margin: 2rem 0 0.8rem;
  }
  
  .article-content h3 {
    font-size: 1.2rem;
    margin: 1.5rem 0 0.6rem;
  }
  
  .code-block {
    padding: 1rem;
    font-size: 0.8rem;
  }
  
  aside {
    position: static;
    max-height: none;
    margin-top: 2rem;
  }
  
  .side-card {
    padding: 0.75rem;
  }
  
  .side-card h4 {
    font-size: 0.9rem;
  }
  
  .side-desc {
    font-size: 0.8rem;
    -webkit-line-clamp: 2;
  }
}

@media (max-width: 480px) {
  .wrap:has(.featured-section),
  .wrap:has(.all-articles-section) {
    padding: 1rem 0.5rem;
  }
  
  .card-content,
  .featured-card .card-content {
    padding: 0.75rem;
  }
  
  .card-title,
  .featured-card .card-title {
    font-size: 1rem;
  }
  
  .card-image,
  .featured-card .card-image {
    height: 140px;
  }
  
  .wrap {
    padding: 0.5rem;
  }
  
  .article-header {
    padding-top: 80px;
    margin-bottom: 1.5rem;
  }
  
  .article-content {
    font-size: 0.95rem;
  }
  
  .code-block {
    padding: 0.75rem;
    margin: 1rem 0;
  }
  
  .article-content h2 {
    font-size: 1.3rem;
  }
  
  .article-content h3 {
    font-size: 1.1rem;
  }
  
  .back-button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
}

/* Print Styles for Articles */
@media print {
  .reading-progress,
  .navbar,
  aside,
  .back-button,
  .toc {
    display: none !important;
  }
  
  .wrap {
    grid-template-columns: 1fr;
    max-width: none;
    padding: 0;
  }
  
  .article-header {
    padding-top: 0;
    margin-bottom: 2rem;
  }
  
  .article-content {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  .article-content h2 {
    page-break-after: avoid;
    margin-top: 1.5rem;
  }
  
  .code-block {
    page-break-inside: avoid;
    border: 1px solid #ccc;
    background: #f5f5f5 !important;
  }
}

/* Dark theme specific adjustments */
[data-theme="dark"] {
  --bg-primary-rgb: 15, 23, 42;
}

[data-theme="dark"] .code-block {
  background: #1e293b;
  border-left-color: #60a5fa;
}

[data-theme="dark"] .article-content blockquote {
  background: #1e293b;
  border-left-color: #60a5fa;
}

[data-theme="dark"] .toc {
  background: #1e293b;
  border-color: #334155;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Accessibility improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for better keyboard navigation */
.toc-link:focus,
.side-card a:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  border-radius: var(--border-radius-sm);
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
  .article-content {
    line-height: 2;
  }
  
  .code-block {
    border: 2px solid var(--text-primary);
  }
  
  .side-card {
    border: 2px solid var(--text-primary);
  }
}

* Copy button for code blocks */
.copy-code-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.copy-code-btn:hover {
  opacity: 1;
}

/* Search results */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.search-result {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

.search-result:hover {
  background: var(--bg-tertiary);
}