/* Single owner for client motion, color grading and responsive fallbacks. */
#klijenti {
  --client-slot: clamp(180px, 17vw, 260px);
  --client-group-width: max(100vw, calc(8 * var(--client-slot)));

  position: relative;
  z-index: 4;

  width: 100%;
  overflow: hidden;
  padding: clamp(5rem, 12vh, 9rem) 0;

  border-top: 1px solid var(--border-subtle);
  background: radial-gradient(ellipse at 50% 65%, #00ff6605, transparent 65%), var(--bg-base);
}

.klijenti-header-wrap {
  position: relative;

  max-width: var(--container-max);
  margin: 0 auto clamp(2.5rem, 5vw, 4.5rem);
  padding: 0 var(--container-pad);

  text-align: center;
}

.klijenti-eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;

  margin-bottom: 1.25rem;

  color: #8bb79a;
  font: 0.65rem/1.6 var(--font-mono);
  letter-spacing: 0.14em;
}

.klijenti-tag-pip {
  flex: 0 0 6px;

  height: 6px;

  border-radius: 50%;
  background: #00ff66;
  box-shadow: 0 0 10px #00ff6660;

  animation: clientsSignal 3s ease-in-out infinite paused;
}

@keyframes clientsSignal {
  50% {
    opacity: 0.35;
  }
}

#klijenti .klijenti-title {
  margin-bottom: 1.25rem;

  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 4.4rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.15);
}

.klijenti-subtitle {
  max-width: 660px;
  margin: 0 auto;

  font-size: clamp(0.95rem, 1.25vw, 1.15rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.6);
}

.clients-motion-toggle {
  margin-top: 1.5rem;
  padding: 0.6rem 0.9rem;

  border: 1px solid #ffffff18;
  border-radius: 999px;
  background: #ffffff03;

  color: #ffffff99;
  font: 0.7rem/1.4 var(--font-mono);
  cursor: pointer;
  transition:
    color 0.25s,
    border-color 0.25s;
}

.clients-motion-toggle:hover {
  color: #fff;

  border-color: #00ff6655;
}

.clients-motion-toggle:focus-visible {
  outline: 1px solid #00ff66;
  outline-offset: 4px;
}

.klijenti-marquee-container {
  display: flex;
  flex-direction: column;
  gap: clamp(0.5rem, 2vh, 1.5rem);

  width: 100%;
  overflow: hidden;

  mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
}

#klijenti .marquee-row {
  width: 100%;
  overflow: hidden;
}

#klijenti .marquee-track {
  display: flex;

  width: calc(2 * var(--client-group-width));

  animation: clientsDrift 48s linear infinite paused;
}

#klijenti .marquee-row-2 .marquee-track {
  animation-duration: 40s;
  animation-direction: reverse;
}

#klijenti .marquee-row-3 .marquee-track {
  animation-duration: 50s;
}

@keyframes clientsDrift {
  to {
    transform: translateX(-50%);
  }
}

#klijenti .marquee-group {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex: 0 0 auto;
  /* Eight equal slots per group; explicit width keeps the 50% seam exact. */

  width: var(--client-group-width);
  min-width: 100vw;
}

#klijenti .client-logo-item {
  --brand-rgb: 220 230 240;

  position: relative;

  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--client-slot);

  width: var(--client-slot);
  height: clamp(100px, 10vw, 136px);
  padding: 24px 30px;

  isolation: isolate;
}

/* Ambient light follows the dominant hue of each supplied brand asset. */
#klijenti .client-logo-item[title="Con Color"] {
  --brand-rgb: 242 36 36;
}

#klijenti .client-logo-item[title="Ferivi Sport"] {
  --brand-rgb: 242 36 36;
}

#klijenti .client-logo-item[title="FINA"] {
  --brand-rgb: 36 88 242;
}

#klijenti .client-logo-item[title="Firmo"] {
  --brand-rgb: 242 139 36;
}

#klijenti .client-logo-item[title="Genesis Grupa"] {
  --brand-rgb: 242 36 88;
}

#klijenti .client-logo-item[title="HER"] {
  --brand-rgb: 36 88 242;
}

#klijenti .client-logo-item[title="Intersport"] {
  --brand-rgb: 36 88 242;
}

#klijenti .client-logo-item[title="Luxottica"] {
  --brand-rgb: 36 139 242;
}

#klijenti .client-logo-item[title="Mandis Pharm"] {
  --brand-rgb: 36 242 36;
}

#klijenti .client-logo-item[title="Nexe Grupa"] {
  --brand-rgb: 36 242 191;
}

#klijenti .client-logo-item[title="Sobočan"] {
  --brand-rgb: 242 36 36;
}

#klijenti .client-logo-item[title="Oculus"] {
  --brand-rgb: 242 36 36;
}

#klijenti .client-logo-item[title="Optika Jo-Jo"] {
  --brand-rgb: 60 60 242;
}

#klijenti .client-logo-item[title="OTP Banka"] {
  --brand-rgb: 36 242 139;
}

#klijenti .client-logo-item[title="Philip Morris International"] {
  --brand-rgb: 36 139 242;
}

#klijenti .client-logo-item[title="PP Orahovica"] {
  --brand-rgb: 242 191 36;
}

#klijenti .client-logo-item[title="Prima Namještaj"] {
  --brand-rgb: 36 88 242;
}

#klijenti .client-logo-item[title="Prima Pharme"] {
  --brand-rgb: 60 60 242;
}

#klijenti .client-logo-item[title="Roto Dinamic"] {
  --brand-rgb: 242 191 36;
}

#klijenti .client-logo-item[title="SPAR"] {
  --brand-rgb: 242 36 36;
}

#klijenti .client-logo-item[title="Transcorm"] {
  --brand-rgb: 60 60 242;
}

#klijenti .client-logo-item[title="Würth"] {
  --brand-rgb: 242 36 36;
}

.client-logo-item::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 8%;

  border-radius: 50%;
  background: radial-gradient(
    ellipse,
    rgb(var(--brand-rgb) / 0.16),
    rgb(var(--brand-rgb) / 0.04) 45%,
    transparent 72%
  );
  opacity: 1;
  pointer-events: none;
}

#klijenti .client-logo-item img {
  display: block;

  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 52px;
  object-fit: contain;
  filter: saturate(1.12) brightness(1.08) drop-shadow(0 0 10px rgb(var(--brand-rgb) / 0.18));

  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

#klijenti[data-ambient="playing"]:not([data-user-paused="true"]) .marquee-track,
#klijenti[data-ambient="playing"]:not([data-user-paused="true"]) .klijenti-tag-pip {
  animation-play-state: running;
}

#klijenti[data-ambient="playing"] .marquee-track {
  will-change: transform;
}

/* All marks stay illuminated; focus/hover only scale the inner image. */
#klijenti[data-ambient] .marquee-row:focus-within .marquee-track,
#klijenti[data-ambient][data-user-paused="true"] .marquee-track {
  animation-play-state: paused;
}

#klijenti .client-logo-item:focus-visible {
  outline: 1px solid #00ff6660;
  outline-offset: -12px;
}

#klijenti .client-logo-item:focus-visible img {
  transform: scale(1.15);
}

.client-logo-item:focus-visible::before {
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  #klijenti[data-ambient] .marquee-row:has(.client-logo-item:hover) .marquee-track {
    animation-play-state: paused;
  }

  #klijenti .client-logo-item:hover img {
    transform: scale(1.15);
  }

  .client-logo-item:hover::before {
    opacity: 1;
  }
}

/* Static, readable originals on touch and for visitors who reduce motion. */
@media (max-width: 767px), (hover: none), (prefers-reduced-motion: reduce) {
  .clients-motion-toggle {
    display: none;
  }

  .klijenti-marquee-container {
    mask-image: none;
    -webkit-mask-image: none;

    padding: 0 var(--container-pad);

    gap: 0;
  }

  #klijenti .marquee-track {
    width: 100%;
    min-width: 0;

    animation: none;
    will-change: auto;
  }

  #klijenti .marquee-group {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));

    width: 100%;
    min-width: 0;
  }

  #klijenti .marquee-group[aria-hidden="true"] {
    display: none;
  }

  #klijenti .client-logo-item {
    width: auto;
    min-width: 0;
    height: 90px;
    padding: 18px 12px;
  }

  #klijenti .client-logo-item img {
    max-height: 38px;
  }

  #klijenti .klijenti-tag-pip {
    animation: none;
  }
}

@media (max-width: 479px) {
  #klijenti .marquee-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .klijenti-eyebrow {
    font-size: 0.58rem;
    letter-spacing: 0.07em;
  }
}

@media (prefers-reduced-motion: reduce) {
  #klijenti .client-logo-item img,
  .client-logo-item::before {
    transition: none;
  }

  #klijenti .client-logo-item:is(:hover, :focus-visible) img {
    transform: none;
  }
}
