/* General styles for the homepage */
.page-index {
  font-family: Arial, sans-serif;
  color: #333333; /* Dark text for default white body background */
  background-color: #f5f5f5; /* Light grey background for content sections */
  line-height: 1.6;
}

.page-index__container {
  max-width: 1250px;
  margin: 0 auto;
  padding: 0 15px; /* Added padding for smaller screens */
  box-sizing: border-box;
}

/* Module 1: Hero Section */
.page-index__hero-section {
  padding-top: 10px; /* Small top padding, body handles main offset */
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
  background-color: #017439; /* Example background if image doesn't cover fully */
}

.page-index__hero-image img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  object-fit: cover; /* Cover for desktop */
}

/* Module 2: Access Links */
.page-index__access-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 1250px;
  margin: 0 auto;
  padding: 30px 15px;
  box-sizing: border-box;
  background-color: #ffffff;
  border-bottom: 1px solid #eee;
}

.page-index__btn-access-link {
  display: block;
  padding: 15px 20px;
  background-color: #017439; /* Primary color for functional buttons */
  color: #ffffff;
  text-align: center;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 1.1em;
  transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  word-wrap: break-word;
}

.page-index__btn-access-link:hover {
  background-color: #005a2e; /* Slightly darker green on hover */
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* Module 3: Brand Intro */
.page-index__brand-intro {
  padding: 40px 0;
  text-align: center;
  background-color: #ffffff;
}

.page-index__main-title {
  font-size: clamp(2em, 3.5vw, 3.2em); /* Clamp for H1, not fixed large size */
  font-weight: 700;
  color: #017439;
  margin-bottom: 20px;
  line-height: 1.2;
}

.page-index__intro-text {
  font-size: 1.1em;
  max-width: 900px;
  margin: 0 auto;
  color: #555555;
  text-align: justify;
}

/* Module 4: Category Lobby */
.page-index__category-lobby {
  padding: 50px 0;
  background-color: #f5f5f5;
}

.page-index__section-title {
  font-size: 2em;
  font-weight: 600;
  color: #017439;
  text-align: center;
  margin-bottom: 30px;
  position: relative;
  padding-bottom: 10px;
}

.page-index__section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background-color: #C30808; /* Accent color */
  margin: 10px auto 0;
}

.page-index__category-lobby__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-top: 30px;
}

.page-index__category-card,
.page-index__category-card-link {
  display: block;
  border: none;
  box-shadow: none;
  outline: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0;
}

.page-index__category-card-link img {
  aspect-ratio: 1 / 1;
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  border: none;
  box-shadow: none;
  border-radius: 0;
  transition: transform 0.3s ease;
}

.page-index__category-card-link:hover img {
  transform: translateY(-5px);
}

/* Module 5: Blog Slider */
.page-index__blog-slider {
  padding: 50px 0;
  background-color: #ffffff;
}

.page-index__slider-wrapper {
  position: relative;
  margin-top: 30px;
}

.page-index__blog-slider-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 15px; /* Space for scrollbar */
}

.page-index__blog-slider-track::-webkit-scrollbar {
  height: 8px;
}

.page-index__blog-slider-track::-webkit-scrollbar-thumb {
  background: #017439;
  border-radius: 10px;
}

.page-index__blog-slider-track::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.page-index__post-item {
  flex: 0 0 calc(33.333% - 11px); /* 3 cards per row with gap */
  scroll-snap-align: start;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.3s ease;
}

.page-index__post-item:hover {
  transform: translateY(-5px);
}

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

.page-index__image-cover {
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  position: relative;
  overflow: hidden;
  background-color: #e0e0e0; /* Placeholder background */
}

.page-index__image-cover img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.page-index__post-content {
  padding: 15px;
}

.page-index__post-title {
  font-size: 1.2em;
  font-weight: 600;
  color: #017439;
  margin-bottom: 10px;
  line-height: 1.4;
}

.page-index__post-meta {
  font-size: 0.9em;
  color: #777;
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.page-index__post-excerpt {
  font-size: 0.95em;
  color: #555;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-index__blog-slider-prev,
.page-index__blog-slider-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.5em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.page-index__blog-slider-prev:hover,
.page-index__blog-slider-next:hover {
  opacity: 1;
}

.page-index__blog-slider-prev {
  left: 0;
}

.page-index__blog-slider-next {
  right: 0;
}

.page-index__view-all-posts {
  text-align: center;
  margin-top: 40px;
}

.page-index__btn-view-all {
  display: inline-block;
  padding: 12px 25px;
  background-color: #C30808; /* Custom color for view all button */
  color: #FFFF00; /* Custom color for view all button font */
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  transition: background-color 0.3s ease;
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  word-wrap: break-word;
}

.page-index__btn-view-all:hover {
  background-color: #a30606;
}

/* Responsive styles */
@media (max-width: 1024px) {
  .page-index__main-title {
    font-size: clamp(1.8em, 3.8vw, 2.8em);
  }
  .page-index__category-lobby__grid {
    gap: 12px;
  }
  .page-index__post-item {
    flex: 0 0 calc(50% - 8px); /* 2 cards on tablet */
  }
  .page-index__blog-slider-prev,
  .page-index__blog-slider-next {
    width: 35px;
    height: 35px;
    font-size: 1.3em;
  }
}

@media (max-width: 849px) {
  .page-index__hero-image img {
    object-fit: contain !important;
    aspect-ratio: unset !important;
    max-height: none !important;
  }
}

@media (max-width: 768px) {
  .page-index {
    font-size: 16px;
    line-height: 1.6;
  }
  .page-index__container {
    padding: 0 15px; /* Ensure consistent padding */
  }

  /* Hero section */
  .page-index__hero-section {
    padding-top: 10px; /* Still 10px, not var(--header-offset) */
  }
  .page-index__hero-image img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }

  /* Access links */
  .page-index__access-links {
    grid-template-columns: 1fr; /* Single column on mobile */
    padding: 20px 15px;
  }
  .page-index__btn-access-link {
    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;
  }

  /* Brand Intro */
  .page-index__brand-intro {
    padding: 30px 0;
  }
  .page-index__main-title {
    font-size: clamp(1.5em, 5vw, 2.5em);
    padding: 0 15px;
  }
  .page-index__intro-text {
    font-size: 1em;
    padding: 0 15px;
  }

  /* Category Lobby */
  .page-index__category-lobby {
    padding: 30px 0;
  }
  .page-index__section-title {
    font-size: 1.8em;
    padding: 0 15px 10px;
  }
  .page-index__category-lobby__grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
    gap: 10px;
    padding: 0 15px; /* Add padding to grid container */
  }
  .page-index__category-card-link img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important; /* Ensure square aspect ratio is maintained visually */
  }

  /* Blog Slider */
  .page-index__blog-slider {
    padding: 30px 0;
  }
  .page-index__blog-slider-track {
    padding: 0 15px 15px; /* Padding for scrollable area */
  }
  .page-index__post-item {
    flex: 0 0 90%; /* Single card on mobile, with some side padding */
  }
  .page-index__post-title {
    font-size: 1.1em;
  }
  .page-index__post-excerpt {
    font-size: 0.9em;
  }
  .page-index__blog-slider-prev,
  .page-index__blog-slider-next {
    width: 30px;
    height: 30px;
    font-size: 1.2em;
    top: calc(50% - 15px); /* Adjust position if cards get taller */
  }
  .page-index__blog-slider-prev {
    left: 5px;
  }
  .page-index__blog-slider-next {
    right: 5px;
  }

  .page-index__view-all-posts {
    margin-top: 30px;
  }
  .page-index__btn-view-all {
    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;
  }

  /* General image and button responsiveness */
  .page-index img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
  .page-index__section,
  .page-index__card,
  .page-index__container {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    /* padding-left: 15px; */ /* Already handled by page-index__container */
    /* padding-right: 15px; */
  }
}