/* ==========================================================================
   Success Stories — 3D Draggable Card Carousel
   ========================================================================== */

.cs3d {
  padding: clamp(72px, 9vw, 120px) 0;
  background: #0a0a0b;
  position: relative;
  overflow: hidden;
}

/* ── Header ── */
.cs3d__head {
  text-align: center;
  margin-bottom: clamp(24px, 3vw, 36px);
}

.cs3d__title {
  margin: 0;
  font-size: clamp(26px, 3.5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text, #e6e7e9);
}

/* ── Tabs ── */
.cs3d__tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: clamp(36px, 5vw, 60px);
}

.cs3d__tab {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: transparent;
  color: var(--color-muted, #a7a9ad);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.cs3d__tab:hover {
  border-color: rgba(255,255,255,.25);
  color: #fff;
}

.cs3d__tab.is-active {
  background: #fff;
  color: #0b0c0d;
  border-color: #fff;
  font-weight: 600;
}

/* Nav arrows */
.cs3d__nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.04);
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.cs3d__nav-btn:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.3);
}

.cs3d__nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Viewport (full-bleed) ── */
.cs3d__viewport {
  position: relative;
  width: 100%;
  overflow: visible;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.cs3d__viewport:active {
  cursor: grabbing;
}

/* ── Track ── */
.cs3d__track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  position: relative;
  min-height: 560px;
  perspective: 1200px;
  perspective-origin: center center;
}

/* ── Individual card ── */
.cs3d__card {
  position: absolute;
  width: clamp(340px, 30vw, 420px);
  flex-shrink: 0;
  transition: transform 0.6s cubic-bezier(.4,0,.2,1), opacity 0.6s ease, filter 0.5s ease;
  will-change: transform, opacity;
  transform-style: preserve-3d;
}

/* Cards positioned via JS — but define the visual states here */
.cs3d__card.is-active {
  z-index: 10;
  opacity: 1;
  filter: none;
}

.cs3d__card:not(.is-active) {
  opacity: 0.55;
  filter: brightness(0.7);
  pointer-events: none;
}

/* ── Card inner ── */
.cs3d__card-inner {
  background: var(--color-surface, #151617);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  padding: clamp(24px, 2.5vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
  overflow: hidden;
}

.cs3d__card.is-active .cs3d__card-inner {
  border-color: rgba(255,255,255,.12);
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
}

/* ── Card head ── */
.cs3d__card-head h3 {
  margin: 0 0 10px;
  font-size: clamp(17px, 1.5vw, 21px);
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.cs3d__card-desc {
  margin: 0;
  font-size: var(--font-size-sm, 0.875rem);
  line-height: 1.65;
  color: var(--color-muted, #a7a9ad);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Metrics ── */
.cs3d__card-metrics {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.cs3d__metric {
  flex: 1;
  min-width: 80px;
}

.cs3d__metric-val {
  display: block;
  font-size: clamp(22px, 2.5vw, 28px);
  font-weight: 800;
  color: #77a9ff;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.cs3d__metric-label {
  font-size: 11px;
  color: var(--color-muted, #a7a9ad);
  line-height: 1.4;
  margin-top: 2px;
  display: block;
}

/* ── Card image ── */
.cs3d__card-image {
  border-radius: 12px;
  overflow: hidden;
  margin: 0 -8px;
}

.cs3d__card-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  transition: transform 0.5s cubic-bezier(.4,0,.2,1);
}

.cs3d__card.is-active:hover .cs3d__card-image img {
  transform: scale(1.03);
}

/* ── CTA ── */
.cs3d__card-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-accent, #2f70ff);
  text-decoration: none;
  transition: gap 0.3s ease, color 0.3s ease;
  padding: 4px 0;
}

.cs3d__card-cta:hover {
  gap: 12px;
}

/* ── Drag indicator ── */
.cs3d__drag {
  position: absolute;
  left: 50%;
  bottom: -40px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.cs3d__viewport:hover .cs3d__drag {
  opacity: 0.6;
}

.cs3d__drag span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .cs3d__card {
    width: clamp(300px, 70vw, 380px);
  }

  .cs3d__track {
    min-height: 500px;
  }

  .cs3d__tabs {
    padding: 0 16px;
  }
}

@media (max-width: 640px) {
  .cs3d {
    padding: 60px 0;
  }

  .cs3d__track {
    min-height: auto;
    perspective: none;
    flex-direction: column;
    gap: 20px;
    padding: 0 20px;
  }

  .cs3d__card {
    position: relative !important;
    width: 100% !important;
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
    pointer-events: auto !important;
  }

  .cs3d__card-inner {
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
  }

  .cs3d__viewport {
    cursor: auto;
  }

  .cs3d__drag {
    display: none;
  }

  .cs3d__tabs {
    display: none;
  }

  .cs3d__card-desc {
    -webkit-line-clamp: unset;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .cs3d__card {
    transition: opacity 0.3s ease;
  }

  .cs3d__card-image img {
    transition: none;
  }
}
