/* ==========================================================================
   BLOG.CSS - Blog Section Styles
   Terminal Journal - architg.me
   ========================================================================== */

/* --------------------------------------------------------------------------
   Blog Listing Page
   -------------------------------------------------------------------------- */
.blog-listing {
  padding-top: calc(60px + var(--space-3xl));
  min-height: 100vh;
}

.blog-listing .section-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.blog-listing .section-subtitle {
  max-width: 100%;
  text-wrap: balance; /* Modern CSS for balanced line breaks */
}

/* Category Filters */
.blog-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-3xl);
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-glass);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.filter-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.filter-btn--active {
  background: var(--accent-cyan-dim);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.filter-btn i {
  font-size: 16px;
}

/* Blog Grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--space-xl);
  margin-bottom: var(--space-3xl);
}

@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }
}

/* Blog Cards */
.blog-card {
  display: block;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-slow);
  text-decoration: none;
  color: inherit;
}

.blog-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  color: inherit;
}

.blog-card--hidden {
  display: none;
}

.blog-card-image {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.blog-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.blog-card:hover .blog-card-image img {
  transform: scale(1.05);
}

.blog-card-content {
  padding: var(--space-lg);
}

.blog-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.blog-card-category {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.blog-card-category--ai {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
}

.blog-card-category--engineering {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.blog-card-category--pool {
  background: var(--accent-magenta-dim);
  color: var(--accent-magenta);
}

.blog-card-category--thoughts {
  background: var(--accent-yellow-dim);
  color: var(--accent-yellow);
}

.blog-card-date,
.blog-card-reading-time {
  color: var(--text-muted);
}

.blog-card-title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-sm);
  line-height: 1.3;
  color: var(--text-primary);
  transition: color var(--transition-fast);
}

.blog-card:hover .blog-card-title {
  color: var(--accent-cyan);
}

.blog-card-excerpt {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

.blog-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* Empty State */
.blog-empty {
  max-width: 500px;
  margin: var(--space-3xl) auto;
}

/* --------------------------------------------------------------------------
   Blog Post Page
   -------------------------------------------------------------------------- */
.blog-post {
  padding-top: 60px;
}

/* Hero Image */
.blog-hero {
  position: relative;
  height: 400px;
  overflow: hidden;
}

@media (max-width: 768px) {
  .blog-hero {
    height: 250px;
  }
}

.blog-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0%, var(--bg-primary) 100%);
}

/* Layout */
.blog-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-3xl);
  padding: var(--space-3xl) 0;
  align-items: start;
}

@media (max-width: 1024px) {
  .blog-layout {
    grid-template-columns: 1fr;
  }
}

.blog-main {
  max-width: 800px;
}

/* Header */
.blog-header {
  margin-bottom: var(--space-3xl);
}

.blog-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
  transition: color var(--transition-fast);
}

.blog-back:hover {
  color: var(--accent-cyan);
}

.blog-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.blog-category {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.blog-category--ai {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
}

.blog-category--engineering {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.blog-category--pool {
  background: var(--accent-magenta-dim);
  color: var(--accent-magenta);
}

.blog-category--thoughts {
  background: var(--accent-yellow-dim);
  color: var(--accent-yellow);
}

.blog-date,
.blog-reading-time {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-muted);
}

.blog-title {
  font-size: var(--text-4xl);
  line-height: 1.1;
  margin-bottom: var(--space-lg);
}

.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* --------------------------------------------------------------------------
   Blog Content Typography
   -------------------------------------------------------------------------- */
.blog-content {
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--text-secondary);
}

.blog-content h2 {
  font-size: var(--text-2xl);
  margin-top: var(--space-3xl);
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
  scroll-margin-top: 100px;
}

.blog-content h3 {
  font-size: var(--text-xl);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  color: var(--text-primary);
  scroll-margin-top: 100px;
}

.blog-content h4 {
  font-size: var(--text-lg);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.blog-content p {
  margin-bottom: var(--space-lg);
}

.blog-content a {
  color: var(--accent-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}

.blog-content a:hover {
  color: var(--accent-magenta);
}

.blog-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.blog-content em {
  font-style: italic;
}

/* Lists */
.blog-content ul,
.blog-content ol {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-xl);
}

.blog-content ul {
  list-style: none;
}

.blog-content ul li {
  position: relative;
  margin-bottom: var(--space-sm);
  padding-left: var(--space-md);
}

.blog-content ul li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.blog-content ol li {
  margin-bottom: var(--space-sm);
}

/* Blockquotes */
.blog-content blockquote {
  margin: var(--space-xl) 0;
  padding: var(--space-lg) var(--space-xl);
  border-left: 3px solid var(--accent-cyan);
  background: var(--bg-glass);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
}

.blog-content blockquote p:last-child {
  margin-bottom: 0;
}

/* Images */
.blog-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  margin: var(--space-xl) 0;
  border: 1px solid var(--border-subtle);
}

/* Horizontal Rule */
.blog-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-medium), transparent);
  margin: var(--space-3xl) 0;
}

/* Code Blocks - Inline */
.blog-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.2em 0.4em;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
}

/* Code Blocks - Block */
.blog-content pre {
  margin: var(--space-xl) 0;
  padding: var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.blog-content pre code {
  padding: 0;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* Rouge Syntax Highlighting - Cyberpunk Theme */
.highlight {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.highlight pre {
  margin: 0;
  border: none;
}

.highlight .c, .highlight .c1, .highlight .cm { color: #71717a; font-style: italic; } /* Comments */
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr { color: var(--accent-magenta); } /* Keywords */
.highlight .nc, .highlight .nn { color: var(--accent-cyan); } /* Class/Module names */
.highlight .nf, .highlight .ni { color: var(--accent-green); } /* Function names */
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .ss { color: var(--accent-yellow); } /* Strings */
.highlight .nb, .highlight .bp { color: var(--accent-cyan); } /* Built-ins */
.highlight .no, .highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi { color: var(--accent-orange); } /* Variables */
.highlight .o, .highlight .ow { color: var(--text-primary); } /* Operators */
.highlight .p { color: var(--text-secondary); } /* Punctuation */
.highlight .m, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .mo, .highlight .il { color: var(--accent-magenta); } /* Numbers */
.highlight .na { color: var(--accent-cyan); } /* Attributes */
.highlight .nt { color: var(--accent-magenta); } /* HTML tags */
.highlight .err { color: #ff5f56; } /* Errors */

/* --------------------------------------------------------------------------
   Table of Contents
   -------------------------------------------------------------------------- */
.blog-toc {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

@media (max-width: 1024px) {
  .blog-toc {
    display: none;
  }
}

.toc-container {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.toc-header {
  margin-bottom: var(--space-md);
}

.toc-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-cyan);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin-bottom: var(--space-sm);
}

.toc-list a {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: var(--space-xs) 0;
  padding-left: var(--space-sm);
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.toc-list a:hover {
  color: var(--accent-cyan);
}

.toc-list a.toc-active {
  color: var(--accent-cyan);
  border-left-color: var(--accent-cyan);
}

.toc-list .toc-h3 {
  padding-left: var(--space-lg);
  font-size: calc(var(--text-xs) * 0.9);
}

/* --------------------------------------------------------------------------
   Share Buttons
   -------------------------------------------------------------------------- */
.share-buttons {
  margin-top: var(--space-3xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-subtle);
}

.share-label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-glass);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-base);
}

.share-btn:hover {
  transform: translateY(-2px);
}

.share-btn--twitter:hover {
  border-color: #1da1f2;
  color: #1da1f2;
}

.share-btn--linkedin:hover {
  border-color: #0077b5;
  color: #0077b5;
}

.share-btn--copy:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.share-btn--copy.copied {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.share-btn--copy.copied i::before {
  content: "\f26b"; /* bi-check icon */
}

.share-btn--copy.copied span {
  display: none;
}

.share-btn--copy.copied::after {
  content: "Copied!";
}

/* --------------------------------------------------------------------------
   Author Bio
   -------------------------------------------------------------------------- */
.blog-author {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-3xl);
  padding: var(--space-xl);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

@media (max-width: 480px) {
  .blog-author {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

.blog-author-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  border: 2px solid var(--border-subtle);
  flex-shrink: 0;
}

.blog-author-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.blog-author-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.blog-author-name {
  font-size: var(--text-lg);
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.blog-author-bio {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Post Navigation
   -------------------------------------------------------------------------- */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-top: var(--space-3xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-subtle);
}

@media (max-width: 640px) {
  .post-nav {
    grid-template-columns: 1fr;
  }
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all var(--transition-base);
}

.post-nav-link:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.post-nav-link--empty {
  background: none;
  border: none;
}

.post-nav-link--next {
  text-align: right;
}

.post-nav-direction {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-cyan);
}

.post-nav-link--next .post-nav-direction {
  justify-content: flex-end;
}

.post-nav-title {
  font-size: var(--text-base);
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.3;
}

/* --------------------------------------------------------------------------
   Reading Progress (Enhanced)
   -------------------------------------------------------------------------- */
.blog-post .scroll-progress {
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-magenta));
}

/* --------------------------------------------------------------------------
   Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .blog-listing {
    padding-top: calc(60px + var(--space-2xl));
  }

  .blog-filters {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: var(--space-sm);
    margin-bottom: var(--space-2xl);
  }

  .filter-btn {
    flex-shrink: 0;
  }

  .blog-title {
    font-size: var(--text-3xl);
  }

  .blog-layout {
    padding: var(--space-2xl) 0;
  }
}
