/* General styles for page-index */
.page-index {
  font-family: Arial, sans-serif;
  color: #333333; /* Default text color for light body background */
  line-height: 1.6;
}

.page-index__section-title {
  text-align: center;
  font-size: 2.2em;
  color: #017439;
  margin-bottom: 40px;
  position: relative;
}

.page-index__section-title::before,
.page-index__section-title::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 50px;
  height: 2px;
  background: #017439;
}

.page-index__section-title::before {
  left: calc(50% - 100px);
}

.page-index__section-title::after {
  right: calc(50% - 100px);
}

/* Module 1: Hero Section */
.page-index__hero-section {
  padding-top: 10px; /* Assuming shared.css handles body padding-top */
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
  margin-bottom: 30px;
}

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

/* 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 12px;
  box-sizing: border-box;
}

.page-index__btn-access-link {
  display: block;
  padding: 15px 20px;
  text-align: center;
  text-decoration: none;
  font-weight: bold;
  border-radius: 8px;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  word-wrap: break-word;
}

.page-index__btn-register,
.page-index__btn-login {
  background: #C30808;
  color: #FFFF00;
}

.page-index__btn-download {
  background: #017439;
  color: #FFFFFF;
}

.page-index__btn-access-link:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Module 3: Brand Intro */
.page-index__brand-intro {
  max-width: 1250px;
  margin: 0 auto;
  padding: 20px 12px;
  box-sizing: border-box;
  text-align: center;
  margin-bottom: 40px;
}

.page-index__main-title {
  font-weight: bold;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #017439;
  margin-bottom: 20px;
  /* clamp for responsive font size, avoiding fixed large values */
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.page-index__intro-text {
  font-size: 1.1em;
  color: #555555;
  line-height: 1.8;
  text-align: justify;
}

.page-index__intro-text a {
  color: #017439;
  text-decoration: underline;
}

/* Module 4: Category Lobby */
.page-index__category-lobby {
  max-width: 1250px;
  margin: 0 auto;
  padding: 20px 12px;
  box-sizing: border-box;
  margin-bottom: 50px;
}

.page-index__category-lobby__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  justify-content: center;
}

.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 {
  max-width: 1250px;
  margin: 0 auto;
  padding: 20px 12px;
  box-sizing: border-box;
  margin-bottom: 50px;
}

.page-index__blog-slider-container {
  position: relative;
  display: flex;
  align-items: center;
}

.page-index__blog-slider-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  flex-grow: 1;
  padding-bottom: 10px; /* Space for scrollbar on some systems */
}

.page-index__blog-slider-track::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.page-index__blog-slider-prev,
.page-index__blog-slider-next {
  background: #017439;
  color: #FFFFFF;
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  border-radius: 50%;
  font-size: 1.2em;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: background-color 0.3s ease;
}

.page-index__blog-slider-prev {
  left: -20px;
}

.page-index__blog-slider-next {
  right: -20px;
}

.page-index__blog-slider-prev:hover,
.page-index__blog-slider-next:hover {
  background-color: #005a2e;
}

.page-index__post-item {
  flex: 0 0 calc(33.333% - 11px); /* 3 items per row with gap */
  scroll-snap-align: start;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: transform 0.3s ease;
  border: 1px solid #e0e0e0; /* Added for contrast */
}

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

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

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

.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;
  position: relative;
}

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

.page-index__post-excerpt {
  font-size: 0.95em;
  color: #555555;
  margin-bottom: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-index__post-date {
  font-size: 0.85em;
  color: #888888;
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.8);
  padding: 3px 8px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Responsive Styles */

/* Mobile-specific styles for images and buttons to prevent overflow */
@media (max-width: 768px) {
  .page-index img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }

  .page-index__hero-section,
  .page-index__access-links,
  .page-index__brand-intro,
  .page-index__category-lobby,
  .page-index__blog-slider,
  .page-index__category-card,
  .page-index__post-item {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px;
    padding-right: 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;
  }

  .page-index__access-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-left: 15px;
    padding-right: 15px;
  }
}

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

@media (max-width: 768px) {
  /* 1. Banner __hero-section (padding adjustment for smaller screens) */
  .page-index__hero-section {
    padding-top: 10px;
  }

  /* 2. Three Access Links __access-links */
  .page-index__access-links {
    grid-template-columns: 1fr;
    padding: 20px 15px;
  }

  /* 3. Brand Intro __brand-intro */
  .page-index__main-title {
    font-size: clamp(1.5rem, 6vw, 2.2rem);
  }
  .page-index__intro-text {
    font-size: 1em;
    text-align: left;
  }

  /* 4. Five Entry Points __category-lobby */
  .page-index__category-lobby__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .page-index__category-card-link img {
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }

  /* 5. Blog Slider __blog-slider */
  .page-index__blog-slider-prev,
  .page-index__blog-slider-next {
    display: none; /* Hide arrows on small screens for better touch scroll */
  }

  .page-index__blog-slider-track {
    padding-bottom: 0;
  }

  .page-index__post-item {
    flex: 0 0 85%; /* Show roughly one card with some peek of next */
  }

  .page-index__section-title {
    font-size: 1.8em;
    margin-bottom: 25px;
  }
  .page-index__section-title::before,
  .page-index__section-title::after {
    width: 30px;
  }
  .page-index__section-title::before {
    left: calc(50% - 70px);
  }
  .page-index__section-title::after {
    right: calc(50% - 70px);
  }
}

@media (max-width: 549px) {
  .page-index__category-lobby__grid {
    grid-template-columns: 1fr 1fr;
  }
  .page-index__blog-slider-prev,
  .page-index__blog-slider-next {
    display: none;
  }
}