/* style/index.css */

/* General styles for page-index to ensure contrast with default white body background */
.page-index {
  color: #333333; /* Text Main */
  background: #F5F7FA; /* Background color */
}

/* 🚨 Video Section Styles */
.page-index__video-section {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  /* 🚨 页头整段高度由 shared 的 body { padding-top: var(--header-offset); } 承担；此处仅用小额顶距，禁止再写 var(--header-offset) 以免双倍空白 */
  padding-top: 10px; /* Small top padding */
  background: #F5F7FA; /* Background color */
}

.page-index__video-container {
  position: relative;
  width: 100%; /* 🚨 Desktop: Must include width: 100% */
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.page-index__video-link {
  display: block;
  text-decoration: none;
  position: relative;
  width: 100%;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border-radius: 8px;
  overflow: hidden;
}

.page-index__video-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.page-index__video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.page-index__video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
  object-fit: cover;
  pointer-events: none; /* Prevents video controls from blocking click event on parent <a> */
}

.page-index__video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.page-index__video-link:hover .page-index__video-overlay {
  opacity: 1;
}

.page-index__video-click-hint {
  color: #ffffff;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  padding: 10px 20px;
  background: rgba(229, 57, 53, 0.8); /* Primary color with opacity */
  border-radius: 5px;
  white-space: nowrap;
}

.page-index__video-cta {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 30px;
}

.page-index__play-now-button {
  display: inline-block;
  padding: 15px 40px;
  background: linear-gradient(180deg, #FF5A4F 0%, #E53935 100%); /* Button gradient */
  color: #ffffff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: none;
  cursor: pointer;
  max-width: 100%; /* Ensure button adapts to mobile */
  box-sizing: border-box;
  white-space: normal;
  word-wrap: break-word;
}

.page-index__play-now-button:hover {
  background: linear-gradient(180deg, #E53935 0%, #FF5A4F 100%); /* Slight inverse on hover */
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.page-index__play-now-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 🚨 Promo Dark Section (GifCode Tabs + Blog Section Title) */
.page-index__promo-dark {
  background: #2c2c2c; /* Dark background */
  padding: 24px 16px;
  color: #ffffff; /* Light text for dark background */
}

.page-index__gifcode-tabs {
  max-width: 1250px;
  margin: 0 auto;
  padding: 20px 0;
}

.page-index__gifcode-title {
  color: #E53935; /* Primary color */
  text-align: center;
  text-transform: uppercase;
  font-size: 1.8rem;
  margin-bottom: 20px;
}

.page-index__gifcode-tab-nav {
  display: flex;
  justify-content: center;
  gap: 24px;
  list-style: none;
  padding: 0;
  margin: 16px 0 30px;
}

.page-index__gifcode-tab-nav a {
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  padding: 8px 4px;
  border-bottom: 2px solid transparent;
  font-weight: bold;
  transition: all 0.3s ease;
}

.page-index__gifcode-tab-nav a.is-active {
  color: #E53935; /* Primary color for active tab */
  border-bottom-color: #E53935;
}

.page-index__gifcode-tab-nav a:hover:not(.is-active) {
  color: #FF5A4F; /* Secondary color on hover */
}

.page-index__gifcode-panel {
  display: none;
}

.page-index__gifcode-panel.is-active {
  display: block;
}

.page-index__gifcode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 1250px;
  margin: 0 auto;
}

.page-index__gifcode-col {
  flex: 1 1 calc(50% - 6px); /* Two columns on desktop */
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  box-sizing: border-box;
}

.page-index__gifcode-img {
  width: 100%;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.page-index__gifcode-img:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.page-index__gifcode-img img {
  display: block;
  width: 100%;
  aspect-ratio: 370 / 127; /* Maintain aspect ratio */
  object-fit: cover;
  transition: transform 0.3s;
  border-radius: 4px;
}

.page-index__gifcode-img:hover img {
  transform: scale(1.03);
}

.page-index__blog-section-title {
  color: #E53935; /* Primary color */
  text-align: center;
  margin: 40px 0 20px; /* Margin below GifCode tabs and above blog slider */
  font-size: 1.5rem;
  font-weight: bold;
}

/* 🚨 Blog Slider Section */
.page-index__blog-slider {
  padding: 30px 0 50px;
  background: #F5F7FA; /* Background color (light) */
  color: #333333; /* Dark text for light background */
}

.page-index__blog-slider-wrap {
  position: relative;
  max-width: 1250px;
  margin: 0 auto;
  padding: 0 40px; /* Space for nav buttons */
}

.page-index__blog-slider-track {
  display: flex;
  gap: 16px;
  overflow-x: auto; /* Enable horizontal scrolling */
  scroll-snap-type: x mandatory; /* Snap to items */
  scrollbar-width: none; /* Hide scrollbar for Firefox */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.page-index__blog-slider-track::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Webkit browsers */
}

.page-index__post-item {
  flex: 0 0 calc((100% - (16px * 4)) / 5); /* 5 cards visible on desktop, 4 gaps */
  scroll-snap-align: start;
  min-width: 0; /* Allow shrinking */
  box-sizing: border-box;
}

.page-index__post-box {
  position: relative;
  background: #2c2c2c; /* Dark background for card */
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  height: 100%; /* Ensure consistent card height */
  display: flex;
  flex-direction: column;
}

.page-index__post-image {
  position: relative;
  width: 100%;
}

.page-index__post-cover {
  position: relative;
  padding-top: 120px; /* Fixed height for cover image */
  overflow: hidden;
  background: #333; /* Placeholder background */
}

.page-index__post-cover-link {
  display: block;
  position: absolute;
  inset: 0;
}

.page-index__post-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.page-index__post-cover-link:hover img {
  transform: scale(1.05);
}

.page-index__post-text {
  padding: 12px;
  text-align: center;
  color: #fff; /* Light text for dark card background */
  flex-grow: 1; /* Allow text content to expand */
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page-index__post-title {
  margin: 0 0 8px;
  line-height: 1.3;
  font-size: 0.95rem;
}

.page-index__post-title a {
  color: #E53935; /* Primary color for title link */
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s ease;
}

.page-index__post-title a:hover {
  color: #FF5A4F; /* Secondary color on hover */
}

.page-index__post-divider {
  width: 40px;
  height: 2px;
  background: #E53935; /* Primary color */
  margin: 8px auto;
}

.page-index__post-excerpt {
  color: #bbb;
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Limit to 2 lines */
  -webkit-box-orient: vertical;
}

.page-index__post-date {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #fff; /* White background for date badge */
  border: 2px solid #E53935; /* Primary color border */
  border-radius: 4px;
  padding: 4px 6px;
  text-align: center;
  font-size: 12px;
  line-height: 1.2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-index__post-date-day {
  display: block;
  font-weight: 700;
  color: #333; /* Dark text */
}

.page-index__post-date-month {
  display: block;
  font-size: 10px;
  color: #666;
  text-transform: uppercase;
}

.page-index__blog-slider-prev,
.page-index__blog-slider-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(229, 57, 53, 0.8); /* Primary color with opacity */
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background 0.3s ease, transform 0.3s ease;
}

.page-index__blog-slider-prev:hover,
.page-index__blog-slider-next:hover {
  background: #E53935; /* Primary color on hover */
  transform: translateY(-50%) scale(1.05);
}

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

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

/* 🚨 Responsive Design */

/* Tablet (849px) */
@media (max-width: 849px) {
  .page-index__blog-slider-wrap {
    padding: 0 20px; /* Adjust padding for smaller screens */
  }
  .page-index__post-item {
    flex: 0 0 calc((100% - (16px * 2)) / 3); /* 3 cards visible */
  }
}

/* Mobile (768px and below) */
@media (max-width: 768px) {
  .page-index__video-section {
    padding-top: 10px !important;
    padding-bottom: 40px;
    padding-left: 15px;
    padding-right: 15px;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  
  .page-index__video-container {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 0;
    padding-right: 0;
    overflow: hidden !important;
  }
  
  .page-index__video-link {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .page-index__video-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 4px;
    overflow: hidden !important;
  }
  
  .page-index__video {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    border-radius: 4px;
    object-fit: contain;
  }
  
  .page-index__video-cta {
    margin-top: 20px;
    padding-left: 15px;
    padding-right: 15px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .page-index__play-now-button {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 12px 30px !important;
    font-size: 16px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
  }
  
  .page-index__video-click-hint {
    font-size: 14px !important;
    padding: 8px 16px !important;
  }

  /* General image and container responsiveness for mobile */
  .page-index img {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
  }
  
  .page-index__promo-dark,
  .page-index__gifcode-tabs,
  .page-index__blog-slider,
  .page-index__blog-slider-wrap {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    overflow: hidden !important;
  }

  .page-index__gifcode-row {
    flex-direction: column; /* Stack columns on mobile */
    gap: 15px;
  }
  .page-index__gifcode-col {
    flex: 1 1 100%; /* Single column on mobile */
    gap: 15px;
  }

  .page-index__gifcode-title {
    font-size: 1.5rem;
  }
  .page-index__gifcode-tab-nav {
    gap: 15px;
    margin-bottom: 20px;
  }
  .page-index__gifcode-tab-nav a {
    font-size: 0.9rem;
    padding: 6px 2px;
  }

  .page-index__blog-section-title {
    font-size: 1.2rem;
    margin-top: 30px;
    margin-bottom: 15px;
  }

  .page-index__blog-slider-prev,
  .page-index__blog-slider-next {
    width: 30px;
    height: 30px;
    font-size: 20px;
  }
  .page-index__blog-slider-wrap {
    padding: 0 30px; /* Adjust padding for smaller buttons */
  }
}

/* Mobile (549px and below) */
@media (max-width: 549px) {
  .page-index__post-item {
    flex: 0 0 100%; /* 1 card visible on mobile */
  }
  .page-index__blog-slider-wrap {
    padding: 0 20px; /* Further adjust padding for very small screens */
  }
  .page-index__blog-slider-prev,
  .page-index__blog-slider-next {
    width: 25px;
    height: 25px;
    font-size: 18px;
  }
}