/* General page styling */
.page-index {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: #FFF5E1; /* Text Main */
  background: #B71C1C; /* Background */
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

/* Section titles */
.page-index__section-title {
  font-size: 2.2em;
  color: #FFF5E1; /* Text Main */
  text-align: center;
  margin-bottom: 40px;
  margin-top: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  font-weight: bold;
}

.page-index__section-title-line {
  flex-grow: 1;
  height: 2px;
  background: linear-gradient(90deg, transparent, #F2B544, transparent); /* Border color */
  max-width: 150px;
}

/* Module 1: Hero Section */
.page-index__hero-section {
  padding-top: 10px; /* Adjust as per shared.css body padding */
  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;
}

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

.page-index__btn-access-link {
  display: block;
  padding: 18px 25px;
  background: linear-gradient(180deg, #FFD86A 0%, #E6B800 100%); /* Button gradient */
  color: #7A0E0E; /* Deep Red for contrast */
  text-align: center;
  text-decoration: none;
  border-radius: 10px;
  font-size: 1.1em;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  white-space: normal; /* Allow text to wrap */
  word-wrap: break-word; /* Break long words */
}

.page-index__btn-access-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), 0 0 20px #FFCC66; /* Glow */
}

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

.page-index__main-title {
  font-size: clamp(2em, 3.5vw, 2.8em); /* Use clamp for H1 */
  color: #F4D34D; /* Gold */
  margin-bottom: 20px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.5px;
}

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

.page-index__intro-text a {
  color: #FFCC66; /* Glow */
  text-decoration: underline;
  font-weight: bold;
}

.page-index__intro-text a:hover {
  color: #F4D34D; /* Gold */
}

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

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

.page-index__category-card {
  display: block;
  border: none;
  box-shadow: none;
  outline: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0;
  overflow: hidden; /* Ensure no overflow */
}

.page-index__category-card-link {
  display: block;
  border: none;
  box-shadow: none;
  outline: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0;
  transition: transform 0.3s ease;
}

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

.page-index__category-card-link img {
  aspect-ratio: 1 / 1;
  width: 100%;
  height: auto;
  object-fit: contain; /* Ensure the entire image is visible within the element's padding box */
  display: block;
  border: none;
  box-shadow: none;
  border-radius: 0;
  max-width: 100%; /* Ensure responsiveness */
}

/* Module 5: Blog Slider */
.page-index__blog-slider {
  max-width: 1250px;
  margin: 0 auto;
  padding: 20px 15px 60px;
  box-sizing: border-box;
}

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

.page-index__blog-slider-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  scrollbar-width: none; /* Hide scrollbar for Firefox */
  padding-bottom: 10px; /* Space for potential scrollbar */
}

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

.page-index__post-item {
  flex: 0 0 calc(33.333% - 13.333px); /* 3 items per row with 20px gap */
  scroll-snap-align: start;
  background: #D32F2F; /* Card BG */
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.page-index__post-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(255, 204, 102, 0.5); /* Subtle glow */
}

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

.page-index__post-image-wrapper {
  position: relative;
  width: 100%;
  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;
}

.page-index__post-date {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: #FFF5E1; /* Text Main */
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.85em;
  z-index: 10;
}

.page-index__post-title {
  font-size: 1.2em;
  font-weight: bold;
  color: #F4D34D; /* Gold */
  margin: 15px 15px 10px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.page-index__post-excerpt {
  font-size: 0.9em;
  color: #FFF5E1; /* Text Main */
  margin: 0 15px 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.page-index__blog-slider-nav {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #FFF5E1; /* Text Main */
  font-size: 2.5em;
  cursor: pointer;
  padding: 10px 15px;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.page-index__blog-slider-nav:hover {
  background: rgba(255, 255, 255, 0.4);
  color: #F4D34D; /* Gold */
}

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

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

/* Responsive Styles */
/* Mobile first approach, desktop overrides */
@media (max-width: 1024px) {
  .page-index__section-title {
    font-size: 1.8em;
    margin-top: 40px;
    margin-bottom: 30px;
  }
  .page-index__section-title-line {
    max-width: 100px;
  }
  .page-index__blog-slider-prev {
    left: 0px;
  }
  .page-index__blog-slider-next {
    right: 0px;
  }
}

@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;
  }

  /* Universal image responsiveness */
  .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 {
    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: 10px; /* Ensure small top padding */
    margin-bottom: 20px;
  }

  /* Module 2: Access Links */
  .page-index__access-links {
    grid-template-columns: 1fr; /* Stack buttons vertically */
    gap: 15px;
    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;
    font-size: 1em;
    padding: 15px 20px;
  }

  /* Module 3: Brand Intro */
  .page-index__main-title {
    font-size: clamp(1.8em, 5vw, 2.2em);
    margin-bottom: 15px;
  }
  .page-index__intro-text {
    font-size: 1em;
  }

  /* Module 4: Category Lobby */
  .page-index__category-lobby__grid {
    grid-template-columns: repeat(2, 1fr); /* 2 items per row */
    gap: 15px;
  }
  .page-index__category-card-link img {
    aspect-ratio: 1 / 1; /* Maintain square aspect ratio */
    object-fit: contain;
  }

  /* Module 5: Blog Slider */
  .page-index__blog-slider-wrapper {
    margin: 0 20px; /* Give space for nav buttons */
  }
  .page-index__blog-slider-track {
    scroll-padding-left: 0; /* Adjust scroll snap */
  }
  .page-index__post-item {
    flex: 0 0 calc(100% - 10px); /* 1 item per row with a bit of gap */
    scroll-snap-align: center;
  }
  .page-index__blog-slider-nav {
    font-size: 2em;
    padding: 8px 12px;
  }
  .page-index__blog-slider-prev {
    left: -10px;
  }
  .page-index__blog-slider-next {
    right: -10px;
  }
}

/* Contrast Fixes based on body background (B71C1C is dark) */
.page-index {
  color: #FFF5E1; /* Text Main - light text for dark background */
  background: #B71C1C; /* Background - dark */
}

.page-index__card,
.page-index__post-item {
  background: #D32F2F; /* Card BG - dark */
  color: #FFF5E1; /* Text Main - light text for dark background */
}

.page-index__btn-access-link {
  background: linear-gradient(180deg, #FFD86A 0%, #E6B800 100%); /* Button gradient - light */
  color: #7A0E0E; /* Deep Red - dark text for light background */
}

.page-index__main-title {
  color: #F4D34D; /* Gold - light color for dark background */
}

.page-index__section-title {
  color: #FFF5E1; /* Text Main - light color for dark background */
}

.page-index__intro-text a {
  color: #FFCC66; /* Glow - light color for dark background */
}

.page-index__post-title {
  color: #F4D34D; /* Gold - light color for dark background */
}

.page-index__post-excerpt {
  color: #FFF5E1; /* Text Main - light color for dark background */
}