/* Flight Factory Live Featured Products V1 */

#products .ff-live-featured-card {
  min-width: 0;
}

#products .ff-featured-product-link {
  display: block;
  text-decoration: none;
}

#products .ff-featured-product-link .product-img {
  height: 155px;
  overflow: hidden;
  background: #141414;
}

#products .ff-featured-product-link .product-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#products .ff-featured-product-link h3 {
  color: #fff;
  overflow-wrap: anywhere;
}

#products .ff-featured-stock {
  margin: 7px 0 12px;
  color: #72e29a;
  font-size: 12px;
  font-weight: bold;
}

#products .ff-featured-low {
  color: #ffba52;
}

#products .ff-featured-action {
  display: block;
  width: 100%;
  padding: 11px 8px;
  background: #ed1b24;
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: bold;
  border-radius: 2px;
}

#products .ff-featured-action:hover,
#products .ff-featured-action:focus-visible {
  background: #c8101b;
}

#products .ff-featured-message {
  color: #ddd;
  padding: 20px;
}

@media (max-width: 600px) {
  #products .ff-featured-product-link .product-img {
    height: 170px;
  }
}


/* FF_FEATURED_SLIDE_V5 */

/* Keep cards from creating sideways page scrolling */
#products {
  overflow: hidden;
}

#ffHomeFeatured {
  opacity: 1;
  transform: translateX(0);
}

#ffHomeFeatured.ff-slide-out {
  animation: ffFeaturedSlideOut .5s ease-in forwards;
}

#ffHomeFeatured.ff-slide-in {
  animation: ffFeaturedSlideIn .5s ease-out forwards;
}

@keyframes ffFeaturedSlideOut {
  from { transform: translateX(0); }
  to   { transform: translateX(-110%); }
}

@keyframes ffFeaturedSlideIn {
  from { transform: translateX(110%); }
  to   { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  #ffHomeFeatured.ff-slide-out,
  #ffHomeFeatured.ff-slide-in {
    animation-duration: .01ms;
  }
}


/* FF_FRED_HEADING_V1 */

/* Factory Fred's big cartoon-style showcase heading */
#products > .section-title {
    position: relative;
    display: flex;
    justify-content: flex-start;
    padding: 24px 0 30px;
    margin-bottom: 12px;
}

#products > .section-title h2 {
    position: relative;
    display: block;
    max-width: 76%;
    margin: 0;
    padding: 0 0 13px;
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: clamp(30px, 3.4vw, 59px);
    font-style: italic;
    font-weight: 900;
    line-height: 1.06;
    letter-spacing: -1.4px;
    text-transform: uppercase;
    text-shadow:
        3px 4px 0 #171717,
        5px 6px 2px #000;
}

#products > .section-title h2 span {
    display: block;
    color: #ed1b24;
    font-size: 1.12em;
    font-style: italic;
    font-weight: 900;
    text-shadow:
        3px 4px 0 #430006,
        5px 6px 3px #000;
}

#products > .section-title h2::after {
    content: "";
    position: absolute;
    left: 12%;
    bottom: 0;
    height: 5px;
    width: 85%;
    background: linear-gradient(
        90deg, transparent, #ed1b24 18%,
        #ff3333 75%, transparent
    );
    transform: skewX(-30deg);
    border-radius: 50%;
}

/* Mobile layout will be refined when Fred is installed */
@media (max-width: 700px) {
    #products > .section-title h2 {
        max-width: 100%;
        font-size: clamp(24px, 6vw, 34px);
    }
}


/* FF_FRED_CLEAN_DESKTOP_LAYOUT_V5 */

/* Fred is hidden on smaller screens until mobile is designed */
#products .ff-fred-showcase {
    display: none;
}

/* DESKTOP FACTORY FRED SHOWCASE */
@media (min-width: 1250px) {

    #products {
        position: relative;
        isolation: isolate;

        /* OUR FOUR ADJUSTABLE SETTINGS */
        --ff-fred-width: 71%;
        --ff-fred-top: 15px;
        --ff-fred-right: -30px;
        --ff-products-down: 105px;
    }

    /* Working featured products: four across, two rows */
    #products #ffHomeFeatured {
        width: 76% !important;
        max-width: 76% !important;
        grid-template-columns:
            repeat(4, minmax(0, 1fr)) !important;

        margin-top: var(--ff-products-down);
        position: relative;
        z-index: 1;
    }

    /* Full-length Factory Fred, separate from rotating grid */
    #products .ff-fred-showcase {
        display: block;
        position: absolute;

        top: var(--ff-fred-top);
        right: var(--ff-fred-right);
        width: var(--ff-fred-width);

        max-width: none;
        z-index: 2;
        pointer-events: none;
    }

    #products .ff-fred-showcase img {
        display: block;
        width: 100%;
        height: auto;
        object-fit: contain;
        pointer-events: none;
    }
}

/* Preserve current layout below desktop breakpoint */
@media (max-width: 1249px) {
    #products #ffHomeFeatured {
        width: 100% !important;
        max-width: 100% !important;
    }

    #products .ff-fred-showcase {
        display: none !important;
    }
}


/* FF_FRED_PRODUCT_ALIGNMENT_V6 */
@media (min-width: 1250px) {

    /* Extend the right-hand card slightly beneath Fred's fingers */
    #products #ffHomeFeatured {
        width: 79% !important;
        max-width: 79% !important;
    }

    /* Make both product rows a little more compact */
    #products .product-grid .product-img {
        height: 140px !important;
    }

    #products .ff-featured-product-link .product-img {
        height: 140px !important;
    }
}


/* FF_FRED_HEADING_LOWER_V7 */
@media (min-width: 1250px) {
    #products > .section-title {
        transform: translateY(85px);
    }
}


/* FF_FRED_MOBILE_SHOWCASE_V1 */

/* Hidden on desktop — original desktop Fred stays intact */
#products .ff-fred-mobile {
    display: none;
}

@media (max-width: 700px) {

    #products {
        position: relative;
    }

    /* Space for Fred between the heading and products */
    #products .ff-fred-mobile {
        display: block;
        position: relative;
        width: 100%;
        height: clamp(155px, 49vw, 210px);
        z-index: 3;
        pointer-events: none;
    }

    /* Fred sits on the right, leaning towards the first row */
    #products .ff-fred-mobile img {
        position: absolute;
        width: min(50vw, 230px);
        max-width: none;
        height: auto;
        top: -4px;
        right: 0;
        display: block;
        pointer-events: none;
    }

    /* Real product cards remain fully interactive */
    #products #ffHomeFeatured {
        position: relative;
        z-index: 1;
        width: 100% !important;
        max-width: 100% !important;
    }
}


/* FF_FRED_MOBILE_HEADING_POSITION_V2 */
@media (max-width: 700px) {
    #products > .section-title {
        transform: translateY(80px);
        position: relative;
        z-index: 4;
    }
}


/* FF_FRED_MOBILE_COMPACT_V3 */
@media (max-width: 700px) {

    /* Smaller heading, closer to the categories */
    #products > .section-title {
        transform: translateY(140px);
        z-index: 4;
    }

    #products > .section-title h2 {
        font-size: clamp(20px, 5vw, 26px);
        line-height: 1.05;
        letter-spacing: -0.5px;
    }

    #products > .section-title h2 span {
        font-size: 1.08em;
    }

    /* Move Fred AND the product cards up together */
    #products .ff-fred-mobile {
        margin-top: -60px;
    }

    /* Keep all product cards and buttons working */
    #products #ffHomeFeatured {
        position: relative;
        z-index: 1;
    }
}


/* FF_FRED_MOBILE_GAP_FIX_V4 */
@media (max-width: 700px) {

    /* Bring the entire Fred showcase closer to categories */
    #products {
        margin-top: -65px !important;
    }
}
