/* Moved from inline <style> in includes/pdp.related.products.cfm. */
#pdp-related-container .row-image { position: relative; }
#pdp-related-container .product--label-container {
    position: absolute;
    z-index: 1;
    top: 8px;
    left: 8px;
}
#pdp-related-container .product--label {
    display: inline-block;
    border-radius: 4px;
    background-color: #007BFF;
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    line-height: 20px;
    padding: 0 10px;
    text-transform: uppercase;
    text-align: center;
    z-index: 2;
}
#pdp-related-container .product--label.clearance { background-color: red; color: #fff; }
#pdp-related-container .product--label.new { background-color: green; color: #fff; }

/* Button keeps the site's standard black primaryButton look but with
   card-safe geometry: the global 64px side padding overflows a ~200px
   card and stacks the label onto two lines. */
#pdp-related-container .row-button { margin-top: 8px; }
#pdp-related-container .row-button .primaryButton {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background-color: #141414;
    border: none;
    cursor: pointer;
    padding: 13px 8px; /* site padding is 13px 64px -- sides reduced to fit the card */
    transition: all .12s ease-in;
    text-align: center;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#pdp-related-container .row-button .primaryButton:hover,
#pdp-related-container .row-button .primaryButton:active,
#pdp-related-container .row-button .primaryButton:focus { background-color: #5a554e; }
#pdp-related-container .row-button .primaryButton span {
    display: inline;
    float: none;
    padding: 0;
    margin: 0;
    background: none;
    color: #fff;
}

/* Cards use a GRID here instead of product.grid.css's fixed 25%-basis
   flex (which forces 4-5 cramped columns in the narrow modal iframe).
   Capped at 4 columns, stepping down with window width. */
#pdp-related-container .flex-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin: 12px 0 32px;
}
@media (max-width: 1000px) { #pdp-related-container .flex-container { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 680px)  { #pdp-related-container .flex-container { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px)  { #pdp-related-container .flex-container { grid-template-columns: 1fr; } }
#pdp-related-container .flex-item {
    width: auto;
    max-width: none;
    margin: 0;
    flex: none;
}

/* Align price / stock / button across the whole row: cards are equal
   height (grid default), the text block absorbs the spare space, so the
   bottom group (price, then stock, then button) lines up on every card. */
#pdp-related-container .flex-item > a {
    display: flex;
    flex-direction: column;
    height: 100%;
}
#pdp-related-container .row-text { flex: 1 1 auto; }
#pdp-related-container .row-price { margin-top: 10px; text-align: center; }
#pdp-related-container .row-stock { margin: 4px 0 0; text-align: center; }
