@layer sections {
  /* ==========================================================================
     SECTION 4: WORKFLOW TIMELINE (wf-)
     Five-step lab trajectory with reactive ribbon line and live step counter
     ========================================================================== */

  .wf {
    background-color: var(--c-blue-50);
    color: var(--c-navy-900);
    padding-block: var(--section-pad);
    position: relative;
    overflow: clip;
  }

  .wf__container {
    max-inline-size: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  /* 12-Column Desktop Grid Layout (Section 4.1) */
  .wf__grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: var(--gutter);
    align-items: start;
  }

  /* Sticky Sidebar (Cols 1-5, sticky top: 18svh) */
  .wf__sticky-col {
    grid-column: 1 / 6;
    position: sticky;
    inset-block-start: 18svh;
    align-self: start;
  }

  .wf__kicker {
    display: block;
    font-size: var(--fs-label);
    color: var(--c-green-700);
    font-weight: 600;
    letter-spacing: var(--track-label);
    text-transform: uppercase;
    margin-block-end: var(--s-2);
  }

  .wf__title {
    font-size: var(--fs-h2);
    line-height: var(--lh-head);
    font-weight: 700;
    color: var(--c-navy-900);
    margin: 0 0 var(--s-4);
    text-wrap: balance;
  }

  html[lang='fa'] .wf__title {
    font-weight: 800;
    padding-block-end: 4px;
  }

  .wf__intro {
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    color: var(--c-ink-700);
    margin: 0 0 var(--s-8);
    max-inline-size: 42ch;
    text-wrap: pretty;
  }

  /* Live Sticky Counter (Section 4.1) */
  .wf__counter {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-block-start: var(--s-6);
  }

  .wf__counter-num {
    font-size: clamp(2.5rem, 2rem + 2vw, 4rem);
    font-weight: 700;
    line-height: 1;
    color: var(--c-navy-900);
    font-variant-numeric: tabular-nums;
  }

  .wf__counter-name {
    font-size: var(--fs-body);
    font-weight: 600;
    color: var(--c-green-700);
    margin-block-start: var(--s-2);
  }

  /* Steps Column (Cols 7-12) */
  .wf__steps-col {
    grid-column: 7 / 13;
    position: relative;
  }

  /* Dynamically built overlay SVG for the ribbon line (Section 4.2) */
  .wf__svg {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
  }

  .wf__track {
    stroke: var(--c-blue-100);
    stroke-width: 3px;
    fill: none;
  }

  .wf__line {
    stroke: var(--c-green-500);
    stroke-width: 4px;
    stroke-linecap: round;
    fill: none;
    will-change: stroke-dashoffset;
  }

  .wf__node {
    fill: var(--c-white);
    stroke: var(--c-blue-300);
    stroke-width: 2px;
    transition: fill 0.3s ease, stroke 0.3s ease;
    transform-origin: center center;
  }

  .wf__node.is-active {
    fill: var(--c-green-500);
    stroke: var(--c-green-500);
  }

  /* Steps Container & Individual Steps */
  .wf__steps {
    list-style: none;
    margin: 0;
    padding: 0;
    padding-block-end: 18svh;
    position: relative;
    z-index: 2;
  }

  .wf__step {
    min-block-size: 62svh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  /* Node anchor marker at top of each step for dynamic geometry measurement */
  .wf__node-anchor {
    position: absolute;
    inset-block-start: 12px;
    inset-inline-start: 24px;
    inline-size: 18px;
    block-size: 18px;
    pointer-events: none;
    visibility: hidden;
  }

  /* Step Content (Baseline opacity 0.45 for visibility, blooms to 1 on activation) */
  .wf__step-content {
    padding-inline-start: 64px;
    opacity: 0.45;
    transition: opacity 0.35s ease, transform 0.35s ease;
    will-change: opacity, transform;
  }

  .wf__step.is-active .wf__step-content {
    opacity: 1;
  }

  .wf__num {
    font-size: 4rem;
    line-height: 1;
    font-weight: 700;
    color: var(--c-blue-400);
    opacity: 0.7;
    transition: color 0.35s ease, opacity 0.35s ease, transform 0.35s ease;
    font-variant-numeric: tabular-nums;
    margin-block-end: var(--s-2);
  }

  .wf__step.is-active .wf__num {
    color: var(--c-green-600);
    opacity: 1;
    transform: scale(1.05);
  }

  .wf__step-title {
    font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem);
    line-height: var(--lh-head);
    font-weight: 600;
    color: var(--c-navy-900);
    margin: 0 0 var(--s-2);
  }

  html[lang='fa'] .wf__step-title {
    font-weight: 700;
  }

  .wf__step-text {
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    color: var(--c-ink-700);
    margin: 0;
    max-inline-size: 44ch;
    text-wrap: pretty;
  }

  /* Tablet and Mobile Layout (< 1024 px, Section 4.1) */
  @media (max-width: 1023px) {
    .wf__grid {
      display: flex;
      flex-direction: column;
      gap: var(--s-8);
    }

    .wf__sticky-col {
      position: static;
      grid-column: auto;
    }

    .wf__counter {
      display: none;
    }

    .wf__steps-col {
      grid-column: auto;
      inline-size: 100%;
    }

    .wf__step {
      min-block-size: 34svh;
    }

    .wf__line {
      stroke-width: 3px;
    }

    .wf__node-anchor {
      inset-inline-start: 14px;
    }

    .wf__step-content {
      padding-inline-start: 46px;
    }
  }

  /* Reduced Motion (Section 4.4) */
  @media (prefers-reduced-motion: reduce) {
    .wf__counter {
      display: none !important;
    }

    .wf__line {
      stroke-dashoffset: 0 !important;
    }

    .wf__step-content {
      opacity: 1 !important;
      transform: none !important;
    }

    .wf__node {
      fill: var(--c-green-500) !important;
      stroke: var(--c-green-500) !important;
    }
  }
}
