/* ============================================
   Blog Post Styling - Modern & Professional
   ============================================ */

/* Blog Post Container */
.blog-post {
  background: var(--color-bg-primary);
  min-height: calc(100vh - 80px);
}

/* Blog Header - Hero Section */
.blog-header {
  position: relative;
  background: linear-gradient(135deg, rgba(206, 141, 37, 0.05) 0%, rgba(140, 85, 12, 0.02) 100%);
  padding: var(--spacing-5xl) 0 var(--spacing-4xl);
  overflow: hidden;
}

.blog-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 50%, rgba(206, 141, 37, 0.03) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(140, 85, 12, 0.02) 0%, transparent 50%);
  pointer-events: none;
}

/* Blog Meta Information */
.blog-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.blog-meta span {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.blog-meta span::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--color-primary);
  border-radius: 50%;
}

.blog-date {
  font-weight: var(--font-weight-medium);
}

.blog-author {
  color: var(--color-primary);
  font-weight: var(--font-weight-medium);
}

/* Blog Title */
.blog-header h1 {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  line-height: 1.2;
  margin-bottom: var(--spacing-xl);
  max-width: 800px;
}

/* Blog Hero Image */
.blog-hero-image {
  width: 100%;
  max-width: 800px;
  height: 400px;
  object-fit: cover;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  margin: var(--spacing-xl) 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.blog-hero-image:hover {
  transform: scale(1.02) translateZ(0);
}

/* Blog Excerpt */
.blog-excerpt {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  line-height: 1.6;
  max-width: 700px;
  margin-top: var(--spacing-lg);
}

/* Blog Content Container */
.blog-content {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--spacing-4xl) var(--spacing-lg);
}

/* Blog Sections */
.blog-section {
  margin-bottom: var(--spacing-4xl);
  padding: var(--spacing-3xl) 0;
  border-bottom: 1px solid var(--color-border);
}

.blog-section:last-of-type {
  border-bottom: none;
  margin-bottom: var(--spacing-5xl);
}

/* Section Headings */
.blog-section h2 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-xl);
  position: relative;
}

.blog-section h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 2px;
}

.blog-section h3 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: var(--spacing-3xl) 0 var(--spacing-lg);
}

.blog-section h4 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: var(--spacing-xl) 0 var(--spacing-md);
}

/* Blog Paragraphs */
.blog-section p {
  font-size: var(--font-size-base);
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
  text-align: justify;
}

.blog-section p:last-child {
  margin-bottom: 0;
}

/* Styled Quotes */
.styled-quote {
  background: linear-gradient(135deg, rgba(206, 141, 37, 0.05) 0%, rgba(140, 85, 12, 0.02) 100%);
  border-left: 4px solid var(--color-primary);
  padding: var(--spacing-xl);
  margin: var(--spacing-2xl) 0;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  position: relative;
}

.styled-quote::before {
  content: '"';
  font-size: var(--font-size-4xl);
  color: var(--color-primary);
  position: absolute;
  top: -10px;
  left: 20px;
  opacity: 0.3;
}

.styled-quote p {
  font-style: italic;
  font-size: var(--font-size-lg);
  color: var(--color-text-primary);
  margin: 0;
  line-height: 1.6;
}

/* Blog Lists */
.blog-section ul, .blog-section ol {
  margin: var(--spacing-lg) 0;
  padding-left: var(--spacing-2xl);
}

.blog-section li {
  margin-bottom: var(--spacing-md);
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.blog-section li strong {
  color: var(--color-text-primary);
}

/* Nested Lists */
.blog-section ul ul, .blog-section ol ol {
  margin: var(--spacing-md) 0;
  padding-left: var(--spacing-xl);
}

.blog-section ul ul li, .blog-section ol ol li {
  font-size: var(--font-size-sm);
  margin-bottom: var(--spacing-sm);
}

/* Blog Tables */
.table-responsive {
  overflow-x: auto;
  margin: var(--spacing-2xl) 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.blog-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.blog-table th {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  padding: var(--spacing-lg);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.blog-table td {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.blog-table tbody tr:hover {
  background: rgba(206, 141, 37, 0.02);
}

.blog-table tbody tr:last-child td {
  border-bottom: none;
}

/* Mermaid Diagrams Container */
.mermaid-container {
  margin: var(--spacing-2xl) 0;
  max-width: 100%;
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  box-sizing: border-box;
  position: relative;
  /* Ensure container can show full diagram */
  min-height: 400px;
}

.mermaid {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-2xl);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  width: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) var(--color-bg-secondary);
}

.mermaid::-webkit-scrollbar {
  height: 8px;
}

.mermaid::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
  border-radius: 4px;
}

.mermaid::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 4px;
}

.mermaid::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-dark);
}

.mermaid svg {
  max-width: none;
  height: auto;
  min-width: 600px; /* Ensure minimum width for readability */
  width: auto;
  display: block;
  margin: 0 auto;
}

/* Code Blocks */
.blog-section pre {
  background: var(--color-bg-dark);
  color: var(--color-text-primary-dark);
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: var(--spacing-xl) 0;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  border: 1px solid var(--color-border-dark);
}

.blog-section code {
  background: rgba(206, 141, 37, 0.1);
  color: var(--color-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9em;
}

/* Blockquotes */
.blog-section blockquote {
  border-left: 4px solid var(--color-primary);
  padding-left: var(--spacing-lg);
  margin: var(--spacing-2xl) 0;
  color: var(--color-text-secondary);
  font-style: italic;
  position: relative;
}

.blog-section blockquote::before {
  content: '"';
  font-size: var(--font-size-3xl);
  color: var(--color-primary);
  position: absolute;
  left: -10px;
  top: -15px;
  opacity: 0.3;
}

/* Call-to-Action Section */
.blog-cta {
  background: linear-gradient(135deg, var(--color-bg-secondary) 0%, rgba(206, 141, 37, 0.02) 100%);
  padding: var(--spacing-4xl) 0;
  text-align: center;
  border-top: 1px solid var(--color-border);
}

.blog-cta h3 {
  font-size: var(--font-size-2xl);
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-lg);
}

.blog-cta p {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Related Posts Section */
.related-posts {
  padding: var(--spacing-4xl) 0;
  border-top: 1px solid var(--color-border);
}

.related-posts h3 {
  text-align: center;
  font-size: var(--font-size-2xl);
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-2xl);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-xl);
  margin-top: var(--spacing-2xl);
}

.related-post {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.related-post:hover {
  transform: translateY(-5px) translateZ(0);
  box-shadow: var(--shadow-xl);
}

.related-post img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.related-post-content {
  padding: var(--spacing-lg);
}

.related-post h4 {
  font-size: var(--font-size-lg);
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-sm);
}

.related-post p {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-md);
  line-height: 1.5;
}

.related-post .read-more {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.related-post .read-more:hover {
  text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
  .blog-header {
    padding: var(--spacing-3xl) 0 var(--spacing-2xl);
  }

  .blog-header h1 {
    font-size: var(--font-size-3xl);
  }

  .blog-hero-image {
    height: 250px;
  }

  .blog-content {
    padding: var(--spacing-2xl) var(--spacing-md);
  }

  .blog-section {
    margin-bottom: var(--spacing-2xl);
    padding: var(--spacing-xl) 0;
  }

  .blog-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }

  .blog-table th,
  .blog-table td {
    padding: var(--spacing-md);
    font-size: var(--font-size-xs);
  }

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

  .mermaid {
    padding: var(--spacing-xl);
    font-size: 0.8em;
  }

  .mermaid-container {
    margin: var(--spacing-xl) 0;
    padding: 0;
    min-height: 300px;
  }

  .mermaid svg {
    min-width: 500px; /* Smaller minimum width on mobile */
    max-width: none;
    width: auto;
  }
}

@media (max-width: 480px) {
  .blog-header h1 {
    font-size: var(--font-size-2xl);
  }

  .blog-section h2 {
    font-size: var(--font-size-2xl);
  }

  .blog-section h3 {
    font-size: var(--font-size-xl);
  }

  .styled-quote {
    padding: var(--spacing-lg);
  }
}
