/* Steps block — numbered step cards + gradient CTA box. Figma 269-582.
   Exact desktop values; responsive below. */
.sun-steps {
  background: var(--sun-border);                 /* #efefef — section bg (light grey) */
  padding: clamp(48px, 6vw, 80px) 0;
}
.sun-steps__inner {
  box-sizing: border-box;
  width: min(1280px, 100% - 48px);               /* theme-wide standard container */
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;                /* 620 / 620 at 1280 with 40 gap */
  gap: 40px;
  align-items: start;
}

/* Left column — heading + subhead. Sticks at the same stop as the stack: while
   the cards fold over each other the heading has to stay beside them, otherwise
   half the section is empty grey for the length of the scroll. */
.sun-steps__aside {
  position: sticky;
  top: calc(var(--sun-header-h, 76px) + 32px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.sun-steps__heading {
  margin: 0;
  font-family: var(--wp--preset--font-family--brand);
  font-weight: 500;
  font-size: clamp(32px, 4vw, 48px);             /* H2 Display 48/56 */
  line-height: 1.1667;
  letter-spacing: -0.48px;
  color: var(--sun-secondary);                   /* #132140 */
}
.sun-steps__subhead {
  margin: 0;
  font-size: 18px;                               /* Subhead L 18/24 */
  line-height: 24px;
  color: var(--sun-bluegrey);                    /* #4f5563 */
}

/* Right column — card stack. Equal rows: every card takes the height of the
   tallest one (grid-auto-rows: 1fr), so the diagonal wedge cut has the same
   angle on all cards — with mixed heights (2- vs 3-line texts) the "shifted
   over each other" look falls apart. */
.sun-steps__list {
  display: grid;
  grid-auto-rows: 1fr;
  gap: 16px;
  min-width: 0;
  /* Where the first card comes to rest. 16px — one card gap — put the stack
     right up against the header; 32px lets it breathe. */
  --sun-steps-stop: calc(var(--sun-header-h, 76px) + 32px);
}

/* The stack: every card halts at the SAME point under the header, so each one
   slides all the way over the one before instead of parking a strip lower.
   The staircase version looked better standing still, but every covered card
   kept showing its step number through the one on top, and four numbers piled
   up in the corner. Full cover, no pile. Pure layout — no scroll listener.
   The markup still carries --i; nothing reads it at the moment. */
.sun-steps__card {
  position: sticky;
  top: var(--sun-steps-stop);
}

/* The fold. Sticky alone makes a card slide up and stop dead; what reads as
   "folding over" is the card tipping down onto the stack in the last stretch
   before it settles. It hinges on its own top edge, driven by the card's own
   position in the viewport — a scroll timeline, so it runs on the compositor
   and there is no listener anywhere.

   Scoped to the list so the perspective belongs to the stack, not the page. */
.sun-steps__list {
  perspective: 1600px;
  perspective-origin: top center;
}
@supports (animation-timeline: view()) {
  .sun-steps__card {
    transform-origin: top center;
    animation: sun-steps-fold linear both;
    animation-timeline: view();
    /* Starts once the card is well inside the viewport and is finished by the
       time it reaches its sticky stop; beyond that the card must sit flat, or
       the stack looks bent. */
    animation-range: entry 60% cover 42%;
  }
  /* The last card has nothing to fold onto — it is the one everything else
     ends up under. */
  .sun-steps__card:last-child { animation: none; }
}
@keyframes sun-steps-fold {
  from { transform: rotateX(7deg) translateY(10px); }
  to   { transform: none; }
}

/* A scroll-linked tilt is exactly the kind of motion that makes people queasy. */
@media (prefers-reduced-motion: reduce) {
  .sun-steps__card { animation: none !important; transform: none !important; }
}

/* Card — white, right corners rounded 4px, grey wedge cut on the top-left
   (Figma "Subtract": triangle (0,0)-(121,0)-(0,208) in section-bg colour). */
.sun-steps__card {
  /* No position here: the stack rule above already makes this sticky, which is
     its own containing block for the wedge ::before. Re-declaring relative here
     would win on source order and silently kill the stack. */
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  /* Left padding keeps the content clear of the wedge (Figma 1427:16135: the
     content column starts at 125 on a 620 card). */
  padding: 28px 28px 28px var(--sun-steps-pad-left, 125px);
  /* The card itself carries NO background. Its surface is painted by ::before
     and really cut at the diagonal, so the wedge is a hole, not grey paint.
     That matters once the cards overlap: a painted wedge would sit on top of
     the card beneath and hide it, a cut one lets it through.
     The width of the wedge lives here so the responsive override has one place
     to change. */
  /* The grey corner, fixed in both directions. It used to run to the card's
     bottom-left corner, so its angle followed the card height; a fixed triangle
     looks the same on every card whatever happens to the text. */
  --sun-steps-wedge: 121px;
  --sun-steps-wedge-h: 208px;
  /* The cut is empty by default — that is the point. Give this the section
     colour and the notch is painted instead, which hides whatever lies under
     it. That was necessary while the step number still sat inside the wedge;
     since the number moved into the card, the hole is safe. */
  --sun-steps-wedge-fill: transparent;
  /* No shadow here. An upward shadow does give the overlap an edge, but it also
     smears onto the grey section above every card that is NOT overlapping, and
     that haze is exactly what blunts the diagonal cut. */
}
/* The card's surface. Sits behind the content and is clipped to the card shape
   minus the top-left wedge: from the top edge at --sun-steps-wedge down to the
   bottom-left corner, so the diagonal always lands exactly on that corner
   whatever the card's height.
   Why a layer instead of clip-path on the card: clip-path cuts the children
   too, and the step number sits inside the wedge — it would be sliced off. */
.sun-steps__card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--sun-base);                   /* #ffffff */
  border-radius: 0 4px 4px 0;
  /* The notch is cut out of the surface, not painted over it — so a card that
     slides on top shows the one beneath through its own corner.
     Three mask layers, because the cut has FIXED geometry (121x208) while the
     card height varies:
       1. the triangle box itself, split along a diagonal. "to bottom right"
          puts that diagonal exactly through the other two corners, which is the
          hypotenuse we want — no angle to compute, no height to know.
          The stop spans half a percent instead of being hard: a hard gradient
          stop is not anti-aliased, and the staircase it leaves is invisible on
          white against grey but obvious on the blue CTA. Half a percent of a
          ~209px gradient line is about one pixel — enough to read as a clean
          edge, too little to look blurred.
       2. everything right of the wedge.
       3. the strip below it, for cards taller than 208.
     Layers 2 and 3 start 1px EARLY so they overlap layer 1 instead of butting
     against it. Two mask layers that meet exactly leave a sub-pixel gap at
     fractional device positions, and that gap reads as a hairline along the
     seam — the same artefact this block was already chased for once before. */
  --sun-steps-mask:
    linear-gradient(to bottom right, transparent 49.75%, #000 50.25%)
      0 0 / var(--sun-steps-wedge) var(--sun-steps-wedge-h) no-repeat,
    linear-gradient(#000, #000)
      calc(var(--sun-steps-wedge) - 1px) 0 / calc(100% - var(--sun-steps-wedge) + 1px) 100% no-repeat,
    linear-gradient(#000, #000)
      0 calc(var(--sun-steps-wedge-h) - 1px) / var(--sun-steps-wedge) max(0px, calc(100% - var(--sun-steps-wedge-h) + 1px)) no-repeat;
  -webkit-mask: var(--sun-steps-mask);
  mask: var(--sun-steps-mask);
  pointer-events: none;
}

/* The wedge itself. Paints nothing while --sun-steps-wedge-fill is transparent,
   which leaves the cut from ::before showing. Give it the section colour and the
   old painted look is back, opaque over the card beneath. */
.sun-steps__card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--sun-steps-wedge-fill);
  /* Figma draws this as a fixed 121x208 triangle ("Subtract") and lets the card
     clip it — on a 152 card the diagonal leaves the bottom edge at x≈33, it does
     NOT run into the corner. Keeping the triangle fixed instead of tying it to
     the card height is what makes every card look identical, and it is also what
     survives a text that wraps: the angle stays put, the card just gets taller. */
  clip-path: polygon(0 0, var(--sun-steps-wedge) 0, 0 var(--sun-steps-wedge-h));
  pointer-events: none;
}

/* Head row: number (or CTA arrow) and the label side by side.
   ::after is the LAST child in paint order, so the opaque wedge would cover the
   content unless the content lifts itself above it. */
.sun-steps__head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;                                     /* Figma: 01 ends at 29, LABEL starts at 45 */
  min-height: 32px;
}
.sun-steps__num {
  font-family: var(--wp--preset--font-family--brand);
  font-weight: 500;
  font-size: 24px;                               /* H5 Display 24/32 */
  line-height: 32px;
  color: var(--sun-primary);                     /* #ff710a */
}

/* Card body */
.sun-steps__body {
  position: relative;
  z-index: 1;                                    /* same reason as the head row */
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;                                     /* Figma: head 0–32, text at 48 */
}
.sun-steps__pill {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 4px 10px 4px 8px;
  background: #edf0fb;                           /* PRIMARY/Blue/Light — no theme token */
  border: 1px solid var(--sun-accent);           /* #4a67d2 */
  border-radius: 4px;
  font-family: var(--wp--preset--font-family--brand);
  font-weight: 500;
  font-size: var(--wp--preset--font-size--xs);   /* 12/16 */
  line-height: 16px;
  color: #212e5e;                                /* PRIMARY/Blue/Dark :active — no theme token */
}
.sun-steps__text {
  margin: 0;
  font-family: var(--wp--preset--font-family--brand);
  font-weight: 500;
  font-size: 18px;                               /* H6 Display 18/24 */
  line-height: 24px;
  color: var(--sun-secondary);                   /* #132140 */
}

/* CTA card — accent→navy gradient (Figma 103°, accent at 21%) */
.sun-steps__card--cta::before {
  background: linear-gradient(103deg, var(--sun-accent) 21.07%, var(--sun-secondary) 100%);
}
.sun-steps__cta-arrow {
  display: inline-flex;
  /* Navy while it sat out on the grey wedge; it is inside the blue card now. */
  color: var(--sun-base);
}
.sun-steps__cta-arrow .sun-steps__cta-arrow-icon { width: 24px; height: 24px; }
.sun-steps__cta-title {
  margin: 0;
  font-family: var(--wp--preset--font-family--brand);
  font-weight: 500;
  font-size: 18px;
  line-height: 24px;
  color: var(--sun-base);                        /* #ffffff */
}
.sun-steps__cta-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}
.sun-steps__cta-btn .sun-steps__btn-icon { width: 16px; height: 16px; }
.sun-steps__cta-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-family: var(--wp--preset--font-family--brand);
  font-weight: 500;
  font-size: var(--wp--preset--font-size--sm);   /* 14/20 */
  line-height: 20px;
  color: var(--sun-base);                        /* on the blue→navy card: white instead of CI blue */
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  transition: color .15s ease;
}
.sun-steps__cta-link:hover { color: var(--sun-primary); }    /* on the dark card: orange, navy would vanish */
.sun-steps__cta-link .sun-steps__cta-link-icon {
  width: 16px;
  height: 16px;
  transform: rotate(-45deg);                     /* → becomes ↗ */
}

/* Optional avatars in the CTA box */
.sun-steps__avatars { display: inline-flex; }
.sun-steps__avatars .sun-steps__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--sun-base);
}
.sun-steps__avatars .sun-steps__avatar + .sun-steps__avatar { margin-left: -8px; }

/* Responsive — columns stack; cards compact on mobile */
@media (max-width: 1024px) {
  .sun-steps__inner { grid-template-columns: 1fr; gap: 40px; }
  /* One column: heading and stack now sit above each other, and two sticky
     elements sharing one stop means the first card lands on the heading. The
     heading scrolls away normally; only the cards stack. */
  .sun-steps__aside { position: static; }
  .sun-steps__aside { max-width: 640px; }
}
@media (max-width: 600px) {
  /* The padding shorthand has to keep the left value on the variable, otherwise
     it resets it and the content slides under the wedge. */
  .sun-steps__card {
    --sun-steps-wedge: 91px;
    --sun-steps-wedge-h: 156px;
    --sun-steps-pad-left: 88px;
    padding: 20px 20px 20px var(--sun-steps-pad-left);
  }
  .sun-steps__head { gap: 12px; }
  .sun-steps__body { gap: 12px; }
  .sun-steps__text { font-size: 16px; line-height: 22px; }
  .sun-steps__cta-actions { gap: 12px; }
}
