/* ==========================================================================
   Horizontal Scroll Services Section
   ScrollTrigger-pinned horizontal rail with 3D tilt cards
   ========================================================================== */

/* ── Section wrapper — height drives the scroll distance ── */
.services-hscroll {
  position: relative;
  background: #0a0a0b;
}

/* ── Sticky viewport ── */
.services-hscroll__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 0;
}

/* ── Header row ── */
.services-hscroll__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(32px, 4vw, 48px);
  padding-top: clamp(80px, 10vw, 120px);
}

.services-hscroll__head-text {
  flex: 1;
}

.services-hscroll__eyebrow {
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent, #2f70ff);
  margin: 0 0 12px;
}

.services-hscroll__head h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 38px);
  letter-spacing: -0.02em;
  color: var(--color-text, #e6e7e9);
  line-height: 1.15;
}

/* ── Horizontal track ── */
.services-hscroll__track {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  overflow: visible;
}

.services-hscroll__rail {
  display: flex;
  gap: clamp(16px, 2vw, 24px);
  padding: 0 max(24px, calc((100vw - 1200px) / 2 + 24px));
  will-change: transform;
}

/* ── Card ── */
.services-hscroll__card {
  flex: 0 0 clamp(280px, 22vw, 360px);
  height: clamp(340px, 40vh, 420px);
  position: relative;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  cursor: pointer;
  transform-style: preserve-3d;
  perspective: 800px;
  transition: border-color 0.4s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.services-hscroll__card:hover {
  border-color: rgba(var(--color-accent-rgb, 47,112,255), 0.3);
}

.services-hscroll__card-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(20px, 2.5vw, 32px);
  transform: translateZ(30px); /* pop forward in 3D space */
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Number ── */
.services-hscroll__num {
  font-size: 13px;
  font-weight: 600;
  color: rgba(var(--color-accent-rgb, 47,112,255), 0.5);
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 16px;
}

/* ── Icon ── */
.services-hscroll__icon {
  width: 44px;
  height: 44px;
  margin-bottom: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(var(--color-accent-rgb, 47,112,255), 0.08);
  border: 1px solid rgba(var(--color-accent-rgb, 47,112,255), 0.15);
  transition: background 0.35s ease, border-color 0.35s ease, transform 0.35s ease;
}

.services-hscroll__icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: invert(1);
  opacity: 0.8;
  transition: opacity 0.35s ease;
}

.services-hscroll__card:hover .services-hscroll__icon {
  background: rgba(var(--color-accent-rgb, 47,112,255), 0.15);
  border-color: rgba(var(--color-accent-rgb, 47,112,255), 0.3);
  transform: translateY(-2px);
}

.services-hscroll__card:hover .services-hscroll__icon img {
  opacity: 1;
}

/* ── Typography ── */
.services-hscroll__card h3 {
  margin: 0 0 10px;
  font-size: clamp(17px, 1.4vw, 20px);
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.services-hscroll__card p {
  margin: 0;
  font-size: var(--font-size-sm, 0.875rem);
  line-height: 1.65;
  color: var(--color-muted, #a7a9ad);
  flex: 1;
}

/* ── Hover arrow ── */
.services-hscroll__arrow {
  margin-top: auto;
  padding-top: 16px;
  color: var(--color-accent, #2f70ff);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.services-hscroll__card:hover .services-hscroll__arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ── 3D Tilt glare ── */
.tilt-card__glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  background: radial-gradient(
    circle at var(--glare-x, 50%) var(--glare-y, 50%),
    rgba(255, 255, 255, 0.12) 0%,
    transparent 60%
  );
  transition: opacity 0.35s ease;
}

.services-hscroll__card:hover .tilt-card__glare {
  opacity: 1;
}

/* ── Gradient border glow on hover ── */
.services-hscroll__card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(var(--color-accent-rgb, 47,112,255), 0.0) 0%,
    rgba(var(--color-accent-rgb, 47,112,255), 0.2) 50%,
    rgba(123, 97, 255, 0.15) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.services-hscroll__card:hover::before {
  opacity: 1;
}

/* ── Progress bar ── */
.services-hscroll__progress {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: clamp(24px, 3vw, 40px);
  padding-top: clamp(20px, 2vw, 32px);
}

.services-hscroll__progress-bar {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.services-hscroll__progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--hscroll-progress, 0%);
  background: linear-gradient(90deg, var(--color-accent, #2f70ff), var(--color-accent-2, #7b61ff));
  border-radius: 2px;
  transition: width 0.1s linear;
}

.services-hscroll__counter {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-muted, #a7a9ad);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 50px;
  text-align: right;
}

/* ── Mobile fallback: vertical scroll ── */
@media (max-width: 768px) {
  .services-hscroll {
    height: auto !important;
  }

  .services-hscroll__sticky {
    position: relative;
    height: auto;
    padding: clamp(60px, 8vw, 100px) 0;
  }

  .services-hscroll__head {
    flex-direction: column;
    align-items: flex-start;
    padding-top: 0;
  }

  .services-hscroll__track {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
    padding: 20px 0;
  }

  .services-hscroll__track::-webkit-scrollbar {
    display: none;
  }

  .services-hscroll__rail {
    padding: 0 20px;
  }

  .services-hscroll__card {
    flex: 0 0 85vw;
    max-width: 340px;
    height: auto;
    min-height: 320px;
    scroll-snap-align: center;
  }

  .services-hscroll__progress {
    display: none;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .services-hscroll__card {
    transform: none !important;
  }

  .services-hscroll__card-inner {
    transform: none !important;
  }

  .tilt-card__glare {
    display: none;
  }
}
