/* ==========================================================
   Brands / Partner Logos — Module Styles
   Module: brands_bar  (universal renderer)
   ──────────────────────────────────────────────────────────
   Extracted from the inline <style> block of
   web/partials/brands_bar.php (Wave 4, 2026-05-21). Loaded once
   per page via the $GLOBALS['_brands_bar_css_emitted'] guard.

   Colours tokenised to --mt-* where an EXACT token exists (the
   raw neutral scale is template-stable, so a "light" / "dark"
   slab keeps its intended tone on every template). Opacity-based
   rgba() borders/tints and the dark-mode canvas colour (#0d1117)
   are intentionally kept literal — no exact token exists and the
   priority is preserving the current visual appearance.
   ========================================================== */

/* ============================================================
   BRANDS BAR V2 — VISUAL FIX
   Variable-driven, aspect-aware, FORCED logo size
============================================================ */

.brands-bar {
  /* Inline style sets:  --logo-height-desktop  --logo-height-mobile
     Spacing class sets: --gap-desktop --gap-mobile --pad-desktop --pad-mobile */
  --logo-height: var(--logo-height-desktop);
  --inner-pad: calc(var(--logo-height) * 0.08);
  --gap: var(--gap-desktop);
  --section-pad-y: var(--pad-desktop);
  padding: var(--section-pad-y) 0;
  position: relative;
  /* Visual weight: subtle borders on every bg mode */
  border-top:    1px solid rgba(15,23,42,0.06);
  border-bottom: 1px solid rgba(15,23,42,0.06);
}

/* ── Spacing presets — REDUCED ~30% from v2 base ────────── */
.brands-bar--spacing-tight  {
  --gap-desktop: 18px;  --gap-mobile: 12px;
  --pad-desktop: 32px;  --pad-mobile: 24px;
}
.brands-bar--spacing-normal {
  --gap-desktop: 28px;  --gap-mobile: 18px;
  --pad-desktop: 44px;  --pad-mobile: 32px;
}
.brands-bar--spacing-loose  {
  --gap-desktop: 44px;  --gap-mobile: 28px;
  --pad-desktop: 56px;  --pad-mobile: 40px;
}

/* ── Background variants ─────────────────────────────────── */
.brands-bar--light {
  background: var(--mt-neutral-50);
}
.brands-bar--dark {
  background: #0d1117;
  color: var(--mt-neutral-0);
  border-top:    1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brands-bar--transparent {
  /* visual-weight contrast even when "transparent" */
  background: rgba(15,23,42,0.025);
}

/* ── Header (title + subtitle) ───────────────────────────── */
.brands-bar__header { text-align: center; margin-bottom: 22px; }
.brands-bar__title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 8px;
  color: var(--mt-neutral-900);
  letter-spacing: -0.01em;
}
.brands-bar--dark .brands-bar__title { color: var(--mt-neutral-0); }

.brands-bar__subtitle {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--mt-neutral-500);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.5;
}
.brands-bar--dark .brands-bar__subtitle { color: rgba(255,255,255,0.65); }

/* ════════════════════════════════════════════════════════════
   SLOT — FORCED REAL LOGO SIZE
   Image height is EXPLICITLY set to var(--logo-height), not
   derived from container. Slot grows naturally in width to
   accommodate the image's natural aspect ratio. Min-width floor
   of 120px (or height × 1.5, whichever larger) prevents square
   logos from looking lonely.
═══════════════════════════════════════════════════════════════ */
.brands-slot {
  height: var(--logo-height);
  /* Floor: 120px hard minimum, OR height × 1.5, whichever is larger */
  min-width: max(120px, calc(var(--logo-height) * 1.5));
  padding: 0 var(--inner-pad);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brands-slot a,
.brands-slot > div {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
}
.brands-slot img {
  /* Image height is FORCED to logo_height. Width auto-flexes by
     natural aspect ratio. No max-width — slot grows to fit. */
  height: var(--logo-height);
  width: auto;
  display: block;
  object-fit: contain;
}
.brands-slot__name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--mt-neutral-400);
  white-space: nowrap;
  text-align: center;
}

/* ════════════════════════════════════════════════════════════
   COLOR TREATMENT
═══════════════════════════════════════════════════════════════ */

/* COLOR (default) — brightness 1.1 boost + strong hover */
.brands-bar--style-color .brands-slot img {
  filter: brightness(1.1);
  opacity: 1;
  transition: transform 220ms ease, filter 220ms ease;
}
.brands-bar--style-color .brands-slot:hover img {
  filter: brightness(1.18);
  transform: scale(1.1);
}

/* GREYSCALE (opt-in) — full reveal on hover */
.brands-bar--style-greyscale .brands-slot img {
  filter: grayscale(100%);
  opacity: 0.85;
  transition: filter 220ms ease, opacity 220ms ease, transform 220ms ease;
}
.brands-bar--style-greyscale .brands-slot:hover img {
  filter: grayscale(0%) brightness(1.1);
  opacity: 1;
  transform: scale(1.1);
}

/* Dark-bg readability adjustments */
.brands-bar--dark.brands-bar--style-color .brands-slot img {
  filter: brightness(1.2);
}
.brands-bar--dark.brands-bar--style-color .brands-slot:hover img {
  filter: brightness(1.3);
  transform: scale(1.1);
}
.brands-bar--dark.brands-bar--style-greyscale .brands-slot img {
  filter: grayscale(100%) brightness(1.6);
  opacity: 0.85;
}
.brands-bar--dark.brands-bar--style-greyscale .brands-slot:hover img {
  filter: grayscale(0%) brightness(1.15);
  opacity: 1;
  transform: scale(1.1);
}

/* ════════════════════════════════════════════════════════════
   GRID LAYOUT — centered, wraps cleanly
═══════════════════════════════════════════════════════════════ */
.brands-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--gap);
}

/* ════════════════════════════════════════════════════════════
   STRIP LAYOUT — auto-scrolling marquee
═══════════════════════════════════════════════════════════════ */
.brands-strip {
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
          mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
}
.brands-strip__track {
  display: flex;
  align-items: center;
  width: max-content;
  gap: var(--gap);
  animation: brandsScrollV2 30s linear infinite;
}
.brands-strip__track:hover { animation-play-state: paused; }

@keyframes brandsScrollV2 {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ════════════════════════════════════════════════════════════
   MOBILE RULES (< 992px)
   - Always grid (strip animation disabled)
   - logo_height scales to mobile value
   - gap and section padding use mobile variables
   - Image gets max-width: 100% so it fits column without overflow
═══════════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
  .brands-bar {
    --logo-height: var(--logo-height-mobile);
    --gap: var(--gap-mobile);
    --section-pad-y: var(--pad-mobile);
  }
  .brands-strip {
    -webkit-mask-image: none;
            mask-image: none;
  }
  .brands-strip__track {
    flex-wrap: wrap;
    width: 100%;
    animation: none;
    justify-content: center;
  }
  .brands-strip__track > [aria-hidden="true"] { display: none; }
  /* Mobile column-grid cells need flexible image width to fit column */
  .brands-slot img { max-width: 100%; }
}

/* Mobile column-grid breakpoints */
@media (max-width: 991px) and (min-width: 768px) {
  .brands-grid,
  .brands-strip__track {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }
  .brands-grid .brands-slot,
  .brands-strip__track .brands-slot {
    min-width: 0;
  }
}
@media (max-width: 767px) and (min-width: 576px) {
  .brands-grid,
  .brands-strip__track {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .brands-grid .brands-slot,
  .brands-strip__track .brands-slot {
    min-width: 0;
  }
}
@media (max-width: 575px) and (min-width: 380px) {
  .brands-grid,
  .brands-strip__track {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  .brands-grid .brands-slot,
  .brands-strip__track .brands-slot {
    min-width: 0;
  }
}
@media (max-width: 379px) {
  .brands-grid,
  .brands-strip__track {
    display: grid;
    grid-template-columns: 1fr;
  }
  .brands-grid .brands-slot,
  .brands-strip__track .brands-slot {
    min-width: 0;
  }
}

/* Mobile typography */
@media (max-width: 767px) {
  .brands-bar__title    { font-size: 1.25rem; }
  .brands-bar__subtitle { font-size: 0.85rem; }
  .brands-bar__header   { margin-bottom: 16px; }
}

/* ════════════════════════════════════════════════════════════
   REDUCED-MOTION ACCESSIBILITY
═══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .brands-strip {
    -webkit-mask-image: none;
            mask-image: none;
  }
  .brands-strip__track {
    animation: none;
    flex-wrap: wrap;
    width: 100%;
    justify-content: center;
  }
  .brands-strip__track > [aria-hidden="true"] { display: none; }
  .brands-slot img { transition: none !important; }
  .brands-slot:hover img { transform: none !important; }
}
