.brand-marquee {
  --brand-gap: 16px;
  --brand-half-gap: 8px;
  --brand-slot-width: clamp(164px, 18vw, 216px);
  position: relative;
  max-width: 100%;
  overflow: hidden;
  border-radius: 8px;
}

.brand-marquee:focus {
  outline: none;
}

.brand-marquee:focus-visible {
  outline: 3px solid var(--color-signal-red);
  outline-offset: 4px;
}

.brand-marquee__track {
  width: max-content;
  display: flex;
  align-items: center;
  gap: var(--brand-gap);
  animation: brand-marquee-left 42s linear infinite;
  will-change: transform;
}

.brand-marquee:hover .brand-marquee__track,
.brand-marquee:focus .brand-marquee__track,
.brand-marquee:focus-within .brand-marquee__track {
  animation-play-state: paused;
}

.brand-marquee__group {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--brand-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.brand-card {
  width: var(--brand-slot-width);
  height: 84px;
  min-height: 0;
  flex: 0 0 var(--brand-slot-width);
  box-sizing: border-box;
  display: grid;
  place-items: center;
  padding: 0 20px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
}

.brand-card img {
  width: auto;
  height: auto;
  max-width: 100%;
  display: block;
  object-fit: contain;
}

.brand-card--hikvision img,
.brand-card--ajax img {
  max-height: 32px;
}

.brand-card--imou img {
  max-height: 36px;
}

.brand-card--zkteco img,
.brand-card--beninca img {
  max-height: 40px;
}

.brand-card--tp-link img {
  max-height: 44px;
}

.brand-card--dahua img {
  max-height: 48px;
}

.brand-card__inset {
  max-width: 100%;
  display: grid;
  place-items: center;
  padding: 8px 12px;
  border-radius: 4px;
}

.brand-card__inset--graphite {
  background: var(--color-graphite);
}

.brand-card__inset--tp-link {
  background: #4acbd6;
}

@keyframes brand-marquee-left {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(calc(-50% - var(--brand-half-gap)), 0, 0); }
}

@media (max-width: 767px) {
  .brand-marquee {
    --brand-gap: 10px;
    --brand-half-gap: 5px;
    --brand-slot-width: 160px;
  }

  .brand-card {
    height: 72px;
    padding: 0 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-marquee {
    overflow: visible;
  }

  .brand-marquee__track {
    width: 100%;
    display: block;
    animation: none !important;
    transform: none !important;
    will-change: auto;
  }

  .brand-marquee__group {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }

  .brand-marquee__group[aria-hidden="true"] {
    display: none;
  }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .brand-card {
    width: calc(50% - var(--brand-half-gap));
    flex-basis: calc(50% - var(--brand-half-gap));
  }
}
