/* General page styling */
.page-index {
  font-family: Arial, sans-serif;
  color: #333333; /* Default text color for light background */
  background: var(--secondary-color); /* White background from shared */
  line-height: 1.6;
}

/* Module 1: Hero Section */
.page-index__hero-section {
  padding-top: 10px; /* Small top padding, not var(--header-offset) */
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
  margin-bottom: 20px;
}
.page-index__hero-image {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
.page-index__hero-image img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  object-fit: cover; /* Default cover for desktop */
  min-height: 200px; /* Ensure minimum size */
}

/* 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;
  background-color: #C30808; /* Custom color for register/login buttons */
  color: #FFFF00; /* Custom font color for register/login buttons */
  text-align: center;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 18px;
  transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  max-width: 100%; /* Ensure responsive */
  box-sizing: border-box;
  white-space: normal;
  word-wrap: break-word;
}
.page-index__btn-access-link:hover {
  background-color: #e13923; /* Slightly darker red on hover */
  transform: translateY(-2px);
  box-shadow: 0 4px 10px 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-size: clamp(28px, 3.5vw, 42px); /* Responsive font size */
  color: #017439;
  margin-bottom: 20px;
  line-height: 1.2;
  font-weight: 700;
}
.page-index__intro-text {
  font-size: 17px;
  color: #555555;
  text-align: justify;
  max-width: 900px;
  margin: 0 auto;
}
.page-index__intro-link {
  color: #017439;
  text-decoration: none;
  font-weight: bold;
}
.page-index__intro-link:hover {
  text-decoration: underline;
}
.page-index__keyword {
  font-weight: bold;
  color: #017439;
}

/* Module 4: Game Lobby */
.page-index__category-lobby {
  max-width: 1250px;
  margin: 0 auto;
  padding: 40px 12px;
  box-sizing: border-box;
  text-align: center;
  margin-bottom: 40px;
}
.page-index__section-title {
  font-size: clamp(24px, 3vw, 36px);
  color: #017439;
  margin-bottom: 30px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.page-index__section-title::before,
.page-index__section-title::after {
  content: '';
  flex-grow: 1;
  height: 2px;
  background: #e0e0e0;
  margin: 0 15px;
}
.page-index__category-lobby__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  width: 100%; /* Ensure it takes full width of its container */
  max-width: 100%;
  box-sizing: border-box;
}
.page-index__category-card {
  display: block;
  border: none;
  box-shadow: none;
  outline: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0;
}
.page-index__category-card-link {
  display: block;
  border: none;
  box-shadow: none;
  outline: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0;
  text-decoration: none;
}
.page-index__category-card-link img {
  aspect-ratio: 1 / 1; /* Enforce square aspect ratio */
  width: 100%;
  height: auto;
  object-fit: contain; /* Contain the image within the square */
  display: block;
  border: none;
  box-shadow: none;
  border-radius: 0;
  transition: transform 0.3s ease;
  min-height: 200px; /* Ensure minimum size */
}
.page-index__category-card-link img:hover {
  transform: translateY(-5px);
}

/* Module 5: Blog Slider */
.page-index__blog-slider-section {
  max-width: 1250px;
  margin: 0 auto;
  padding: 40px 12px;
  box-sizing: border-box;
  margin-bottom: 40px;
}
.page-index__blog-slider-container {
  position: relative;
  margin-top: 30px;
  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; /* For smoother scrolling on iOS */
  padding-bottom: 10px; /* Space for scrollbar */
}
.page-index__blog-slider-track::-webkit-scrollbar {
  height: 8px;
}
.page-index__blog-slider-track::-webkit-scrollbar-thumb {
  background-color: #017439;
  border-radius: 4px;
}
.page-index__blog-slider-track::-webkit-scrollbar-track {
  background-color: #e0e0e0;
  border-radius: 4px;
}
.page-index__blog-slider-prev,
.page-index__blog-slider-next {
  background: #017439;
  color: #FFFFFF;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  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: #005f2e;
}

.page-index__post-item {
  flex: 0 0 calc(33.333% - 11px); /* 3 cards on desktop with gap */
  scroll-snap-align: start;
  background: #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;
  min-width: 280px; /* Minimum width for blog card */
  height: auto;
  display: flex;
  flex-direction: column;
}
.page-index__post-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}
.page-index__post-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.page-index__post-image-wrapper {
  position: relative;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  overflow: hidden;
}
.page-index__post-image-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  min-height: 200px; /* Ensure minimum size */
}
.page-index__post-date {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  z-index: 5;
}
.page-index__post-title {
  font-size: 18px;
  font-weight: 700;
  color: #017439;
  padding: 15px 20px 10px;
  margin: 0;
}
.page-index__post-divider {
  width: 50px;
  height: 2px;
  background: #e0e0e0;
  margin: 0 20px;
}
.page-index__post-excerpt {
  font-size: 15px;
  color: #666666;
  padding: 10px 20px 20px;
  margin: 0;
  flex-grow: 1; /* Allow excerpt to take available space */
}
.page-index__view-all-posts {
  text-align: center;
  margin-top: 30px;
}
.page-index__btn-view-all-blog {
  display: inline-block;
  padding: 12px 25px;
  background-color: #017439;
  color: #ffffff;
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  transition: background-color 0.3s ease;
}
.page-index__btn-view-all-blog:hover {
  background-color: #005f2e;
}

/* Responsive styles */
@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) {
  /* General mobile adaptations */
  .page-index {
    font-size: 16px;
    line-height: 1.6;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
  }

  /* All content sections/containers */
  .page-index__hero-section,
  .page-index__access-links,
  .page-index__brand-intro,
  .page-index__category-lobby,
  .page-index__blog-slider-section {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px;
    padding-right: 15px;
  }

  /* Module 1: Hero Section */
  .page-index__hero-section {
    padding-top: 5px; /* Adjust if needed, small top padding */
    margin-bottom: 15px;
  }
  .page-index__hero-image {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .page-index__hero-image img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }

  /* Module 2: Access Links */
  .page-index__access-links {
    grid-template-columns: 1fr; /* Single column on mobile */
    padding: 20px 15px; /* Adjust padding for mobile */
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap !important;
    gap: 10px;
  }
  .page-index__btn-access-link {
    font-size: 16px;
    padding: 12px 15px;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-wrap: break-word !important;
  }

  /* Module 3: Brand Intro */
  .page-index__brand-intro {
    padding: 15px 15px;
    margin-bottom: 20px;
  }
  .page-index__main-title {
    font-size: clamp(24px, 7vw, 36px); /* Adjust clamp for mobile */
  }
  .page-index__intro-text {
    font-size: 15px;
    text-align: left;
  }

  /* Module 4: Game Lobby */
  .page-index__category-lobby {
    padding: 20px 15px;
    margin-bottom: 20px;
  }
  .page-index__section-title {
    font-size: clamp(20px, 6vw, 30px);
    margin-bottom: 20px;
  }
  .page-index__category-lobby__grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
    gap: 10px;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .page-index__category-card-link img {
    min- /* Adjust min-height for mobile if needed */
  }

  /* Module 5: Blog Slider */
  .page-index__blog-slider-section {
    padding: 20px 15px;
    margin-bottom: 20px;
  }
  .page-index__blog-slider-container {
    margin-top: 20px;
  }
  .page-index__blog-slider-prev,
  .page-index__blog-slider-next {
    width: 30px;
    height: 30px;
    font-size: 20px;
    left: 0px; /* Adjusted for smaller screens */
    right: 0px; /* Adjusted for smaller screens */
  }
  .page-index__blog-slider-track {
    padding-bottom: 5px;
    padding-left: 20px; /* Ensure cards are not hidden by buttons */
    padding-right: 20px; /* Ensure cards are not hidden by buttons */
  }
  .page-index__post-item {
    flex: 0 0 85%; /* Single card visible on mobile */
    min-width: unset;
  }
  .page-index__post-image-wrapper img {
    min-
  }
  .page-index__post-title {
    font-size: 16px;
    padding: 10px 15px 5px;
  }
  .page-index__post-excerpt {
    font-size: 14px;
    padding: 5px 15px 15px;
  }
  .page-index__post-date {
    font-size: 11px;
    padding: 3px 8px;
  }
  .page-index__btn-view-all-blog {
    padding: 10px 20px;
    font-size: 15px;
  }
}

@media (max-width: 549px) {
  .page-index__category-lobby__grid {
    grid-template-columns: 1fr 1fr; /* Still 2 columns for very small screens */
  }
}