/* A category's subcategories over its list (CategoryTemplate.ProductsInGridOrLines.cshtml): one rail of chips, a
   picture and the name, that scrolls sideways. On a phone the finger scrolls it (no bar); on a desktop two arrows
   page it and a white fade marks the side that has more. Neutral greys and the store's brand colour
   (--ryan-primary) as the one accent, as the filters beside the list. Plain CSS, scoped under .tc-subcats. */

.tc-subcats {
    --sc-ink: #3f4064;
    --sc-line: #e7e7ec;
    --sc-accent: var(--ryan-primary, #007ad0);
    position: relative;
    margin: 0 0 24px;
    direction: rtl;
}

.tc-subcats *,
.tc-subcats *::before,
.tc-subcats *::after {
    box-sizing: border-box;
}

.tc-subcats__rail {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0;
    scroll-behavior: smooth;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tc-subcats__rail::-webkit-scrollbar {
    display: none;
}

.tc-subcats__chip {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 240px;
    height: 60px;
    padding: 5px 5px 5px 18px;
    border: 1px solid var(--sc-line);
    border-radius: 14px;
    background: #fff;
    color: var(--sc-ink) !important;
    text-decoration: none !important;
    transition: border-color .15s ease;
}

.tc-subcats__chip:hover {
    border-color: var(--sc-accent);
}

.tc-subcats__chip:focus-visible {
    outline: 2px solid var(--sc-accent);
    outline-offset: 2px;
}

.tc-subcats__img {
    flex: none;
    display: block;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    background: #f3f3f5;
}

.tc-subcats__name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
    line-height: 22px;
    font-weight: 700;
}

/* the desktop's arrows and fades: the script keeps .is-start / .is-end on the rail's box */
.tc-subcats__arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-top: -18px;
    padding: 0;
    border: 1px solid var(--sc-line);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
    color: var(--sc-ink);
    cursor: pointer;
}

.tc-subcats__arrow:hover {
    border-color: var(--sc-accent);
    color: var(--sc-accent);
}

.tc-subcats__arrow svg {
    width: 18px;
    height: 18px;
}

.tc-subcats__arrow--next {
    left: 4px;
}

.tc-subcats__arrow--prev {
    right: 4px;
}

.tc-subcats::before,
.tc-subcats::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 1;
    width: 96px;
    pointer-events: none;
    transition: opacity .15s ease;
}

.tc-subcats::before {
    left: 0;
    background: linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0));
}

.tc-subcats::after {
    right: 0;
    background: linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0));
}

.tc-subcats.is-end::before,
.tc-subcats.is-start::after,
.tc-subcats.is-end .tc-subcats__arrow--next,
.tc-subcats.is-start .tc-subcats__arrow--prev {
    opacity: 0;
    visibility: hidden;
}

/* ---------- a phone: the finger scrolls, the rail runs to the screen's edges ---------- */
@media only screen and (max-width: 959px) {
    .tc-subcats {
        margin: 0 -16px 12px;
    }

    .tc-subcats__rail {
        padding: 2px 16px;
        scroll-padding: 0 16px;
    }

    .tc-subcats__chip {
        max-width: 200px;
        height: 52px;
        gap: 8px;
        padding: 4px 4px 4px 14px;
        border-radius: 12px;
    }

    .tc-subcats__img {
        width: 42px;
        height: 42px;
        border-radius: 9px;
    }

    .tc-subcats__name {
        font-size: 12px;
        line-height: 20px;
    }

    .tc-subcats__arrow,
    .tc-subcats::before,
    .tc-subcats::after {
        display: none;
    }
}
