/**
 * Sible rail (plg_system_siblefoundation 1.2.0)
 *
 * A row of cards that scrolls sideways, shared by the product page ("More from our vendors", Figma "Section / Explore"
 * 373:837) and the home page ("Meet our vendors", Figma "Section / Vendors" 617:2183). Only the frame, the row and
 * the Scroll Arrow buttons (Figma 373:836, 617:2200) live here; each page styles its own heading and cards.
 *
 * Markup: a frame with class sf-rail and the attribute data-sf-rail, holding one list with class sf-rail__row whose
 * children are the cards. rail.js adds the arrows and the keyboard. Without it the row is a plain scrollable list
 * with a thin scrollbar, and every card can be reached.
 *
 * The row snaps to the start of each card. It has 8px of padding with a matching negative margin, so the focus ring
 * of the first and last card is not clipped by the scroll box. Scrolling the row at either end does not scroll the
 * page or start the browser's back gesture (overscroll-behavior-x). Smooth scrolling only when motion is allowed.
 *
 * Per page settings (custom properties on the frame):
 *   --sf-rail-gap        space between cards (default space-md)
 *   --sf-rail-arrow-top  top of the arrows, from the top of the frame (default: centred on the frame)
 *   --sf-rail-arrow-x    left of the previous arrow and right of the next one, from the frame's edges (default 8px:
 *                        over the ends of the row; negative values put them outside it)
 */

.sf-rail {
    position: relative;
}

.sf-rail__row {
    display: flex;
    gap: var(--sf-rail-gap, var(--sf-space-md));
    margin: -8px;
    padding: 8px;
    list-style: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-padding-inline: 8px;
    scroll-snap-type: x mandatory;
    scrollbar-color: var(--sf-color-line-strong) transparent;
    scrollbar-width: thin;
}

.sf-rail__row > * {
    scroll-snap-align: start;
}

.sf-rail.is-enhanced .sf-rail__row {
    scrollbar-width: none;
}

.sf-rail.is-enhanced .sf-rail__row::-webkit-scrollbar {
    display: none;
}

@media (prefers-reduced-motion: no-preference) {
    .sf-rail__row {
        scroll-behavior: smooth;
    }
}

/*
 * Scroll Arrow (39 x 39, a white chevron): real buttons added by the script, from 48rem and only while the row
 * overflows (phones swipe). The round dark backing is derived (a bare white chevron would vanish over a light photo).
 * At an end the arrow stays focusable and is dimmed (aria-disabled), so a keyboard user does not lose their place.
 */
.sf-rail__arrow {
    position: absolute;
    top: var(--sf-rail-arrow-top, calc(50% - 19.5px));
    z-index: 2;
    display: none;
    place-items: center;
    width: 39px;
    height: 39px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--sf-radius-pill);
    background: color-mix(in srgb, var(--sf-color-ground-inverse) 75%, transparent);
    color: var(--sf-color-ink-inverse);
    cursor: pointer;
}

.sf-rail__arrow svg {
    display: block;
    width: 10px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.sf-rail__arrow--prev {
    left: var(--sf-rail-arrow-x, 8px);
}

.sf-rail__arrow--next {
    right: var(--sf-rail-arrow-x, 8px);
}

.sf-rail__arrow:hover {
    background: var(--sf-color-ground-inverse);
}

.sf-rail__arrow[aria-disabled="true"] {
    opacity: 0.35;
    cursor: default;
}

.sf-rail__arrow:focus-visible {
    outline: 3px solid var(--sf-color-ink-inverse);
    outline-offset: 3px;
}

@media (min-width: 48rem) {
    .sf-rail__arrow:not([hidden]) {
        display: grid;
    }
}
