/* Public brand directory. Scoped so catalog, checkout and admin styles stay isolated. */
.storefront-body .brand-directory-page [hidden] {
    display: none !important;
}

.storefront-body .brand-directory-page {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    max-width: 1360px;
    margin-inline: auto;
}

.storefront-body .brand-directory-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 24px;
    margin-bottom: 16px;
    padding: clamp(18px, 2.6vw, 28px);
    border: 1px solid var(--p24-line, #e9dce0);
    border-radius: 16px;
    background: linear-gradient(115deg, #fff 55%, #fff4f0);
}

.storefront-body .brand-directory-hero .section-label {
    margin-bottom: 8px;
}

.storefront-body .brand-directory-hero h1 {
    margin: 0 0 5px;
    color: var(--p24-ink, #211719);
    font-size: clamp(27px, 3.4vw, 38px);
    line-height: 1.15;
}

.storefront-body .brand-directory-hero p {
    max-width: 670px;
    margin: 0;
    color: var(--p24-muted, #64606c);
    font-size: 14px;
}

.storefront-body .brand-directory-total {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 118px;
    min-height: 75px;
    padding: 10px 16px;
    border: 1px solid #f0ddda;
    border-radius: 13px;
    background: #fff;
    text-align: center;
}

.storefront-body .brand-directory-total strong {
    color: #760a17;
    font-size: 27px;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.storefront-body .brand-directory-total span {
    color: var(--p24-muted, #64606c);
    font-size: 12px;
}

.storefront-body .brand-directory-tools {
    display: grid;
    gap: 12px;
    min-width: 0;
    margin-bottom: 22px;
    padding: 14px;
    border: 1px solid var(--p24-line, #e9dce0);
    border-radius: 14px;
    background: #fff;
}

.storefront-body .brand-directory-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(100%, 520px);
    min-height: 46px;
    padding: 0 4px 0 14px;
    border: 1px solid #e0d6d5;
    border-radius: 10px;
    background: #fffdfc;
    color: #7b6f73;
}

.storefront-body .brand-directory-search:focus-within {
    border-color: #9c192b;
    outline: 2px solid #9c192b;
    outline-offset: 1px;
}

.storefront-body .brand-directory-search > svg {
    flex: 0 0 auto;
    width: 19px;
    height: 19px;
}

.storefront-body .brand-directory-search input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--p24-ink, #211719);
    font-size: 14px;
}

.storefront-body .brand-directory-search input::placeholder {
    color: #777078;
    opacity: 1;
}

/* The localized clear button below replaces the browser-specific cancel icon. */
.storefront-body .brand-directory-search input::-webkit-search-cancel-button {
    display: none;
}

.storefront-body .brand-directory-clear {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #f7edeb;
    color: #760a17;
    cursor: pointer;
}

.storefront-body .brand-directory-clear:hover,
.storefront-body .brand-directory-clear:focus-visible {
    outline: 2px solid #9c192b;
    outline-offset: 1px;
    background: #f1dedd;
}

.storefront-body .brand-directory-clear svg {
    width: 17px;
    height: 17px;
}

.storefront-body .brand-directory-alphabet {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding: 1px 1px 7px;
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.storefront-body .brand-directory-alphabet a {
    display: grid;
    flex: 0 0 44px;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid #e8dddd;
    border-radius: 9px;
    background: #fff;
    color: #493a40;
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
}

.storefront-body .brand-directory-results-count {
    margin: 0;
    color: #675760;
    font-size: 13px;
    font-weight: 650;
}

.storefront-body .brand-directory-results-count:empty {
    display: none;
}

.storefront-body .brand-directory-featured {
    min-width: 0;
    margin-bottom: 24px;
}

.storefront-body .brand-directory-featured h2 {
    margin: 0 0 12px;
    color: var(--p24-ink, #211719);
    font-size: 18px;
    line-height: 1.3;
}

.storefront-body .brand-directory-grid {
    display: grid;
    align-items: start;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 156px), 1fr));
    gap: 9px;
    min-width: 0;
    max-width: 100%;
}

.storefront-body .brand-directory-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 82px;
    padding: 12px 14px;
    border: 1px solid #eadddc;
    border-radius: 12px;
    background: #fff;
    color: var(--p24-ink, #211719);
}

.storefront-body .brand-directory-card-name {
    min-width: 0;
    color: inherit;
    font-size: 15px;
    font-weight: 760;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.storefront-body .brand-directory-card small {
    color: var(--p24-muted, #64606c);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.storefront-body .brand-directory-groups {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    min-width: 0;
}

.storefront-body .brand-directory-group {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: start;
    gap: 18px;
    min-width: 0;
    padding: 18px 0;
    border-top: 1px solid #eadfdd;
    scroll-margin-top: 155px;
}

.storefront-body .brand-directory-group:first-child {
    padding-top: 0;
    border-top: 0;
}

.storefront-body .brand-directory-group h2 {
    display: grid;
    place-items: center;
    width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 3px;
    border: 1px solid #ecd8d4;
    border-radius: 11px;
    background: #fff0ed;
    color: #760a17;
    font-size: 19px;
    font-weight: 850;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.storefront-body .brand-directory-group:target h2 {
    border-color: #760a17;
    background: #760a17;
    color: #fff;
}

.storefront-body .brand-directory-group ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 195px), 1fr));
    gap: 3px 12px;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.storefront-body .brand-directory-group li {
    min-width: 0;
}

.storefront-body .brand-directory-group li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    min-width: 0;
    min-height: 42px;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #2d252a;
    font-size: 14px;
    line-height: 1.3;
}

.storefront-body .brand-directory-group li a span {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.storefront-body .brand-directory-group li a small {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 6px;
    background: #f6f1ef;
    color: #675d62;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
    white-space: nowrap;
}

.storefront-body .brand-directory-alphabet a:hover,
.storefront-body .brand-directory-alphabet a:focus-visible {
    border-color: #9c192b;
    outline: 2px solid #9c192b;
    outline-offset: 1px;
    background: #fff5f2;
    color: #760a17;
}

.storefront-body .brand-directory-card:hover,
.storefront-body .brand-directory-card:focus-visible,
.storefront-body .brand-directory-group li a:hover,
.storefront-body .brand-directory-group li a:focus-visible {
    border-color: #dfaaa9;
    outline: 2px solid transparent;
    background: #fff5f2;
    color: #760a17;
}

.storefront-body .brand-directory-card:focus-visible,
.storefront-body .brand-directory-group li a:focus-visible {
    outline-color: #9c192b;
    outline-offset: 1px;
}

@media (width <= 720px) {
    .storefront-body .brand-directory-grid {
        grid-auto-columns: minmax(165px, 58%);
        grid-auto-flow: column;
        grid-template-columns: none;
        gap: 9px;
        overflow-x: auto;
        padding: 2px 1px 10px;
        scroll-padding-inline: 1px;
        scroll-snap-type: x proximity;
        scrollbar-width: thin;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    .storefront-body .brand-directory-card {
        scroll-snap-align: start;
    }
}

@media (width <= 620px) {
    .storefront-body .brand-directory-hero {
        align-items: flex-start;
        gap: 12px;
        padding: 17px;
    }

    .storefront-body .brand-directory-hero .section-label {
        margin-bottom: 6px;
    }

    .storefront-body .brand-directory-hero h1 {
        font-size: 28px;
    }

    .storefront-body .brand-directory-total {
        flex-direction: row;
        gap: 8px;
        min-width: 0;
        min-height: 42px;
        padding: 7px 12px;
        text-align: left;
    }

    .storefront-body .brand-directory-total strong {
        font-size: 21px;
    }

    .storefront-body .brand-directory-tools {
        gap: 10px;
        margin-bottom: 20px;
        padding: 11px;
    }

    .storefront-body .brand-directory-search {
        width: 100%;
    }

    .storefront-body .brand-directory-alphabet a {
        flex-basis: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .storefront-body .brand-directory-group {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        padding: 16px 0;
        scroll-margin-top: 115px;
    }

    .storefront-body .brand-directory-group ul {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px 7px;
    }

    .storefront-body .brand-directory-group li a {
        min-height: 46px;
        padding: 7px;
        font-size: 13px;
    }
}

@media (width <= 360px) {
    .storefront-body .brand-directory-group ul {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .storefront-body .brand-directory-card,
    .storefront-body .brand-directory-alphabet a,
    .storefront-body .brand-directory-group li a {
        transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    }
}
