:root{
  --stack-maxw: 1200px;
  --stack-gap: 60px;
  --stack-logo-h: 46px;
  --stack-speed: 24s;        /* time to scroll one SEGMENT */
  --stack-edge: 12%;
  --stack-border: var(--border);
  --stack-fade: var(--surface);
}

.tech-stack{ padding: 2.5rem 0 1.5rem; background: transparent; }
.stack-container{ max-width: var(--stack-maxw); margin: 0 auto; padding: 0 20px; }

.stack-header{ text-align: center; margin: 0 0 18px; }
.stack-eyebrow{ font-weight: 800; font-size: 16px; line-height: 1.1; letter-spacing: .08em; text-transform: uppercase; color: var(--text); margin: 0 0 6px; }
.stack-deck{ font-size: 18px; line-height: 1.5; color: #6b7280; margin: 0; }

.stack-rail{ position: relative; overflow: hidden; padding: 22px 0; }

/* IMPORTANT: no CSS animation on track; JS will move it */
.stack-track{
  display: flex;
  align-items: center;
  gap: var(--stack-gap);
  will-change: transform;
  z-index: 1;
}

/* Each “segment” = one full copy of your items (JS will wrap & clone) */
.stack-seg{
  display: inline-flex;
  align-items: center;
  gap: var(--stack-gap);
  flex: 0 0 auto;
}

.stack-track img{
  height: var(--stack-logo-h);
  width: auto;
  object-fit: contain;
  opacity: .98;
  transition: opacity .2s ease, transform .2s ease;
  filter: drop-shadow(0 0 0 rgba(0,0,0,0));
}
.stack-track img:hover{ opacity: 1; transform: translateY(-2px); }

.stack-rail::after{
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--stack-border);
  z-index: 1;
}

.stack-fade{ position: absolute; top: 0; bottom: 0; width: var(--stack-edge); pointer-events: none; z-index: 2; }
.stack-fade-left{ left: 0; background: linear-gradient(to right, var(--stack-fade), rgba(255,255,255,0)); }
.stack-fade-right{ right: 0; background: linear-gradient(to left, var(--stack-fade), rgba(255,255,255,0)); }

@media (prefers-reduced-motion: reduce){
  .stack-track{ transform: none !important; }
}

@media (max-width: 768px){
  :root{ --stack-gap: 40px; --stack-logo-h: 36px; --stack-edge: 18%; }
  .stack-deck{ font-size: 16px; }
}

/* Caption stuff – unchanged */
.stack-item{ display: inline-flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; min-width: 48px; }
.stack-item::after{
  content: attr(data-label);
  font-size: 12px;
  line-height: 1;
  color: #6b7280;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
  white-space: nowrap;
  pointer-events: none;
}
.stack-item:hover::after, .stack-item:focus-within::after{ opacity: 1; transform: translateY(0); }
.stack-item:hover img, .stack-item:focus-within img{ transform: translateY(-2px); }

/* track has NO gap; segments handle their own gaps */
.stack-track{
  display: flex;
  align-items: center;
  gap: 0;                         /* ⬅️ important */
  will-change: transform;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.stack-seg{
  display: inline-flex;
  align-items: center;
  gap: var(--stack-gap);          /* inner gaps between items */
  flex: 0 0 auto;
  white-space: nowrap;
}

/* add one more gap at the END so segW includes the boundary spacing */
.stack-seg::after{
  content: "";
  flex: 0 0 var(--stack-gap);     /* ⬅️ trailing spacer equals one gap */
}
