/* ============================================
   Step Swipe — layout + components
   ============================================ */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", sans-serif;
  background: #8a8a8a;
  color: #0a0a0a;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------
   Root track
   -------------------------------------------- */

.step-swipe {
  --step-swipe-bg: #8a8a8a;
  --step-swipe-fg: rgba(255, 255, 255, 0.92);
  --step-swipe-fg-soft: rgba(255, 255, 255, 0.78);
  --step-swipe-line: rgba(255, 255, 255, 0.18);
  --step-swipe-fill: rgba(255, 255, 255, 0.85);
  --step-swipe-margin: 40px;
  --step-swipe-font: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --step-swipe-columns: 4;
  --step-swipe-card-width: 47.5vw;
  --step-swipe-zoom: 1.1;
  --step-swipe-track-height: 500vh;

  position: relative;
  width: 100%;
  height: var(--step-swipe-track-height);
  font-family: var(--step-swipe-font);
  -webkit-font-smoothing: antialiased;
  background: var(--step-swipe-bg);
}

.step-swipe__data {
  display: none;
}

/* Sticky viewport stage */
.step-swipe__stage {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: var(--step-swipe-bg);
}

/* --------------------------------------------
   Background stack
   -------------------------------------------- */

.step-swipe__background {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.step-swipe__background-layer {
  position: absolute;
  inset: 0;
  /* Wipe from bottom upward as --step-swipe-clip rises 0 → 100 */
  clip-path: inset(0% 0% calc(var(--step-swipe-clip, 0) * 1%) 0%);
  will-change: clip-path;
}

.step-swipe__background-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(var(--step-swipe-zoom, 1.1));
  transform-origin: 50% 50%;
  filter: brightness(0.65) saturate(0.92);
}

/* --------------------------------------------
   Center card
   -------------------------------------------- */

.step-swipe__card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(var(--step-swipe-card-width, 47.5vw), 88vw);
  aspect-ratio: 3 / 2;
  border-radius: 12px;
  overflow: hidden;
  z-index: 2;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.step-swipe__card-layer {
  position: absolute;
  inset: 0;
  clip-path: inset(0% 0% calc(var(--step-swipe-clip, 0) * 1%) 0%);
  will-change: clip-path;
}

.step-swipe__card-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --------------------------------------------
   Progress line
   -------------------------------------------- */

.step-swipe__progress {
  position: absolute;
  top: 28px;
  left: var(--step-swipe-margin);
  right: var(--step-swipe-margin);
  height: 1px;
  background: var(--step-swipe-line);
  z-index: 3;
}

.step-swipe__progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--step-swipe-fill);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

/* --------------------------------------------
   Title grid (one column per step)
   -------------------------------------------- */

.step-swipe__titles {
  position: absolute;
  top: 44px;
  left: var(--step-swipe-margin);
  right: var(--step-swipe-margin);
  display: grid;
  grid-template-columns: repeat(var(--step-swipe-columns), minmax(0, 1fr));
  z-index: 3;
  pointer-events: none;
  overflow: visible;
}

.step-swipe__title {
  grid-row: 1;
  position: relative;
  z-index: 1;
  font-size: clamp(24px, 3.4vw, 44px);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1.25;
  color: #ffffff;
  margin: 0;
  padding: 0;
  white-space: nowrap;
  overflow: visible;
  width: max-content;
  max-width: none;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

.step-swipe__title[data-column]:last-child {
  justify-self: end;
  text-align: right;
}

.step-swipe__title:has(.step-swipe__title-char) {
  z-index: 2;
}

.step-swipe__title-line {
  position: relative;
  display: block;
  /* Mask for char roll — extra room so descenders (y, g) aren't cut off */
  overflow: hidden;
  padding: 0.12em 0.08em 0.38em;
  margin: -0.12em -0.08em -0.38em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.step-swipe__title-char {
  position: relative;
  display: inline-block;
  backface-visibility: hidden;
}

/* --------------------------------------------
   Step number (odometer)
   -------------------------------------------- */

.step-swipe__number {
  position: absolute;
  left: var(--step-swipe-margin);
  bottom: 32px;
  display: inline-flex;
  align-items: flex-start;
  gap: 0;
  font-size: clamp(52px, 8.5vw, 88px);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #ffffff;
  z-index: 3;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

.step-swipe__digit {
  position: relative;
  display: block;
  flex: 0 0 auto;
  overflow: hidden;
  height: 1em;
  width: 0.62em;
  vertical-align: top;
}

.step-swipe__digit-roller {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.step-swipe__digit-roller span {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 1em;
  width: 100%;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* --------------------------------------------
   Description
   -------------------------------------------- */

.step-swipe__description {
  position: absolute;
  right: var(--step-swipe-margin);
  bottom: 40px;
  width: min(340px, calc(100% - 2 * var(--step-swipe-margin)));
  font-size: 15px;
  font-weight: 380;
  line-height: 1.55;
  color: var(--step-swipe-fg-soft);
  z-index: 3;
  pointer-events: none;
  margin: 0;
}

.step-swipe__description-line {
  position: relative;
  will-change: transform;
}

/* Mask wrappers created by SplitText */
.step-swipe__description .step-swipe__description-line,
.step-swipe__description [class*="line"] {
  overflow: hidden;
}

/* --------------------------------------------
   Mobile
   -------------------------------------------- */

@media (max-width: 767px) {
  .step-swipe {
    --step-swipe-margin: 20px;
  }

  .step-swipe__titles {
    display: block;
    top: 40px;
    left: var(--step-swipe-margin);
    right: var(--step-swipe-margin);
  }

  .step-swipe__title {
    position: absolute;
    left: 0;
    top: 0;
    right: auto;
    font-size: clamp(28px, 9vw, 40px);
    justify-self: start;
    text-align: left;
    width: max-content;
    max-width: calc(100vw - 2 * var(--step-swipe-margin) - 64px);
  }

  .step-swipe__title[data-column]:last-child {
    justify-self: start;
    text-align: left;
  }

  .step-swipe__number {
    left: auto;
    right: var(--step-swipe-margin);
    top: 40px;
    bottom: auto;
    font-size: 44px;
  }

  .step-swipe__card {
    width: calc(100% - 2 * var(--step-swipe-margin));
  }

  .step-swipe__description {
    left: var(--step-swipe-margin);
    right: auto;
    top: auto;
    bottom: 24px;
    width: calc(100% - 2 * var(--step-swipe-margin));
    max-width: 360px;
    font-size: 14px;
  }
}
