/* style/blog.css */

/* Custom Colors */
:root {
  --color-primary: #11A84E;
  --color-secondary: #22C768;
  --gradient-button: linear-gradient(180deg, #2AD16F 0%, #13994A 100%);
  --bg-card: #11271B;
  --bg-main: #08160F;
  --text-main: #F2FFF6;
  --text-secondary: #A7D9B8;
  --border-color: #2E7A4E;
  --color-glow: #57E38D;
  --color-gold: #F2C14E;
  --color-divider: #1E3A2A;
  --color-deep-green: #0A4B2C;
  --text-dark-contrast: #333333; /* For light backgrounds */
  --text-light-contrast: #ffffff; /* For dark backgrounds */
}

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

/* Adjust main content area for body padding-top handled by shared.css */
.page-blog__hero-section,
.page-blog__latest-articles-section,
.page-blog__categories-section,
.page-blog__popular-posts-section,
.page-blog__cta-section,
.page-blog__faq-section {
  padding: 60px 0;
}

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

.page-blog__section-title {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  margin-bottom: 20px;
}

.page-blog__section-description {
  font-size: 18px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 40px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* Hero Section */
.page-blog__hero-section {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 500px;
  overflow: hidden;
  padding-top: 10px; /* Small top padding, body handles header offset */
  background-color: var(--bg-main);
}

.page-blog__hero-image-wrapper {
  position: relative;
  width: 100%;
  max-height: 70vh;
  overflow: hidden;
  margin-bottom: 20px;
}

.page-blog__hero-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  filter: brightness(0.7); /* Slightly darken image for text contrast */
  min-height: 200px;
  min-width: 200px;
}

.page-blog__hero-content {
  position: relative;
  z-index: 10;
  padding: 20px;
  max-width: 900px;
  box-sizing: border-box;
}

.page-blog__main-title {
  font-size: clamp(36px, 5vw, 60px);
  font-weight: 800;
  color: var(--color-gold);
  margin-bottom: 15px;
  line-height: 1.2;
  text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.page-blog__subtitle {
  font-size: clamp(18px, 2.5vw, 24px);
  color: var(--text-main);
  margin-bottom: 30px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* Buttons */
.page-blog__btn-primary,
.page-blog__btn-secondary {
  display: inline-block;
  padding: 14px 30px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
  transition: all 0.3s ease;
  cursor: pointer;
  box-sizing: border-box;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
}

.page-blog__btn-primary {
  background: var(--gradient-button);
  color: var(--text-light-contrast);
  border: 2px solid transparent;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  margin-right: 15px;
}

.page-blog__btn-primary:hover {
  background: linear-gradient(180deg, #13994A 0%, #2AD16F 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.page-blog__btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.page-blog__btn-secondary:hover {
  background: var(--color-primary);
  color: var(--text-light-contrast);
  transform: translateY(-2px);
}

/* Card Styles */
.page-blog__card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* Latest Articles Section */
.page-blog__latest-articles-section {
  background-color: var(--bg-main);
  color: var(--text-main);
}

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

.page-blog__article-card {
  display: flex;
  flex-direction: column;
}

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

.page-blog__article-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-bottom: 1px solid var(--color-divider);
  min-height: 200px;
  min-width: 200px;
}

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

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

.page-blog__article-excerpt {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 15px;
  flex-grow: 1;
}

.page-blog__article-date {
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0.8;
}

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

/* Categories Section */
.page-blog__categories-section {
  background-color: var(--color-deep-green);
  color: var(--text-main);
}

.page-blog__category-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
}

.page-blog__category-item {
  display: block;
  padding: 12px 25px;
  background-color: var(--bg-card);
  color: var(--text-main);
  text-decoration: none;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 600;
  transition: background-color 0.3s ease, color 0.3s ease;
  border: 1px solid var(--border-color);
}

.page-blog__category-item:hover {
  background-color: var(--color-primary);
  color: var(--text-light-contrast);
  border-color: var(--color-primary);
}

/* Popular Posts Section */
.page-blog__popular-posts-section {
  background-color: var(--bg-main);
  color: var(--text-main);
}

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

.page-blog__popular-card {
  display: flex;
  flex-direction: column;
}

.page-blog__popular-card .page-blog__article-image {
  height: 200px; /* Adjusted height for popular cards */
}

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

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

.page-blog__popular-excerpt {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  flex-grow: 1;
}

.page-blog__popular-date {
  font-size: 13px;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* Call to Action Section */
.page-blog__cta-section {
  background-color: var(--color-deep-green);
  text-align: center;
  color: var(--text-main);
}

.page-blog__cta-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page-blog__cta-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  color: var(--color-gold);
  margin-bottom: 20px;
}

.page-blog__cta-description {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 30px;
  max-width: 800px;
}

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

/* FAQ Section */
.page-blog__faq-section {
  background-color: var(--bg-main);
  color: var(--text-main);
}

.page-blog__faq-list {
  max-width: 900px;
  margin: 0 auto;
}

.page-blog__faq-item {
  margin-bottom: 15px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background-color: var(--bg-card);
  overflow: hidden;
}

.page-blog__faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.3s ease;
  user-select: none;
  list-style: none; /* For details tag */
}

.page-blog__faq-question::-webkit-details-marker {
  display: none; /* Hide default marker for details tag */
}

.page-blog__faq-item:hover .page-blog__faq-question {
  background-color: rgba(var(--color-primary), 0.1);
}

.page-blog__faq-qtext {
  flex-grow: 1;
}

.page-blog__faq-toggle {
  font-size: 24px;
  line-height: 1;
  margin-left: 15px;
  color: var(--color-primary);
}

.page-blog__faq-answer {
  padding: 0 20px 20px;
  font-size: 16px;
  color: var(--text-secondary);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

/* For details tag, browser handles expansion */
.page-blog__faq-item[open] .page-blog__faq-answer {
  max-height: 1000px; /* Sufficiently large for content */
  padding-top: 10px;
  transition: max-height 0.5s ease-in, padding 0.5s ease-in;
}

/* Fallback for div based FAQ */
.page-blog__faq-item.active .page-blog__faq-answer {
  max-height: 1000px !important;
  padding-top: 10px !important;
}

.page-blog__faq-item.active .page-blog__faq-toggle {
  content: '−';
}

/* Responsive Design */
@media (max-width: 1024px) {
  .page-blog__hero-image-wrapper {
    max-height: 60vh;
  }
  .page-blog__article-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
  .page-blog__popular-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  .page-blog__hero-section {
    padding: 40px 0;
    padding-top: 10px !important;
  }
  .page-blog__hero-image-wrapper {
    max-height: 40vh;
    margin-bottom: 15px;
  }
  .page-blog__main-title {
    font-size: clamp(28px, 8vw, 40px);
  }
  .page-blog__subtitle {
    font-size: clamp(16px, 4vw, 20px);
    margin-bottom: 20px;
  }
  .page-blog__btn-primary,
  .page-blog__btn-secondary {
    width: 100% !important;
    max-width: 100% !important;
    margin-right: 0 !important;
    margin-bottom: 15px;
    padding: 12px 20px;
    font-size: 16px;
  }
  .page-blog__cta-buttons {
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 300px; /* constrain button group width */
  }
  .page-blog__container,
  .page-blog__section,
  .page-blog__card,
  .page-blog__cta-container {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px;
    padding-right: 15px;
  }

  /* Mobile image responsiveness */
  .page-blog img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
  }
  .page-blog__article-image,
  .page-blog__popular-card .page-blog__article-image {
    height: auto; /* Allow auto height on mobile */
    max-height: 200px;
  }

  .page-blog__section-title {
    font-size: clamp(24px, 6vw, 36px);
  }
  .page-blog__section-description {
    font-size: 16px;
    margin-bottom: 30px;
  }
  .page-blog__article-title {
    font-size: 18px;
  }
  .page-blog__article-excerpt {
    font-size: 14px;
  }
  .page-blog__category-item {
    font-size: 15px;
    padding: 10px 20px;
  }
  .page-blog__popular-title {
    font-size: 17px;
  }
  .page-blog__popular-excerpt {
    font-size: 13px;
  }
  .page-blog__faq-question {
    font-size: 16px;
    padding: 15px;
  }
  .page-blog__faq-answer {
    font-size: 14px;
  }
}