/* ============================================================
   Numbered List section (layout "numbered_list")
   Design ref: Family Service "How the Family Service helps" +
   Programme "A staged path to recovery", built to the mra-research
   "How we deliver insights" pattern Miles pointed to: the numbers are
   NODES and a caramel line drops from each number down to the next,
   CONNECTING them (a timeline / flowchart). The line stops at the last
   number. Numbers are centred over the line; content sits to the right.
   Cream (Light Cream #F9F7F2) or light-grey band. Mobile: intro first.
   ============================================================ */

.numbered-list {
  padding-block: var(--section-padding);
  --nl-gap: var(--space-lg);
}

.numbered-list--cream {
  background: var(--color-cream-light);
}

.numbered-list--light-grey {
  background: var(--color-light-grey);
}

/* ---- Layout (mobile-first: single column, intro then items) ---- */

.numbered-list__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* ---- Intro column ---- */

.numbered-list__heading {
  margin-bottom: var(--space-md);
}

.numbered-list__text {
  color: var(--color-text);
}

.numbered-list__text p {
  margin-bottom: 1em;
}

.numbered-list__text p:last-child {
  margin-bottom: 0;
}

/* ---- Numbered items (timeline of numbered nodes) ---- */

.numbered-list__items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--nl-gap);
}

.numbered-list__item {
  position: relative;
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  column-gap: 1.5rem;
  align-items: start;
}

/* Connector: drops from below each number, through this item and the gap,
   to the next number - linking the nodes. No connector after the last item. */
.numbered-list__item:not(:last-child)::before {
  content: "";
  position: absolute;
  /* sits just under the numeral, a touch left of the "1." centre */
  left: calc(1.1rem - 1px);
  /* clear gap below this number and above the next one */
  top: 2.5rem;
  bottom: calc(-1 * var(--nl-gap) + 0.5rem);
  width: 2px;
  background: var(--color-accent);
  z-index: 0;
}

.numbered-list__number {
  position: relative;
  z-index: 1;
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.15;
  color: var(--color-accent);
}

.numbered-list__item-title {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-heading-sm);
  line-height: 1.2;
  color: var(--color-heading);
}

.numbered-list__item-text {
  color: var(--color-text);
}

.numbered-list__item-text p {
  margin: 0 0 0.5em;
}

.numbered-list__item-text p:last-child {
  margin-bottom: 0;
}

/* ---- Draw-in animation (mra-style): connectors grow downward when the
       section scrolls into view. Robust: connectors are visible by default;
       JS adds .numbered-list--anim to opt in, so no-JS keeps them shown.
       Skipped entirely under reduced-motion. ---- */

@media (prefers-reduced-motion: no-preference) {
  .numbered-list--anim .numbered-list__item:not(:last-child)::before {
    transform: scaleY(0);
    transform-origin: top center;
    transition: transform 0.55s ease;
  }

  .numbered-list--anim.is-visible
    .numbered-list__item:not(:last-child)::before {
    transform: scaleY(1);
  }

  .numbered-list--anim.is-visible .numbered-list__item:nth-child(2)::before {
    transition-delay: 0.16s;
  }

  .numbered-list--anim.is-visible .numbered-list__item:nth-child(3)::before {
    transition-delay: 0.32s;
  }

  .numbered-list--anim.is-visible .numbered-list__item:nth-child(4)::before {
    transition-delay: 0.48s;
  }

  .numbered-list--anim.is-visible .numbered-list__item:nth-child(5)::before {
    transition-delay: 0.64s;
  }
}

/* ---- Tablet: two columns, tightened (768-1023) ---- */

@media (min-width: 768px) {
  .numbered-list {
    --nl-gap: 2.75rem;
  }

  .numbered-list__inner {
    display: grid;
    grid-template-columns: 5fr 7fr;
    column-gap: 3rem;
    align-items: start;
  }
}

/* ---- Desktop (1024+) ---- */

@media (min-width: 1024px) {
  .numbered-list {
    --nl-gap: 3.25rem;
  }

  .numbered-list__inner {
    column-gap: 5rem;
  }

  .numbered-list__item {
    grid-template-columns: 3rem 1fr;
    column-gap: 1.6rem;
  }

  .numbered-list__item:not(:last-child)::before {
    left: calc(1.35rem - 1px);
    top: 3rem;
  }

  .numbered-list__number {
    font-size: 2.5rem;
  }
}
