/* ============================================================
   PROCESS  .process
   "4. My Process": four step cards, read one at a time.
   Three modes:
   1. Default (no JS, or reduced motion on tablet/desktop):
      a plain grid, 4 across (one column on tablet).
   2. Phones (≤767px): a swipe row that snaps one card into the
      middle. Pure CSS; JS only adds the fade + counter.
   3. .is-pinned (added by js/modules/process-scroll.js, all
      sizes): the section pins to the screen and scrolling slides
      the cards sideways, resting on each one; the centred card
      is sharp, the others fade back.
   Tweak the card width with --step-w.
   ============================================================ */

.process {
  --step-w: min(34rem, 44vw);       /* card width in the sliding row */
  --step-gap: 3vw;
  overflow: clip;                   /* the sliding row never causes sideways page scroll */
}

.process__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
}

/* "01 / 04": only shown when the row is interactive */
.process__counter {
  display: none;
  color: var(--color-gray);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.process__counter-current {
  color: var(--color-text);
  font-size: 1.6rem;
  font-weight: var(--fw-bold);
}

.process__steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  width: var(--content-width);
  margin-inline: auto;
  padding-top: 4rem;
}

.process-step {
  padding: 1rem;
}

.process-step__title {
  padding-bottom: 0.25rem;
  color: var(--color-gray);
  font-size: var(--fs-h5);
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.02rem;
}

.process-step__text {
  color: var(--color-gray);
  font-size: 0.9rem;
}

/* thin bar under the row that fills as you move through the steps */
.process__progress {
  display: none;
  height: 2px;
  margin-top: 2.5rem;
  border-radius: 2px;
  background-color: var(--color-line);
  overflow: hidden;
}

.process__progress-bar {
  display: block;
  height: 100%;
  background-color: var(--color-primary);
  transform: scaleX(0.25);
  transform-origin: left;
}

.process.is-enhanced .process__counter,
.process.is-enhanced .process__progress {
  display: block;
}

/* ============ 3. Pinned sideways scroll (JS, all sizes) ============ */
.process.is-pinned {
  padding-block: 0;
}

.process.is-pinned .process__stage {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100vh;
  height: 100svh;
  padding-top: var(--nav-offset);
}

.process.is-pinned .process__steps {
  display: flex;
  gap: var(--step-gap);
  width: max-content;
  margin: 0;
  /* first and last card can sit in the middle of the screen */
  padding: 3.5rem calc(50vw - var(--step-w) / 2) 0;
  will-change: transform;
}

.process.is-pinned .process-step {
  flex: 0 0 var(--step-w);
  padding: 2.5rem;
  transform-origin: center;
  /* each card on its own GPU layer: the fade/scale applied on every scroll
     frame then only re-composites the card instead of re-drawing its text.
     Measured 2026-12-01: raster work in this section −96%, phones went
     from choppy to smooth. */
  will-change: transform, opacity;
}

.process.is-pinned .process__progress-bar {
  will-change: transform;           /* same idea: the bar's scaleX moves every frame */
}

.process.is-pinned .process-step__title {
  padding-bottom: 1rem;
  color: var(--color-text);
  font-size: 2rem;
  font-weight: var(--fw-bold);
}

.process.is-pinned .process-step__text {
  font-size: 1.15rem;
  line-height: var(--lh-l);
}

@media (max-width: 991px) {
  .process {
    --step-w: 70vw;
  }

  .process__steps {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding-top: 2rem;
  }

  .process-step {
    padding-inline: 0.5rem;
  }

  .process-step__title {
    font-size: 1.1rem;
    font-weight: var(--fw-bold);
  }

  .process-step__text {
    max-width: 73%;
  }

  .process.is-pinned .process-step__text {
    max-width: none;
  }
}

/* ============ 2. Phones: swipe row ============ */
@media (max-width: 767px) {
  .process {
    --step-w: 82vw;
  }

  .process__steps {
    display: flex;
    gap: 0.75rem;
    width: auto;
    padding: 2rem calc(50vw - var(--step-w) / 2) 0.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .process__steps::-webkit-scrollbar {
    display: none;
  }

  .process-step {
    flex: 0 0 var(--step-w);
    padding: 1.5rem 1.25rem;
    scroll-snap-align: center;
  }

  .process-step__title {
    padding-bottom: 0.5rem;
    color: var(--color-text);
    font-size: 1.05rem;
    font-weight: var(--fw-bold);
  }

  .process-step__text {
    max-width: none;
    font-size: 0.95rem;
    line-height: var(--lh-l);
  }

  .process__progress {
    margin-top: 1.5rem;
  }

  .process__counter-current {
    font-size: 1.3rem;
  }
}

/* phones in pinned mode: the swipe row becomes the scroll-driven row */
@media (max-width: 767px) {
  .process.is-pinned .process__steps {
    overflow: visible;
    scroll-snap-type: none;
    padding: 2rem calc(50vw - var(--step-w) / 2) 0;
  }

  .process.is-pinned .process-step {
    padding: 1.75rem 1.4rem;
  }

  .process.is-pinned .process-step__title {
    padding-bottom: 0.75rem;
    font-size: 1.35rem;
  }

  .process.is-pinned .process-step__text {
    font-size: 1rem;
  }
}

