/* ==========================================================
   YETI³ PRODUCT RAIL
   Product detail: similar / recently viewed
   ========================================================== */

.recommendations {
    --rail-gap: 20px;
    --rail-columns: 4;

    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin: 72px 0 0;
    padding: 0;
    overflow: hidden;
}

.recommendations > header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin: 0 0 24px;
    padding: 0 0 13px;
    border-bottom: 1px solid rgba(41, 35, 28, .09);
}

.recommendations > header h2 {
    margin: 0;
    padding: 0;
    border: 0;
    text-align: left;
}

.recommendations > header > div {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.recommendations > header button {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border: 1px solid rgba(151, 113, 56, .25);
    border-radius: 50%;
    background: rgba(255, 255, 255, .88);
    color: #29231c;
    font: 300 27px/1 Georgia, serif;
    cursor: pointer;
    box-shadow: 0 5px 18px rgba(43, 34, 20, .04);
    transition:
        background .2s ease,
        color .2s ease,
        border-color .2s ease,
        opacity .2s ease,
        transform .2s ease;
}

.recommendations > header button:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: #29231c;
    background: #29231c;
    color: #fff;
}

.recommendations > header button:disabled {
    opacity: .22;
    cursor: default;
}

/*
 * Critical isolation.
 * This element is always a horizontal flex rail regardless of
 * .grid / .product-grid / legacy recommendation rules.
 */
.recommendations > .recommendations-track {
    display: flex !important;
    grid-template-columns: none !important;
    grid-auto-flow: unset !important;
    align-items: stretch !important;

    box-sizing: border-box;
    width: 100% !important;
    max-width: none !important;
    min-width: 0;

    gap: var(--rail-gap) !important;
    margin: 0 !important;
    padding: 6px 2px 32px !important;

    overflow-x: auto !important;
    overflow-y: hidden !important;

    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.recommendations > .recommendations-track::-webkit-scrollbar {
    display: none;
}

/*
 * Leave a small piece of the next card visible.
 * Apart from making the rail visually obvious, this guarantees
 * useful horizontal overflow whenever more cards exist.
 */
.recommendations > .recommendations-track > .workshop-card {
    box-sizing: border-box !important;

    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    flex-basis:
        calc(
            (100% - ((var(--rail-columns) - 1) * var(--rail-gap)) - 54px)
            / var(--rail-columns)
        ) !important;

    width:
        calc(
            (100% - ((var(--rail-columns) - 1) * var(--rail-gap)) - 54px)
            / var(--rail-columns)
        ) !important;

    min-width: 0 !important;
    max-width: none !important;

    margin: 0 !important;

    scroll-snap-align: start;
    scroll-snap-stop: normal;
}

@media (max-width: 1180px) {
    .recommendations {
        --rail-columns: 3;
    }
}

@media (max-width: 820px) {
    .recommendations {
        --rail-columns: 2;
        margin-top: 54px;
    }

    .recommendations > header {
        margin-bottom: 18px;
    }
}

@media (max-width: 560px) {
    .recommendations {
        --rail-gap: 14px;
        overflow: visible;
    }

    .recommendations > header button {
        width: 40px;
        height: 40px;
        min-height: 40px;
        flex-basis: 40px;
        font-size: 25px;
    }

    .recommendations > .recommendations-track {
        padding-right: 18px !important;
    }

    .recommendations > .recommendations-track > .workshop-card {
        flex-basis: min(82vw, 310px) !important;
        width: min(82vw, 310px) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .recommendations > .recommendations-track {
        scroll-behavior: auto;
    }
}
