/* ======================================================================
   Vehicle-agnostic brand product browse — brand.products.cfm
   Facet rail (manufacturer's own categories) + responsive card grid.
   Namespaced .bb- : verified unused elsewhere, and deliberately NOT .ts-,
   which script.js already claims for the typeahead suggestion rows.
   ====================================================================== */

.bb-wrap {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    margin: 24px auto 48px;

    /* .fixedwidth is max-width + auto margins with NO gutter, so below
       1632px the grid ran straight into both viewport edges. Fixed here
       rather than in .fixedwidth, which the whole site depends on.

       Deliberately NOT setting text-align here: the CARDS inherit centring
       from .fixedwidth and are designed around it (see .bb-cat's
       align-self). Only the results header opts out, below. */
    padding-left: 24px;
    padding-right: 24px;
}
@media (max-width: 640px) {
    .bb-wrap { padding-left: 16px; padding-right: 16px; }
}

/* ---- Facet rail ---------------------------------------------------- */
.bb-rail {
    flex: 0 0 240px;
    position: sticky;
    top: 16px;
}
.bb-rail h2 {
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 0 0 10px;
    color: #11171f;
}
.bb-cats {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    text-align: left;
}
.bb-cats li + li { border-top: 1px solid #eee; }
.bb-cats a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    padding: 10px 14px;
    font-size: 0.9375rem;
    line-height: 1.3;
    color: #333;
    text-decoration: none;
}
.bb-cats a:hover { background: #f6f6f6; }
.bb-cats a.bb-active {
    background: #11171f;
    color: #fff;
    font-weight: 600;
}
.bb-count {
    flex: 0 0 auto;
    font-size: 0.8125rem;
    color: #888;
}
.bb-cats a.bb-active .bb-count { color: rgba(255,255,255,.75); }

/* ---- Results ------------------------------------------------------- */
.bb-results { flex: 1 1 auto; min-width: 0; }
.bb-resulthead {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    /* The heading sits left (flex-start), so the search label and the
       count must too - inheriting .fixedwidth's centring put them in the
       middle of a row that starts at the left edge. */
    text-align: left;
}
.bb-resulthead h1 {
    font-size: 1.375rem;
    margin: 0;
    color: #11171f;
}
.bb-showing { font-size: 0.9375rem; color: #666; }
.bb-showing strong { color: #11171f; }
.bb-showing-page { white-space: nowrap; }

/* ---- Search within the brand ---------------------------------------
   Takes the full width of the head row and pushes the count onto its own
   line: on a brand with 42 pages of parts, this is the control that
   actually gets someone to a product, so it should not be competing for
   space with the heading. */
.bb-search { flex: 1 0 100%; order: 2; margin: 4px 0 0; }
.bb-search-label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #11171f;
    margin-bottom: 6px;
}
.bb-search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.bb-search input[type="search"] {
    flex: 1 1 260px;
    min-width: 0;
    /* 18px: the site's input scale. Anything smaller triggers the iOS
       zoom-on-focus, which on a search box is a jarring way to start. */
    font-size: 18px;
    padding: 11px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #11171f;
}
.bb-search input[type="search"]:focus {
    outline: none;
    border-color: #11171f;
    box-shadow: 0 0 0 3px rgba(17, 23, 31, .12);
}
.bb-search button {
    flex: 0 0 auto;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 24px;
    border: 1px solid #11171f;
    border-radius: 6px;
    background: #11171f;
    color: #fff;
    cursor: pointer;
}
.bb-search button:hover { background: #333; border-color: #333; }
.bb-search-clear {
    flex: 0 0 auto;
    font-size: 0.9375rem;
    color: #666;
}
.bb-showing { order: 3; flex: 1 0 100%; }

.bb-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}
.bb-card {
    flex: 1 0 calc(25% - 20px);
    max-width: calc((100% - 60px) / 4);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow .15s ease, transform .15s ease;
}
.bb-card:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}
.bb-card > a {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 14px;
    text-decoration: none;
    color: inherit;
}

/* fixed-height band so cards line up whatever the image proportions */
.bb-image {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.bb-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.bb-cat {
    display: inline-block;
    background: #007dba;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    align-self: center;   /* centred in the card, not hugging the left edge */
}
.bb-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: #11171f;
}
.bb-pn {
    font-size: 0.9375rem;
    color: #666;
    margin-top: 3px;
}
.bb-stock { font-size: 0.9375rem; margin: 8px 0 10px; }
.bb-card .price-container { margin-top: auto; }

/* ---- Load more ----------------------------------------------------- */
.bb-more { text-align: center; margin: 28px 0 0; }
.bb-more a {
    display: inline-block;
    background: #11171f;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 28px;
    border-radius: 6px;
    text-decoration: none;
}
.bb-more a:hover { background: #333; }

.bb-empty { padding: 40px 0; text-align: center; color: #666; }

/* ---- Pagination -----------------------------------------------------
   The full page pages properly; .bb-more above is only for the fragment
   embed, where an IntersectionObserver really does append. */
.bb-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 32px 0 8px;
}
.bb-pager-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.bb-pager-pages li { margin: 0; }

.bb-pager-num,
.bb-pager-step {
    display: inline-block;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #11171f;
    font-size: 1rem;
    text-decoration: none;
    /* 44px minimum: these are the one control on the page people tap
       repeatedly, and a 30px number is a coin toss on a phone. */
    min-width: 44px;
    padding: 10px 12px;
    text-align: center;
}
.bb-pager-step { padding: 10px 18px; font-weight: 600; }
.bb-pager-num:hover,
.bb-pager-step:hover { border-color: #11171f; }

.bb-pager-num.is-current {
    background: #11171f;
    border-color: #11171f;
    color: #fff;
    font-weight: 700;
}
/* Kept in the flow rather than hidden: on page 1 a "Previous" that
   vanishes makes the whole row jump sideways when you reach page 2. */
.bb-pager-step.is-disabled {
    color: #b3b8bf;
    border-color: #eee;
    cursor: default;
}
.bb-pager-gap {
    display: inline-block;
    min-width: 24px;
    text-align: center;
    color: #999;
}

@media (max-width: 640px) {
    /* The numbers wrap to their own line; prev/next stay a thumb apart. */
    .bb-pager { justify-content: space-between; }
    .bb-pager-pages { order: -1; flex: 1 0 100%; justify-content: center; }
}

/* ---- Responsive ---------------------------------------------------- */
@media (max-width: 1200px) {
    .bb-card { flex-basis: calc(33.333% - 20px); max-width: calc((100% - 40px) / 3); }
}
@media (max-width: 980px) {
    .bb-wrap { display: block; }
    .bb-rail { position: static; margin-bottom: 20px; }
}
@media (max-width: 900px) {
    .bb-card { flex-basis: calc(50% - 20px); max-width: calc((100% - 20px) / 2); }
}
@media (max-width: 600px) {
    .bb-card { flex-basis: 100%; max-width: 100%; }
}

/* ----------------------------------------------------------------------------
   WHAT IT FITS  (added 2026-08-13)
   ----------------------------------------------------------------------------
   Make + model, straight under the title. Exists because a manufacturer's
   titles are not always distinct: DBA's 17 big brake kits are every one of them
   "Big Brake Upgrade Kit", and the vehicle is the only thing separating them.

   Each label is its own <span> so the separator is drawn in CSS rather than
   baked into the string - the labels come from TecDoc reference data and are
   HTML-encoded individually.
---------------------------------------------------------------------------- */
.bb-fits {
    margin: 2px 0 4px;
    font-size: var(--oct-text-sm);
    line-height: 1.45;
    color: var(--oct-ink-mute);
}
.bb-fit + .bb-fit::before,
.bb-fit + .bb-fits-more::before {
    content: " \00B7 ";
    color: var(--oct-ink-faint);
}
.bb-fits-more { white-space: nowrap; }

/* ---- TuV/ECE approved-only toggle -----------------------------------------
   Rendered by brand.browse.block.cfm only when the scope has approved parts.
   Blue matches the ECE badge system (--oct-cert in foundations.css). */
.bb-ece { margin: 6px 0 2px; }
.bb-ece-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border: 1.5px solid var(--oct-cert, #1476d2);
    border-radius: var(--oct-radius-pill, 999px);
    color: var(--oct-cert, #1476d2);
    background: #fff;
    font-size: var(--oct-text-sm, 15px);
    font-weight: 600;
    text-decoration: none;
    line-height: 1.3;
}
.bb-ece-toggle:hover { background: #eaf3fc; text-decoration: none; }
.bb-ece-toggle.bb-ece-on { background: var(--oct-cert, #1476d2); color: #fff; }
.bb-ece-toggle.bb-ece-on:hover { background: #0f5da8; }
.bb-ece-n {
    background: #eaf3fc;
    color: var(--oct-cert, #1476d2);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: var(--oct-text-xs, 13px);
}
.bb-ece-x { font-weight: 400; opacity: .85; }
