/* ── Find the Right Stone ───────────────────────────────────
   Figma: desktop 1904:1698, tablet 3112:41448, mobile 2243:1928.
   The row starts in line with the heading and runs off the
   right edge of the screen.
   ─────────────────────────────────────────────────────────── */

.search-by-category {
    padding: var(--pad-y) var(--pad-x);
    overflow-x: clip;
}

.search-by-category--grey {
    padding-bottom: 40px;
    background: var(--color-grey-light);
}

.search-by-category__inner {
    max-width: var(--site-max-w);
    margin: 0 auto;
}

.search-by-category__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.search-by-category__arrows {
    display: flex;
    flex-shrink: 0;
    gap: 16px;
}

/* The Swiper slider's window: out to the right edge of the screen, the last
   card stopping at the page's padding. The padding shows the cards' shadows;
   pulled back on the left so the cards stay in line with the heading. */
.search-by-category__viewport {
    margin: 13px calc(50% - 50vw) -12px -12px; /* 25px to the heading, less the 12px top padding */
    padding: 12px var(--pad-x) 12px 12px;
    overflow: hidden;
    touch-action: pan-y;
}

/* Swiper moves the row; its gap becomes Swiper's spacing (search-by-category.js). */
.search-by-category__track {
    display: flex;
    gap: 17px;
    transition-property: transform;
    list-style: none;
}

.search-by-category__item {
    display: flex;
    flex: 0 0 417px;
    height: 334px;
}

.search-by-category__item .term-card {
    flex: 1 1 auto;
}

/* ── Tablet ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .search-by-category__head {
        align-items: flex-end;
    }

    .search-by-category__viewport {
        margin-top: 12px;
    }

    .search-by-category__item {
        flex-basis: 328px;
        height: 263px;
    }
}

/* ── Mobile: no arrows, swipe ───────────────────────────────── */
@media (max-width: 767px) {
    .search-by-category__arrows {
        display: none;
    }

    /* Out to the left edge of the screen too, so the cards swipe off it;
       the padding keeps the first card in line with the heading. */
    .search-by-category__viewport {
        margin-top: 13px;
        margin-left: calc(50% - 50vw);
        padding-left: var(--pad-x);
    }

    .search-by-category__item {
        flex-basis: min(301px, 80vw);
        height: 318px;
    }
}

/* The grey one sits right on Tools & Guidance */
@media (max-width: 1024px) {
    .search-by-category--grey {
        padding-bottom: 24px;
    }
}

@media (max-width: 767px) {
    .search-by-category--grey {
        padding-bottom: 20px;
    }
}
