/*
 * The "Shop by brand" page [sc_brand_directory] (inc/brands/directory.php), as approved on 2026-09-18:
 * popular brands (soft shadow, taller plate), then one grid of every brand by product count. Hover
 * swaps the border and tint, never lifts. Loaded only on a page that prints the directory.
 */
.sc-brand-directory {
  --sc-brand-gold: #dc9814;                      /* non-text only: hover border, focus ring */
  --sc-brand-gold-ink: #966504;                  /* count numerals — AA 5.05:1 on white */
  --sc-brand-tile-border: #e5e5e5;
  --sc-brand-muted: #767676;
  --sc-brand-heading: #222222;                   /* theme heading ink */
  --sc-brand-body: #444444;                      /* theme body ink */
  --sc-brand-card-bg: #ffffff;
  --sc-brand-hover-tint: rgba(220, 152, 20, 0.06);
  --sc-brand-radius: 12px;
  margin: 16px 0 48px;
}

.sc-brand-page-sub {
  margin: 0 0 40px;
  font-size: 16px;
  color: var(--sc-brand-body);
}

.sc-brand-tier { margin-bottom: 64px; }
.sc-brand-tier-title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--sc-brand-heading);
}
.sc-brand-tier-sub {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--sc-brand-muted);
}

/* --- Card anatomy (one <a> holds plate + meta) --- */
.sc-brand-card {
  display: flex;
  flex-direction: column;
  background: var(--sc-brand-card-bg);
  border: 1px solid var(--sc-brand-tile-border);
  border-radius: var(--sc-brand-radius);
  text-decoration: none;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}
.sc-brand-card:hover,
.sc-brand-card:focus-visible {
  border-color: var(--sc-brand-gold);
  background-color: var(--sc-brand-hover-tint);
}
.sc-brand-card:focus-visible {
  outline: 2px solid var(--sc-brand-gold);
  outline-offset: 2px;
}
/* Featured tier: the ONLY place shadows are allowed (design rule). */
.sc-brand-card--featured { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }
.sc-brand-card--featured:hover,
.sc-brand-card--featured:focus-visible { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10); }

.sc-brand-plate {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 96px;               /* grid tile plate */
  padding: 0 16px;
  overflow: hidden;
}
.sc-brand-card--featured .sc-brand-plate { height: 120px; } /* featured plate */

/* Logo normalization: every upload sits in the same optical box. */
.sc-brand-logo {
  max-width: 100%;
  max-height: 64px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.sc-brand-card--featured .sc-brand-logo { max-height: 80px; }
.sc-brand-logo--placeholder { width: 64px; height: 64px; }

.sc-brand-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-top: 1px solid var(--sc-brand-tile-border); /* internal hairline divider */
  text-align: center;
  min-width: 0;
}
.sc-brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--sc-brand-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sc-brand-card--featured .sc-brand-name { font-size: 16px; }
.sc-brand-count { font-size: 13px; color: var(--sc-brand-muted); }
.sc-brand-count b { font-weight: 600; color: var(--sc-brand-gold-ink); }

/* --- Grids: column count via --sc-brand-cols (set inline per shortcode attrs;
       featured grid ships 6, all-brands grid ships the columns attr) --- */
.sc-brand-grid {
  display: grid;
  grid-template-columns: repeat(var(--sc-brand-cols, 4), 1fr);
  gap: 24px;
}

/* Collapse ladder (audit-confirmed): featured 3-across @768-1023, everything
   2-col <=767. Grid: 4 >=1024 -> 3 @768-1023 -> 2 <=767. */
@media ( max-width: 1023px ) {
  .sc-brand-grid { grid-template-columns: repeat(3, 1fr); }
}
@media ( max-width: 767px ) {
  .sc-brand-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .sc-brand-tier { margin-bottom: 48px; }
}

/* Reduced motion: transitions off — hover states still differ by colour. */
@media ( prefers-reduced-motion: reduce ) {
  .sc-brand-card { transition: none; }
}
