/**
 * Category pages (plg_system_siblecategory)
 *
 * Styles the markup the plugin swaps into com_content category and
 * categories views under the configured roots. Loaded through the web asset
 * manager (media/joomla.asset.json) only on those pages.
 *
 * Design: Figma "Category / Browse Page" (280:518) and Item Card (238:189).
 * Values come from the --sf- tokens (plg_system_siblefoundation). Raw px
 * values are Figma layout measurements with no variable behind them; each
 * one says where it comes from.
 *
 * Mobile type styles below 48rem, Desktop from 48rem. Breakpoints are
 * Gantry's: 30rem, 48rem, 60rem, 75rem.
 */

/* ------------------------------------------------------------ page frame */

/*
 * Full bleed. Gantry boxes component output in
 * #g-intro > .g-container (75rem) > .g-grid > .g-block > .g-content >
 * .platform-content.container > .row > .col, with padding at every level.
 * These rules flatten that chain, only on pages this plugin owns
 * (body.sib-browse is added when the swap succeeds).
 */
body.sib-browse,
body.sib-browse #g-page-surround {
    background: var(--sf-color-ground-inverse);
}

body.sib-browse #g-intro {
    padding: 0;
    background: var(--sf-color-ground-inverse);
    color: var(--sf-color-ink-inverse);
}

body.sib-browse #g-intro > .g-container {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
}

body.sib-browse #g-intro .g-content {
    margin: 0;
    padding: 0;
}

body.sib-browse #g-intro .platform-content {
    max-width: none;
    margin: 0;
    padding: 0;
}

body.sib-browse #g-intro .platform-content > .row {
    margin: 0;
}

body.sib-browse #g-intro .platform-content > .row > .col {
    padding: 0;
}

/* Figma frame width; wider screens centre the layout on the full bleed ground. */
.sib-cat {
    --sib-gutter: 20px; /* Mobile B homepage, Section / Shop side padding */
    max-width: 1440px;
    margin: 0 auto;
    color: var(--sf-color-ink-inverse);
    font: var(--sf-type-mobile-body);
}

.sib-cat a,
.sib-cat a:hover,
.sib-cat a:focus {
    color: inherit;
}

.sib-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ------------------------------------------------------- toolbar row */

/*
 * Figma "Search + Sort Row": 75 tall, padding 0 / space-3xl / 9, with the
 * 55 tall pill sitting 6 from the top. The 6 top padding keeps that offset
 * when the result line wraps onto a second line.
 */
.sib-cat__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sf-space-md);
    padding: var(--sf-space-md) var(--sib-gutter);
}

@media (min-width: 48rem) {
    .sib-cat__bar {
        min-height: 75px;
        padding: 6px var(--sf-space-3xl) 9px;
    }
}

/*
 * In-page search. On the Shop and Services browse pages (.sib-search--section,
 * 1.4.1) it is the section search and always shows: the header search and the
 * mobile search row search the whole site. On the /search page the header
 * search is that same whole-site search, so with the site chrome (body.sf-hdr)
 * that page's form stays hidden; without the chrome it is the fallback. Field
 * rules carry .sib-cat so they outrank Gantry's input[type="search"] rules.
 */
body.sf-hdr .sib-cat .sib-search:not(.sib-search--section) {
    display: none;
}

.sib-search {
    display: flex;
    flex: 1 1 320px;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sf-space-xs);
    margin: 0;
}

.sib-cat .sib-search__field {
    flex: 1 1 200px;
    width: auto;
    min-width: 0;
    max-width: 420px;
    height: auto;
    padding: var(--sf-space-xs) var(--sf-space-lg);
    background: transparent;
    border: 1px solid var(--sf-color-line-default);
    border-radius: var(--sf-radius-pill);
    color: var(--sf-color-ink-inverse);
    font: var(--sf-type-mobile-body);
}

.sib-cat .sib-search__field::placeholder {
    color: var(--sf-color-ink-secondary);
    opacity: 1;
}

.sib-cat .sib-search__field:focus {
    box-shadow: none;
    outline: 2px solid var(--sf-color-ground-cream);
    outline-offset: 2px;
}

/* Button / Primary (394:925) */
.sib-search__btn {
    padding: 10px 36px;
    background: var(--sf-color-accent-green);
    border: 0;
    border-radius: var(--sf-radius-pill);
    color: var(--sf-color-ground-cream);
    font: var(--sf-type-mobile-body-emphasis);
    cursor: pointer;
}

.sib-search__btn:hover,
.sib-search__btn:focus {
    background: var(--sf-color-ink-primary);
}

.sib-search__clear {
    font: var(--sf-type-desktop-link-mono);
    color: var(--sf-color-line-default);
}

.sib-search__clear:hover {
    text-decoration: underline;
}

@media (min-width: 48rem) {
    .sib-cat .sib-search__field {
        font: var(--sf-type-desktop-body);
    }

    .sib-search__btn {
        font: var(--sf-type-desktop-button-label);
    }
}

/*
 * Sort pill (Figma "Sort Dropdown"): padding space-sm / space-lg, gap
 * space-xs, line-default stroke, pill radius, Desktop/Body. Figma has no
 * open state; the menu reuses the same tokens.
 */
.sib-sort {
    position: relative;
    margin-left: auto;
}

.sib-sort__btn {
    display: flex;
    align-items: center;
    gap: var(--sf-space-xs);
    padding: var(--sf-space-xs) var(--sf-space-md);
    border: 1px solid var(--sf-color-line-default);
    border-radius: var(--sf-radius-pill);
    color: var(--sf-color-ink-inverse);
    font: var(--sf-type-mobile-body);
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.sib-sort__btn::-webkit-details-marker {
    display: none;
}

.sib-sort__btn:focus-visible {
    outline: 2px solid var(--sf-color-ground-cream);
    outline-offset: 2px;
}

/* Figma draws a line-default "⌄" glyph; a bordered square keeps it crisp in every font. */
.sib-sort__caret {
    width: 7px;
    height: 7px;
    margin-top: -4px;
    border-right: 1.5px solid var(--sf-color-line-default);
    border-bottom: 1.5px solid var(--sf-color-line-default);
    transform: rotate(45deg);
}

.sib-sort[open] .sib-sort__caret {
    margin-top: 3px;
    transform: rotate(-135deg);
}

.sib-sort__menu {
    position: absolute;
    z-index: 10;
    top: calc(100% + var(--sf-space-xs));
    right: 0;
    min-width: 100%;
    margin: 0;
    padding: var(--sf-space-xs) 0;
    background: var(--sf-color-ground-inverse);
    border: 1px solid var(--sf-color-line-default);
    border-radius: var(--sf-radius-md);
    list-style: none;
}

.sib-cat .sib-sort__opt {
    display: block;
    padding: var(--sf-space-2xs) var(--sf-space-lg);
    color: var(--sf-color-ink-inverse);
    font: var(--sf-type-mobile-body);
    text-decoration: none;
    white-space: nowrap;
}

.sib-cat .sib-sort__opt:hover,
.sib-cat .sib-sort__opt:focus {
    background: var(--sf-color-ground-nav);
}

.sib-cat .sib-sort__opt[aria-current] {
    color: var(--sf-color-ground-cream);
    text-decoration: underline;
}

/* Result line (Figma "Result Count"): Body Italic Single in line-default. */
.sib-cat__result {
    flex-basis: 100%;
    margin: 0;
    color: var(--sf-color-line-default);
    font: var(--sf-type-mobile-body-italic);
}

/*
 * "Search all products" after a category search: widens the same query to the
 * whole root. Not drawn in Figma; it uses Desktop/Link Mono with an arrow like
 * the empty state's links (Link Mono has no Mobile style, so all widths).
 */
.sib-cat .sib-cat__result-all {
    display: block;
    margin-top: var(--sf-space-2xs);
    color: var(--sf-color-ink-inverse);
    font: var(--sf-type-desktop-link-mono);
    font-style: normal;
    text-decoration: none;
    white-space: nowrap;
}

.sib-cat .sib-cat__result-all:hover,
.sib-cat .sib-cat__result-all:focus-visible {
    color: var(--sf-color-ink-inverse);
    text-decoration: underline;
    text-underline-offset: 4px;
}

@media (min-width: 48rem) {
    .sib-sort__btn {
        padding: var(--sf-space-sm) var(--sf-space-lg);
        font: var(--sf-type-desktop-body);
    }

    .sib-cat .sib-sort__opt {
        font: var(--sf-type-desktop-body);
    }

    .sib-cat__result {
        font: var(--sf-type-desktop-body-italic-single);
    }

    /* Count and link side by side; a wrapped link starts flush left. */
    .sib-cat__result {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        column-gap: var(--sf-space-sm);
    }

    .sib-cat .sib-cat__result-all {
        margin-top: 0;
    }

    /*
     * Header search present and no in-page search in the row (the /search
     * page, Figma No Results 396:1360): the result count sits on the left of
     * the row and the sort pill on the right. Where the section search shows,
     * the row is search, sort, then the count on its own line.
     */
    body.sf-hdr .sib-cat .sib-cat__bar:not(:has(> .sib-search--section)) > .sib-cat__result {
        order: -1;
        flex: 1 1 0;
        min-width: 0;
    }
}

/* While a search-as-you-type request runs (category.js, 1.5.0) the current results dim a little. */
.sib-cat__main.is-loading {
    opacity: 0.55;
}

@media (prefers-reduced-motion: no-preference) {
    .sib-cat__main {
        transition: opacity 0.15s ease;
    }
}

/* ------------------------------------------------------------ layout */

.sib-cat__layout {
    padding: 0 var(--sib-gutter) var(--sf-space-2xl);
}

/*
 * Figma "Content Row": sidebar 383 wide, 3 gap, results column, padding
 * right space-3xl and bottom space-4xl. The sidebar and right padding scale
 * with the viewport below the 1440 frame width.
 */
@media (min-width: 48rem) {
    .sib-cat__layout {
        display: grid;
        grid-template-columns: clamp(240px, 26.6vw, 383px) minmax(0, 1fr);
        column-gap: 3px;
        padding: 0 clamp(var(--sf-space-lg), 4.44vw, var(--sf-space-3xl)) var(--sf-space-4xl) 0;
    }
}

/* ----------------------------------------------------------- sidebar */

/*
 * Figma "Gallery Filters Sidebar: v3" (81:179): padding 40 / 36, space-lg
 * between blocks. Phones get the same content inside a collapsed
 * "Filters" disclosure above the grid.
 */
.sib-filters__toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--sf-space-xs);
    padding: var(--sf-space-xs) var(--sf-space-md);
    border: 1px solid var(--sf-color-line-default);
    border-radius: var(--sf-radius-pill);
    color: var(--sf-color-ink-inverse);
    font: var(--sf-type-mobile-body);
    list-style: none;
    cursor: pointer;
    user-select: none;
}

/* Phones: keep the Filters control clear of the first row of photos. */
@media (max-width: 47.99rem) {
    .sib-filters {
        margin-bottom: var(--sf-space-xs);
    }
}

.sib-filters__toggle::-webkit-details-marker {
    display: none;
}

.sib-filters__toggle:focus-visible,
.sib-frow__hd:focus-visible,
.sib-cat .sib-radio:focus-visible,
.sib-cat .sib-frow__opt:focus-visible {
    outline: 2px solid var(--sf-color-ground-cream);
    outline-offset: 2px;
}

.sib-filters__caret {
    width: 7px;
    height: 7px;
    margin-top: -4px;
    border-right: 1.5px solid var(--sf-color-line-default);
    border-bottom: 1.5px solid var(--sf-color-line-default);
    transform: rotate(45deg);
}

.sib-filters[open] .sib-filters__caret {
    margin-top: 3px;
    transform: rotate(-135deg);
}

.sib-filters__body {
    display: flex;
    flex-direction: column;
    gap: var(--sf-space-lg);
    padding: var(--sf-space-lg) 0 var(--sf-space-md);
}

.sib-filters__title {
    margin: 0;
    color: var(--sf-color-ink-inverse);
    font: var(--sf-type-desktop-results-heading);
}

/* Category (primary): Filter Heading, then radio rows 14 apart. */
.sib-fgroup {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sib-fgroup__hd,
.sib-frow__hd {
    margin: 0;
    color: var(--sf-color-ink-inverse);
    font: var(--sf-type-desktop-filter-heading);
    letter-spacing: var(--sf-tracking-filter-heading);
    text-transform: uppercase;
}

.sib-fgroup__list,
.sib-frow__opts {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sib-fgroup__list {
    gap: 14px;
}

/* Radio Row / Category Filter (367:787): 14 dot, 10 gap, Filter Option. */
.sib-cat .sib-radio {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sf-color-line-default);
    font: var(--sf-type-desktop-filter-option);
    text-decoration: none;
}

.sib-radio__dot {
    box-sizing: border-box;
    flex: none;
    width: 14px;
    height: 14px;
    border: 1px solid var(--sf-color-line-default);
    border-radius: 50%;
}

.sib-cat .sib-radio:hover {
    color: var(--sf-color-ink-inverse);
}

.sib-cat .sib-radio[aria-current] {
    color: var(--sf-color-ink-inverse);
}

.sib-radio[aria-current] .sib-radio__dot {
    background: var(--sf-color-ground-cream);
    border-color: var(--sf-color-ground-cream);
}

/*
 * Price (Figma "Price Filter"): Label Mono heading, 12 gap, Min to Max
 * boxes 90x36 with a line-default stroke and radius-sm, 10 apart. Figma
 * fixes the block at 80 tall, which sets the space above By vendor.
 */
.sib-price {
    min-height: 80px;
    margin: 0;
}

.sib-price fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.sib-price__hd {
    float: left;
    width: 100%;
    margin: 0 0 var(--sf-space-sm);
    padding: 0;
    color: var(--sf-color-line-default);
    font: var(--sf-type-desktop-label-mono);
    letter-spacing: var(--sf-tracking-label-mono);
    text-transform: uppercase;
}

.sib-price__row {
    display: flex;
    clear: both;
    align-items: center;
    gap: 10px;
}

.sib-price__to {
    color: var(--sf-color-line-default);
    font: var(--sf-type-desktop-body);
}

/* .sib-cat outranks Gantry's input[type="number"] rules. */
.sib-cat .sib-price__field {
    box-sizing: border-box;
    width: 90px;
    /* The sidebar is 240 wide at 48rem: the two fields shrink instead of running into the results column (found 2026-10-19). */
    flex: 0 1 90px;
    min-width: 0;
    height: 36px;
    margin: 0;
    padding: 0 var(--sf-space-sm);
    background: transparent;
    border: 1px solid var(--sf-color-line-default);
    border-radius: var(--sf-radius-sm);
    box-shadow: none;
    color: var(--sf-color-ink-inverse);
    font: var(--sf-type-desktop-body);
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}

.sib-cat .sib-price__field::-webkit-outer-spin-button,
.sib-cat .sib-price__field::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.sib-cat .sib-price__field::placeholder {
    color: var(--sf-color-line-default);
    opacity: 1;
}

.sib-cat .sib-price__field:focus {
    outline: 2px solid var(--sf-color-ground-cream);
    outline-offset: 2px;
}

/* Global filters: space-sm apart, each row under a ground-panel divider. */
.sib-filters__global {
    display: flex;
    flex-direction: column;
    gap: var(--sf-space-sm);
}

/* Filter Row (60:106): heading and +/- symbol, options 14 below. */
.sib-frow {
    padding-top: var(--sf-space-sm);
    border-top: 1px solid var(--sf-color-ground-panel);
}

.sib-frow__hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    cursor: pointer;
}

.sib-frow__hd::-webkit-details-marker {
    display: none;
}

.sib-frow__sym::after {
    content: "+";
    font: var(--sf-type-desktop-field-value);
    letter-spacing: 0;
}

.sib-frow[open] .sib-frow__sym::after {
    content: "\2212";
}

.sib-frow__opts {
    gap: 10px;
    padding: 14px 0 0 4px;
}

.sib-cat .sib-frow__opt {
    color: var(--sf-color-line-default);
    font: var(--sf-type-desktop-filter-option);
    text-decoration: none;
}

.sib-cat .sib-frow__opt:hover,
.sib-cat .sib-frow__opt[aria-current] {
    color: var(--sf-color-ink-inverse);
}

.sib-cat .sib-frow__opt[aria-current] {
    text-decoration: underline;
}

@media (min-width: 48rem) {
    .sib-filters__toggle {
        display: none;
    }

    .sib-filters__body {
        padding: 40px 36px;
    }
}

/* -------------------------------------------------------------- grid */

/*
 * Phones follow Mobile B homepage: 2 columns, space-sm column gap, 26 row
 * gap. Desktop follows "Item Grid": 3 columns of 263 with an 87 gap,
 * 74 between rows, 67 above the first row.
 */
.sib-cat__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--sf-space-sm);
    row-gap: 26px;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 48rem) {
    .sib-cat__grid {
        column-gap: clamp(var(--sf-space-lg), 6.04vw, 87px);
        row-gap: var(--sf-space-2xl);
        padding-top: 67px;
    }
}

@media (min-width: 60rem) {
    .sib-cat__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-width: calc(3 * 263px + 2 * 87px);
        row-gap: 74px;
    }
}

/* -------------------------------------------------------------- card */

/*
 * Item Card. The info block has a fixed height so every card in a row is
 * the same height whether its title takes one line or two.
 * Mobile 175x313: image 175x226, info 87 = 9 padding + 2 title lines (27)
 * + 3 gap + caption line (21).
 * Desktop 263x445: image 263x350, info 95 = 6 padding + 2 title lines (30)
 * + body line (29).
 */
.sib-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin: 0;
}

.sib-card__ph {
    display: block;
    aspect-ratio: 175 / 226;
    overflow: hidden;
    background: var(--sf-color-ground-nav);
}

.sib-card__ph img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.sib-card:hover .sib-card__ph img,
.sib-card:focus-within .sib-card__ph img {
    transform: scale(1.05);
}

/* Reduced motion: no transition and no zoom at all (the card rule is "scales 5% on hover, none under reduced motion"; backlog 19). */
@media (prefers-reduced-motion: reduce) {
    .sib-card__ph img {
        transition: none;
    }

    .sib-card:hover .sib-card__ph img,
    .sib-card:focus-within .sib-card__ph img {
        transform: none;
    }
}

.sib-card__info {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "name name"
        "vendor price";
    align-content: start;
    column-gap: 6px;
    row-gap: 3px;
    height: 87px;
    padding: 9px 3px 0;
    overflow: hidden;
}

.sib-card__name {
    display: -webkit-box;
    grid-area: name;
    margin: 0;
    overflow: hidden;
    color: var(--sf-color-ink-inverse);
    font: var(--sf-type-mobile-body);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.sib-cat .sib-card__name a {
    text-decoration: none;
}

.sib-cat .sib-card__name a:hover,
.sib-cat .sib-card__vendor:hover {
    text-decoration: underline;
}

.sib-card__price {
    grid-area: price;
    align-self: center;
    font: var(--sf-type-mobile-label-mono);
    letter-spacing: var(--sf-tracking-label-mono);
    text-align: right;
    white-space: nowrap;
}

.sib-cat .sib-card__vendor {
    grid-area: vendor;
    align-self: center;
    min-width: 0;
    overflow: hidden;
    font: var(--sf-type-mobile-caption);
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (min-width: 48rem) {
    .sib-card__ph {
        aspect-ratio: 263 / 350;
    }

    .sib-card__info {
        grid-template-areas:
            "name price"
            "vendor vendor";
        column-gap: var(--sf-space-xs);
        row-gap: 0;
        height: 95px;
        padding: 6px 0 0 6px;
    }

    .sib-card__name {
        font: var(--sf-type-desktop-title);
    }

    .sib-card__price {
        align-self: start;
        font: var(--sf-type-desktop-label-mono);
    }

    .sib-cat .sib-card__vendor {
        align-self: start;
        justify-self: start;
        max-width: 100%;
        font: var(--sf-type-desktop-body);
    }
}

/* --------------------------------------------------------- empty state */

/*
 * Figma "Empty State / No Results" (396:1540): paper texture panel,
 * radius-md, padding 56 / 64, 16 between items, ink-primary text.
 *
 * The paper sits on a ::before layer so Figma's Texture effect (the rough
 * edge) can be applied to it alone: #sib-paper-edge is an SVG filter
 * rendered with the panel. The text is not filtered. Browsers that cannot
 * apply url() filters to HTML show a plain edge.
 */
.sib-empty {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sf-space-md);
    margin-top: var(--sf-space-md);
    padding: var(--sf-space-lg) var(--sib-gutter);
    color: var(--sf-color-ink-primary);
}

.sib-empty::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background: var(--sf-color-ground-page) url("../../plg_system_siblefoundation/images/paper.webp") center / cover;
    border-radius: var(--sf-radius-md);
    /* brightness: Figma darkens the paper fill (exposure -0.07). */
    filter: url("#sib-paper-edge") brightness(0.95);
}

.sib-cat .sib-empty .sib-link {
    color: var(--sf-color-ink-primary);
}

/*
 * Heading Section with a 251 wide rule 16 below it, in the foundation's
 * Mobile/Heading Section style (needs plg_system_siblefoundation 1.1.0).
 */
.sib-empty__hd {
    margin: 0;
    padding-bottom: var(--sf-space-md);
    color: var(--sf-color-ink-primary);
    font: var(--sf-type-mobile-heading-section);
    background: linear-gradient(var(--sf-color-ink-primary), var(--sf-color-ink-primary)) left bottom / min(251px, 100%) 1px no-repeat;
}

/* Figma sets this at 20 / 150%, a looser Body. */
.sib-empty__body {
    max-width: 700px;
    margin: 0;
    font: var(--sf-type-mobile-body);
}

.sib-empty__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sf-space-md) var(--sf-space-xl);
    padding-top: var(--sf-space-xs);
}

/* Button / Primary (394:925) */
.sib-cat .sib-btn {
    display: inline-block;
    padding: 10px 36px;
    background: var(--sf-color-accent-green);
    border-radius: var(--sf-radius-pill);
    color: var(--sf-color-ground-cream);
    font: var(--sf-type-desktop-button-label);
    text-decoration: none;
}

.sib-cat .sib-btn:hover,
.sib-cat .sib-btn:focus {
    background: var(--sf-color-ink-primary);
    color: var(--sf-color-ground-cream);
}

.sib-cat .sib-link {
    font: var(--sf-type-desktop-link-mono);
    text-decoration: none;
}

.sib-cat .sib-link:hover {
    text-decoration: underline;
}

.sib-cat .sib-btn:focus-visible,
.sib-cat .sib-link:focus-visible {
    outline: 2px solid var(--sf-color-ink-primary);
    outline-offset: 3px;
}

/*
 * Commissions pitch under a 0.75 dashed rule (4 on, 4 off) in
 * color/line/strong (foundation 1.1.0).
 */
.sib-empty__pitch {
    display: flex;
    align-self: stretch;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sf-space-md) 28px;
    padding-top: calc(var(--sf-space-md) + var(--sf-space-xs));
    background: repeating-linear-gradient(to right, var(--sf-color-line-strong) 0 4px, transparent 4px 8px) left top / 100% 0.75px no-repeat;
}

.sib-stamp {
    flex: none;
    width: 93px;
    height: 38px;
}

.sib-empty__pitch-copy {
    display: flex;
    flex: 1 1 260px;
    flex-direction: column;
    gap: var(--sf-space-xs);
    max-width: 560px;
}

.sib-empty__pitch-hd {
    margin: 0;
    font: var(--sf-type-desktop-button-label);
}

/* Figma sets this at 20 / 140%. */
.sib-empty__pitch-body {
    margin: 0;
    font: var(--sf-type-mobile-body);
    line-height: 1.4;
}

/* "Recently added": Heading Section in cream, 40 above and below. */
.sib-recent {
    margin-top: 40px;
}

.sib-recent__hd {
    margin: 0 0 var(--sf-space-lg);
    color: var(--sf-color-ground-cream);
    font: var(--sf-type-mobile-heading-section);
}

.sib-recent .sib-cat__grid {
    padding-top: 0;
}

@media (min-width: 48rem) {
    .sib-empty {
        max-width: calc(3 * 263px + 2 * 87px);
        margin-top: 67px;
        padding: 56px var(--sf-space-3xl);
    }

    .sib-empty__hd,
    .sib-recent__hd {
        font: var(--sf-type-desktop-heading-section);
    }

    .sib-empty__body {
        font: var(--sf-type-desktop-body);
        line-height: 1.5;
    }

    .sib-empty__pitch-body {
        font: var(--sf-type-desktop-body);
        line-height: 1.4;
    }

    .sib-recent__hd {
        margin-bottom: 40px;
    }
}

@media (min-width: 60rem) {
    .sib-recent .sib-card:nth-child(4) {
        display: none;
    }
}

/* ------------------------------------------- home page browse section */

/*
 * The browse section of the home page (plg_system_siblehome borrows it through the onSibleBrowse event). The home
 * Figma frame shows 3 rows: 3 cards across on desktop (9), 2 across on phones (6). The plugin sends 9 products,
 * so the extra cards are hidden where the grid has fewer columns (hidden cards never load their photo: lazy).
 */
@media (max-width: 47.99rem) {
    .sib-cat--home .sib-card:nth-child(n + 7) {
        display: none;
    }
}

@media (min-width: 48rem) and (max-width: 59.99rem) {
    .sib-cat--home .sib-card:nth-child(n + 9) {
        display: none;
    }
}

/* "Browse all products" under the grid, on the dark ground. */
.sib-cat--home .sib-cat__more {
    margin: var(--sf-space-xl) 0 0;
}

.sib-cat--home .sib-link:focus-visible {
    outline-color: var(--sf-color-ink-inverse);
}

@media (min-width: 60rem) {
    .sib-cat--home .sib-cat__more {
        margin-top: var(--sf-space-2xl);
    }
}

/* ------------------------------------------------------ /search page */

/*
 * Vendor Match (Figma 607:2156 desktop, 607:2352 phone): the paper panel of the empty state (radius-md, the rough
 * edge filter on a ::before layer so the text stays crisp), the avatar, "VENDOR · N ITEMS", the name, the tagline and
 * the storefront link. The whole panel is one link. The grey of the empty avatar is the directory's placeholder grey
 * (#828b87, Figma ground/banner-empty), kept as one local property until backlog 21 adds the shared token.
 */
.sib-vmatch,
.sib-pmatch {
    margin-top: var(--sf-space-lg);
}

/*
 * The phone frame (607:2320) binds no text styles in this block, so the nearest existing Mobile styles are used. They are
 * a little larger than the frame's own measurements (heading 28 SemiBold, label 12, name 22 Medium, tagline 16): the
 * Mobile/Heading Section, Label Mono, Heading MD and Body Italic styles. Only the arrow maps exactly (Desktop/Link Mono, 18).
 */
.sib-vmatch__hd {
    margin: 0 0 var(--sf-space-md);
    color: var(--sf-color-ground-cream);
    font: var(--sf-type-mobile-heading-section);
}

.sib-vmatch__hd--products {
    margin-bottom: var(--sf-space-md);
}

.sib-pmatch .sib-cat__grid {
    padding-top: 0;
}

/*
 * Phone (Figma 607:2320): the count leads, then one row with Filters on the left and Sort on the right. The Sort pill is
 * a second copy of the menu inside the sidebar block (so the Filters pill and it share a line while the opened filters
 * drop below them); the bar's own copy is shown from 48rem.
 */
.sib-cat--search .sib-cat__result {
    order: -1;
}

.sib-cat--search .sib-cat__side {
    position: relative;
}

.sib-cat__side-sort {
    position: absolute;
    top: 0;
    right: 0;
}

.sib-cat--search .sib-cat__bar .sib-sort {
    display: none;
}

@media (min-width: 48rem) {
    .sib-cat__side-sort {
        display: none;
    }

    .sib-cat--search .sib-cat__bar .sib-sort {
        display: block;
    }
}

.sib-vmatch__list {
    display: flex;
    flex-direction: column;
    gap: var(--sf-space-md);
    margin: 0;
    padding: 0;
    list-style: none;
}

.sib-vcard {
    --sib-vmatch-empty: #828b87;

    position: relative;
    isolation: isolate;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px var(--sf-space-md);
    color: var(--sf-color-ink-primary);
    text-decoration: none;
}

.sib-vcard::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background: var(--sf-color-ground-page) url("../../plg_system_siblefoundation/images/paper.webp") center / cover;
    border-radius: var(--sf-radius-md);
    filter: url("#sib-paper-edge") brightness(0.95);
}

.sib-cat a.sib-vcard:hover,
.sib-cat a.sib-vcard:focus-visible {
    color: var(--sf-color-ink-primary);
    text-decoration: none;
}

.sib-vcard:hover .sib-vcard__name,
.sib-vcard:focus-visible .sib-vcard__name {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.sib-vcard:focus-visible {
    outline: 2px solid var(--sf-color-ground-cream);
    outline-offset: 4px;
}

.sib-vcard__avatar {
    box-sizing: border-box;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    overflow: hidden;
    border: 3px solid var(--sf-color-ground-page);
    border-radius: 50%;
    background: var(--sib-vmatch-empty);
    color: var(--sf-color-ink-inverse);
    font: var(--sf-type-mobile-heading-md);
    text-transform: uppercase;
}

.sib-vcard__avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sib-vcard__id {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sf-space-2xs);
}

.sib-cat .sib-vcard__name,
.sib-cat .sib-vcard__tag {
    color: var(--sf-color-ink-primary);
}

.sib-vcard__meta {
    color: var(--sf-color-line-strong);
    font: var(--sf-type-mobile-label-mono);
    text-transform: uppercase;
}

.sib-vcard__name {
    font: var(--sf-type-mobile-heading-md);
    overflow-wrap: anywhere;
}

.sib-vcard__tag {
    font: var(--sf-type-mobile-body-italic);
}

/* Phone: only the arrow (Figma draws "→" at the top right). */
.sib-vcard__go {
    flex: none;
    color: var(--sf-color-line-strong);
    font: var(--sf-type-desktop-link-mono);
}

.sib-vcard__visit {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (min-width: 48rem) {
    .sib-vmatch,
    .sib-pmatch {
        margin-top: 67px;
    }

    .sib-vmatch__hd {
        margin-bottom: var(--sf-space-lg);
        font: var(--sf-type-desktop-heading-section);
    }

    .sib-vcard {
        align-items: center;
        gap: var(--sf-space-xl);
        padding: var(--sf-space-lg) var(--sf-space-xl);
    }

    .sib-vcard__avatar {
        width: 88px;
        height: 88px;
        font: var(--sf-type-desktop-heading-subsection);
    }

    .sib-vcard__meta {
        font: var(--sf-type-desktop-field-label);
        letter-spacing: 1.2px;
    }

    .sib-vcard__name {
        font: var(--sf-type-desktop-heading-subsection);
    }

    .sib-vcard__tag {
        font: var(--sf-type-desktop-body-italic);
    }

    .sib-vcard__go {
        display: flex;
        align-items: center;
        gap: 6px;
        color: var(--sf-color-ink-primary);
        font: var(--sf-type-desktop-link-mono);
    }

    /*
     * The results column is about 300 wide at 48rem: wrapped, "Visit storefront" takes its own line under the name instead of
     * squeezing the name into a column of one word a line. From 60rem all three sit in one row as in Figma.
     */
    .sib-vcard {
        flex-wrap: wrap;
    }

    .sib-vcard__id {
        flex-basis: calc(100% - 88px - var(--sf-space-xl));
    }

    .sib-vcard__go {
        flex-basis: 100%;
        justify-content: flex-end;
    }

    .sib-vcard__visit {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip-path: none;
    }
}

@media (min-width: 60rem) {
    .sib-vcard {
        flex-wrap: nowrap;
    }

    .sib-vcard__id {
        flex-basis: 0;
    }

    .sib-vcard__go {
        flex-basis: auto;
    }
}
