/* Base styles for the blog page */
.page-blog {
  font-family: 'Arial', sans-serif;
  line-height: 1.6;
  color: #333333; /* Dark text for light body background */
  background-color: #ffffff; /* Body background is white */
}

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

.page-blog__section-title {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  color: #017439;
  text-align: center;
  margin-bottom: 15px;
}

.page-blog__section-subtitle {
  font-size: clamp(16px, 2vw, 18px);
  color: #555555;
  text-align: center;
  margin-bottom: 40px;
}

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

.page-blog__section-subtitle--white {
  color: #f0f0f0;
}

.page-blog__sub-title {
  font-size: clamp(20px, 3vw, 24px);
  font-weight: 600;
  color: #017439;
  margin-top: 30px;
  margin-bottom: 15px;
}

/* Buttons */
.page-blog__btn-primary,
.page-blog__btn-secondary {
  display: inline-block;
  padding: 12px 25px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  text-align: center;
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  word-wrap: break-word;
}

.page-blog__btn-primary {
  background-color: #C30808; /* Use custom color for register/login */
  color: #FFFF00; /* Use custom font color */
  border: 2px solid #C30808;
}

.page-blog__btn-primary:hover {
  background-color: #a00606;
  border-color: #a00606;
  color: #ffffff;
}

.page-blog__btn-secondary {
  background-color: #ffffff;
  color: #017439;
  border: 2px solid #017439;
}

.page-blog__btn-secondary:hover {
  background-color: #017439;
  color: #ffffff;
}

.page-blog__btn-secondary--white {
  background-color: transparent;
  color: #ffffff;
  border: 2px solid #ffffff;
}

.page-blog__btn-secondary--white:hover {
  background-color: #ffffff;
  color: #017439;
}

.page-blog__cta-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 30px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* Hero Section */
.page-blog__hero-section {
  position: relative;
  text-align: center;
  color: #ffffff;
  padding-top: 10px; /* Small top padding for hero section */
  padding-bottom: 50px;
  overflow: hidden;
}

.page-blog__hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

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

.page-blog__hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 80px 20px;
  background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent overlay for text readability */
  border-radius: 10px;
}

.page-blog__main-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 20px;
  color: #ffffff;
}

.page-blog__description {
  font-size: clamp(18px, 2.5vw, 22px);
  margin-bottom: 30px;
  color: #f0f0f0;
}

/* Posts Section */
.page-blog__posts-section {
  padding: 60px 0;
  background-color: #f8f8f8;
}

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

.page-blog__post-card {
  background-color: #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;
}

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

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

.page-blog__post-thumbnail {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  max-width: 100%;
}

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

.page-blog__post-title {
  font-size: clamp(18px, 2.5vw, 22px);
  font-weight: 700;
  margin-bottom: 10px;
  color: #017439;
  min-height: 60px; /* Ensure consistent height for titles */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.page-blog__post-excerpt {
  font-size: 15px;
  color: #666666;
  margin-bottom: 15px;
  min-height: 70px; /* Ensure consistent height for excerpts */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.page-blog__post-date {
  font-size: 14px;
  color: #999999;
}

.page-blog__view-all-button-container {
  text-align: center;
  margin-top: 50px;
}

/* Categories Section */
.page-blog__categories-section {
  padding: 60px 0;
  background-color: #017439;
  color: #ffffff;
}

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

.page-blog__category-item {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  transition: background-color 0.3s ease;
}

.page-blog__category-item:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.page-blog__category-title {
  font-size: clamp(20px, 2.5vw, 24px);
  font-weight: 700;
  margin-bottom: 15px;
  color: #ffffff;
}

.page-blog__category-description {
  font-size: 15px;
  color: #f0f0f0;
  margin-bottom: 20px;
}

.page-blog__category-link {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 600;
  color: #FFFF00; /* Custom color for category link */
  background-color: #C30808; /* Custom color for category link */
  border: 2px solid #C30808;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.page-blog__category-link:hover {
  background-color: #a00606;
  color: #ffffff;
  border-color: #a00606;
}

.page-blog__content-image {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 40px;
  border-radius: 10px;
  max-width: 100%;
}

/* Importance Section */
.page-blog__importance-section {
  padding: 60px 0;
  background-color: #ffffff;
}

.page-blog__article-body {
  max-width: 900px;
  margin: 0 auto;
  font-size: 16px;
  color: #333333;
}

.page-blog__article-body p {
  margin-bottom: 1em;
  text-align: justify;
}

/* CTA Section */
.page-blog__cta-section {
  padding: 60px 0;
  background-color: #017439;
  color: #ffffff;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-blog__cta-inner {
  position: relative;
  z-index: 1;
}

.page-blog__cta-image {
  position: absolute;
  bottom: 0;
  right: 0;
  opacity: 0.2;
  width: 100%;
  height: auto;
  max-width: 600px; /* Limit image size on desktop */
  z-index: 0;
  transform: translateX(20%);
  display: block;
}

/* FAQ Section */
.page-blog__faq-section {
  padding: 60px 0;
  background-color: #f8f8f8;
}

.page-blog__faq-list {
  margin-top: 40px;
}

details.page-blog__faq-item {
  margin-bottom: 15px;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
  overflow: hidden;
  background: #fff;
  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: #333333;
}
.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 10px 10px;
  color: #555555;
}

/* Global image responsive styles */
.page-blog img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Responsive styles */
@media (max-width: 1024px) {
  .page-blog__hero-content {
    padding: 60px 20px;
  }

  .page-blog__posts-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }

  .page-blog__categories-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .page-blog__cta-image {
    max-width: 400px;
  }
}

@media (max-width: 768px) {
  /* HERO 主图区域 */
  .page-blog__hero-section {
    padding-bottom: 30px;
  }
  .page-blog__hero-image img {
    object-fit: contain !important; /* 移动端防止裁切 */
    aspect-ratio: unset !important;
    height: auto !important;
    max-height: 300px; /* Limit height on mobile */
  }
  .page-blog__hero-content {
    padding: 40px 15px;
    background-color: rgba(0, 0, 0, 0.7); /* Slightly darker overlay for mobile */
  }
  .page-blog__main-title {
    font-size: clamp(28px, 8vw, 36px);
  }
  .page-blog__description {
    font-size: clamp(16px, 3vw, 18px);
  }
  .page-blog__cta-buttons {
    flex-direction: column; /* 移动端按钮垂直排列 */
    gap: 15px;
    padding-left: 15px;
    padding-right: 15px;
  }
  .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__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;
    flex-wrap: wrap !important;
    gap: 10px;
  }

  /* 产品展示图区域 (Posts Grid) */
  .page-blog__posts-grid {
    grid-template-columns: 1fr; /* Một cột trên di động */
    gap: 20px;
  }
  .page-blog__posts-section .page-blog__container {
    padding-left: 15px;
    padding-right: 15px;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .page-blog__post-thumbnail {
    height: 180px;
  }
  .page-blog__post-title {
    font-size: 18px;
    min-height: unset;
  }
  .page-blog__post-excerpt {
    font-size: 14px;
    min-height: unset;
  }

  /* 装饰主标题 + 长文 SEO 区 */
  .page-blog__section-title {
    font-size: clamp(24px, 7vw, 32px);
    margin-bottom: 10px;
  }
  .page-blog__section-subtitle {
    font-size: clamp(14px, 3vw, 16px);
    margin-bottom: 20px;
  }
  .page-blog__sub-title {
    font-size: clamp(18px, 4vw, 22px);
    margin-top: 25px;
  }
  .page-blog__article-body {
    font-size: 15px;
    padding-left: 15px;
    padding-right: 15px;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .page-blog__article-body p {
    text-align: left;
  }

  /* 通用图片与容器 */
  .page-blog img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
  .page-blog__container,
  .page-blog__category-item,
  .page-blog__cta-inner {
    padding-left: 15px;
    padding-right: 15px;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .page-blog__categories-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* FAQ */
  details.page-blog__faq-item summary.page-blog__faq-question {
    padding: 15px;
  }
  .page-blog__faq-qtext {
    font-size: 15px;
  }
  details.page-blog__faq-item .page-blog__faq-answer {
    padding: 0 15px 15px;
  }

  /* CTA Section adjustments */
  .page-blog__cta-section {
    padding: 40px 0;
  }
  .page-blog__cta-image {
    position: relative;
    transform: translateX(0);
    max-width: 100%;
    margin-top: 30px;
    opacity: 0.3;
  }
}