/* ==========================================================================
   EWD Site — "How We Build" scroll-pinned process section
   Self-contained stylesheet; reuses the design tokens declared on :root
   in style.css (colors, easing, fonts) but owns all layout/animation here.

   Behavior summary:
   - At >=1200px, the section pins to the viewport (position: sticky) while
     the user scrolls through a tall wrapper; process.js maps scroll
     progress to an active step index. No click/keyboard step-jumping —
     scroll is the only input, and reaching the last step releases the
     pin into normal flow (the section below it).
   - Below 1200px, pinning is disabled entirely and every step renders as
     a normal stacked block, revealed once via scroll into view.
   ========================================================================== */

.process {
  position: relative;
  /* background: var(--bg); */
}

/* ---------- Pin wrapper ---------- */

.process__pin-wrap {
  position: relative;
}

.process__sticky {
  position: relative;
  /* display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--header-h) + 1.5rem) clamp(1.25rem, 4vw, 2.5rem) 2.5rem; */
}

.process__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 55% 45% at 20% 15%, rgba(73, 46, 159, 0.14), transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 85%, rgba(44, 59, 108, 0.12), transparent 60%);
}

.process__inner {
  position: relative;
  z-index: 1;
}

.process__frame {
  /* --chamfer: 48px; */
  position: relative;
  /* padding: clamp(2rem, 4vw, 3rem) clamp(1.5rem, 5vw, 3.5rem) clamp(1.75rem, 4vw, 2.5rem); */
  /* background: var(--border);
  clip-path: polygon(
    0 var(--chamfer),
    var(--chamfer) 0,
    calc(100% - var(--chamfer)) 0,
    100% var(--chamfer),
    100% 100%,
    0 100%
  ); */
  padding-top: 96px;
}
.process__frame > svg {
    position: absolute !important;
    top: 0;
    height: fit-content;
    width: 100%;
}
.process__frame > img {
    position: absolute !important;
    top: 0;
    height: fit-content;
    width: 100%;
}

/* .process__frame::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: 0;
  background: linear-gradient(180deg, rgba(44, 59, 108, 0.15), rgba(12, 14, 24, 0.55) 40%);
  clip-path: polygon(
    0 calc(var(--chamfer) - 1px),
    calc(var(--chamfer) - 1px) 0,
    calc(100% - var(--chamfer) + 1px) 0,
    100% calc(var(--chamfer) - 1px),
    100% 100%,
    0 100%
  );
} */

.process__frame > *:not(.process__emblem) {
  position: relative;
  z-index: 1;
}

.process__emblem {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translate(-50%, 0);
}

.process__header {
    /* max-width: 640px; */
    /* margin: 0 auto 1.5rem; */
    text-align: center;
    margin-bottom: 58px;
    padding-top: 12px;
}

.process__header h2 {
  margin: 0.5rem 0 0.75rem;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: capitalize;
  font-size: clamp(1.75rem, 3.4vw, 2.4rem);
  color: var(--text);
}

.process__subtext {
  margin: 0;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.6;
}

/* ---------- Stepper (decorative progress indicator only) ---------- */

.stepper {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 102px;
    max-width: 958px;
    margin: auto;
}

.stepper__track {
    position: absolute;
    top: 40px;
    left: 22px;
    right: 22px;
    height: 1px;
    background: rgba(105, 90, 161, 0.90);
    z-index: 0;
}

.stepper__progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: rgb(255 255 255 / 90%);
  transition: width 0.35s var(--ease-out);
}

.step {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    flex: 1;
    /* padding: 0.25rem; */
    text-align: center;
    /* color: var(--text-dimmer); */
}

.step__ring {
    position: relative;
    width: 75px;
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    /* background: var(--bg-alt); */
    /* border: 1px solid var(--border-strong); */
    transition: transform 0.3s var(--ease-out), background-color 0.3s var(--ease-out), border-color 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
    background: #111335;
    border: 1px solid rgba(105, 90, 161, 0.90);
}

.step__ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.step__ring-track {
  fill: none;
  stroke-width: 2;
  stroke: rgba(138, 207, 235, 0.6);
}

.step__num {
    position: relative;
    font-family: var(--font-body);
    transition: color 0.3s var(--ease-out);
    color: #615396;
    font-size: 41px;
    font-weight: 400;
    line-height: 30px;
    letter-spacing: -0.41px;
    text-transform: capitalize;
}

.step__label {
    transition: color 0.3s var(--ease-out);
    color: rgba(255, 255, 255, 0.25);
    font-family: var(--font-body);
    font-size: 18px;
    font-weight: 300;
    line-height: 25px;
    text-transform: capitalize;
}

.step.is-active .step__ring {
  background: #E1D9FF;
  border: 1px solid rgba(225, 217, 255, 0.90);
}

.step.is-active .step__num {
  color: #130740;
  font-weight: 600;
}

.step.is-active .step__label {
  color: rgba(255, 255, 255, 0.85);
}

.step.is-complete .step__ring {
  /* background: rgba(138, 207, 235, 0.12);
  border-color: rgba(138, 207, 235, 0.4); */
  border: 1px solid rgb(105 90 161 / 40%);
}
.step.is-complete .step__ring .step__num {
    opacity: 0.4;
}

.step.is-complete .step__ring-svg {
  opacity: 1;
}

/* .step.is-complete .step__num {
  color: var(--cyan);
} */

/* ---------- Stage: step blocks ---------- */

.process__stage {
  position: relative;
  /* padding: 0 100px; */
  margin-top: 30px;
}

.step-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 65px;
  align-items: center;
  padding: 0 148px;
}

.step-block__content {
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: center;
    gap: 24px;
    height: 100%;
    max-width: 380px;
}

/* Step visual: a plain gradient card (step-block__media) tinted per
   step, with an ambient glow behind it and a continuous scroll-driven
   parallax drift applied directly as a transform from process.js. That
   transform is written every animation frame (lerped toward the scroll
   target for a smooth, non-jittery drift), so it deliberately has no
   CSS transition of its own — a competing transition would just fight
   the per-frame updates and make the motion stutter. This was a plain
   <img> pointing at a real photo that was meant to be swapped in later
   and never was, permanently 404ing on a file that never existed — a
   plain div with the same box styling instead of a placeholder image
   reference is honest about what's actually there. */

.step-block__visual {
  position: relative;
  min-width: 0;
  --mood-a: 44, 59, 108;
  --mood-b: 138, 207, 235;
      border-radius: 20px;
    overflow: hidden;
    height: 395px;
}

/* .step-block__visual[data-mood="leads"] { --mood-a: 44, 59, 108; --mood-b: 138, 207, 235; }
.step-block__visual[data-mood="sales"] { --mood-a: 97, 180, 97; --mood-b: 138, 207, 235; }
.step-block__visual[data-mood="automate"] { --mood-a: 73, 46, 159; --mood-b: 44, 59, 108; }
.step-block__visual[data-mood="experience"] { --mood-a: 138, 207, 235; --mood-b: 73, 46, 159; }
.step-block__visual[data-mood="scale"] { --mood-a: 97, 180, 97; --mood-b: 73, 46, 159; } */

/* .step-block__visual::before {
  content: "";
  position: absolute;
  inset: -10%;
  z-index: 0;
  border-radius: 30px;
  background:
    radial-gradient(circle at 30% 25%, rgba(var(--mood-a), 0.4), transparent 60%),
    radial-gradient(circle at 75% 80%, rgba(var(--mood-b), 0.3), transparent 60%);
  filter: blur(28px);
  pointer-events: none;
} */

.step-block__media {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    border: 1px solid var(--border-strong);
    /* background: var(--bg-alt); */
    /* box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45); */
    /* will-change: transform; */
}
.step-block__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.step-block__badge {
    position: absolute;
    z-index: 2;
    right: 30px;
    top: 30px;
    width: 152px;
    height: 152px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: rgba(26, 29, 78, 0.92);
    box-shadow: 0 4px 24px 0 rgba(0, 0, 0, 0.25);
    color: #D0D1E0;
    font-family: var(--font-body);
    font-size: 108px;
    font-weight: 600;
    line-height: 55px;
    letter-spacing: -1.08px;
    text-transform: capitalize;
}
.step-block__media svg {
    position: absolute;
    top: -40px;
    right: -28px;
}

/* ---------- Content ---------- */
.panel__title {
    font-family: var(--font-heading);
    color: var(--text);
    font-size: 44px;
    font-style: normal;
    font-weight: 600;
    line-height: 55px;
    letter-spacing: -0.44px;
    text-transform: capitalize;
}

.panel__text {
    margin: 0;
    font-family: var(--font-body);
    color: #C0C0C0;
    font-size: 19px;
    font-weight: 300;
    line-height: 32px;
}

/* ==========================================================================
   Desktop: pinned scrollytelling (>=1200px)
   ========================================================================== */

@media (min-width: 1200px) {
  .process__pin-wrap {
    height: calc(var(--step-count) * 100vh);
  }

  .process__sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
  }

  .process__inner {
    max-height: calc(100vh - var(--header-h) - 3rem);
  }

  .process__stage {
    height: clamp(280px, 40vh, 400px);
  }

  .step-block {
    display: none;
    position: absolute;
    inset: 0;
  }

  .step-block.is-active,
  .step-block.is-leaving-fwd,
  .step-block.is-leaving-bwd,
  .step-block.is-entering-fwd,
  .step-block.is-entering-bwd {
    display: grid;
  }

  /* Distinct step-change motion: a directional wipe on the visual panel
     (clip-path, not opacity) paired with a separate flip-in on the text
     content — two different motion languages instead of one crossfade. */
  .step-block__visual {
    clip-path: inset(0 0 0 0);
  }

  .step-block__content {
    perspective: 800px;
  }

  .step-block__content > * {
    transform-origin: bottom left;
  }

  .step-block.is-entering-fwd .step-block__visual {
    animation: wipe-in-fwd 0.65s var(--ease-out) forwards;
  }

  .step-block.is-entering-bwd .step-block__visual {
    animation: wipe-in-bwd 0.65s var(--ease-out) forwards;
  }

  .step-block.is-leaving-fwd .step-block__visual {
    animation: wipe-out-fwd 0.5s var(--ease-out) forwards;
  }

  .step-block.is-leaving-bwd .step-block__visual {
    animation: wipe-out-bwd 0.5s var(--ease-out) forwards;
  }

  .step-block.is-entering-fwd .step-block__content,
  .step-block.is-entering-bwd .step-block__content {
    animation: content-flip-in 0.55s var(--ease-out) 0.12s both;
  }

  .step-block.is-leaving-fwd .step-block__content,
  .step-block.is-leaving-bwd .step-block__content {
    animation: content-flip-out 0.35s var(--ease-out) forwards;
  }
}

@media (min-width: 1200px) and (max-height: 840px) {

  /* .process__header h2 {
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    margin: 0.3rem 0 0.5rem;
  } */

  .process__stage {
    height: clamp(260px, 40vh, 380px);
  }

  .panel__metric {
    margin-bottom: 0.6rem;
  }

  /* .panel__title {
    margin-bottom: 0.5rem;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
  } */

  /* .panel__text {
    margin-bottom: 0.8rem;
    font-size: 0.84rem;
  } */

  .panel__points {
    gap: 0.35rem;
  }

  .panel__points li {
    font-size: 0.8rem;
  }
}

/* ==========================================================================
   Below 1200px: pinning disabled, steps stack as a normal scroll story
   ========================================================================== */

@media (max-width: 1199px) {
  .process__sticky {
    padding-top: calc(var(--header-h) + 2rem);
  }

  .process__header {
    margin-bottom: 2.5rem;
  }

  .stepper {
    display: none;
  }

  .process__stage {
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
  }

  .step-block {
    grid-template-columns: 1fr;
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  }

  .step-block.is-active {
    opacity: 1;
    transform: translateY(0);
  }

  .step-block__visual {
    max-width: 420px;
  }
}

@media (max-width: 640px) {
  .process__frame {
    --chamfer: 28px;
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }

  .step-block__visual {
    max-width: 100%;
  }
}

/* ==========================================================================
   Keyframes
   ========================================================================== */

@keyframes emblem-ping {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.9); opacity: 0; }
}

@keyframes log-in {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes draw-path {
  to { stroke-dashoffset: 0; }
}

@keyframes code-in {
  to { opacity: 1; transform: translateX(0); }
}

@keyframes wipe-in-fwd {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes wipe-in-bwd {
  from { clip-path: inset(0 0 0 100%); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes wipe-out-fwd {
  from { clip-path: inset(0 0 0 0); }
  to { clip-path: inset(0 0 0 100%); }
}

@keyframes wipe-out-bwd {
  from { clip-path: inset(0 0 0 0); }
  to { clip-path: inset(0 100% 0 0); }
}

@keyframes content-flip-in {
  from { opacity: 0; transform: translateY(20px) rotateX(-10deg); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0) rotateX(0); filter: blur(0); }
}

@keyframes content-flip-out {
  from { opacity: 1; transform: translateY(0) rotateX(0); }
  to { opacity: 0; transform: translateY(-12px) rotateX(6deg); }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .process__emblem-ring {
    animation: none;
    opacity: 0.5;
  }

  .step-block__visual,
  .step-block__content {
    animation: none !important;
    clip-path: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  .panel__index-num.is-bumping {
    animation: none;
  }

  @media (max-width: 1199px) {
    .step-block {
      transition: none;
      opacity: 1;
      transform: none;
    }
  }
}
