/* ==========================================================================
   TRIONEX — brand-logos.css
   Two logo sections: "Shop by car manufacturer" and "Shop by battery brand".
   Logos are loaded from images/logos/… ; until a file exists the tile shows
   a clean monogram + name instead (see js/brand-logos.js).
   Requires: base.css, js/brand-logos.js
   ========================================================================== */

.logo-section .section-head { align-items: flex-end; }
.section-head__sub {
  margin-top: var(--space-2);
  color: var(--color-text-light);
  max-width: 52ch;
}

/* --------------------------------------------------------------------------
   Car manufacturer grid
   -------------------------------------------------------------------------- */
.make-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: var(--space-3);
}

.make-tile {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--space-2);
  width: 100%;
  aspect-ratio: 1 / 0.9;
  padding: var(--space-3) var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: #ffffff;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-mid) var(--ease-out),
              transform var(--dur-mid) var(--ease-out),
              box-shadow var(--dur-mid) var(--ease-out);
}
.make-tile__logo {
  display: grid;
  place-items: center;
  width: 100%;
  height: 60px;
}
.make-tile__logo img {
  max-width: 82%;
  max-height: 56px;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform var(--dur-mid) var(--ease-out);
}

/* Monogram shown when no logo file is present */
.logo-mono {
  display: none;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-brand);
  transition: background var(--dur-mid) var(--ease-out), color var(--dur-mid) var(--ease-out);
}
.no-logo .logo-mono { display: grid; }
.no-logo img { display: none; }

.make-tile__name {
  font-family: var(--font-head);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text);
}

@media (hover: hover) {
  .make-tile:hover {
    border-color: rgba(11, 61, 145, 0.45);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
  }
  .make-tile:hover img { transform: scale(1.06); }
  .make-tile:hover .logo-mono { background: var(--color-accent); color: #ffffff; border-color: var(--color-accent); }
  .make-tile:hover .make-tile__name { color: var(--color-accent-hover); }
}
.make-tile:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

/* Collapsed rows on small screens — "View all" expands them */
.make-grid__more { display: contents; }

.logo-section__foot {
  display: flex;
  justify-content: center;
  margin-top: var(--space-6);
}
.btn--outline-accent {
  --btn-fg: var(--color-accent-hover);
  --btn-border: var(--color-accent);
  --btn-bg: transparent;
  min-width: 200px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.btn--outline-accent:hover { --btn-bg: var(--color-accent); --btn-fg: #ffffff; }

/* --------------------------------------------------------------------------
   Battery brand cards
   -------------------------------------------------------------------------- */
.logo-section--brands { background: var(--color-surface); }

.brand-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-4);
}

.brand-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: #ffffff;
  overflow: hidden;
  transition: border-color var(--dur-mid) var(--ease-out),
              transform var(--dur-mid) var(--ease-out),
              box-shadow var(--dur-mid) var(--ease-out);
}
.brand-card__logo {
  position: relative;
  display: grid;
  place-items: center;
  height: 110px;
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}
/* thin brand-colour bar across the top of each card */
.brand-card__logo::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--brand-color, var(--color-accent));
}
.brand-card__logo img {
  max-width: 82%;
  max-height: 64px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.brand-card .logo-mono {
  width: auto;
  height: auto;
  border: 0;
  background: none;
  border-radius: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--brand-color, var(--color-brand));
}

.brand-card__body {
  display: grid;
  gap: 4px;
  padding: var(--space-3) var(--space-4) var(--space-4);
}
.brand-card__name {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}
.brand-card__name a::after { content: ""; position: absolute; inset: 0; }
.brand-card__meta {
  font-size: 0.8rem;
  color: var(--color-text-light);
}
.brand-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin-top: var(--space-2);
  font-family: var(--font-head);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-accent-hover);
}
.brand-card__cta svg { width: 14px; height: 14px; transition: transform var(--dur-fast) var(--ease-out); }

@media (hover: hover) {
  .brand-card:hover {
    border-color: rgba(11, 61, 145, 0.45);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
  }
  .brand-card:hover .brand-card__cta svg { transform: translateX(3px); }
}
.brand-card:focus-within { border-color: var(--color-accent); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .make-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .brand-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .make-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
  .make-tile { aspect-ratio: 1 / 1.05; padding: var(--space-2) 4px; border-radius: 12px; }
  .make-tile__logo { height: 40px; }
  .make-tile__logo img { max-height: 36px; }
  .logo-mono { width: 40px; height: 40px; font-size: 0.85rem; }
  .make-tile__name { font-size: 0.72rem; }
  /* show 8 on phones until "View all" is tapped */
  .make-grid:not(.is-expanded) .make-tile:nth-child(n+9) { display: none; }

  .brand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .brand-card__logo { height: 88px; }
}
