/* 🚨 Tổng quan: Các quy tắc CSS phải tuân thủ BEM, không dùng bộ chọn toàn cục/hậu duệ, và phải có đầy đủ quy tắc @media (max-width: 768px) cho TẤT CẢ các module. */

/* ==================================================================
   Màu sắc tùy chỉnh (theo customColors)
   ================================================================== */
:root {
  --page-index-primary-color: #2F6BFF;
  --page-index-secondary-color: #6FA3FF;
  --page-index-button-gradient: linear-gradient(180deg, #4A8BFF 0%, #2F6BFF 100%);
  --page-index-card-bg: #FFFFFF;
  --page-index-background: #F4F7FB;
  --page-index-text-main: #1F2D3D;
  --page-index-text-black: #000000;
  --page-index-border-color: #D6E2FF;
  --page-index-glow-color: #A5C4FF;
}

/* ==================================================================
   Body và các thiết lập chung cho .page-index
   ================================================================== */
.page-index {
  background-color: var(--page-index-background);
  color: var(--page-index-text-main);
  font-family: Arial, sans-serif;
  line-height: 1.6;
  font-size: 17px;
}

.page-index p {
  margin-bottom: 1em;
  color: var(--page-index-text-main);
}

.page-index h1, .page-index h2, .page-index h3, .page-index h4, .page-index h5, .page-index h6 {
  color: var(--page-index-text-black);
  margin-top: 0;
  margin-bottom: 0.5em;
  line-height: 1.2;
}

.page-index a {
  color: var(--page-index-primary-color);
  text-decoration: none;
}

.page-index a:hover {
  text-decoration: underline;
}

.page-index ul {
  list-style: disc;
  margin-left: 20px;
  margin-bottom: 1em;
  color: var(--page-index-text-main);
}

.page-index li {
  margin-bottom: 0.5em;
}

/* ==================================================================
   Module 1: HERO主图区域
   ================================================================== */
.page-index__hero-section {
  position: relative;
  padding-bottom: 0;
  padding-left: 0;
  padding-right: 0;
  padding-top: 10px; /* shared đã cho body padding-top, nên ở đây chỉ dùng khoảng 10px */
  margin-top: 0;
  background-color: transparent;
}

.page-index__hero-container {
  position: relative;
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.page-index__hero-image {
  width: 100%;
  margin: 0;
}

.page-index__hero-image img {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  object-fit: cover; /* Mặc định desktop dùng cover */
}

@media (min-width: 850px) {
  .page-index__hero-image img {
    aspect-ratio: 16/5;
    object-fit: cover;
  }
}

/* 🚨 Mobile HERO主图防裁切 (max-width: 849px) */
@media (max-width: 849px) {
  .page-index__hero-section {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .page-index__hero-image img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: unset !important;
    object-fit: contain !important; /* Mobile dùng contain để không bị cắt */
    max-height: none !important;
    display: block !important;
  }
}

/* 🚨 Mobile HERO主图区域 (max-width: 768px) */
@media (max-width: 768px) {
  .page-index__hero-section {
    padding-top: 10px !important; /* Đảm bảo chỉ 10px padding-top */
    padding-left: 0;
    padding-right: 0;
    margin-top: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
}

/* ==================================================================
   Module 2: Sản phẩm trưng bày (gameshow)
   ================================================================== */
.page-index__products-section {
  width: 100%;
  padding: 60px 20px;
  box-sizing: border-box;
  background-color: var(--page-index-background);
}

.page-index__products-container {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.page-index__products-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(6, 1fr); /* Desktop: 6 cột */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.page-index__product-card {
  width: 100%;
  max-width: 300px; /* Giới hạn chiều rộng tối đa */
  border-radius: 0; /* Không bo tròn */
  overflow: hidden;
  background: transparent;
  box-shadow: none; /* Không đổ bóng */
  transition: transform 0.3s ease;
}

.page-index__product-card:hover {
  transform: translateY(-3px);
}

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

.page-index__product-card-image {
  width: 100%;
  max-width: 300px;
  overflow: hidden;
}

.page-index__product-card-image img {
  max-width: 100%;
  width: 100%;
  height: auto; /* Giữ tỷ lệ gốc */
  display: block;
}

/* 🚨 Mobile Sản phẩm trưng bày (max-width: 768px) */
@media (max-width: 768px) {
  .page-index__products-section {
    padding: 40px 15px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* Ngăn cuộn ngang */
    box-sizing: border-box;
  }
  .page-index__products-container,
  .page-index__products-grid {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .page-index__products-grid {
    grid-template-columns: repeat(2, 1fr); /* Mobile: 2 cột x 3 hàng */
    gap: 15px;
  }
  .page-index__product-card,
  .page-index__product-card-image {
    max-width: 100%;
  }
}

/* ==================================================================
   Module 3: Tiêu đề chính trang trí (H1 duy nhất)
   ================================================================== */
.page-index__section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  padding: 24px 12px;
  box-sizing: border-box;
  text-align: center;
  background-color: var(--page-index-background);
}

.page-index__section-title {
  margin: 0;
  font-size: clamp(1.1rem, 4.5vw, 1.75rem); /* H1 dùng clamp */
  line-height: 1.35;
  color: var(--page-index-text-black);
  font-weight: bold;
}

.page-index__section-title-line {
  flex: 1;
  max-width: 80px;
  height: 2px;
  opacity: 0.6;
  background-color: var(--page-index-text-main);
}

/* 🚨 Mobile Tiêu đề chính trang trí (max-width: 768px) */
@media (max-width: 768px) {
  .page-index__section-title-wrap {
    padding: 20px 10px;
  }
  .page-index__section-title {
    font-size: clamp(1rem, 5vw, 1.5rem);
    line-height: 1.4;
  }
  .page-index__section-title-line {
    max-width: 40px;
  }
}

/* ==================================================================
   Module 4: Nội dung SEO dài (Article Body)
   ================================================================== */
.page-index__article-body {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 48px;
  box-sizing: border-box;
  overflow-x: hidden;
  background-color: var(--page-index-background);
  color: var(--page-index-text-main);
}

.page-index__article-body h2 {
  margin: 2.5rem 0 1rem;
  font-size: 2.2rem;
  color: var(--page-index-text-black);
}

.page-index__article-body h3 {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.5rem;
  color: var(--page-index-text-black);
}

.page-index__article-body p {
  margin-bottom: 1em;
  color: var(--page-index-text-main);
}

.page-index__article-figure {
  margin: 2rem auto;
  max-width: 800px;
  text-align: center;
}

.page-index__article-figure img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.page-index__article-figure figcaption {
  margin-top: 10px;
  font-size: 0.9em;
  color: #666;
}

.page-index__article-quote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  border-left: 4px solid var(--page-index-primary-color);
  background-color: var(--page-index-card-bg);
  color: var(--page-index-text-main);
  font-style: italic;
  font-size: 1.1em;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* 🚨 Mobile Nội dung SEO dài (max-width: 768px) */
@media (max-width: 768px) {
  .page-index__article-body {
    padding: 0 15px 32px;
    font-size: 16px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .page-index__article-body h2 {
    font-size: clamp(1.5rem, 6vw, 1.8rem);
    margin: 2rem 0 0.8rem;
  }
  .page-index__article-body h3 {
    font-size: clamp(1.2rem, 5vw, 1.4rem);
    margin: 1.2rem 0 0.6rem;
  }
  .page-index__article-figure {
    margin: 1.5rem auto;
    max-width: 100%;
  }
  .page-index__article-figure img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
  .page-index__article-quote {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    font-size: 1em;
  }
}

/* ==================================================================
   Nút CTA chung (cho cả desktop và mobile)
   ================================================================== */
.page-index__cta-button {
  display: inline-block;
  padding: 12px 25px;
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  font-weight: bold;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
  margin-bottom: 20px;
  box-sizing: border-box;
}

.page-index__btn-primary {
  background: var(--page-index-button-gradient);
  color: #ffffff;
  border: none;
}

.page-index__btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  text-decoration: none;
}

/* 🚨 Mobile Nút CTA chung (max-width: 768px) */
@media (max-width: 768px) {
  .page-index__cta-button,
  .page-index__btn-primary {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    padding: 14px 20px;
    font-size: 17px;
  }
  .page-index__article-body .page-index__cta-button {
    margin-left: auto;
    margin-right: auto;
    display: block;
  }
}

/* ==================================================================
   Ảnh và container chung (responsive)
   ================================================================== */
.page-index img {
  max-width: 100%;
  height: auto;
  display: block;
}

.page-index__section,
.page-index__container,
.page-index__box {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* 🚨 Mobile ảnh và container chung (max-width: 768px) */
@media (max-width: 768px) {
  .page-index img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }
  
  .page-index__section,
  .page-index__container,
  .page-index__box {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px;
    padding-right: 15px;
  }
}