/* ==========================================================================
   services.css — Sticky section + staircase cards (track scrolls)
   - Section height is set dynamically by JS based on card positions
   - Sticky stage: 100vh pinned to viewport
   - Cards are positioned absolutely inside the track, forming a staircase
   - As user scrolls, the track translates UP so cards flow through
     the pinned 100vh window
   - First 3 cards burst from center when section is scrolled into view
   - Remaining cards fade up naturally as they enter the viewport
   - Title blurs (background layer), cards sit in front (higher z-index)
   ========================================================================== */

:root {
  --services-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.services-section {
  position: relative;
  overflow: visible;
}

/* ── Sticky stage: white background stays fixed in viewport ── */
.services-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: var(--white);
  color: var(--text);
}

/* ── Track: contains title + cards, translates up via JS ── */
.services-track {
  position: relative;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
  will-change: transform;
}

/* Track stacks above the title so cards appear in front of the text */
@media (min-width: 769px) {
  .services-track {
    z-index: 3;
  }
}

/* ── Title (fixed outside track) ── */
.services-title {
  position: relative;
  z-index: 2;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 100px var(--gutter) 60px;
  text-align: center;
  font-family: var(--display);
  font-size: clamp(56px, 9vw, 140px);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--text);
  transition: filter 0.6s var(--services-ease);
  pointer-events: none;
}

.services-title.is-blurred {
  filter: blur(6px);
}

.services-title span {
  display: block;
}

.services-title .line-red {
  color: var(--red);
}

/* ── Cards container ── */
.services-cards {
  position: relative;
}

/* ── Each card: absolutely positioned via inline styles from data ── */
.service-card {
  position: absolute;
  width: 320px;
  padding: 22px 20px 24px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(13, 13, 13, 0.08);
  transition:
    box-shadow 0.4s var(--services-ease);
  min-height: 280px;
}

/* ── First 3 cards: burst from center (all screens) ── */
.service-card:nth-child(-n+3) {
  z-index: 3;
  opacity: 0;
  will-change: transform, opacity;
}

/* ── Remaining cards: scroll-up reveal (all screens) ── */
.service-card:nth-child(n+4) {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.service-card:nth-child(n+4).is-visible {
  opacity: 1;
  transform: translateY(0);
}

.service-card:hover {
  box-shadow: 0 20px 50px rgba(13, 13, 13, 0.18);
}

/* ── Card variants ── */
.service-card--light {
  background: var(--card-bg, var(--light));
  color: var(--text);
}

.service-card--white {
  background: var(--card-bg, var(--white));
  color: var(--text);
  border: 1px solid var(--border-light);
}

.service-card--dark {
  background: var(--card-bg, var(--black));
  color: var(--white);
}

.service-card__name {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.service-card__desc {
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 20px;
  opacity: 0.75;
}

.service-card--dark .service-card__desc {
  color: rgba(255, 255, 255, 0.7);
  opacity: 1;
}

.service-card__features {
  list-style: none;
  margin-top: auto;
  margin-bottom: 24px;
  flex: 1;
}

.service-card__features li {
  position: relative;
  padding: 6px 0 6px 16px;
  font-size: 12.5px;
  line-height: 1.4;
}

.service-card__features li::before {
  content: '\2022';
  position: absolute;
  left: 0;
  top: 5px;
  color: var(--red);
  font-weight: 700;
}

.service-card__time {
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
  letter-spacing: 0;
  margin-top: 6px;
}

/* ── Responsive: collapse to flow layout on small screens ── */
@media (max-width: 768px) {
  .services-section {
    height: auto !important;
  }
  .services-sticky {
    position: relative;
    height: auto;
    overflow: visible;
  }
  .services-track {
    transform: none !important;
  }
  .services-title {
    font-size: clamp(40px, 9vw, 80px);
    padding: 60px var(--gutter) 30px;
  }
  .services-title.is-blurred {
    filter: none;
  }
  .services-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 60px;
  }
  .service-card {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    width: 100%;
    min-height: auto;
  }

  .service-card:nth-child(-n+3) {
    opacity: 0;
    transform: scale(0.92) translateY(14px);
    transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .service-card:nth-child(-n+3).is-visible {
    opacity: 1;
    transform: scale(1) translateY(0);
  }

  .service-card:nth-child(n+4) {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 640px) {
  .services-title { font-size: clamp(32px, 10vw, 56px); }
}
