/**
 * Brands Showcase - Elegant Brand & Manufacturer Directory
 *
 * @author    MEG Venture <info@megventure.com>
 * @copyright 2019-2026 MEG Venture
 * @license   Academic Free License 3.0 (AFL-3.0)
 */

/* Breathing room before whatever the theme renders next (newsletter block,
   footer, ...). Padding rather than margin so it cannot collapse out of the
   section, and #main.cbp so a theme rule on #main cannot flatten it. */
#main.cbp {
    padding-bottom: 3rem;
}

.cbp-board {
    --cbp-accent: #2fb5d2;
    --cbp-cols: 4;
    --cbp-surface: #ffffff;
    --cbp-border: #e6e9ec;
    --cbp-muted: #7a8288;
    --cbp-radius: 12px;
    margin: 0 auto;
}

.cbp-title {
    margin-bottom: 1.25rem;
}

/* Toolbar: search + count ------------------------------------------------ */
.cbp-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 1rem;
}

.cbp-search {
    flex: 1 1 260px;
    max-width: 420px;
}

.cbp-search__input {
    width: 100%;
    padding: 10px 14px;
    font-size: 1rem;
    line-height: 1.4;
    color: inherit;
    background: var(--cbp-surface);
    border: 1px solid var(--cbp-border);
    border-radius: 999px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.cbp-search__input:focus {
    outline: none;
    border-color: var(--cbp-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--cbp-accent) 22%, transparent);
}

.cbp-count {
    margin: 0;
    color: var(--cbp-muted);
    font-size: .9rem;
    white-space: nowrap;
}

/* A-Z index ------------------------------------------------------------- */
.cbp-index {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 1.5rem;
}

.cbp-index__item {
    min-width: 34px;
    padding: 6px 10px;
    font-size: .9rem;
    font-weight: 600;
    text-align: center;
    color: inherit;
    background: var(--cbp-surface);
    border: 1px solid var(--cbp-border);
    border-radius: 8px;
    cursor: pointer;
    transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.cbp-index__item:hover {
    border-color: var(--cbp-accent);
    color: var(--cbp-accent);
}

.cbp-index__item.is-current {
    color: #fff;
    background: var(--cbp-accent);
    border-color: var(--cbp-accent);
}

.cbp-index__item.is-disabled {
    opacity: .35;
    cursor: default;
    pointer-events: none;
}

/* Grid ------------------------------------------------------------------ */
.cbp-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(var(--cbp-cols), minmax(0, 1fr));
    gap: 16px;
}

.cbp-card {
    margin: 0;
}

.cbp-card__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    padding: 18px 14px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    background: var(--cbp-surface);
    border: 1px solid var(--cbp-border);
    border-radius: var(--cbp-radius);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.cbp-card__link:hover,
.cbp-card__link:focus-visible {
    transform: translateY(-3px);
    border-color: var(--cbp-accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
    text-decoration: none;
}

.cbp-card__media {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 90px;
    margin-bottom: 12px;
}

.cbp-card__logo {
    max-width: 100%;
    max-height: 90px;
    object-fit: contain;
}

.cbp-card__badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    background: var(--cbp-accent);
    border-radius: 50%;
}

.cbp-card__name {
    display: block;
    font-weight: 600;
    word-break: break-word;
}

.cbp-card__count {
    display: block;
    margin-top: 4px;
    font-size: .85rem;
    color: var(--cbp-muted);
}

/* List layout ----------------------------------------------------------- */
.cbp-layout-list .cbp-grid {
    grid-template-columns: 1fr;
    gap: 8px;
}

.cbp-layout-list .cbp-card__link {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    text-align: left;
}

.cbp-layout-list .cbp-card__media {
    width: 56px;
    height: 56px;
    margin-bottom: 0;
    flex: 0 0 56px;
}

.cbp-layout-list .cbp-card__logo {
    max-height: 56px;
}

.cbp-layout-list .cbp-card__badge {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
}

.cbp-layout-list .cbp-card__count {
    margin-top: 2px;
}

/* States ---------------------------------------------------------------- */
.cbp-noresult,
.cbp-empty {
    padding: 2rem 0;
    text-align: center;
    color: var(--cbp-muted);
}

.cbp-card.is-hidden {
    display: none;
}

/* Responsive ------------------------------------------------------------ */
@media (max-width: 991px) {
    .cbp-board:not(.cbp-layout-list) .cbp-grid {
        grid-template-columns: repeat(min(var(--cbp-cols), 3), minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    #main.cbp {
        padding-bottom: 2rem;
    }

    .cbp-board:not(.cbp-layout-list) .cbp-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .cbp-board:not(.cbp-layout-list) .cbp-grid {
        grid-template-columns: 1fr;
    }
}

/* Dark theme friendliness ----------------------------------------------- */
@media (prefers-color-scheme: dark) {
    .cbp-board {
        --cbp-surface: #1c1f22;
        --cbp-border: #33383d;
        --cbp-muted: #9aa2a8;
    }

    .cbp-card__link:hover,
    .cbp-card__link:focus-visible {
        box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
    }
}
