/* Features Top Alignment - Ensure title, video, and text start at same height */

/* Base alignment for all desktop/laptop screens */
@media screen and (min-width: 768px) {
  /* Change from center to top alignment */
  a.feature-item,
  .feature-item {
    align-items: flex-start !important; /* Changed from center */
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }

  /* Text/Description - align to top */
  .feature-description {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important; /* Changed from center */
    align-items: flex-start !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  .feature-description p {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  /* Video container - stretch to full height */
  .feature-video-container {
    display: block !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    align-self: stretch !important; /* Stretch to full height */
    height: 100% !important;
    position: relative !important;
  }

  /* Title - align to top */
  .feature-title {
    display: flex !important;
    align-items: flex-start !important; /* Changed from center */
    justify-content: flex-start !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    height: auto !important;
    align-self: flex-start !important;
  }

  .feature-title h3 {
    margin-top: 0 !important;
    padding-top: 0 !important;
    line-height: 0.9 !important; /* Tight line height to align with text baseline */
    display: block !important;
  }

  /* Ensure all elements start at the exact same pixel */
  .feature-description,
  .feature-video-container,
  .feature-title {
    position: relative !important;
    top: 0 !important;
  }
}

/* Fine-tune for different screen sizes */

/* Large screens (1440px+) */
@media screen and (min-width: 1440px) {
  a.feature-item,
  .feature-item {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }

  /* Adjust title line height for optical alignment */
  .feature-title h3 {
    line-height: 0.85 !important;
    /* Small negative margin to perfectly align with text baseline */
    margin-top: -0.15rem !important;
  }
}

/* Medium-large screens (1280px - 1439px) */
@media screen and (min-width: 1280px) and (max-width: 1439px) {
  a.feature-item,
  .feature-item {
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }

  .feature-title h3 {
    line-height: 0.88 !important;
    margin-top: -0.12rem !important;
  }
}

/* Small laptops (1024px - 1279px) */
@media screen and (min-width: 1024px) and (max-width: 1279px) {
  a.feature-item,
  .feature-item {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }

  .feature-title h3 {
    line-height: 0.9 !important;
    margin-top: -0.1rem !important;
  }
}

/* Very small laptops (768px - 1023px) */
@media screen and (min-width: 768px) and (max-width: 1023px) {
  a.feature-item,
  .feature-item {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  .feature-title h3 {
    line-height: 0.92 !important;
    margin-top: -0.08rem !important;
  }
}

/* Ensure video fills the full height of the feature item */
@media screen and (min-width: 768px) {
  .feature-video-container {
    height: 100% !important;
    min-height: 100% !important;
    aspect-ratio: unset !important;
    max-height: none !important;
    position: relative !important;
  }

  .feature-video {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
  }
}

/* Ensure feature items have sufficient height for video */
@media screen and (min-width: 1440px) {
  a.feature-item,
  .feature-item {
    min-height: 280px !important;
  }
}

@media screen and (min-width: 1280px) and (max-width: 1439px) {
  a.feature-item,
  .feature-item {
    min-height: 250px !important;
  }
}

@media screen and (min-width: 1024px) and (max-width: 1279px) {
  a.feature-item,
  .feature-item {
    min-height: 220px !important;
  }
}

@media screen and (min-width: 768px) and (max-width: 1023px) {
  a.feature-item,
  .feature-item {
    min-height: 200px !important;
  }
}

/* Debug helper - Uncomment to visualize alignment */
/*
@media screen and (min-width: 768px) {
  .feature-description::before,
  .feature-video-container::before,
  .feature-title::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: red;
    z-index: 999;
  }
}
*/

/* Ensure feature number stays with description */
@media screen and (min-width: 768px) {
  .feature-number {
    margin-top: auto !important; /* Push to bottom of description */
    padding-top: 1rem !important;
  }
}

/* Reset any conflicting vertical centering from other CSS files */
@media screen and (min-width: 768px) {
  a.feature-item,
  .feature-item {
    align-content: flex-start !important;
    align-items: flex-start !important;
  }

  a.feature-item > *,
  .feature-item > * {
    align-self: flex-start !important;
  }
}