.home-featured-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 1rem;
    /* Use the shared Bootstrap container gutter used by every home-page row. */
    margin-inline: 0;
}

.home-featured-layout--products-only {
    grid-template-columns: minmax(0, 1fr);
}

.home-featured-layout--tip-only {
    grid-template-columns: minmax(0, 1fr);
}

/* A standalone Featured Products carousel follows the category and Best
   Sellers left edge. Its navigation controls sit outside the product track. */
.home-featured-layout--products-only .home-featured-products-heading {
    margin-left: 0;
}

.home-featured-layout--products-only .home-products-track-wrapper {
    padding-inline: 0;
}

.home-featured-layout--products-only .home-products-nav-prev {
    left: -2.35rem;
}

.home-featured-layout--products-only .home-products-nav-next {
    right: -2.35rem;
}

/* Preserve the Tip's one-third desktop column when it is the only promoted
   home-page item. */
.home-featured-layout--tip-only .home-favorite-tip {
    width: calc((100% - 1rem) / 3);
}

.home-favorite-tip-heading {
    display: inline-block;
    margin-bottom: .65rem;
    color: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
}

.home-favorite-tip-heading:hover {
    color: var(--site-brand-primary, #0057b8);
    text-decoration: underline;
}

.home-favorite-tip-card {
    display: block;
    overflow: hidden;
    border: 1px solid #d8e1ea;
    border-radius: .75rem;
    background: #fff;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 .25rem .8rem rgba(15, 23, 42, .08);
}

.home-favorite-tip-card:hover {
    color: inherit;
    box-shadow: 0 .45rem 1.1rem rgba(15, 23, 42, .14);
}

.home-favorite-tip-image-link,
.home-favorite-tip-title-link {
    color: inherit;
    text-decoration: none;
}

.home-favorite-tip-title-link:hover,
.home-favorite-tip-title-link:focus-visible {
    color: inherit;
    text-decoration: none;
}

.home-favorite-tip-card picture,
.home-favorite-tip-card img {
    display: block;
    width: 100%;
}

.home-favorite-tip-card img {
    aspect-ratio: 1600 / 375;
    object-fit: cover;
}

.home-favorite-tip-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.5rem;
}

.home-featured-placeholder {
    min-height: 100%;
    border-radius: .75rem;
    background: #fff;
}

.home-featured-products {
    min-width: 0;
    min-height: 100%;
}

.home-featured-products-heading {
    margin: 0 0 .65rem 2.9rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.home-best-sellers {
    margin-inline: 0;
}

.home-best-sellers-heading {
    margin: 0 0 .65rem;
    font-size: 1.1rem;
    font-weight: 700;
}

/* Keep Best Sellers aligned with the Tip card rather than reserving space
   inside the carousel for the navigation controls. */
.home-best-sellers .home-products-track-wrapper {
    padding-inline: 0;
}

.home-best-sellers .home-products-nav-prev {
    left: -2.35rem;
}

.home-best-sellers .home-products-nav-next {
    right: -2.35rem;
}

.home-products-carousel {
    position: relative;
}

.home-products-track-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 0 2.9rem;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}

.home-products-track-wrapper::-webkit-scrollbar {
    display: none;
}

.home-products-track {
    display: flex;
    gap: .75rem;
    min-width: max-content;
    padding-bottom: .25rem;
}

.home-products-item {
    width: 180px;
    flex: 0 0 auto;
    scroll-snap-align: start;
}

.home-product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid #d8e1ea;
    border-radius: .75rem;
    background: #fff;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 .2rem .65rem rgba(15, 23, 42, .08);
}

.home-product-card:hover {
    color: inherit;
    box-shadow: 0 .4rem 1rem rgba(15, 23, 42, .14);
}

.home-product-image {
    display: flex;
    height: 175px;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.home-product-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.home-product-image i {
    font-size: 2rem;
}

.home-product-name {
    min-height: 3.75em;
    margin: 0;
    padding: .75rem .75rem .5rem;
    color: #212529;
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.25;
}

.home-product-detail-btn {
    display: block;
    margin: auto .75rem .75rem;
    padding: .4rem .55rem;
    border-radius: .375rem;
    background: var(--site-brand-primary, #0057b8);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

.home-products-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 999px;
    background: var(--site-brand-primary, #0057b8);
    color: #fff;
    box-shadow: 0 .2rem .65rem rgba(0, 0, 0, .2);
}

.home-products-nav:disabled {
    opacity: .45;
}

.home-products-nav-prev { left: .35rem; }
.home-products-nav-next { right: .35rem; }

.home-main-heading {
    margin: 0 0 1rem;
    color: var(--site-text-color, #212529);
    font-size: clamp(1.3rem, 2.3vw, 2rem);
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
}

.catalog-carousel {
    position: relative;
}

.catalog-track-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    /* Keep category cards aligned with promotional and Best Seller rows. */
    padding: 0;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.catalog-track-wrapper::-webkit-scrollbar {
    display: none;
}

.catalog-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    min-width: max-content;
    padding-bottom: 4px;
}

.catalog-item {
    width: 240px;
    flex: 0 0 auto;
    scroll-snap-align: start;
}

.catalog-nav {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 999px;
    background: var(--site-brand-primary, #0057b8);
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .2);
}

.catalog-nav:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.catalog-nav-prev { left: 8px; }
.catalog-nav-next { right: 8px; }

@media (max-width: 991.98px) {
    .home-featured-layout {
        /* The mobile promotion area is a single full-width column, aligned
           directly with the category carousel above it. */
        display: block;
        width: 100%;
        margin-inline: 0;
    }

    .home-favorite-tip,
    .home-featured-products,
    .home-best-sellers {
        width: 100%;
        max-width: none;
        min-width: 0;
        margin-inline: 0;
    }

    .home-featured-products {
        margin-top: 1.5rem;
    }

    .home-featured-layout--tip-only .home-favorite-tip {
        width: 100%;
    }

    .home-favorite-tip-card img {
        aspect-ratio: 1600 / 375;
    }

    .home-favorite-tip-card {
        width: 100%;
    }

    .home-featured-placeholder {
        min-height: 12rem;
    }

    .home-products-item {
        width: 165px;
    }

    /* Align the heading and first featured-product card with the category
       carousel and Tip card. Keep the navigation controls outside the track. */
    .home-featured-products-heading {
        margin-left: 0;
    }

    .home-best-sellers {
        /* The section starts at the same left edge as the category track. */
        margin-inline: 0;
    }

    .home-best-sellers-heading {
        margin-left: 0;
    }

    .home-products-track-wrapper {
        padding-inline: 0;
        scroll-snap-type: x mandatory;
    }

    /* The track width matches the visible viewport. Each implicit grid column
       therefore occupies half of it, while additional cards remain swipeable. */
    .home-products-track {
        display: grid;
        /* Match the category carousel: two full cards in view with the
           remaining cards available by a horizontal swipe. */
        grid-auto-columns: calc((100% - 1rem) / 2);
        grid-auto-flow: column;
        gap: 1rem;
        min-width: 100%;
        width: 100%;
    }

    .home-products-item {
        width: auto;
    }

    .home-product-image {
        height: clamp(7.5rem, 32vw, 10.5rem);
    }

    .home-products-nav-prev,
    .home-best-sellers .home-products-nav-prev,
    .home-featured-layout--products-only .home-products-nav-prev {
        left: .35rem;
    }

    .home-products-nav-next,
    .home-best-sellers .home-products-nav-next,
    .home-featured-layout--products-only .home-products-nav-next {
        right: .35rem;
    }

    .catalog-track-wrapper {
        padding-inline: 0;
        scroll-snap-type: x mandatory;
    }

    /* Keep two complete category cards in the visible mobile viewport. */
    .catalog-track {
        display: grid;
        grid-auto-columns: calc((100% - 1rem) / 2);
        grid-auto-flow: column;
        min-width: 100%;
        width: 100%;
    }

    .catalog-item {
        width: auto;
    }

    .catalog-item .d-flex {
        height: clamp(8.5rem, 38vw, 13.75rem) !important;
    }
}
