/* Home — 05 Process ------------------------------------------------------------
   Sticky intro + 4 editorial step rows on a "paint rail". The rail, nodes and
   numeral swipes use ONE brand → ink progression — never the 5 service hues,
   which are reserved to mean "service" across the page.
   The rail is a dashed track that fills while scrolling (desktop + motion only,
   see 05-process.js → .is-scrub). Default state (no JS, mobile, reduced motion)
   = fully painted.                                                             */

.mx-process {
  --p-node: 64px;                              /* step icon chip */
  --p-pad: clamp(30px, 3.2vw, 46px);          /* row padding */
  --p-col: clamp(20px, 2.6vw, 36px);          /* rail → row gap */
  /* Step paint: brand deepening toward ink (flat brand where color-mix is unsupported) */
  --p-c1: var(--mx-brand);
  --p-c2: var(--mx-brand);
  --p-c3: var(--mx-brand);
  --p-c4: var(--mx-brand);
}
@supports (color: color-mix(in oklab, red, blue)) {
  .mx-process {
    --p-c2: color-mix(in oklab, var(--mx-brand) 80%, var(--mx-ink));
    --p-c3: color-mix(in oklab, var(--mx-brand) 60%, var(--mx-ink));
    --p-c4: color-mix(in oklab, var(--mx-brand) 40%, var(--mx-ink));
  }
}
.mx-process__step--1 { --step: var(--p-c1); --step-next: var(--p-c2); }
.mx-process__step--2 { --step: var(--p-c2); --step-next: var(--p-c3); }
.mx-process__step--3 { --step: var(--p-c3); --step-next: var(--p-c4); }
.mx-process__step--4 { --step: var(--p-c4); --step-next: var(--p-c4); }

.mx-process__grid {
  display: grid; align-items: stretch;   /* aside spans the full row so its content can stick */
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(40px, 6vw, 112px);
}

/* Intro column ------------------------------------------------------------- */
.mx-process__sticky {
  position: sticky; top: calc(var(--mx-header-h) + 40px);
  padding-top: var(--p-pad);
}
.mx-process__title { max-width: 13ch; }
.mx-process__lead { margin-top: 22px; max-width: 34em; }

.mx-process__cta { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 20px; margin-top: 34px; }
.mx-process__cta-note { max-width: 15em; font: 600 14px/1.45 var(--mx-font); color: var(--mx-muted); }

/* Steps -------------------------------------------------------------------- */
.mx-process__steps { position: relative; list-style: none; }
.mx-process__step {
  position: relative;
  display: grid; grid-template-columns: var(--p-node) minmax(0, 1fr); column-gap: var(--p-col);
}

/* Rail segment: from this node's centre to the next node's centre */
.mx-process__seg {
  position: absolute; z-index: 0;
  left: calc(var(--p-node) / 2 - 2px); top: calc(var(--p-pad) + var(--p-node) / 2);
  width: 4px; height: 100%;
}
.mx-process__seg::before { /* dashed, unpainted track */
  content: ""; position: absolute; left: 1px; top: 0; bottom: 0; width: 2px;
  background: repeating-linear-gradient(to bottom, var(--mx-line-strong) 0 7px, transparent 7px 13px);
}
.mx-process__fill {
  position: absolute; inset: 0; border-radius: 4px;
  background: linear-gradient(to bottom, var(--step), var(--step-next));
  transform-origin: 50% 0;
}

.mx-process__node {
  position: relative; z-index: 1; grid-column: 1; align-self: start;
  display: grid; place-items: center;
  width: var(--p-node); height: var(--p-node); margin-top: var(--p-pad);
  border-radius: 18px;
  background: var(--step); color: var(--mx-paper); font-size: 22px;
  box-shadow: 0 0 0 7px var(--mx-sand), 0 12px 24px -14px rgba(22, 26, 35, .45);
  transition: background-color .3s var(--mx-ease), color .3s var(--mx-ease), box-shadow .3s var(--mx-ease), transform .45s var(--mx-ease-out);
}

.mx-process__body {
  grid-column: 2; min-width: 0;
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: clamp(20px, 3vw, 44px); align-items: start;
  padding-block: var(--p-pad);
  border-top: 1px solid var(--mx-line-strong);
}
.mx-process__step:last-child .mx-process__body { border-bottom: 1px solid var(--mx-line-strong); }

.mx-process__num { /* oversized editorial numeral + paint swipe in the step colour */
  position: relative; display: block; min-width: 1.15em;
  font: 600 clamp(4rem, 2.4rem + 3.4vw, 6.5rem)/.8 var(--mx-font-display);
  font-variation-settings: "opsz" 96;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -0.06em; color: var(--mx-ink);
  -webkit-text-stroke: 0 transparent;
  padding-bottom: 22px;
  transition: color .45s var(--mx-ease);
}
.mx-process__num::after {
  content: ""; position: absolute; left: .02em; bottom: 0; width: 1em; height: 12px;
  background: var(--step);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 40' preserveAspectRatio='none'%3E%3Cpath d='M4 26c40-14 92-18 150-17 70 1 120 6 170 3 26-2 48-6 70-9-6 8-20 16-48 20-60 9-128 6-190 6-56 0-104 3-148 7-6 0-8-6-4-10z'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 40' preserveAspectRatio='none'%3E%3Cpath d='M4 26c40-14 92-18 150-17 70 1 120 6 170 3 26-2 48-6 70-9-6 8-20 16-48 20-60 9-128 6-190 6-56 0-104 3-148 7-6 0-8-6-4-10z'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
  transform-origin: left center;
  transition: transform .8s var(--mx-ease-out) .1s;
}

.mx-process__text { padding-top: 2px; }
.mx-process__kicker {
  margin-bottom: 10px;
  font: 700 12px/1.2 var(--mx-font); letter-spacing: .16em; text-transform: uppercase; color: var(--mx-muted);
}
.mx-process__name { margin-bottom: 10px; }
.mx-process__desc { max-width: 40ch; font-size: 16.5px; line-height: 1.65; color: var(--mx-muted); }

/* Scroll-linked state (desktop + motion; class added by JS) ---------------- */
.mx-process.is-scrub .mx-process__step:not(.is-reached) .mx-process__node {
  background: var(--mx-paper); color: var(--mx-muted);
  box-shadow: 0 0 0 7px var(--mx-sand), inset 0 0 0 1.5px var(--mx-line-strong);
  transform: scale(.88);
}
.mx-process.is-scrub .mx-process__step:not(.is-reached) .mx-process__num {
  color: transparent; -webkit-text-stroke: 1.5px var(--mx-muted);
}
.mx-process.is-scrub .mx-process__step:not(.is-reached) .mx-process__num::after { transform: scaleX(0); }

/* Responsive --------------------------------------------------------------- */
@media (max-width: 1023px) {
  .mx-process__grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .mx-process__sticky { position: static; padding-top: 0; max-width: 680px; }
  .mx-process__title { max-width: none; }
  .mx-process__cta { margin-top: 28px; }
}
@media (max-width: 767px) {
  .mx-process { --p-node: 50px; --p-pad: 28px; --p-col: 18px; }
  .mx-process__node { border-radius: 14px; font-size: 18px; box-shadow: 0 0 0 5px var(--mx-sand), 0 10px 20px -14px rgba(22, 26, 35, .45); }
  .mx-process__body { grid-template-columns: minmax(0, 1fr); }
  .mx-process__num { font-size: 2.6rem; padding-bottom: 12px; margin-bottom: 10px; justify-self: start; }
  .mx-process__num::after { height: 8px; }
  .mx-process__kicker { /* the numeral already shows the step; keep "Step 0X of 04" for screen readers */
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .mx-process__desc { font-size: 16px; }
}
@media (max-width: 599px) {
  .mx-process__cta .mx-btn { flex: 1 1 100%; }
  .mx-process__cta-note { max-width: none; }
}
@media (max-width: 374px) {
  .mx-process { --p-node: 44px; --p-col: 14px; }
}
/* Short laptop screens: the intro would not fit beside the steps — let it scroll normally. */
@media (min-width: 1024px) and (max-height: 700px) {
  .mx-process__sticky { position: static; }
}

/* ===== Mobile layer (<=1023): m4-work (process part) ===== */
/* Folded from _mobile-wip/m4-work.css: process brush rail M7/P7 and the phone step layout. */
/* Process: numeral beside the title, text full width */
@media (max-width: 767px) {
  .mx-process { --p-node: 44px; --p-pad: 22px; --p-col: 16px; }
  .mx-process__grid { gap: 30px; }
  .mx-process__node { border-radius: 13px; font-size: 17px; }
  .mx-process__body { grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: baseline; padding-top: calc(var(--p-pad) + 8px); }
  .mx-process__text { display: contents; }
  .mx-process__num { font-size: 1.95rem; min-width: 1.1em; padding-bottom: 9px; margin: 0; }
  .mx-process__num::after { height: 7px; }
  .mx-process__name { margin: 0; }
  .mx-process__desc { grid-column: 1 / -1; margin-top: 6px; }
}
@media (max-width: 374px) {
  .mx-process { --p-node: 40px; --p-col: 12px; }
  .mx-process__num { font-size: 1.7rem; }
}

@media (max-width: 1023px) {
  .mx-process__name { text-wrap: balance; } /* no one-word last line ("Start Preparation / & Execution") */
}

/* M7: the brush rail paints itself as you read (05-process.js adds .mxm-p: <=1023px, motion allowed).
   Scrubbed by the scroll, against a line 62% down the screen (the desktop trigger): only the rail
   segment (scale) and its wet-paint bead (translate). At that line each step flips state (.mxm-on, set
   by an IntersectionObserver, reversible), like desktop's .is-reached: the node's paper chip fades off
   the paint and the node settles from .88, the numeral fills and its brush swipe strokes on. The moving
   parts are opacity and transforms; the icon and numeral colour flips are one-shot 250ms transitions,
   never scrubbed. Text never fades. Without scroll timelines the segment fills by class (.mxm-full). */
@media (max-width: 1023px) and (prefers-reduced-motion: no-preference) {
  .mxm-p .mx-process__node { transition: color .25s var(--mx-ease), scale .32s var(--mx-ease-out); }
  .mxm-p .mx-process__node::before { /* the unpainted paper chip, laid over the paint */
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: var(--mx-paper); box-shadow: inset 0 0 0 1.5px var(--mx-line-strong);
    opacity: 0; transition: opacity .25s var(--mx-ease);
  }
  .mxm-p .mx-process__node > i { position: relative; } /* above the paper chip */
  .mxm-p .mx-process__num { transition: color .25s var(--mx-ease); }
  .mxm-p .mx-process__num::after { transition: transform .4s var(--mx-ease-out) .1s; }
  .mxm-p .mx-process__step:not(.mxm-on) .mx-process__node { color: var(--mx-muted); scale: .88; }
  .mxm-p .mx-process__step:not(.mxm-on) .mx-process__node::before { opacity: 1; }
  .mxm-p .mx-process__step:not(.mxm-on) .mx-process__num { color: transparent; -webkit-text-stroke: 1.5px var(--mx-muted); }
  .mxm-p .mx-process__step:not(.mxm-on) .mx-process__num::after { transform: scaleX(0); }
  .mxm-p-io .mx-process__fill { transition: transform .4s var(--mx-ease-out); }
  .mxm-p-io .mx-process__step:not(.mxm-full) .mx-process__fill { transform: scaleY(0); }
  /* first pass (page opened mid-section): steps arrive in their state, nothing animates */
  .mx-process.mxm-p-0 :is(.mx-process__node, .mx-process__num, .mx-process__fill),
  .mx-process.mxm-p-0 .mx-process__node::before, .mx-process.mxm-p-0 .mx-process__num::after { transition: none; }
}
@supports (animation-timeline: view()) {
  @media (max-width: 1023px) and (prefers-reduced-motion: no-preference) {
    .mxm-p .mx-process__seg { view-timeline: --mxm-seg block; view-timeline-inset: 0px 38%; }
    .mxm-p .mx-process__fill, .mxm-p .mx-process__seg::after { animation: mxm-p-fill linear both; animation-timeline: --mxm-seg; animation-range: entry 0% entry 100%; }
    .mxm-p .mx-process__seg::after { /* wet paint front */
      content: ""; position: absolute; left: -3px; top: 0; width: 10px; height: 100%; pointer-events: none;
      background: radial-gradient(5px 7px at 50% 0, var(--step-next) 92%, transparent) no-repeat;
      animation-name: mxm-p-bead;
    }
  }
}
@keyframes mxm-p-fill { from { scale: 1 0; } }
@keyframes mxm-p-bead { to { translate: 0 100%; } }
/* ===== /Mobile layer: m4-work (process part) ===== */

/* ===== Mobile perf (<=1023): content-visibility ===== */
/* Skipped while far off screen (see 02-intro.css). Measured heights. Desktop (1024+) is untouched. */
@media (max-width: 1023px) { #process { content-visibility: auto; contain-intrinsic-size: auto 1160px; } html.mx-cv-all #process { content-visibility: visible; } }
@media (max-width: 767px) { #process { contain-intrinsic-size: auto 1000px; } }
@media (max-width: 599px) { #process { contain-intrinsic-size: auto 1100px; } }
/* ===== /Mobile perf: content-visibility ===== */
