/* /brands page styles (loaded only by Components/Pages/Brands.razor). All selectors are prefixed brands-/brand-. Tokens from PointShop_Brands_Spec.md §8, reconciled with the site
   (warm neutral page background, sage surfaces, deep green actions). */
.brands-page {
    --bp-text: #302c2a;
    --bp-muted: #5f5a55;
    --bp-card: #ffffff;
    --bp-primary: #174d2a;
    --bp-primary-hover: #0f3a1f;
    --bp-sage: #e3e8d5;
    --bp-border: #e2ddd2;
    --bp-radius: 14px;
    --bp-gap: 22px;
    color: var(--bp-text);
    display: flex;
    flex-direction: column;
    gap: 3rem;
    margin-top: -1rem;
}

.brands-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Hero ── */
.brands-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    align-items: center;
}

.brands-hero__title {
    font-size: clamp(1.875rem, 1.2rem + 2.4vw, 3rem);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
    max-width: 18ch;
}

.brands-hero__lead {
    margin-top: 0.75rem;
    font-size: 1rem;
    color: var(--bp-muted);
}

.brands-hero__art img {
    width: 100%;
    height: auto;
    max-height: 340px;
    object-fit: cover;
    border-radius: var(--bp-radius);
}

@media (min-width: 1024px) {
    .brands-hero {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
        min-height: 280px;
    }
}

@media (max-width: 639px) {
    .brands-hero__art { display: none; }   /* keep Popular brands close to the top on phones */
}

/* ── Search ── */
.brands-search {
    position: relative;
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    max-width: 36rem;
}

.brands-search__icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    width: 1.1rem;
    height: 1.1rem;
    transform: translateY(-50%);
    color: var(--bp-muted);
    pointer-events: none;
}

.brands-search__input {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    padding: 0 1rem 0 2.6rem;
    border: 1px solid var(--bp-border);
    border-radius: 10px;
    background: var(--bp-card);
    font-size: 1rem;
    color: var(--bp-text);
}

.brands-search__input:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--bp-primary) 35%, transparent);
    outline-offset: 1px;
    border-color: var(--bp-primary);
}

/* ── Buttons, chips, tags ── */
.brands-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.brands-btn--primary {
    background: var(--bp-primary);
    color: #fff;
    border: 1px solid var(--bp-primary);
    text-transform: uppercase;
}

.brands-btn--primary:hover { background: var(--bp-primary-hover); }

.brands-btn--ghost {
    background: var(--bp-card);
    color: var(--bp-primary);
    border: 1px solid var(--bp-border);
}

.brands-btn--ghost:hover,
.brands-btn--ghost.is-active {
    border-color: var(--bp-primary);
    background: var(--bp-sage);
}

.brands-btn.is-disabled {
    opacity: 0.45;
    cursor: default;
}

.brands-btn:focus-visible,
.brands-chip:focus-visible,
.brands-alpha__item:focus-visible,
.brand-card a:focus-visible,
.brand-card__save:focus-visible,
.brands-directory a:focus-visible {
    outline: 3px solid var(--bp-primary);
    outline-offset: 2px;
}

.brands-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.brands-chip {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 1rem;
    border: 1px solid var(--bp-border);
    border-radius: 999px;
    background: var(--bp-card);
    color: var(--bp-text);
    font-size: 0.875rem;
    text-decoration: none;
}

.brands-chip:hover { border-color: var(--bp-primary); }

.brands-chip.is-active {
    background: #5b7a4e;
    border-color: #5b7a4e;
    color: #fff;
}

.brands-tag {
    display: inline-block;
    margin: 0 0.4rem 0.4rem 0;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    background: var(--bp-sage);
    font-size: 0.8125rem;
}

/* ── Sections ── */
.brands-section__title {
    font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.01em;
}

.brands-section__title:focus { outline: none; }
.brands-section__title:focus-visible { outline: 3px solid var(--bp-primary); outline-offset: 4px; }

.brands-section__lead {
    margin-top: 0.4rem;
    color: var(--bp-muted);
}

/* ── Cards ── */
.brands-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--bp-gap);
    margin-top: 1.25rem;
    padding: 0;
    list-style: none;
}

@media (max-width: 399px) {
    .brands-cards { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 1024px) {
    .brands-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.brand-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border-radius: var(--bp-radius);
    background: var(--bp-card);
    box-shadow: 0 1px 2px rgba(48, 44, 42, 0.06), 0 6px 18px rgba(48, 44, 42, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.brand-card:hover {
    box-shadow: 0 2px 4px rgba(48, 44, 42, 0.08), 0 12px 28px rgba(48, 44, 42, 0.1);
    transform: translateY(-2px);
}

.brand-card__media {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f1ede4;
}

/* Absolutely positioned so tall/wide merchant photos can't stretch the square frame. */
.brand-card__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.brand-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    padding: 1rem 1.1rem 1.15rem;
}

.brand-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.brand-card__name {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.25;
}

.brand-card__name a {
    color: inherit;
    text-decoration: none;
}

.brand-card__name a:hover { text-decoration: underline; }

.brand-card__save {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: -10px -10px 0 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--bp-text);
    cursor: pointer;
}

.brand-card__save svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.brand-card__save.is-saved svg {
    fill: #c2410c;
    stroke: #c2410c;
}

.brand-card__save:disabled { cursor: default; opacity: 0.6; }

.brand-card__sponsored {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bp-muted);
}

.brand-card__desc {
    font-size: 0.875rem;
    color: var(--bp-muted);
    flex: 1;
}

.brand-card__cta {
    margin-top: 0.5rem;
    color: var(--bp-primary);
    font-weight: 700;
    font-size: 0.9375rem;
    text-decoration: none;
    min-height: 24px;
}

.brand-card__cta:hover { text-decoration: underline; }

/* ── Alphabet ── */
.brands-alpha {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem;
    margin-top: 1.25rem;
    padding: 0.35rem;
    border-radius: 999px;
    background: var(--bp-sage);
}

.brands-alpha__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 0.5rem;
    border-radius: 999px;
    color: var(--bp-primary);
    font-weight: 700;
    text-decoration: none;
}

.brands-alpha__item:hover { background: rgba(255, 255, 255, 0.6); }

/* Desktop: share the row so All, #, A–Z fit on one line. */
@media (min-width: 1024px) {
    .brands-alpha { flex-wrap: nowrap; }
    .brands-alpha__item { flex: 1 1 0; min-width: 0; padding: 0; }
}

.brands-alpha__item.is-active {
    background: var(--bp-primary);
    color: #fff;
}

.brands-alpha__item.is-empty {
    color: #a9ad9c;
    font-weight: 500;
}

@media (max-width: 639px) {
    .brands-alpha { border-radius: var(--bp-radius); }
}

/* ── Toolbar / states ── */
.brands-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.brands-toolbar__count {
    font-size: 0.875rem;
    color: var(--bp-muted);
    min-height: 1.25rem;
}

.brands-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.brands-active-filters { margin-top: 0.75rem; }

.brands-note {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--bp-muted);
}

.brands-state {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding: 1.5rem;
    border-radius: var(--bp-radius);
    background: var(--bp-card);
}

.brands-state--error { border-left: 4px solid #b91c1c; }

/* ── Directory (row-major grid so reading and tab order match visual order) ── */
.brands-directory {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1.5rem;
    margin-top: 1rem;
    padding: 0;
    list-style: none;
}

@media (min-width: 640px) {
    .brands-directory { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .brands-directory { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 359px) {
    .brands-directory { grid-template-columns: minmax(0, 1fr); }
}

.brands-directory li {
    min-width: 0;
}

.brands-directory a {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: var(--bp-text);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.brands-directory a:hover {
    color: var(--bp-primary);
    text-decoration: underline;
}

.brands-skeleton {
    display: block;
    height: 1rem;
    margin: 0.85rem 0;
    width: 70%;
    border-radius: 6px;
    background: #ebe6dc;
}

/* ── Pager ── */
.brands-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.brands-pager__status {
    font-size: 0.875rem;
    color: var(--bp-muted);
}

@media (prefers-reduced-motion: reduce) {
    .brand-card,
    .brands-btn { transition: none; }
    .brand-card:hover { transform: none; }
}
