/* ==========================================================
   RELATED PRODUCTS & UPSELLS
   ========================================================== */
.woocommerce .related,
.woocommerce .upsells {
    display: block;
    width: 100%;
    clear: both;
    margin-top: 56px;
}

.woocommerce .related > h2,
.woocommerce .upsells > h2 {
    font-family: var(--sl-font-display) !important;
    font-size: clamp(28px, 3vw, 36px) !important;
    font-weight: 400 !important;
    color: var(--sl-charcoal) !important;
    letter-spacing: -0.02em !important;
    margin-bottom: 24px !important;
}

.sl-related-products-footer {
    margin-top: 18px;
    display: flex;
    justify-content: center;
}

.sl-related-products-footer__link {
    min-width: 220px;
    justify-content: center;
}

.related.products > h2.sl-related-products-heading-row,
.related > h2.sl-related-products-heading-row,
.upsells.products > h2.sl-related-products-heading-row,
.upsells > h2.sl-related-products-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: nowrap;
}

.related.products > h2 .sl-related-products-heading-text,
.related > h2 .sl-related-products-heading-text,
.upsells.products > h2 .sl-related-products-heading-text,
.upsells > h2 .sl-related-products-heading-text {
    display: inline-block;
    line-height: 1.05;
    flex: 1 1 auto;
}

.related.products > h2 .sl-related-products-footer,
.related > h2 .sl-related-products-footer,
.upsells.products > h2 .sl-related-products-footer,
.upsells > h2 .sl-related-products-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    margin: 0;
}

.related.products > h2 .sl-related-products-footer__link,
.related > h2 .sl-related-products-footer__link,
.upsells.products > h2 .sl-related-products-footer__link,
.upsells > h2 .sl-related-products-footer__link {
    min-width: 0;
    padding: 12px 24px;
    border-radius: 999px;
    line-height: 1;
    white-space: nowrap;
}

.sl-related-carousel-nav {
    display: none;
}

.woocommerce .related ul.products,
.woocommerce .upsells ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: var(--sl-card-gap) !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.woocommerce .related ul.products li.product,
.woocommerce .upsells ul.products li.product {
    background: var(--sl-white);
    border-radius: var(--sl-radius);
    border: 1px solid var(--sl-sand);
    overflow: hidden;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    float: none !important;
    width: 100% !important;
    clear: none !important;
}

.woocommerce .related ul.products li.product:hover,
.woocommerce .upsells ul.products li.product:hover {
    transform: translateY(-4px);
    box-shadow: var(--sl-shadow-lift);
}

.woocommerce .related ul.products li.product a img,
.woocommerce .upsells ul.products li.product a img {
    aspect-ratio: 4 / 5 !important;
    width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
    display: block !important;
}

.woocommerce .related ul.products li.product .woocommerce-loop-product__title,
.woocommerce .upsells ul.products li.product .woocommerce-loop-product__title {
    font-family: var(--sl-font-display) !important;
    font-size: 17px !important;
    font-weight: 500 !important;
    color: var(--sl-charcoal) !important;
    padding: 14px 16px 4px !important;
    line-height: 1.35 !important;
}

.woocommerce .related ul.products li.product .price,
.woocommerce .upsells ul.products li.product .price {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--sl-charcoal) !important;
    padding: 4px 16px 14px !important;
    display: block !important;
}

.woocommerce .related ul.products li.product .price del,
.woocommerce .upsells ul.products li.product .price del {
    color: var(--sl-mist) !important;
    font-size: 12px !important;
}

.woocommerce .related ul.products li.product .price ins,
.woocommerce .upsells ul.products li.product .price ins {
    text-decoration: none !important;
    color: var(--sl-terracotta) !important;
}

.woocommerce .related ul.products li.product .button,
.woocommerce .upsells ul.products li.product .button {
    margin: 0 16px 16px !important;
    width: calc(100% - 32px) !important;
    text-align: center !important;
    font-size: 11px !important;
    padding: 10px 16px !important;
    border-radius: var(--sl-radius-pill) !important;
}

/* Single product related-card refinement */
body.single-product .related ul.products li.product.sl-product-card,
body.single-product .upsells ul.products li.product.sl-product-card {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
}

body.single-product .related .sl-product-card-box,
body.single-product .upsells .sl-product-card-box {
    background: var(--sl-white);
    border: 1px solid var(--sl-sand);
    border-radius: 18px;
    box-shadow: var(--sl-shadow-soft);
    padding-bottom: 14px;
}

body.single-product .related .sl-product-img-wrap,
body.single-product .upsells .sl-product-img-wrap {
    aspect-ratio: 4 / 5;
    background: var(--sl-cream-deep);
}

body.single-product .related .sl-product-card-box .sl-product-info,
body.single-product .upsells .sl-product-card-box .sl-product-info {
    padding: 14px 16px 0;
    gap: 10px;
}

body.single-product .related .sl-product-name,
body.single-product .upsells .sl-product-name {
    margin-bottom: 0;
    font-size: 16px;
    line-height: 1.35;
    min-height: 2.7em;
}

body.single-product .related .sl-price-current,
body.single-product .upsells .sl-price-current {
    font-size: 15px;
    font-weight: 700;
    color: var(--sl-charcoal);
}

body.single-product .related .sl-price-old,
body.single-product .upsells .sl-price-old {
    font-size: 13px;
    color: var(--sl-mist);
}

body.single-product .related .sl-product-card-actions,
body.single-product .upsells .sl-product-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
    padding: 0 16px;
}

body.single-product .related .sl-product-card-actions .sl-add-btn,
body.single-product .related .sl-product-card-actions .sl-buy-now-btn,
body.single-product .upsells .sl-product-card-actions .sl-add-btn,
body.single-product .upsells .sl-product-card-actions .sl-buy-now-btn {
    width: 100%;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: center;
    text-decoration: none;
}

body.single-product .related .sl-product-card-actions .sl-add-btn,
body.single-product .upsells .sl-product-card-actions .sl-add-btn {
    background: var(--sl-cream-deep);
    border: 1px solid var(--sl-sand);
    color: var(--sl-charcoal);
}

body.single-product .related .sl-product-card-actions .sl-add-btn:hover,
body.single-product .upsells .sl-product-card-actions .sl-add-btn:hover {
    background: var(--sl-sand);
    border-color: var(--sl-sand-dark);
}

body.single-product .related .sl-product-card-actions .sl-buy-now-btn,
body.single-product .upsells .sl-product-card-actions .sl-buy-now-btn {
    background: var(--sl-sage);
    border: 1px solid var(--sl-sage);
    color: var(--sl-white);
}

body.single-product .related .sl-product-card-actions .sl-buy-now-btn:hover,
body.single-product .upsells .sl-product-card-actions .sl-buy-now-btn:hover {
    background: var(--sl-sage-dark);
    border-color: var(--sl-sage-dark);
    color: var(--sl-white);
}


@media (max-width: 767px) {
    .related.products,
    .related,
    .upsells.products,
    .upsells {
        overflow: hidden;
    }

    .related.products > h2.sl-related-products-heading-row,
    .related > h2.sl-related-products-heading-row,
    .upsells.products > h2.sl-related-products-heading-row,
    .upsells > h2.sl-related-products-heading-row {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        column-gap: 12px;
        row-gap: 8px;
        align-items: start;
        margin-bottom: 14px;
    }

    .related.products > h2 .sl-related-products-heading-text,
    .related > h2 .sl-related-products-heading-text,
    .upsells.products > h2 .sl-related-products-heading-text,
    .upsells > h2 .sl-related-products-heading-text {
        grid-column: 1;
        grid-row: 1 / span 2;
        align-self: center;
        min-width: 0;
        line-height: 1.04;
        font-size: clamp(28px, 6.6vw, 38px);
    }

    .related.products > h2 .sl-related-products-footer,
    .related > h2 .sl-related-products-footer,
    .upsells.products > h2 .sl-related-products-footer,
    .upsells > h2 .sl-related-products-footer {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        align-self: start;
        margin: 0;
    }

    .related.products > h2 .sl-related-products-footer__link,
    .related > h2 .sl-related-products-footer__link,
    .upsells.products > h2 .sl-related-products-footer__link,
    .upsells > h2 .sl-related-products-footer__link {
        width: auto;
        padding: 11px 18px;
        min-height: 44px;
        font-size: 12px;
        letter-spacing: 0.06em;
    }

    .sl-related-carousel-nav {
        display: inline-flex;
        grid-column: 2;
        grid-row: 2;
        justify-self: end;
        align-self: start;
        margin: 0;
        gap: 7px;
    }

    .sl-related-carousel-arrow {
        width: 34px;
        height: 34px;
        border-radius: 999px;
        border: 1px solid rgba(28, 28, 28, 0.14);
        background: rgba(255, 255, 255, 0.92);
        color: #1c1c1c;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        font-size: 20px;
        line-height: 1;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    }

    .sl-related-carousel-arrow[disabled] {
        opacity: 0.42;
        box-shadow: none;
    }

    body.single-product .related,
    body.single-product .upsells {
        position: relative;
        overflow: hidden;
    }

    body.single-product .related .products,
    body.single-product .upsells .products {
        display: flex !important;
        gap: 14px;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        scrollbar-width: none;
        padding: 4px 34px 12px 2px;
        margin: 8px 0 0;
        scroll-padding-left: 2px;
        overscroll-behavior-x: contain;
    }

    body.single-product .related .products::-webkit-scrollbar,
    body.single-product .upsells .products::-webkit-scrollbar {
        display: none;
    }

    body.single-product .related .products > li,
    body.single-product .upsells .products > li,
    body.single-product .related ul.products li.product,
    body.single-product .upsells ul.products li.product {
        flex: 0 0 min(82vw, 320px) !important;
        width: min(82vw, 320px) !important;
        max-width: min(82vw, 320px) !important;
        min-width: min(82vw, 320px) !important;
        margin: 0 !important;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    body.single-product .related::after,
    body.single-product .upsells::after {
        content: '';
        position: absolute;
        top: 76px;
        right: 0;
        bottom: 0;
        width: 28px;
        pointer-events: none;
        background: linear-gradient(to right, rgba(247, 245, 239, 0), rgba(247, 245, 239, 1));
    }
}

/* ==========================================================
   PHASE 4 RELATED / UPSELLS RESPONSIVE CLEANUP
   ========================================================== */
@media (max-width: 1023px) {
    .woocommerce .related ul.products,
    .woocommerce .upsells ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 767px) {
    .woocommerce .related ul.products,
    .woocommerce .upsells ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    body.single-product .related .sl-product-card-box,
    body.single-product .upsells .sl-product-card-box {
        border-radius: 14px;
    }

    body.single-product .related .sl-product-card-box .sl-product-info,
    body.single-product .upsells .sl-product-card-box .sl-product-info {
        padding: 12px 14px 0;
        gap: 8px;
    }

    body.single-product .related .sl-product-name,
    body.single-product .upsells .sl-product-name {
        font-size: 14px;
    }

    body.single-product .related .sl-product-card-actions,
    body.single-product .upsells .sl-product-card-actions {
        padding: 0 14px;
        gap: 6px;
        margin-top: 10px;
    }

    body.single-product .related .sl-product-card-actions .sl-add-btn,
    body.single-product .related .sl-product-card-actions .sl-buy-now-btn,
    body.single-product .upsells .sl-product-card-actions .sl-add-btn,
    body.single-product .upsells .sl-product-card-actions .sl-buy-now-btn {
        min-height: 40px;
        font-size: 10px;
    }
}


/* ==========================================================
   PHASE 1 PDP RELATED PRODUCTS UPGRADE
   ========================================================== */
body.single-product .related ul.products li.product.sl-product-card--single-cta .sl-product-card-actions,
body.single-product .upsells ul.products li.product.sl-product-card--single-cta .sl-product-card-actions {
    grid-template-columns: 1fr;
}

body.single-product .related ul.products li.product.sl-product-card--single-cta .sl-view-btn,
body.single-product .upsells ul.products li.product.sl-product-card--single-cta .sl-view-btn {
    min-height: 46px;
    border-radius: 14px;
    background: var(--sl-cream-deep);
    border-color: var(--sl-sand);
    color: var(--sl-charcoal);
}

body.single-product .related > h2,
body.single-product .upsells > h2 {
    margin-bottom: 18px !important;
}

@media (max-width: 767px) {
    .related.products > h2 .sl-related-products-heading-text,
    .related > h2 .sl-related-products-heading-text,
    .upsells.products > h2 .sl-related-products-heading-text,
    .upsells > h2 .sl-related-products-heading-text {
        font-size: clamp(24px, 7vw, 34px);
    }

    .related.products > h2 .sl-related-products-footer__link,
    .related > h2 .sl-related-products-footer__link,
    .upsells.products > h2 .sl-related-products-footer__link,
    .upsells > h2 .sl-related-products-footer__link {
        padding: 10px 16px;
        min-height: 42px;
        font-size: 11px;
    }

    body.single-product .related .products > li,
    body.single-product .upsells .products > li,
    body.single-product .related ul.products li.product,
    body.single-product .upsells ul.products li.product {
        flex: 0 0 min(78vw, 300px) !important;
        width: min(78vw, 300px) !important;
        max-width: min(78vw, 300px) !important;
        min-width: min(78vw, 300px) !important;
    }
}


/* ==========================================================
   PHASE 2 SINGLE PRODUCT MERCHANDISING POLISH
   - cleaner related heading
   - easier browsing chips
   - calmer related card rhythm on mobile
   ========================================================== */
.sl-single-product-browse-more {
    margin-top: 22px;
    padding-top: 8px;
}

.sl-single-product-browse-more__title {
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 1.2;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sl-mist);
    font-weight: 700;
}

.sl-single-product-browse-more__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sl-single-product-browse-more__chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(214, 204, 190, 0.9);
    background: rgba(255, 255, 255, 0.78);
    color: var(--sl-charcoal);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.sl-single-product-browse-more__chip:hover,
.sl-single-product-browse-more__chip:focus-visible {
    border-color: rgba(92, 122, 94, 0.28);
    background: rgba(247, 245, 239, 0.96);
    transform: translateY(-1px);
}

.sl-single-product-browse-more__chip.is-current {
    border-color: rgba(92, 122, 94, 0.34);
    background: rgba(92, 122, 94, 0.1);
    color: var(--sl-sage);
}

@media (max-width: 767px) {
    .related.products > h2.sl-related-products-heading-row,
    .related > h2.sl-related-products-heading-row,
    .upsells.products > h2.sl-related-products-heading-row,
    .upsells > h2.sl-related-products-heading-row {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto auto;
        row-gap: 10px;
        margin-bottom: 12px;
    }

    .related.products > h2 .sl-related-products-heading-text,
    .related > h2 .sl-related-products-heading-text,
    .upsells.products > h2 .sl-related-products-heading-text,
    .upsells > h2 .sl-related-products-heading-text {
        grid-column: 1;
        grid-row: 1;
        font-size: clamp(22px, 6.4vw, 30px);
        line-height: 1.08;
        max-width: 10ch;
    }

    .related.products > h2 .sl-related-products-footer,
    .related > h2 .sl-related-products-footer,
    .upsells.products > h2 .sl-related-products-footer,
    .upsells > h2 .sl-related-products-footer {
        grid-column: 1;
        grid-row: 2;
        justify-self: start;
    }

    .related.products > h2 .sl-related-products-footer__link,
    .related > h2 .sl-related-products-footer__link,
    .upsells.products > h2 .sl-related-products-footer__link,
    .upsells > h2 .sl-related-products-footer__link {
        min-height: 40px;
        padding: 10px 15px;
        font-size: 11px;
        letter-spacing: 0.04em;
    }

    .sl-related-carousel-nav {
        grid-column: 1;
        grid-row: 3;
        justify-self: start;
    }

    body.single-product .related .products,
    body.single-product .upsells .products {
        gap: 12px;
        padding: 4px 24px 12px 2px;
        margin-top: 6px;
    }

    body.single-product .related .products > li,
    body.single-product .upsells .products > li,
    body.single-product .related ul.products li.product,
    body.single-product .upsells ul.products li.product {
        flex: 0 0 min(76vw, 286px) !important;
        width: min(76vw, 286px) !important;
        max-width: min(76vw, 286px) !important;
        min-width: min(76vw, 286px) !important;
    }

    body.single-product .related .sl-product-card-box,
    body.single-product .upsells .sl-product-card-box {
        border-radius: 16px;
        padding-bottom: 12px;
    }

    body.single-product .related .sl-product-card-box .sl-product-info,
    body.single-product .upsells .sl-product-card-box .sl-product-info {
        padding: 12px 14px 0;
        gap: 8px;
    }

    body.single-product .related .sl-product-name,
    body.single-product .upsells .sl-product-name {
        font-size: 15px;
        line-height: 1.32;
        min-height: 2.64em;
    }

    body.single-product .related .sl-product-card-actions,
    body.single-product .upsells .sl-product-card-actions {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 0 14px;
        margin-top: 10px;
    }

    body.single-product .related ul.products li.product.sl-product-card--single-cta .sl-view-btn,
    body.single-product .upsells ul.products li.product.sl-product-card--single-cta .sl-view-btn {
        min-height: 44px;
        border-radius: 14px;
        font-size: 12px;
        letter-spacing: 0.04em;
    }

    .sl-single-product-browse-more {
        margin-top: 18px;
    }

    .sl-single-product-browse-more__chips {
        gap: 8px;
    }

    .sl-single-product-browse-more__chip {
        min-height: 40px;
        padding: 10px 14px;
        font-size: 11px;
    }
}


/* ==========================================================
   PHASE 4C SINGLE PRODUCT NAVIGATION HUB
   Customer route card before related products
   ========================================================== */
body.single-product .sl-single-product-browse-more {
    position: relative;
    margin: 28px 0 32px;
    padding: 24px;
    border: 1px solid rgba(214, 204, 190, 0.84);
    border-radius: 26px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.92), rgba(250,246,239,0.84));
    box-shadow: 0 16px 38px rgba(38, 34, 29, 0.06);
}

body.single-product .sl-single-product-browse-more__eyebrow {
    margin: 0 0 8px;
    color: var(--sl-sage-dark);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    line-height: 1.2;
    text-transform: uppercase;
}

body.single-product .sl-single-product-browse-more__title {
    margin: 0;
    color: var(--sl-charcoal);
    font-family: var(--sl-font-serif);
    font-size: clamp(34px, 5vw, 48px);
    font-weight: 500;
    line-height: 1.04;
    letter-spacing: -0.035em;
    text-transform: none;
}

body.single-product .sl-single-product-browse-more__text {
    margin: 10px 0 18px;
    max-width: 620px;
    color: rgba(32,32,32,0.66);
    font-size: 16px;
    line-height: 1.65;
}

body.single-product .sl-single-product-browse-more__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

body.single-product .sl-single-product-browse-more__chip {
    min-height: 44px;
    padding: 11px 17px;
    border: 1px solid rgba(214, 204, 190, 0.88);
    border-radius: 999px;
    background: rgba(255,255,255,0.86);
    color: var(--sl-charcoal);
    font-size: 13px;
    font-weight: 750;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 18px rgba(38, 34, 29, 0.04);
}

body.single-product .sl-single-product-browse-more__chip.is-current {
    border-color: rgba(92, 122, 94, 0.34);
    background: rgba(92, 122, 94, 0.12);
    color: var(--sl-sage-dark);
}

body.single-product .sl-single-product-browse-more__chip:hover,
body.single-product .sl-single-product-browse-more__chip:focus-visible {
    border-color: rgba(92, 122, 94, 0.32);
    background: rgba(255,255,255,0.98);
    color: var(--sl-sage-dark);
    transform: translateY(-1px);
}

@media (max-width: 767px) {
    body.single-product .sl-single-product-browse-more {
        margin: 24px 0 28px;
        padding: 22px 0 22px;
        border-radius: 24px;
        overflow: hidden;
    }

    body.single-product .sl-single-product-browse-more__eyebrow,
    body.single-product .sl-single-product-browse-more__title,
    body.single-product .sl-single-product-browse-more__text {
        padding-inline: 20px;
    }

    body.single-product .sl-single-product-browse-more__title {
        font-size: clamp(35px, 10vw, 44px);
    }

    body.single-product .sl-single-product-browse-more__text {
        margin-bottom: 16px;
        font-size: 15px;
        line-height: 1.58;
    }

    body.single-product .sl-single-product-browse-more__chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 9px;
        padding: 0 20px 4px;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
        mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 24px), transparent 100%);
        -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18px, #000 calc(100% - 24px), transparent 100%);
    }

    body.single-product .sl-single-product-browse-more__chips::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }

    body.single-product .sl-single-product-browse-more__chip {
        flex: 0 0 auto;
        min-height: 42px;
        padding: 10px 16px;
        white-space: nowrap;
        scroll-snap-align: start;
    }

    body.single-product .related,
    body.single-product .related.products,
    body.single-product .upsells,
    body.single-product .upsells.products {
        margin-top: 20px !important;
    }
}
