/* style/blog.css */
/* body đã padding-top: var(--header-offset) từ shared.css, không lặp lại ở đây */
.page-blog {
  font-family: Arial, sans-serif;
  color: var(--text-main-color, #333333); /* Mặc định cho nội dung chính */
  background: var(--site-bg-color, #F5F7FA);
}

.page-blog__hero-section {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column; /* Đảm bảo hình ảnh trên, nội dung dưới */
  align-items: center;
  padding-bottom: 60px; /* Khoảng cách dưới hero */
  padding-top: 10px; /* Khoảng cách nhỏ trên cùng, body đã xử lý header offset */
  background: linear-gradient(180deg, #FF5A4F 0%, #E53935 100%); /* Màu nền nếu hình ảnh không chiếm toàn bộ */
  overflow: hidden; /* Ngăn chặn tràn */
}

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

.page-blog__hero-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  min-height: 200px; /* Đảm bảo kích thước tối thiểu */
}

.page-blog__hero-content {
  position: relative; /* Đảm bảo nội dung không bị overlay */
  z-index: 1;
  max-width: 900px;
  text-align: center;
  padding: 30px 20px 0;
  color: #ffffff;
}

.page-blog__hero-title {
  font-size: clamp(2em, 4vw, 3.2em); /* Giới hạn kích thước chữ h1 */
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 20px;
  color: #ffffff;
  max-width: 100%;
}

.page-blog__hero-description {
  font-size: 1.1em;
  line-height: 1.6;
  margin-bottom: 30px;
  color: #f0f0f0;
}

.page-blog__hero-cta {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.page-blog__articles-section {
  padding: 60px 0;
  background-color: var(--site-bg-color, #F5F7FA);
}

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

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

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

.page-blog__article-card {
  background-color: var(--card-bg-color, #FFFFFF);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  color: var(--text-main-color, #333333);
}

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

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

.page-blog__article-image-wrapper {
  width: 100%;
  height: 225px; /* Cố định chiều cao cho hình ảnh */
  overflow: hidden;
  position: relative;
  background-color: #f0f0f0; /* Màu nền dự phòng */
}

.page-blog__article-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  min-width: 200px; /* Tối thiểu 200px */
  min-height: 200px; /* Tối thiểu 200px */
}

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

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

.page-blog__article-excerpt {
  font-size: 0.95em;
  line-height: 1.5;
  color: #666666;
  margin-bottom: 15px;
}

.page-blog__article-date {
  font-size: 0.85em;
  color: #999999;
}

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

.page-blog__btn-primary,
.page-blog__btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: 2px solid transparent;
  box-sizing: border-box;
  white-space: normal; /* Cho phép chữ xuống dòng */
  word-wrap: break-word; /* Cho phép ngắt từ */
}

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

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

.page-blog__btn-secondary {
  background: #ffffff;
  color: #E53935;
  border-color: #E53935;
}

.page-blog__btn-secondary:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
}

.page-blog__btn-view-all {
  margin-top: 20px;
}

.page-blog__cta-section {
  padding: 80px 20px;
  text-align: center;
  background: linear-gradient(180deg, #FF5A4F 0%, #E53935 100%); /* Sử dụng màu thương hiệu cho nền tối */
  color: #ffffff;
}

.page-blog__cta-title {
  font-size: 2.5em;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.2;
  color: #ffffff;
}

.page-blog__cta-description {
  font-size: 1.1em;
  line-height: 1.6;
  margin-bottom: 40px;
  color: #f0f0f0;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.page-blog__cta-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .page-blog__hero-title {
    font-size: clamp(1.8em, 5vw, 2.8em);
  }
  .page-blog__cta-title {
    font-size: 2em;
  }
}

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

  /* Images */
  .page-blog img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
  .page-blog__hero-image-wrapper,
  .page-blog__article-image-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .page-blog__article-image-wrapper {
    height: auto !important; /* Cho phép chiều cao tự động để ảnh không bị cắt */
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    position: relative;
  }
  .page-blog__article-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  /* Containers */
  .page-blog__container,
  .page-blog__hero-section,
  .page-blog__articles-section,
  .page-blog__cta-section {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px;
    padding-right: 15px;
    overflow-x: hidden !important; /* Prevent horizontal scroll */
  }
  .page-blog__hero-section {
    padding-top: 10px !important; /* body handles header offset */
  }

  /* Titles */
  .page-blog__hero-title {
    font-size: clamp(1.5em, 6vw, 2.5em);
  }
  .page-blog__section-title {
    font-size: 1.8em;
  }
  .page-blog__cta-title {
    font-size: 1.8em;
  }
  .page-blog__article-title {
    font-size: 1.2em;
  }

  /* Buttons */
  .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;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    padding-left: 15px;
    padding-right: 15px;
  }
  .page-blog__hero-cta,
  .page-blog__cta-buttons {
    flex-direction: column !important; /* Stack buttons vertically */
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .page-blog__hero-section {
    padding-bottom: 40px;
  }
  .page-blog__hero-title {
    font-size: clamp(1.4em, 7vw, 2em);
  }
  .page-blog__hero-description {
    font-size: 1em;
  }
  .page-blog__section-title {
    font-size: 1.6em;
  }
  .page-blog__cta-title {
    font-size: 1.6em;
  }
  .page-blog__cta-description {
    font-size: 1em;
  }
  .page-blog__articles-grid {
    grid-template-columns: 1fr;
  }
}

/* Color contrast adjustments for dark background sections */
.page-blog__dark-section {
  color: #ffffff;
}

.page-blog__dark-section .page-blog__cta-title,
.page-blog__dark-section .page-blog__cta-description {
  color: #ffffff;
}