.clients-section {
  --clients-accent: #582aa6;
  padding: clamp(72px, 8vw, 104px) 0;
  background: var(--dark, #0e0f14);
  color: #ffffff;
  /* The sliding rows run the full screen width */
  overflow-x: clip;
  transition: background-color 360ms ease, color 360ms ease;
}

.clients-container {
  width: min(1200px, calc(100% - 48px));
  margin-inline: auto;
}

.clients-header {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.clients-title {
  margin: 0;
  color: #ffffff;
  font-family: var(--font-main, Arial, sans-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.12;
  opacity: 0;
  transform: translateY(10px);
  transition: color 360ms ease, opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.clients-title.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

.clients-subtitle {
  margin: 18px 0 0;
  color: var(--dark-muted, #9da0b5);
  font-family: var(--font-main, Arial, sans-serif);
  font-size: clamp(0.98rem, 1.35vw, 1.125rem);
  line-height: 1.65;
  transition: color 360ms ease;
}

/* Plain grid: shown without JavaScript or with reduced motion */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin: 42px 0 0;
  padding: 0;
  list-style: none;
}

/* Sliding row (built from the grid by initClients) */
.clients-marquee-wrap {
  margin-top: 42px;
  margin-inline: calc(50% - 50vw);
}

/* Moved by initMarqueeMotion: the row can be dragged sideways, while vertical
   swipes still scroll the page */
.clients-marquee {
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.clients-marquee.is-dragging {
  cursor: grabbing;
}

.clients-marquee-track {
  --clients-card: 150px;
  --clients-gap: 72px;
  display: flex;
  gap: var(--clients-gap);
  width: max-content;
  margin: 0;
  padding: 0;
  list-style: none;
  will-change: transform;
}

/* In the sliding row the logos are plain white marks on the dark band */
.clients-marquee .client-logo {
  flex: 0 0 var(--clients-card);
  min-height: 88px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.clients-marquee .client-logo img {
  max-width: 100%;
  max-height: 64px;
  /* Dark logos turn white; white details turn dark so filled marks keep their text */
  filter: grayscale(1) invert(1);
  opacity: 0.8;
  transition: opacity 220ms ease;
}

.clients-marquee .client-logo:hover img {
  opacity: 1;
}

/* No card highlight when a logo is hovered, tapped or focused: a white box
   would hide the white logo */
.clients-marquee .client-logo:hover,
.clients-marquee .client-logo:active,
.clients-marquee .client-logo:focus,
.clients-marquee .client-logo:focus-visible,
.clients-marquee .client-logo:focus-within {
  border: 0;
  background: none;
  box-shadow: none;
}

.clients-marquee .client-logo {
  -webkit-tap-highlight-color: transparent;
}

.client-logo {
  display: flex;
  min-width: 0;
  min-height: 148px;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border: 1px solid var(--border-light, #e6e6ef);
  border-radius: 4px;
  background: #fff;
  transition: border-color 220ms ease, background-color 220ms ease, box-shadow 220ms ease;
}

.client-logo:hover,
.client-logo:active,
.client-logo:focus-visible,
.client-logo:focus-within {
  border-color: rgba(88, 42, 166, 0.48);
  background: #fdfcff;
  box-shadow: 0 8px 24px rgba(40, 25, 62, 0.06);
}

.client-logo__image-wrap {
  position: relative;
  display: flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  justify-content: center;
}

.client-logo img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 176px);
  max-height: 104px;
  object-fit: contain;
  object-position: center;
}

@media (max-width: 1000px) {
  .clients-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
  }

  .client-logo {
    min-height: 138px;
    padding: 18px;
  }
}

@media (max-width: 700px) {
  .clients-section {
    padding: 76px 0 88px;
  }

  .clients-container {
    width: min(100% - 32px, 560px);
  }

  .clients-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 28px;
  }

  .clients-marquee-wrap {
    margin-top: 32px;
  }

  .clients-marquee-track {
    --clients-card: 110px;
    --clients-gap: 44px;
  }

  .clients-marquee .client-logo {
    min-height: 72px;
  }

  .clients-marquee .client-logo img {
    max-height: 48px;
  }

  .client-logo {
    min-height: 124px;
    padding: 14px;
  }

  .client-logo__image-wrap {
    min-height: 0;
  }

  .client-logo img {
    max-height: 88px;
  }
}

@media (max-width: 380px) {
  .clients-container {
    width: calc(100% - 24px);
  }

  .clients-grid {
    gap: 8px;
  }

  .client-logo {
    min-height: 112px;
    padding: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .clients-section,
  .clients-title,
  .clients-subtitle,
  .client-logo {
    transition: none;
  }

  .clients-title {
    opacity: 1;
    transform: none;
  }
}
