/*
* ============================================================================
* BLOG-SPECIFIC STYLES
* ============================================================================
*/

/* --- Blog Index Page --- */

.blog-index-container {
  max-width: 1200px; /* A comfortable width for a list of articles */
  margin: 0 auto;
  padding: var(--space-xl) 0;
}

.blog-index-header {
  text-align: center;
  margin-bottom: var(--space-xxl);
}

.blog-index-header h1 {
  font-family: var(--font-serif-display);
  font-size: 3rem;
  margin-bottom: var(--space-sm);
}

.blog-index-header p {
  font-family: var(--font-serif-text);
  font-size: 1.25rem;
  color: var(--color-text-secondary);
}

/* Container for the list of post cards */
.post-list {
  display: grid;
  gap: var(--space-xl);
}

/* Individual preview card for each post */
.post-preview-card {
  display: flex;
  gap: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background-color: var(--color-background);
  transition:
    transform 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out;
  overflow: hidden;
}

.post-preview-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.07);
  color: var(--color-text-primary); /* Keep text color consistent on hover */
}

.post-preview-image {
  flex-shrink: 0;
  width: 250px;
  height: 180px;
}

.post-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Crops the image to fit without distortion */
  /* Only round the corners that are on the outside edge of the card */
  border-top-left-radius: var(--border-radius);
  border-bottom-left-radius: var(--border-radius);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.post-preview-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-lg);
}

.post-preview-card h2 {
  font-family: var(--font-serif-display);
  font-size: 1.75rem;
  margin: 0 0 var(--space-sm) 0;
  color: var(--color-text-primary);
}

.post-preview-card p {
  font-family: var(--font-serif-text);
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-md) 0;
}

.post-preview-card .publish-date {
  font-family: var(--font-sans); /* Use UI font for metadata */
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-accent);
}

/* --- Single Blog Post Page --- */

/* A container to constrain the width of the text for readability */
.blog-post-container {
  max-width: 75ch; /* 'ch' unit is ideal for line length */
  margin: 0 auto;
  padding: var(--space-xl) 0;
}

.blog-header {
  text-align: center;
  margin-bottom: var(--space-xxl);
}

.blog-header h1 {
  font-family: var(--font-serif-display);
  font-size: 2.75rem;
  line-height: 1.2;
}

.blog-header .publish-date {
  font-family: var(--font-sans);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

/* Styles for the main content rendered from your self-contained templates */
.blog-content p,
.blog-content ul,
.blog-content ol {
  font-family: var(--font-serif-text);
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: var(--space-lg);
}

.blog-content .lead-paragraph {
  font-size: 1.25rem;
  color: var(--color-text-secondary);
}

.blog-content h2 {
  font-family: var(--font-serif-display);
  font-size: 2rem;
  margin-top: var(--space-xxl);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-sm);
}

.blog-content h3 {
  font-family: var(--font-serif-display);
  font-size: 1.5rem;
  margin-top: var(--space-xl);
}

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

.blog-content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  margin: var(--space-xl) auto;
}

.blog-content .blog-image-full-width {
  max-width: var(--max-width-screen);
  width: 85%;
  margin-left: auto;
  margin-right: auto;
  border-radius: var(--border-radius);
}

.blog-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-xxl) auto;
}

.blog-content .style-tip {
  background-color: color-mix(in srgb, var(--color-accent) 8%, transparent);
  border-left: 4px solid var(--color-accent);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  font-family: var(--font-sans);
  font-size: 1rem;
}

/* This is the flex container for the image pair */
.blog-image-pair {
  display: flex;
  flex-wrap: wrap; /* Allows images to stack on small screens */
  gap: var(--space-md); /* Uses your existing variable for consistent spacing */
  margin: var(--space-xl) 0;
  max-width: 100%; /* Ensures it doesn't overflow the main container */
}

/* Each direct child of the pair container will be a flex item */
.blog-image-pair > div {
  flex: 1; /* Each image container takes up half the space */
  min-width: 200px; /* Prevents images from getting too squished before wrapping */
}

/* Override any default margins on images within the pair */
.blog-image-pair img {
  margin: 0;
}

/* Call-to-action section at the end of a post */
.cta-section {
  text-align: center;
  margin-top: var(--space-xxl);
  padding: var(--space-xl);
  background-color: color-mix(in srgb, var(--color-accent) 5%, transparent);
  border-radius: var(--border-radius);
}

/*
* ============================================================================
* RESPONSIVE ADJUSTMENTS
* ============================================================================
*/

@media (max-width: 768px) {
  .post-preview-card {
    flex-direction: column; /* Stack image and text on smaller screens */
  }

  .post-preview-image {
    width: 100%; /* Image takes full width on mobile */
    height: 220px; /* Adjust height for a banner-like appearance */
  }

  .post-preview-image img {
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}
