/* style/blog.css */

/* Variables from custom palette */
:root {
  --primary-color: #2F6BFF;
  --secondary-color: #6FA3FF;
  --button-gradient-start: #4A8BFF;
  --button-gradient-end: #2F6BFF;
  --card-bg: #FFFFFF;
  --page-bg-custom: #F4F7FB; /* This will be the main background for light sections */
  --text-main: #1F2D3D;
  --border-color: #D6E2FF;
  --glow-color: #A5C4FF;
  --text-on-dark: #ffffff; /* For text on dark backgrounds */
  --text-on-light: #333333; /* For text on light backgrounds, ensuring contrast */
}

/* Base styles for the blog page */
.page-blog {
  font-family: 'Arial', sans-serif;
  line-height: 1.6;
  color: var(--text-on-light); /* Default text color for light backgrounds */
  background-color: var(--page-bg-custom); /* Main background for the page */
}

/* Ensure text on dark backgrounds is white */
.page-blog__dark-bg {
  background-color: var(--primary-color); /* Using primary color for dark sections */
  color: var(--text-on-dark);
}

.page-blog__light-bg {
  background-color: var(--page-bg-custom); /* Using custom page background for light sections */
  color: var(--text-on-light);
}

.page-blog__text-contrast-fix {
  color: var(--text-on-dark); /* Force white text on dark backgrounds */
}

/* Container for consistent spacing */
.page-blog__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  box-sizing: border-box;
}

/* Section titles and descriptions */
.page-blog__section-title {
  font-size: 36px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 20px;
  color: var(--text-main);
}

.page-blog__section-description {
  font-size: 18px;
  text-align: center;
  max-width: 800px;
  margin: 0 auto 40px;
  color: #555; /* Slightly lighter for description */
}

/* Hero Section */
.page-blog__hero-section {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  padding-top: 10px; /* Small top padding, body handles header offset */
  background-color: var(--page-bg-custom); /* Consistent with light sections */
  overflow: hidden; /* Ensure no image overflow */
}

.page-blog__hero-container {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%; /* Ensure full width within max-width */
}

.page-blog__hero-image {
  width: 100%;
  margin-bottom: 30px;
  border-radius: 12px;
  overflow: hidden; /* Ensure image corners are rounded */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.page-blog__hero-image img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  object-fit: cover;
  border-radius: 12px; /* Apply border-radius to the image itself */
}

.page-blog__hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  width: 100%;
  padding: 0 15px; /* Add some padding for text on smaller screens */
}

.page-blog__hero-content h1 {
  font-size: clamp(28px, 4vw, 48px); /* Clamp for responsive H1 size */
  font-weight: 800;
  margin-bottom: 15px;
  color: var(--text-main);
  line-height: 1.2;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.page-blog__hero-content p {
  font-size: 18px;
  margin-bottom: 30px;
  color: #555;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* CTA Button */
.page-blog__cta-button,
.page-blog__btn-primary,
.page-blog__btn-secondary {
  display: inline-block;
  padding: 15px 40px;
  background: linear-gradient(180deg, var(--button-gradient-start) 0%, var(--button-gradient-end) 100%);
  color: var(--text-on-dark); /* Ensure white text on button */
  text-decoration: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  margin-top: 20px;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  word-wrap: break-word;
}

.page-blog__cta-button:hover,
.page-blog__btn-primary:hover {
  background: linear-gradient(180deg, var(--button-gradient-end) 0%, var(--button-gradient-start) 100%);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.page-blog__btn-secondary {
  background: var(--card-bg); /* White background for secondary button */
  color: var(--primary-color); /* Primary color text for secondary button */
  border: 2px solid var(--primary-color);
  box-shadow: none;
}

.page-blog__btn-secondary:hover {
  background: var(--primary-color);
  color: var(--text-on-dark);
  border-color: var(--primary-color);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* Intro Section Features Grid */
.page-blog__features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-top: 50px;
}

.page-blog__feature-item {
  background: var(--card-bg);
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border-color);
}

.page-blog__feature-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.page-blog__feature-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 15px;
  color: var(--primary-color);
}

.page-blog__feature-item p {
  font-size: 16px;
  color: #666;
  line-height: 1.7;
}

/* Blog Posts Section */
.page-blog__posts-section {
  background-color: var(--primary-color); /* Dark background for this section */
  padding-top: 60px;
  padding-bottom: 60px;
}

.page-blog__posts-section .page-blog__section-title,
.page-blog__posts-section .page-blog__section-description {
  color: var(--text-on-dark); /* White text on dark background */
}

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

.page-blog__post-card {
  background: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border-color);
}

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

.page-blog__post-link {
  text-decoration: none;
  color: inherit;
  display: block; /* Make the entire card clickable */
}

.page-blog__post-card img {
  width: 100%;
  height: 250px; /* Fixed height for blog post images */
  object-fit: cover;
  display: block;
  min-height: 200px; /* Ensure minimum size */
}

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

.page-blog__post-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-main);
  line-height: 1.4;
}

.page-blog__post-excerpt {
  font-size: 15px;
  color: #666;
  margin-bottom: 15px;
  height: 90px; /* Limit excerpt height for consistency */
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 4; /* Show up to 4 lines */
  -webkit-box-orient: vertical;
}

.page-blog__post-date {
  font-size: 14px;
  color: #999;
  display: block;
  text-align: right;
}

.page-blog__view-all-posts {
  text-align: center;
  margin-top: 60px;
}

/* Call to Action Section */
.page-blog__cta-section {
  padding-top: 60px;
  padding-bottom: 60px;
  background-color: var(--page-bg-custom);
}

.page-blog__cta-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 40px;
  width: 100%; /* Ensure container takes full width */
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* FAQ Section */
.page-blog__faq-section {
  padding-top: 60px;
  padding-bottom: 60px;
  background-color: var(--page-bg-custom);
}

.page-blog__faq-list {
  margin-top: 40px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

details.page-blog__faq-item {
  margin-bottom: 15px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
details.page-blog__faq-item summary.page-blog__faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background-color 0.3s ease;
}
details.page-blog__faq-item summary.page-blog__faq-question::-webkit-details-marker {
  display: none;
}
details.page-blog__faq-item summary.page-blog__faq-question:hover {
  background: #f5f5f5;
}
.page-blog__faq-qtext {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  text-align: left;
  color: var(--text-main);
}
.page-blog__faq-toggle {
  font-size: 24px;
  font-weight: bold;
  color: #666;
  flex-shrink: 0;
  margin-left: 15px;
  width: 28px;
  text-align: center;
}
details.page-blog__faq-item .page-blog__faq-answer {
  padding: 0 20px 20px;
  background: #f9f9f9;
  border-radius: 0 0 5px 5px;
  color: #555;
}
details.page-blog__faq-item .page-blog__faq-answer p {
  margin: 0;
  padding: 0;
}


/* Responsive styles */
@media (max-width: 768px) {
  .page-blog__container {
    padding: 30px 15px;
  }

  .page-blog__hero-section {
    padding-top: 10px !important; /* Important for mobile override */
    padding-bottom: 40px;
    padding-left: 15px;
    padding-right: 15px;
  }

  .page-blog__hero-image img {
    border-radius: 8px;
  }
  
  .page-blog__hero-content h1 {
    font-size: 28px; /* Specific size for mobile */
  }

  .page-blog__hero-content p {
    font-size: 16px;
  }

  .page-blog__cta-button,
  .page-blog__btn-primary,
  .page-blog__btn-secondary {
    padding: 12px 25px;
    font-size: 16px;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-wrap: break-word !important;
  }

  .page-blog__cta-buttons {
    flex-direction: column; /* Stack buttons vertically on mobile */
    gap: 15px;
    padding-left: 15px;
    padding-right: 15px;
  }
  
  .page-blog__section-title {
    font-size: 28px;
  }

  .page-blog__section-description {
    font-size: 16px;
    margin-bottom: 30px;
  }

  .page-blog__features-grid {
    gap: 20px;
  }

  .page-blog__feature-item {
    padding: 20px;
  }

  .page-blog__feature-title {
    font-size: 20px;
  }

  .page-blog__posts-grid {
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: 20px;
  }

  .page-blog__post-card img {
    height: 200px; /* Adjust height for mobile */
  }

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

  .page-blog__post-title {
    font-size: 18px;
  }

  .page-blog__post-excerpt {
    font-size: 14px;
    height: auto; /* Allow full excerpt on mobile if desired, or keep limited */
    -webkit-line-clamp: unset;
  }
  
  details.page-blog__faq-item summary.page-blog__faq-question { padding: 15px; }
  .page-blog__faq-qtext { font-size: 15px; }

  /* Mobile image responsive rules */
  .page-blog img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
  
  .page-blog__hero-image,
  .page-blog__post-card,
  .page-blog__feature-item,
  .page-blog__container {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 0; /* Container padding handled by .page-blog__container itself */
    padding-right: 0;
  }
  /* Re-apply container padding to ensure content doesn't touch edges */
  .page-blog__container {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
}

/* Ensure all images meet minimum size requirements */
.page-blog img {
  min-width: 200px;
  min-height: 200px;
}

/* Override for image elements that might be smaller than 200px due to layout (e.g., small icons, but these are forbidden anyway) */
/* The general rule is all images must be >= 200x200px. */
/* This is a safeguard but should not be necessary if image generation rules are followed. */
.page-blog img:not(.page-blog__icon) {
  min-width: 200px;
  min-height: 200px;
  object-fit: cover; /* Ensure aspect ratio is maintained for content images */
}

/* Text colors for different backgrounds */
.page-blog__section-title.page-blog__text-contrast-fix,
.page-blog__section-description.page-blog__text-contrast-fix {
  color: var(--text-on-dark);
}