/* style/blog.css */

/* Base styles for the blog page */
.page-blog {
  font-family: Arial, sans-serif;
  color: var(--text-main, #1F2D3D); /* Default text color from custom palette */
  background-color: var(--bg-primary, #F4F7FB); /* Default background from custom palette */
  line-height: 1.6;
  padding-bottom: 60px; /* Add some padding at the bottom for content separation */
}

/* Hero Section */
.page-blog__hero-section {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column; /* Image on top, content below */
  align-items: center;
  text-align: center;
  padding: 10px 0 60px 0; /* Small top padding, larger bottom padding */
  overflow: hidden; /* Ensure content stays within bounds */
}

.page-blog__hero-image-wrapper {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.page-blog__hero-image {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.page-blog__hero-content {
  max-width: 900px;
  margin-top: 30px; /* Space between image and content */
  padding: 0 20px;
  box-sizing: border-box;
}

.page-blog__hero-title {
  font-size: clamp(2em, 4vw, 3.5em); /* Responsive H1 font size */
  font-weight: 700;
  color: var(--text-main, #1F2D3D);
  margin-bottom: 20px;
  line-height: 1.2;
}

.page-blog__hero-description {
  font-size: 1.1em;
  color: var(--text-main, #1F2D3D);
  margin-bottom: 30px;
}

.page-blog__hero-cta {
  display: inline-block;
  padding: 12px 30px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

/* Latest Posts Section */
.page-blog__latest-posts-section {
  padding: 60px 0;
  background-color: var(--card-bg, #FFFFFF);
}

.page-blog__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

.page-blog__section-title {
  font-size: clamp(1.8em, 3vw, 2.8em);
  font-weight: 700;
  color: var(--text-main, #1F2D3D);
  text-align: center;
  margin-bottom: 40px;
}

.page-blog__section-title--light {
  color: #ffffff;
}

.page-blog__post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.page-blog__post-card {
  background-color: var(--card-bg, #FFFFFF);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border-color, #D6E2FF);
}

.page-blog__post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.page-blog__post-link {
  text-decoration: none;
  display: block;
  color: inherit;
}

.page-blog__post-image-wrapper {
  width: 100%;
  height: 200px; /* Fixed height for consistency */
  overflow: hidden;
}

.page-blog__post-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.page-blog__post-content {
  padding: 20px;
}

.page-blog__post-title {
  font-size: 1.4em;
  font-weight: 600;
  color: var(--text-main, #1F2D3D);
  margin-bottom: 10px;
  line-height: 1.3;
}

.page-blog__post-meta {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 15px;
}

.page-blog__post-excerpt {
  font-size: 1em;
  color: var(--text-main, #1F2D3D);
  line-height: 1.5;
}

.page-blog__view-all-wrapper {
  text-align: center;
}

/* Categories Section */
.page-blog__categories-section {
  padding: 80px 0;
  background: var(--main-color, #2F6BFF); /* Use primary brand color as background */
  color: #ffffff; /* White text for dark background */
}

.page-blog__category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
}

.page-blog__category-card {
  background-color: rgba(255, 255, 255, 0.15); /* Slightly transparent white on blue */
  border-radius: 10px;
  padding: 25px;
  text-align: center;
  text-decoration: none;
  color: #ffffff;
  transition: background-color 0.3s ease, transform 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.page-blog__category-card:hover {
  background-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
}

.page-blog__category-title {
  font-size: 1.3em;
  font-weight: 600;
  margin-bottom: 10px;
  color: #ffffff;
}

.page-blog__category-description {
  font-size: 0.95em;
  line-height: 1.4;
  color: #f0f0f0;
}

/* CTA Section */
.page-blog__cta-section {
  padding: 80px 0;
  text-align: center;
  background-color: var(--card-bg, #FFFFFF);
}

.page-blog__cta-description {
  font-size: 1.1em;
  color: var(--text-main, #1F2D3D);
  margin-bottom: 40px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.page-blog__cta-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap; /* Allow wrapping on small screens */
}

/* Button Styles from Custom Palette */
.page-blog__btn-primary {
  background: linear-gradient(180deg, #4A8BFF 0%, #2F6BFF 100%);
  color: #ffffff;
  padding: 14px 35px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap; /* Prevent text wrapping initially */
  transition: opacity 0.3s ease;
}

.page-blog__btn-primary:hover {
  opacity: 0.9;
}

.page-blog__btn-secondary {
  background: #ffffff;
  color: var(--main-color, #2F6BFF);
  border: 2px solid var(--main-color, #2F6BFF);
  padding: 14px 35px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap; /* Prevent text wrapping initially */
  transition: background-color 0.3s ease, color 0.3s ease;
}

.page-blog__btn-secondary:hover {
  background-color: var(--main-color, #2F6BFF);
  color: #ffffff;
}

/* Copyright */
.page-blog__copyright {
  text-align: center;
  font-size: 0.9em;
  color: #666;
  padding: 30px 20px;
  margin-top: 40px;
  border-top: 1px solid #e0e0e0;
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
  .page-blog__hero-title {
    font-size: clamp(2em, 5vw, 3em);
  }
  .page-blog__post-image-wrapper {
    height: 180px;
  }
}

@media (max-width: 768px) {
  /* General mobile adaptations */
  .page-blog {
    font-size: 16px;
    line-height: 1.6;
  }

  .page-blog__hero-section {
    padding: 10px 0 40px 0;
  }

  .page-blog__hero-content {
    margin-top: 20px;
  }

  .page-blog__hero-title {
    font-size: clamp(1.8em, 6vw, 2.5em) !important; /* Force smaller H1 on mobile */
  }

  .page-blog__hero-description {
    font-size: 1em;
  }

  .page-blog__latest-posts-section,
  .page-blog__categories-section,
  .page-blog__cta-section {
    padding: 40px 0;
  }

  .page-blog__section-title {
    font-size: clamp(1.6em, 5vw, 2.2em);
    margin-bottom: 30px;
  }

  .page-blog__post-grid {
    grid-template-columns: 1fr; /* Single column for posts */
    gap: 20px;
  }

  .page-blog__post-image-wrapper {
    height: 220px; /* Adjust height for single column */
  }

  .page-blog__post-title {
    font-size: 1.2em;
  }

  .page-blog__category-grid {
    grid-template-columns: 1fr; /* Single column for categories */
    gap: 15px;
  }

  .page-blog__cta-buttons {
    flex-direction: column; /* Stack buttons vertically */
    gap: 15px;
    padding: 0 15px; /* Add padding to prevent overflow */
  }
  
  /* Mobile image, video, button overrides (required with !important) */
  .page-blog img {
    max-width: 100% !important;
    width: 100% !important; /* Ensure images take full width */
    height: auto !important;
    display: block !important;
  }
  
  .page-blog video,
  .page-blog__video { /* If video elements were present */
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
  }
  
  .page-blog__section,
  .page-blog__card,
  .page-blog__container,
  .page-blog__hero-image-wrapper,
  .page-blog__post-image-wrapper,
  .page-blog__video-section,
  .page-blog__video-container,
  .page-blog__video-wrapper,
  .page-blog__cta-buttons,
  .page-blog__button-group,
  .page-blog__btn-container {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px;
    padding-right: 15px;
    overflow: hidden !important; /* Crucial for preventing horizontal scroll */
  }

  .page-blog__hero-section {
    padding-top: 10px !important; /* body already handles --header-offset */
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Button specific mobile styles */
  .page-blog__cta-button,
  .page-blog__btn-primary,
  .page-blog__btn-secondary,
  .page-blog a[class*="button"],
  .page-blog a[class*="btn"] {
    max-width: 100% !important;
    width: 100% !important; /* Buttons take full width */
    box-sizing: border-box !important;
    white-space: normal !important; /* Allow text to wrap */
    word-wrap: break-word !important;
    padding-left: 15px !important; /* Ensure internal padding */
    padding-right: 15px !important;
  }
}