/* Growth Staircase
   Typography follows the theme via --fs-heading-font and the heading/body
   size tokens. Width, side gutter and vertical padding follow the theme
   Spacing settings via --fs-container-width / --fs-side-gutter /
   --fs-section-spacing (set in theme-overrides.css). */

.gsc {
  --gsc-bg: #FFFFFF;
  --gsc-text: #211A21;
  --gsc-muted: #58504E;
  --gsc-highlight: #F26522;
  --gsc-tone-pale: #F0EFEE;
  --gsc-tone-light: #E4E1E0;
  --gsc-tone-neutral: #B0AAA8;
  --gsc-tone-ink: #211A21;
  --gsc-tone-brand: var(--fs-btn-primary-bg, #F7931E);
  --gsc-pad: var(--fs-section-spacing, 80px);
  --gsc-base: clamp(24px, 3vw, 36px);
  --gsc-rise: clamp(28px, 3.4vw, 40px);
  --gsc-gap: 8px;
  --gsc-ease: cubic-bezier(.22, .61, .36, 1);

  padding: var(--gsc-pad) 0;
  background: var(--gsc-bg);
  color: var(--gsc-text);
}

.gsc--space-sm { --gsc-pad: clamp(40px, 5vw, 56px); }
.gsc--space-lg { --gsc-pad: clamp(88px, 10vw, 128px); }

.gsc--bordered {
  border-bottom: 1px solid var(--gsc-section-border, #B0AAA8);
}

/* On charcoal the two stone tones become translucent white and the
   charcoal bar flips to white so every step stays visible. */
.gsc--dark {
  --gsc-bg: #211A21;
  --gsc-text: #FFFFFF;
  --gsc-muted: #B0AAA8;
  --gsc-tone-pale: rgba(255, 255, 255, .08);
  --gsc-tone-light: rgba(255, 255, 255, .18);
  --gsc-tone-neutral: #807673;
  --gsc-tone-ink: #FFFFFF;
}

.gsc *,
.gsc *::before,
.gsc *::after {
  box-sizing: border-box;
}

/* Same box as the theme's .content-wrapper */
.gsc__inner {
  width: 100%;
  max-width: calc(var(--fs-container-width, 1240px) + (var(--fs-side-gutter, 16px) * 2));
  margin: 0 auto;
  padding: 0 var(--fs-side-gutter, 16px);
}

.gsc__heading {
  max-width: 18em;
  margin: 0;
  font-family: var(--fs-heading-font);
  font-size: clamp(calc(var(--fs-h2-size) * 0.65), 4.6vw, var(--fs-h2-size));
  font-weight: var(--fs-h2-weight);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--gsc-text);
}

/* Steps: equal columns, bottom-aligned, so taller bars lift their copy */

.gsc__steps {
  display: grid;
  grid-template-columns: repeat(var(--gsc-cols, 5), minmax(0, 1fr));
  column-gap: var(--gsc-gap);
  align-items: end;
  margin: clamp(32px, 4vw, 48px) 0 0;
  padding: 0;
  list-style: none;
}

.gsc__step {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.gsc__text {
  padding-right: clamp(8px, 1.4vw, 16px);
  margin-bottom: clamp(16px, 1.8vw, 22px);
}

.gsc__tag {
  margin: 0 0 6px;
  font-size: var(--fs-eyebrow-size);
  font-weight: 700;
  line-height: 1.4;
  color: var(--gsc-muted);
}

.gsc__tag--highlight { color: var(--gsc-highlight); }

.gsc__title {
  margin: 0;
  font-family: var(--fs-heading-font);
  font-size: clamp(1.0625rem, 1.6vw, calc(var(--fs-h4-size, 1.25rem)));
  font-weight: var(--fs-h3-weight);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--gsc-text);
}

.gsc__desc {
  margin: 10px 0 0;
  font-size: var(--fs-small-size);
  line-height: 1.6;
  color: var(--gsc-muted);
}

.gsc__bar {
  display: block;
  width: 100%;
  height: calc(var(--gsc-base) + var(--i, 0) * var(--gsc-rise));
  background: var(--gsc-tone-pale);
  transform-origin: center bottom;
}

/* Wide screens: all copy blocks share one row (as tall as the longest
   copy), so a long description can't push its step above the next one.
   Each block then drops by one rise per step from the last, matching the
   bars exactly. Uses `translate` so it composes with the scroll
   animation's `transform`. */

@media (min-width: 900px) {
  @supports (grid-template-rows: subgrid) {
    .gsc__steps {
      grid-template-rows: auto auto;
    }

    .gsc__step {
      display: grid;
      grid-row: span 2;
      grid-template-rows: subgrid;
      align-self: stretch;
    }

    .gsc__text {
      align-self: start;
      translate: 0 calc((var(--gsc-cols, 5) - 1 - var(--i, 0)) * var(--gsc-rise));
    }

    .gsc__bar {
      align-self: end;
    }
  }
}

.gsc__bar--light   { background: var(--gsc-tone-light); }
.gsc__bar--neutral { background: var(--gsc-tone-neutral); }
.gsc__bar--ink     { background: var(--gsc-tone-ink); }
.gsc__bar--brand   { background: var(--gsc-tone-brand); }

/* Narrow screens: steps stack, and the bars turn sideways and lengthen
   step by step so the climb still reads */

@media (max-width: 899px) {
  .gsc__steps {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 32px;
  }

  .gsc__text {
    max-width: 36em;
    padding-right: 0;
    margin-bottom: 14px;
  }

  .gsc__bar {
    width: calc((var(--i, 0) + 1) / var(--gsc-cols, 5) * 100%);
    height: 10px;
    transform-origin: left center;
  }
}

/* Scroll animation
   .is-animated is printed server-side (never in the editor), so content is
   hidden from first paint. The JS adds .is-visible to the section once the
   steps enter the viewport. Each bar grows up from the baseline in turn and
   its copy follows. */

.gsc.is-animated .gsc__heading {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition: opacity .8s var(--gsc-ease), transform .8s var(--gsc-ease);
}

.gsc.is-animated .gsc__step {
  --gsc-at: calc(.2s + var(--i, 0) * .14s);
}

.gsc.is-animated .gsc__bar {
  transform: scaleY(0);
  transition: transform .7s cubic-bezier(.45, .05, .35, 1) var(--gsc-at);
}

.gsc.is-animated .gsc__text {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition:
    opacity .7s var(--gsc-ease) calc(var(--gsc-at) + .3s),
    transform .7s var(--gsc-ease) calc(var(--gsc-at) + .3s);
}

@media (max-width: 899px) {
  .gsc.is-animated .gsc__bar { transform: scaleX(0); }
}

.gsc.is-animated.is-visible .gsc__heading,
.gsc.is-animated.is-visible .gsc__text,
.gsc.is-animated.is-visible .gsc__bar {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .gsc.is-animated .gsc__heading,
  .gsc.is-animated .gsc__text,
  .gsc.is-animated .gsc__bar {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
