/* ==========================================================================
   Process Section
   Block: .process / .process-section
   --------------------------------------------------------------------------
   A numbered run of stages against a progress rail. The heading either sits
   beside the stages and stays in view while they scroll past, or above them.
   ========================================================================== */

.process__layout {
  display: grid;
  gap: var(--space-2x-large);
}

@media (width >= 64rem) {
  .process-section--aside .process__layout {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: var(--space-3x-large);
    align-items: start;
  }

  .process-section--aside .process__aside {
    position: sticky;
    inset-block-start: var(--space-2x-large);
  }
}

.process__figure {
  margin-block-start: var(--space-large);
}

.process__link {
  margin-block-start: var(--space-large);
}

/* ------------------------------------------------------------- The stages */

/*
 * The rail is two lines in the same place: a static track, and a fill that the
 * shared scroll script scales as the reader moves down. With the script off
 * the track alone still ties the stages together.
 */
.process__steps {
  position: relative;
  display: grid;
  gap: var(--space-2x-large);
  margin: 0;
  padding-inline-start: var(--space-x-large);
  list-style: none;
  counter-reset: process-step;
}

.process__steps::before,
.process__steps::after {
  content: "";
  position: absolute;
  inset-inline-start: 0.6875rem;
  width: 2px;
}

.process__steps::before {
  inset-block: 0.75rem;
  background-color: var(--color-border);
}

.process__steps::after {
  inset-block-start: 0.75rem;
  height: calc(100% - 1.5rem);
  background-image: linear-gradient(180deg, var(--color-brand-azure), var(--color-brand-violet));
  transform: scaleY(var(--process-progress, 0));
  transform-origin: 50% 0;
}

/* Without the script there is no progress to report, so the fill is simply
   not drawn rather than sitting at zero. */
.process__steps:not([data-progress-rail])::after {
  display: none;
}

.process-step {
  position: relative;
}

.process-step::before {
  content: "";
  position: absolute;
  inset-block-start: 0.55rem;
  inset-inline-start: calc(var(--space-x-large) * -1 + 0.375rem);
  width: 0.875rem;
  height: 0.875rem;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background-color: var(--color-background);
  transition: background-color var(--duration-base) var(--easing-out),
    border-color var(--duration-base) var(--easing-out),
    transform var(--duration-base) var(--easing-out);
}

.process-step.is-reached::before {
  background-image: var(--gradient-brand);
  border-color: transparent;
  transform: scale(1.15);
}

.process-step__index {
  font-family: var(--font-family-monospace);
  font-size: var(--font-size-overline);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
}

.process-step__title {
  margin-block-start: var(--space-3x-small);
  font-size: var(--font-size-heading-3);
}

.process-step__text {
  margin-block-start: var(--space-2x-small);
  max-width: var(--max-text-width);
  color: var(--color-text-muted);
}

.process-step__text > :first-child {
  margin-block-start: 0;
}

.process-step__text > :last-child {
  margin-block-end: 0;
}

/* ------------------------------------------------------------ Detail rows */

.process-step__detail {
  display: grid;
  gap: var(--space-2x-small);
  margin-block-start: var(--space-medium);
  padding: var(--space-medium) var(--space-large);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  background-color: var(--color-background-raised);
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
}

.process-step__detail dt {
  font-family: var(--font-family-monospace);
  font-size: var(--font-size-overline);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
}

.process-step__detail dd {
  margin: 0;
}

.process-step__detail > div + div {
  padding-block-start: var(--space-2x-small);
  border-block-start: 1px solid var(--color-border-subtle);
}

@media (prefers-reduced-motion: reduce) {
  .process-step::before {
    transition: none;
  }
}
