/*
 * Brand Logos for Botble CMS (maina888/brand-logos).
 * Override the --bl-* tokens in your theme to restyle. Logos sit on white tiles so every brand colour reads, and are
 * scaled to fit (object-fit: contain), so wide wordmarks and square marks both work. Logos on a transparent
 * 5:2 canvas (e.g. 400x160) with the mark centred look most even.
 */
.bl-brand-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.bl-brand-strip-label {
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 500;
    color: var(--bl-muted, #55585b);
}

.bl-brand-strip-track {
    display: flex;
    gap: 8px;
    min-width: 0;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 2px;
}

.bl-brand-strip-track::-webkit-scrollbar {
    display: none;
}

.bl-brand-tile {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 112px;
    height: 52px;
    padding: 4px 8px;
    background: #fff;
    border: 1px solid var(--bl-line, #eaebed);
    border-radius: 8px;
    scroll-snap-align: start;
    transition: border-color 0.2s ease, box-shadow 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.bl-brand-tile img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bl-brand-tile:hover,
.bl-brand-tile:focus-visible {
    border-color: var(--bl-black, #000);
    box-shadow: 0 6px 16px -10px rgba(1, 15, 28, 0.45);
    transform: translateY(-1px);
}

.bl-brand-tile.is-active {
    border: 2px solid var(--bl-black, #000);
    padding: 3px 7px;
}

.bl-brand-tile-clear {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
}

.bl-brand-tile-clear circle {
    fill: var(--bl-black, #000);
}

.bl-brand-tile-clear path {
    fill: none;
    stroke: #fff;
    stroke-width: 1.6;
    stroke-linecap: round;
}

.bl-brand-tile.is-text .bl-brand-tile-name {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--bl-ink, #010f1c);
    text-align: center;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Homepage row and the A-Z wall */
.bl-brand-row-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.bl-brand-row-title {
    font-size: 24px;
    margin: 0;
}

.bl-brand-row-list {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bl-brand-row-list .bl-brand-tile {
    width: 100%;
    height: 72px;
    padding: 8px 14px;
}

.bl-brand-row--grid .bl-brand-row-list {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.bl-brand-row--grid .bl-brand-tile {
    flex-direction: column;
    height: 118px;
    gap: 8px;
    padding: 12px 14px 10px;
}

.bl-brand-row--grid .bl-brand-tile img {
    height: 64px;
    flex: 0 0 auto;
}

.bl-brand-row--grid .bl-brand-tile.is-text .bl-brand-tile-name {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    font-size: 17px;
}

.bl-brand-tile-caption {
    font-size: 13px;
    color: var(--bl-ink, #010f1c);
}

.bl-brand-tile-caption span {
    color: var(--bl-muted, #55585b);
}

/* Product page brand card */
.bl-brand-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 18px 0;
    padding: 10px 14px 10px 10px;
    border: 1px solid var(--bl-line, #eaebed);
    border-radius: 8px;
}

.bl-brand-card-logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 104px;
    height: 48px;
}

.bl-brand-card-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bl-brand-card-logo.is-text span {
    font-weight: 600;
    color: var(--bl-ink, #010f1c);
}

.bl-brand-card-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    min-width: 0;
}

.bl-brand-card-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    line-height: 1.35;
    color: var(--bl-ink, #010f1c);
}

.bl-brand-card-links a:hover > span:first-child {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.bl-brand-card-count {
    margin-left: 2px;
    font-size: 12px;
    color: var(--bl-muted, #55585b);
}

.bl-brand-card-links svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.bl-brand-card-links a:hover svg {
    transform: translateX(3px);
}

/* Brand page header */
.bl-brand-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.bl-brand-header-logo {
    display: flex;
    width: 180px;
    height: 72px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid var(--bl-line, #eaebed);
    border-radius: 8px;
}

.bl-brand-header-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bl-brand-header-count {
    font-size: 14px;
    color: var(--bl-muted, #55585b);
}

/* Inside a page's content (the /brands page), undo the reading-text styles: lists, link underlines, 72ch width. */
.ck-content .bl-brand-row .container {
    max-width: none;
    padding: 0;
}

.ck-content .bl-brand-row .bl-brand-row-list {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
}

.ck-content .bl-brand-row .bl-brand-row-list li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ck-content .bl-brand-row a.bl-brand-tile,
.ck-content .bl-brand-row a.bl-brand-tile * {
    text-decoration: none;
}

.ck-content .bl-brand-row .bl-brand-row-title {
    margin: 0;
    font-size: 24px;
}

@media (max-width: 1199px) {
    .bl-brand-row-list {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .bl-brand-row--grid .bl-brand-row-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    /* Label inline; the logos scroll sideways after it. */
    .bl-brand-strip {
        gap: 8px;
        margin-bottom: 14px;
    }

    .bl-brand-tile {
        width: 96px;
        height: 46px;
    }

    .bl-brand-row-title {
        font-size: 20px;
    }

    .bl-brand-row-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
    }

    .bl-brand-row-list .bl-brand-tile {
        height: 52px;
        padding: 6px 8px;
    }

    /* Homepage row: two rows of four on phones; "All brands" leads to the rest. */
    .bl-brand-row:not(.bl-brand-row--grid) .bl-brand-row-list li:nth-child(n+9) {
        display: none;
    }

    .ck-content .bl-brand-row--grid .bl-brand-row-list,
    .bl-brand-row--grid .bl-brand-row-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .bl-brand-row--grid .bl-brand-tile {
        height: 92px;
        gap: 4px;
        padding: 8px 6px;
    }

    .bl-brand-row--grid .bl-brand-tile img {
        height: 46px;
    }

    .bl-brand-row--grid .bl-brand-tile.is-text .bl-brand-tile-name {
        font-size: 14px;
    }

    .bl-brand-tile-caption {
        font-size: 12px;
    }

    .bl-brand-header-logo {
        width: 140px;
        height: 56px;
    }

    .bl-brand-card-links {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bl-brand-tile,
    .bl-brand-card-links svg {
        transition: none;
    }

    .bl-brand-tile:hover,
    .bl-brand-tile:focus-visible,
    .bl-brand-card-links a:hover svg {
        transform: none;
    }
}
