/* ============================================
   PRODUCT FEATURES SECTION COMPONENT
   RallyBoard-style layout with images and text side-by-side
   
   Dependencies:
   - CSS Variables (from base.css):
     * --container-max-width-wide: Container max width
     * --section-horizontal-padding: Horizontal padding for sections
     * --amp-yellow: Brand yellow color (#fcb825)
     * --amp-gray: Brand gray color (#30303d)
   - External Classes (from base.css - overridden below):
     * .w-background-video: Base video container class
     * .w-background-video-atom: Base video atom class
   ============================================ */

/* Section Container */
.product-features-section {
  width: 100%;
  padding: 120px 0;
  background-color: #ffffff;
  position: relative;
}

/* Main Container */
.product-features-container {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 80px;
  max-width: var(--container-max-width-wide);
  margin: 0 auto;
  padding: 0 var(--section-horizontal-padding);
  align-items: start;
  position: relative;
}

/* Images Container - Pinned by ScrollTrigger */
.product-features-images {
  position: relative;
  width: 100%;
  height: 600px;
  align-self: flex-start;
  z-index: 1;
}

.product-feature-image-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.product-feature-image-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  will-change: opacity, transform;
}

/* First image visible by default */
.product-feature-image-wrapper[data-feature-index="0"] {
  opacity: 1;
}

.product-feature-image-bg {
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

.product-feature-image-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Video Container - Override base.css w-background-video styles */
.product-feature-image-bg .product-feature-video {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background-color: #ffffff;
}

/* Override base.css .w-background-video styles */
.product-feature-image-bg .w-background-video {
  color: inherit;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Override base.css .w-background-video>video styles */
.product-feature-image-bg .w-background-video > video {
  object-fit: cover;
  z-index: 0;
  background-position: 50%;
  background-size: cover;
  width: 100%;
  inset: 0;
}

/* Adjust video container to match 1.25:1 aspect ratio */
.product-feature-image-wrapper[data-feature-index="4"] .product-feature-image-bg {
  aspect-ratio: 1.25 / 1;
  height: auto;
}

.product-feature-image-bg .product-feature-video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  z-index: 0;
}

/* Text Container */
.product-features-text {
  position: relative;
  width: 100%;
  z-index: 2;
}

.product-features-text-container {
  position: relative;
  width: 100%;
}

.product-feature-text-item {
  width: 100%;
  margin-bottom: 250px;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  scroll-margin-top: 120px;
}

.product-feature-text-item:last-child {
  margin-bottom: 0;
}

/* Typography */
.product-feature-heading {
  font-family: Gotham, Arial, sans-serif;
  font-size: 48px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.04em;
  color: var(--amp-yellow);
  margin: 0 0 32px 0;
  text-align: left;
}

.product-feature-description {
  font-family: "Gotham Book", Arial, sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--amp-gray);
  margin: 0;
}

/* Responsive Design - Tablet */
@media screen and (max-width: 991px) {
  .product-features-section {
    padding: 80px 0;
  }

  .product-features-container {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 0 var(--section-horizontal-padding);
  }

  /* Disable ScrollTrigger pinning on tablet/mobile */
  .product-features-images {
    position: relative !important;
    height: auto !important;
    min-height: auto;
    order: 1;
    margin-bottom: 0;
  }

  .product-feature-image-container {
    height: auto;
  }

  .product-feature-image-wrapper {
    position: relative !important;
    opacity: 1 !important;
    margin-bottom: 40px;
    height: auto !important;
  }

  .product-feature-image-wrapper:last-child {
    margin-bottom: 0;
  }

  .product-feature-image-bg {
    height: 400px;
  }

  /* Video container aspect ratio on tablet */
  .product-feature-image-wrapper[data-feature-index="4"] .product-feature-image-bg {
    aspect-ratio: 1.25 / 1;
    height: auto;
    min-height: 400px;
  }

  .product-features-text {
    order: 2;
  }

  .product-feature-text-item {
    margin-bottom: 60px !important;
    min-height: auto !important;
    justify-content: flex-start;
    scroll-margin-top: 80px;
  }

  .product-feature-text-item:last-child {
    margin-bottom: 0;
  }

  .product-feature-heading {
    font-size: 40px;
    margin-bottom: 24px;
  }

  .product-feature-description {
    font-size: 17px;
  }
}

/* Responsive Design - Mobile */
@media screen and (max-width: 767px) {
  .product-features-section {
    padding: 60px 0;
  }

  .product-features-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 16px;
  }

  /* Hide the images container - we'll insert images before each text item */
  .product-features-images {
    display: none;
  }

  .product-features-text {
    width: 100%;
  }

  .product-features-text-container {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  /* Mobile feature items: image → heading → description */
  .product-feature-text-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 48px !important;
    min-height: auto !important;
    justify-content: flex-start;
    scroll-margin-top: 0;
    padding: 0;
  }

  .product-feature-text-item:last-child {
    margin-bottom: 0;
  }

  /* Insert image before each text item using ::before pseudo-element */
  .product-feature-text-item::before {
    content: '';
    display: block;
    width: 100%;
    height: 300px;
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
    background-color: #ffffff;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    order: -1;
  }

  /* Feature 1 Image */
  .product-feature-text-item[data-feature-index="0"]::before {
    background-image: url('/assets/images/products-elevating-fan-entertainment-1.webp');
  }

  /* Feature 2 Image */
  .product-feature-text-item[data-feature-index="1"]::before {
    background-image: url('/assets/images/products-elevating-fan-entertainment-2.webp');
  }

  /* Feature 3 Image */
  .product-feature-text-item[data-feature-index="2"]::before {
    background-image: url('/assets/images/products-drive-sponsorship-revenue-1.gif');
  }

  /* Feature 4 Image */
  .product-feature-text-item[data-feature-index="3"]::before {
    background-image: url('/assets/images/products-drive-sponsorship-revenue-2.webp');
  }

  /* Feature 5 Video - hide ::before, video will be inserted via JS */
  .product-feature-text-item[data-feature-index="4"]::before {
    display: none;
  }

  /* Video container inserted before feature 5 text */
  .product-feature-text-item[data-feature-index="4"] 

  .product-feature-text-item[data-feature-index="4"] .mobile-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
  }

  .product-feature-heading {
    font-size: 32px;
    margin-bottom: 20px;
    line-height: 1.3;
    text-align: center;
  }

  .product-feature-description {
    font-size: 16px;
    line-height: 1.6;
    text-align: center;
  }
}
