/* style/blog.css */

/* Global styles for page-blog scope */
.page-blog {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-main, #333333); /* Default text color from palette */
  background-color: var(--bg-color, #F5F7FA); /* Default background from palette */
}

/* 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 20px 60px; /* Small top padding, larger bottom */
  overflow: hidden; /* Ensure no overflow */
  box-sizing: border-box;
  background-color: var(--bg-color, #F5F7FA); /* Ensure background is set */
}

.page-blog__hero-image {
  width: 100%;
  max-width: 1920px; /* Max width of the image */
  height: auto;
  display: block;
  object-fit: cover;
  margin-bottom: 30px; /* Space between image and content */
}

.page-blog__hero-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 15px;
}

.page-blog__main-title {
  font-size: 2.5em; /* Use em for relative sizing */
  font-weight: bold;
  color: var(--text-main, #333333); /* Ensure contrast */
  line-height: 1.2;
  margin-bottom: 20px;
  max-width: 100%; /* Ensure H1 doesn't overflow */
}

.page-blog__description {
  font-size: 1.1em;
  color: var(--text-main, #333333); /* Ensure contrast */
  margin-bottom: 30px;
}

/* Buttons */
.page-blog__btn-primary,
.page-blog__btn-secondary {
  display: inline-block;
  padding: 12px 25px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s ease;
  cursor: pointer;
  box-sizing: border-box;
  max-width: 100%; /* Ensure buttons are responsive */
  white-space: normal; /* Allow text wrapping */
  word-wrap: break-word; /* Allow text wrapping */
}

.page-blog__btn-primary {
  background: linear-gradient(180deg, #FF5A4F 0%, #E53935 100%);
  color: #ffffff;
  border: 2px solid transparent;
}

.page-blog__btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.page-blog__btn-secondary {
  background: #ffffff;
  color: #E53935;
  border: 2px solid #E53935;
  margin-left: 15px;
}

.page-blog__btn-secondary:hover {
  background: #f0f0f0;
  color: #E53935;
}

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

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

.page-blog__section-title {
  font-size: 2em;
  color: var(--text-main, #333333);
  text-align: center;
  margin-bottom: 50px;
  font-weight: bold;
}

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

.page-blog__post-card {
  background: var(--card-bg, #FFFFFF);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

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

.page-blog__post-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.page-blog__post-cover {
  width: 100%;
  height: 225px; /* Fixed height for consistency, maintain aspect ratio */
  object-fit: cover;
  display: block;
}

.page-blog__post-content {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

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

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

.page-blog__post-excerpt {
  font-size: 1em;
  color: #555555;
  margin-bottom: 20px;
  flex-grow: 1; /* Allow excerpt to take available space */
}

.page-blog__read-more {
  display: inline-block;
  color: #E53935;
  font-weight: bold;
  text-decoration: none;
  align-self: flex-start; /* Align to the start of the flex container */
}

.page-blog__read-more:hover {
  text-decoration: underline;
}

/* Pagination */
.page-blog__pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 50px;
  gap: 10px;
}

.page-blog__pagination-item {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card-bg, #FFFFFF);
  border: 1px solid var(--border-color, #E0E0E0);
  color: var(--text-main, #333333);
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s ease;
}

.page-blog__pagination-item:hover:not(.page-blog__pagination-item--active) {
  background: #f0f0f0;
  border-color: #E53935;
  color: #E53935;
}

.page-blog__pagination-item--active {
  background: #E53935;
  color: #ffffff;
  border-color: #E53935;
  cursor: default;
}

/* CTA Section */
.page-blog__cta-section {
  background: #E53935; /* Brand primary color for dark background */
  color: #ffffff; /* White text for contrast */
  padding: 80px 20px;
  text-align: center;
  box-sizing: border-box;
}

.page-blog__cta-title {
  font-size: 2.2em;
  font-weight: bold;
  margin-bottom: 20px;
  color: #ffffff; /* Ensure white text on dark background */
}

.page-blog__cta-description {
  font-size: 1.1em;
  max-width: 900px;
  margin: 0 auto 40px;
  color: #ffffff; /* Ensure white text on dark background */
}

.page-blog__cta-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */
  width: 100%; /* Ensure container fills width for wrapping */
  max-width: 100%; /* Ensure container fills width for wrapping */
  box-sizing: border-box;
  padding: 0 15px; /* Add padding to prevent buttons from touching edges */
}

/* Responsive styles */
@media (max-width: 1024px) {
  .page-blog__main-title {
    font-size: 2.2em;
  }
  .page-blog__section-title {
    font-size: 1.8em;
  }
  .page-blog__cta-title {
    font-size: 2em;
  }
}

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

  .page-blog__hero-section {
    padding: 10px 15px 40px; /* Adjust padding for mobile */
  }

  .page-blog__hero-image {
    margin-bottom: 20px;
  }

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

  .page-blog__main-title {
    font-size: clamp(1.8em, 5vw, 2.2em); /* Use clamp for H1 on mobile */
    margin-bottom: 15px;
  }

  .page-blog__description {
    font-size: 1em;
    margin-bottom: 20px;
  }

  .page-blog__btn-primary,
  .page-blog__btn-secondary {
    padding: 10px 20px;
    font-size: 0.9em;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    margin-left: 0;
  }

  .page-blog__btn-secondary {
    margin-top: 15px;
  }

  .page-blog__cta-buttons {
    flex-direction: column; /* Stack buttons vertically on mobile */
    gap: 15px;
    padding: 0 15px !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .page-blog__latest-posts {
    padding: 50px 0;
  }

  .page-blog__container {
    padding: 0 15px;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .page-blog__section-title {
    font-size: 1.5em;
    margin-bottom: 30px;
  }

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

  .page-blog__post-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .page-blog__post-cover {
    height: 180px; /* Adjust height for mobile */
  }

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

  .page-blog__cta-section {
    padding: 50px 15px;
  }

  .page-blog__cta-title {
    font-size: 1.8em;
  }

  .page-blog__cta-description {
    font-size: 1em;
    margin-bottom: 30px;
  }

  /* Image responsive adaptation */
  .page-blog img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
  }
  
  /* All containers with images */
  .page-blog__section,
  .page-blog__card,
  .page-blog__container,
  .page-blog__hero-section,
  .page-blog__latest-posts,
  .page-blog__post-card,
  .page-blog__post-link,
  .page-blog__post-content {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  /* For sections that need specific horizontal padding on mobile */
  .page-blog__hero-section,
  .page-blog__latest-posts,
  .page-blog__cta-section {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
}

@media (max-width: 480px) {
  .page-blog__main-title {
    font-size: clamp(1.5em, 6vw, 2em);
  }
  .page-blog__section-title {
    font-size: 1.3em;
  }
  .page-blog__cta-title {
    font-size: 1.5em;
  }
}

/* Color contrast enforcement - using provided palette */
.page-blog__latest-posts,
.page-blog__post-card,
.page-blog__pagination-item {
  background: var(--card-bg, #FFFFFF); /* White background */
  color: var(--text-main, #333333); /* Dark text */
}

.page-blog__dark-bg { /* For CTA section */
  background: #E53935;
  color: #ffffff;
}

.page-blog__cta-section .page-blog__cta-title,
.page-blog__cta-section .page-blog__cta-description {
  color: #ffffff; /* Ensure white text on brand primary background */
}

.page-blog__btn-primary {
  background: linear-gradient(180deg, #FF5A4F 0%, #E53935 100%);
  color: #ffffff; /* White text on gradient button */
}

.page-blog__btn-secondary {
  background: #ffffff;
  color: #E53935; /* Brand primary text on white button */
  border: 2px solid #E53935;
}

/* Ensure no filter is used on images */
.page-blog img {
  filter: none !important;
}