/* =============================================================
   Related / Upsell / Crosssell — dedicated stylesheet
   Loaded only on PDP + cart pages via layout XML.
   Class namespace: rwc-rcs (Related/Crosssell/Upsell — Sections).
   Current scope: RELATED only. Upsell + crosssell still use core
   markup and core classes; their styling lands in a later phase.

   v2 addition: `.rwc-rcs--right-col` variant + `.rwc-rcs--placeholder`
   for the PDP right-column recommendations block. See bottom of file.
   ============================================================= */
.rwc-rcs {
    width: 100%;
    max-width: 1280px;
    margin: 48px auto 0;
    padding: 0 16px;
    clear: both;
    float: none;
}
.rwc-rcs__header {
    border-bottom: 1px solid var(--ss-line, var(--border-card));
    padding-bottom: 12px;
    margin-bottom: 24px;
    text-align: center;
}
.rwc-rcs__title {
    margin: 0;
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 22px;
    line-height: 1.2;
    color: var(--ss-ink, var(--text-primary));
    letter-spacing: -0.01em;
}
.rwc-rcs__subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--ss-ink-3, var(--text-faint));
    line-height: 1.4;
}

/* ── Upsell variant — full-width bottom strip (row 3 on PDP).
      Was compact comparison strip with left accent stripe when nested in
      right column; now that it lives full-width at the bottom, the stripe
      hugging the page edge reads oddly, so the accent moved to header
      border only. ── */
.rwc-rcs--upsell {
    margin-top: 24px;
    margin-bottom: 8px;
}
.rwc-rcs--upsell .rwc-rcs__header {
    padding-bottom: 8px;
    margin-bottom: 14px;
    border-bottom-color: var(--success-soft);
}
.rwc-rcs--upsell .rwc-rcs__title {
    font-size: 17px;
}
.rwc-rcs--upsell .rwc-rcs__subtitle {
    font-size: 12px;
    margin-top: 2px;
}
.rwc-rcs--upsell .rwc-rcs__grid {
    gap: 14px;
}
.rwc-rcs--upsell .rwc-rcs__card {
    padding: 8px;
    gap: 6px;
}
/* max-width:110px on the image container removed — vestigial from the
   old horizontal card design where images sat in a 100px left cell.
   With vertical cards it clamps images to a tiny left-aligned square. */
.rwc-rcs--upsell .rwc-rcs__name {
    font-size: 12px;
    min-height: 32px;
}
.rwc-rcs--upsell .rwc-rcs__price .price {
    font-size: 13px;
}
.rwc-rcs--upsell .rwc-rcs__cta {
    padding: 6px 10px;
    font-size: 11px;
}

/* ── Crosssell variant — cart page complement strip.
      Blue left-border to distinguish from upsell's teal; compact like upsell
      so it doesn't dwarf the cart line items and summary. ── */
.rwc-rcs--crosssell {
    margin-top: 32px;
    margin-bottom: 16px;
    padding-left: 14px;
    border-left: 3px solid var(--ss-blue, var(--accent-hover));
}
.rwc-rcs--crosssell .rwc-rcs__header {
    padding-bottom: 8px;
    margin-bottom: 14px;
    border-bottom-color: var(--accent-border);
}
.rwc-rcs--crosssell .rwc-rcs__title {
    font-size: 17px;
}
.rwc-rcs--crosssell .rwc-rcs__subtitle {
    font-size: 12px;
    margin-top: 2px;
}
.rwc-rcs--crosssell .rwc-rcs__grid {
    gap: 14px;
}
.rwc-rcs--crosssell .rwc-rcs__card {
    padding: 8px;
    gap: 6px;
}
/* max-width:110px on the image container removed — same reason as upsell. */
.rwc-rcs--crosssell .rwc-rcs__name {
    font-size: 12px;
    min-height: 32px;
}
.rwc-rcs--crosssell .rwc-rcs__price .price {
    font-size: 13px;
}
.rwc-rcs--crosssell .rwc-rcs__cta {
    padding: 6px 10px;
    font-size: 11px;
}

/* Cart-page positioning: float into the items column so summary expansion
   on the right doesn't push cross-sell down.
   .cart-container .form-cart  → float:left  width:73%
   .cart-summary               → float:right width:23%
   crosssell mirrors form-cart and clears left to drop under the items. */
.cart-container .rwc-rcs--crosssell {
    float: left;
    clear: left;
    width: 73%;
    margin-right: 4%;
    max-width: none;
    margin-left: 0;
}
@media (max-width: 768px) {
    .cart-container .rwc-rcs--crosssell {
        float: none;
        width: 100%;
        margin-right: 0;
    }
}

/* ── Grid — vertical cards, fixed width, LEFT-aligned so 2 cards don't
       stretch to fill the row. Uses flex-wrap instead of grid so items
       don't get equal-width when there are fewer than the "fits" count. */
.rwc-rcs__grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 16px;
}

/* ── Card — vertical layout: image on top, text stack below, small CTA at bottom.
       Fixed width (200px) so N items always render as N compact tiles, not stretched.
       Matches ULINE/Grainger/McMaster distributor card pattern. */
.rwc-rcs__card {
    flex: 0 0 200px;
    max-width: 200px;
    margin: 0;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--ss-line, var(--border-card));
    border-radius: 6px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.rwc-rcs__card:hover {
    border-color: var(--ss-blue, var(--accent-hover));
    box-shadow: var(--shadow-card-lift);
    transform: translateY(-2px);
}

/* ── Image — square thumb on top ── */
.rwc-rcs__image {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    margin: 0;
    background: #fff;
    border: 1px solid var(--ss-border);
    border-radius: 4px;
    overflow: hidden;
}
.rwc-rcs__image .product-image-container {
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    display: block;
}
.rwc-rcs__image .product-image-wrapper {
    padding: 0 !important;
    height: 100% !important;
}
.rwc-rcs__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    position: static !important;
}

/* ── Name — 2 lines max, small, dark ink ── */
.rwc-rcs__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.35;
    min-height: calc(12px * 1.35 * 2); /* reserve 2 lines so cards align */
    color: var(--ss-ink, var(--text-primary));
    text-decoration: none;
    margin: 0;
}
.rwc-rcs__name:hover {
    color: var(--ss-blue, var(--accent-hover));
}

/* ── Price ── */
.rwc-rcs__price {
    margin: 0;
    line-height: 1;
}
.rwc-rcs__price .price {
    font-family: var(--ss-mono);
    font-weight: 700;
    font-size: 13px;
    color: var(--ss-ink, var(--text-primary));
}

/* ── CTA — small, quiet, single action per card. Kept at card bottom via
       margin-top:auto pushing it to the end of the flex column. */
.rwc-rcs__atc-form {
    margin: auto 0 0;
    padding: 0;
}
.rwc-rcs__cta {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    line-height: 1.3;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .04em;
    border: 1px solid var(--ss-blue, var(--accent-hover));
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-card);
    color: var(--ss-blue, var(--accent-hover));
    transition: background .12s ease, color .12s ease;
}
.rwc-rcs__cta span {
    display: inline;
    line-height: 1.3;
}
.rwc-rcs__cta:hover {
    background: var(--ss-blue, var(--accent-hover));
    color: var(--bg-card);
}

/* ── Tablet ── (auto — flex-wrap handles it) */

/* ── Mobile: horizontal snap-scroll carousel + compact sizing ── */
@media (max-width: 639px) {
    .rwc-rcs {
        margin-top: 24px;
        padding: 0 12px;
        box-sizing: border-box;
        overflow-x: hidden; /* clip carousel cards bleeding past the section right edge */
    }
    .rwc-rcs__header {
        margin-bottom: 16px;
        padding-bottom: 10px;
    }
    .rwc-rcs__title { font-size: 16px; }
    .rwc-rcs__subtitle { font-size: 11px; }

    .rwc-rcs__grid {
        display: flex;
        flex-wrap: nowrap;
        grid-template-columns: none;
        width: 100%;
        box-sizing: border-box;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        gap: 10px;
        padding-bottom: 12px;
        scrollbar-width: thin;
    }
    .rwc-rcs__card {
        flex: 0 0 55%;
        scroll-snap-align: start;
        padding: 8px;
        gap: 4px;
    }
    .rwc-rcs__image .product-image-container { max-width: 110px; }
    .rwc-rcs__name { font-size: 12px; min-height: 32px; }
    .rwc-rcs__price .price { font-size: 13px; }
    .rwc-rcs__cta { font-size: 11px; padding: 6px 8px; }

    /* upsell + crosssell: shrink the teal/blue accent padding-left and title */
    .rwc-rcs--upsell,
    .rwc-rcs--crosssell {
        margin-top: 20px;
        padding-left: 10px;
    }
    .rwc-rcs--upsell .rwc-rcs__title,
    .rwc-rcs--crosssell .rwc-rcs__title { font-size: 15px; }
    .rwc-rcs--upsell .rwc-rcs__subtitle,
    .rwc-rcs--crosssell .rwc-rcs__subtitle { font-size: 11px; }
}

/* =============================================================
   RIGHT-COLUMN VARIANT — .rwc-rcs--right-col
   Sits inside product.info.main (the buy pane column) on PDP.
   Narrower than the full-width main variant; 2-per-row grid,
   compact cards, tight spacing. Also styles the PLACEHOLDER
   image mode (.rwc-rcs__image--placeholder).
   ============================================================= */

.product-info-main .rwc-rcs,
.rwc-rcs--right-col {
    width: 100%;
    max-width: none;
    margin: 20px 0 0;
    padding: 0;
    float: none;
    clear: none;
}
/* Upsell keeps the teal accent stripe (primary recs — high visual weight) */
.product-info-main .rwc-rcs.rwc-rcs--upsell,
.rwc-rcs--right-col.rwc-rcs--upsell {
    padding-left: 12px;
    margin-top: 20px;
    border-left: 3px solid var(--success, #10b981);
}
/* Crosssell mirrors upsell but with blue accent */
.product-info-main .rwc-rcs.rwc-rcs--crosssell,
.rwc-rcs--right-col.rwc-rcs--crosssell {
    padding-left: 12px;
    margin-top: 20px;
    border-left: 3px solid var(--ss-blue, #3b82f6);
}
/* Related loses the accent stripe entirely — secondary "keep browsing" prompt.
   Uses a dashed rule + extra top margin to feel like a distinct block below the
   primary upsell recs, not a mirror of them. */
.product-info-main .rwc-rcs.rwc-rcs--related,
.rwc-rcs--right-col.rwc-rcs--related {
    margin-top: 28px;
    padding-top: 20px;
    padding-left: 0;
    border-top: 1px dashed var(--ss-line, #e2e8f0);
    border-left: none;
}
.product-info-main .rwc-rcs .rwc-rcs__header,
.rwc-rcs--right-col .rwc-rcs__header {
    padding-bottom: 8px;
    margin-bottom: 12px;
}
.product-info-main .rwc-rcs .rwc-rcs__title,
.rwc-rcs--right-col .rwc-rcs__title {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--ss-ink, #0f172a);
}
.product-info-main .rwc-rcs .rwc-rcs__subtitle,
.rwc-rcs--right-col .rwc-rcs__subtitle {
    font-size: 11px;
    margin-top: 2px;
    color: var(--ss-ink-3, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Grid: 2 cards per row, tight gap */
.product-info-main .rwc-rcs .rwc-rcs__grid,
.rwc-rcs--right-col .rwc-rcs__grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

/* Card */
.product-info-main .rwc-rcs .rwc-rcs__card,
.rwc-rcs--right-col .rwc-rcs__card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    margin: 0;
    background: var(--ss-white, #ffffff);
    border: 1px solid var(--ss-border, #e2e8f0);
    border-radius: 10px;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.product-info-main .rwc-rcs .rwc-rcs__card:hover,
.rwc-rcs--right-col .rwc-rcs__card:hover {
    border-color: var(--ss-blue, #3b82f6);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

/* Image — 3:2 aspect (less dominating than 1:1) */
.product-info-main .rwc-rcs .rwc-rcs__image,
.rwc-rcs--right-col .rwc-rcs__image {
    display: block;
    aspect-ratio: 3 / 2;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    max-width: 100%;
}
.product-info-main .rwc-rcs .rwc-rcs__image .product-image-container,
.rwc-rcs--right-col .rwc-rcs__image .product-image-container {
    max-width: 100%;
    width: 100%;
    height: 100%;
    display: block;
}
.product-info-main .rwc-rcs .rwc-rcs__image .product-image-wrapper,
.rwc-rcs--right-col .rwc-rcs__image .product-image-wrapper {
    padding: 0 !important;
    height: 100% !important;
}
.product-info-main .rwc-rcs .rwc-rcs__image img,
.rwc-rcs--right-col .rwc-rcs__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    position: static !important;
}
/* Mute Mage-OS "no image" placeholder so it doesn't read as a broken tile */
.product-info-main .rwc-rcs .rwc-rcs__image img[src*="placeholder"],
.rwc-rcs--right-col .rwc-rcs__image img[src*="placeholder"] {
    opacity: 0.35;
    filter: saturate(0);
}

/* Placeholder image tile — colored bg + centered SVG mark */
.rwc-rcs__image--placeholder {
    position: relative;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: var(--ph-bg, #f1f5f9) !important;
}
.rwc-rcs__image--placeholder .rwc-rcs__ph-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    color: var(--ss-ink-2, #64748b);
}

/* Name */
.product-info-main .rwc-rcs .rwc-rcs__name,
.rwc-rcs--right-col .rwc-rcs__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.35;
    color: var(--ss-ink, #0f172a);
    min-height: 32px;
    margin: 0;
    text-decoration: none;
}
.product-info-main .rwc-rcs .rwc-rcs__name:hover,
.rwc-rcs--right-col .rwc-rcs__name:hover {
    color: var(--ss-blue, #3b82f6);
}

/* Price */
.product-info-main .rwc-rcs .rwc-rcs__price,
.rwc-rcs--right-col .rwc-rcs__price {
    margin: 0;
    font-family: var(--ss-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 13px;
    font-weight: 600;
    color: var(--ss-ink, #0f172a);
    line-height: 1.2;
}
.product-info-main .rwc-rcs .rwc-rcs__price .price,
.rwc-rcs--right-col .rwc-rcs__price .price {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

/* CTA — base shape (flat, no radius, matches right-column design language) */
.product-info-main .rwc-rcs .rwc-rcs__cta,
.rwc-rcs--right-col .rwc-rcs__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
    text-decoration: none;
    margin-top: auto;
    width: 100%;
    text-align: center;
    min-height: 32px;
    line-height: 1;
    box-sizing: border-box;
}

/* PRIMARY — Add to Cart: filled accent, loud, the purchase action */
.product-info-main .rwc-rcs .rwc-rcs__cta--atc,
.rwc-rcs--right-col .rwc-rcs__cta--atc {
    background: var(--ss-blue, #3b82f6);
    border-color: var(--ss-blue, #3b82f6);
    color: #fff;
}
.product-info-main .rwc-rcs .rwc-rcs__cta--atc:hover,
.rwc-rcs--right-col .rwc-rcs__cta--atc:hover {
    background: var(--ss-blue-dk, #1e40af);
    border-color: var(--ss-blue-dk, #1e40af);
    color: #fff;
}

/* SECONDARY — View Details: quiet outline, for configurables that need options */
.product-info-main .rwc-rcs .rwc-rcs__cta--view,
.rwc-rcs--right-col .rwc-rcs__cta--view {
    background: transparent;
    border-color: var(--ss-border, #cbd5e1);
    color: var(--ss-ink-2, #64748b);
}
.product-info-main .rwc-rcs .rwc-rcs__cta--view:hover,
.rwc-rcs--right-col .rwc-rcs__cta--view:hover {
    background: var(--ss-surface, #f8fafc);
    border-color: var(--ss-ink-2, #64748b);
    color: var(--ss-ink, #0f172a);
}

/* Disabled — mainly for the placeholder mockup */
.product-info-main .rwc-rcs .rwc-rcs__cta[disabled],
.rwc-rcs--right-col .rwc-rcs__cta[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}
.product-info-main .rwc-rcs .rwc-rcs__cta[disabled]:hover,
.rwc-rcs--right-col .rwc-rcs__cta[disabled]:hover {
    background: var(--ss-blue, #3b82f6);
    border-color: var(--ss-blue, #3b82f6);
    color: #fff;
}

/* Placeholder section corner tag — subtle "PREVIEW" badge in top-right */
.rwc-rcs--placeholder {
    position: relative;
}
.rwc-rcs--placeholder::after {
    content: 'PREVIEW';
    position: absolute;
    top: 0;
    right: 0;
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ss-ink-3, #94a3b8);
    background: var(--ss-surface, #f1f5f9);
    border-radius: 4px;
}

/* Extra-narrow right column: fall back to single column below ~380px */
@media (max-width: 380px) {
    .product-info-main .rwc-rcs .rwc-rcs__grid,
    .rwc-rcs--right-col .rwc-rcs__grid {
        grid-template-columns: 1fr;
    }
}
