/* ==========================================================================
   06 Workflow — sticky title + counter (left), four steps on a scrubbed rail (right)
   ========================================================================== */
#workflow { overflow: clip; }

/* dial backdrop: a sticky, viewport-tall layer on the right that stays in view for the whole section. A line
   drawing of the logo's D-arc as concentric rings off the right edge; the red arc tracks the step rail
   (--wf-p, scrubbed in workflow.js), the step nodes light up, the tick ring turns slowly. */
#workflow .wf-backdrop { position: absolute; inset: 44px 0 0 0; pointer-events: none; }
#workflow .wf-backdrop-stick {
  position: sticky; top: 0; height: 100vh; height: 100svh; margin-left: auto; width: min(1000px, 66vw); overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 48%), linear-gradient(180deg, transparent 0%, #000 18%, #000 80%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(90deg, transparent 0%, #000 48%), linear-gradient(180deg, transparent 0%, #000 18%, #000 80%, transparent 100%);
          mask-composite: intersect;
}
#workflow .wf-dial { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: .6; }
#workflow .wf-dial-ticks { transform-box: view-box; transform-origin: 100% 50%; animation: wf-turn 140s linear infinite; }
@keyframes wf-turn { to { transform: rotate(-360deg); } }
#workflow .wf-dial-ticks line { stroke: #fff; stroke-opacity: .12; stroke-width: 1.2; }
#workflow .wf-dial-ticks line.major { stroke-opacity: .3; }
#workflow .wf-dial-prog { stroke-dasharray: 1 1; stroke-dashoffset: calc(1 - var(--wf-p, 1)); }
#workflow .wf-dial-head { transform-box: view-box; transform-origin: 100% 50%; transform: rotate(calc(var(--wf-p, 1) * -180deg)); }
#workflow .wf-dial-nodes circle { fill: var(--bg); stroke: rgba(255,255,255,.28); stroke-width: 1.2; transition: fill .5s, stroke .5s; }
#workflow .wf-dial-nodes circle.on { fill: #a1a1a1; stroke: rgba(255,255,255,.5); }

#workflow .wf-layout {
  position: relative; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}

/* ---------- left: sticky column ---------- */
#workflow .wf-aside { position: relative; border-right: 1px solid var(--line); }
#workflow .wf-sticky {
  position: sticky; top: calc(var(--nav-h) + 24px);
  display: grid; gap: 24px; justify-items: start;
  padding: clamp(40px, 4vw, 64px) clamp(24px, 3.4vw, 56px) clamp(40px, 4vw, 56px) var(--pad); /* inset off the rail, like .sec-head */
}
#workflow .wf-sticky .h2 { max-width: 11ch; }
#workflow .wf-sticky .lead { max-width: 400px; }

#workflow .wf-cue { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
#workflow .wf-cue .mono { color: var(--text-2); }
#workflow .wf-cue b { color: var(--text); font-weight: 500; }
#workflow .wf-arrow {
  width: 56px; height: 32px; flex: none; display: grid; place-items: center; overflow: hidden;
  border-radius: var(--r-sm); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.015));
}
#workflow .wf-arrow svg { width: 30px; height: 12px; animation: wf-arrow 2.4s var(--ease-in-out) infinite; }
@keyframes wf-arrow {
  0% { transform: translateX(-46px); }
  22%, 78% { transform: translateX(0); }
  100% { transform: translateX(46px); }
}

/* big step counter */
#workflow .wf-counter {
  width: 100%; margin-top: clamp(16px, 3vw, 48px); padding-top: 22px; border-top: 1px solid var(--line);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
}
#workflow .wf-count-num { display: flex; align-items: flex-start; gap: 10px; line-height: .8; }
#workflow .wf-count-cur {
  font-size: clamp(96px, 10vw, 156px); font-weight: 300; letter-spacing: -0.07em;
  background: linear-gradient(180deg, #fff 15%, #a1a1a1 75%, rgba(161,161,161,.35));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  display: inline-block; font-variant-numeric: tabular-nums;
}
#workflow .wf-count-tot { color: var(--text-3); margin-top: .5em; }
#workflow .wf-count-meta { display: grid; justify-items: end; gap: 12px; padding-bottom: 8px; }
#workflow .wf-count-name { color: var(--text); }
#workflow .wf-ticks { display: flex; gap: 4px; }
#workflow .wf-ticks i { width: 18px; height: 3px; border-radius: 2px; background: var(--line-2); transition: background .5s, box-shadow .5s; }
#workflow .wf-ticks i.on { background: var(--text); }

/* ---------- right: steps + rail ---------- */
#workflow .wf-steps-wrap { position: relative; }
#workflow .wf-rail { position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: var(--line); margin-left: -1px; z-index: 2; }
#workflow .wf-rail-fill {
  position: absolute; inset: 0; display: block; transform-origin: top center; transform: scaleY(var(--wf-p, 1));
  background: linear-gradient(180deg, transparent, rgba(237,237,237,.35) 14%, var(--text));
}

#workflow .wf-step {
  position: relative; display: grid; gap: 16px; align-content: start;
  padding: clamp(36px, 4vw, 60px) clamp(20px, 2.4vw, 36px) clamp(36px, 4vw, 60px) clamp(28px, 4.2vw, 64px);
  border-bottom: 1px solid var(--line);
  transition: opacity .6s var(--ease-out);
}
#workflow .wf-step:last-child { border-bottom: 0; }
#workflow .wf-node {
  position: absolute; left: -5px; top: clamp(42px, calc(4vw + 6px), 66px); width: 9px; height: 9px; border-radius: 50%; z-index: 3;
  background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-3);
  transition: background .5s, box-shadow .5s;
}
#workflow .wf-step-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
#workflow .wf-step-no { color: var(--text-2); transition: color .5s; }
#workflow .wf-step .h3 { font-size: clamp(26px, 2.4vw, 36px); }
#workflow .wf-step-desc { max-width: 520px; color: var(--text-2); text-wrap: pretty; }

/* active / dimmed states (only when JS runs: .wf-live). Inactive steps dim their heading and mock,
   but the description stays at a readable contrast (>= 4.5:1). */
#workflow.wf-live .wf-step > :not(.wf-node) { transition: opacity .6s var(--ease-out); }
#workflow.wf-live .wf-step:not(.is-active) .wf-step-head,
#workflow.wf-live .wf-step:not(.is-active) .h3 { opacity: .5; }
#workflow.wf-live .wf-step:not(.is-active) .wf-step-desc { opacity: .8; }
#workflow.wf-live .wf-step:not(.is-active) .wf-mock { opacity: .4; }
#workflow.wf-live .wf-step.is-done .wf-node,
#workflow .wf-step.is-active .wf-node { background: var(--text); box-shadow: 0 0 0 4px rgba(255,255,255,.08); }
/* the one red signal on the rail: the current step's node */
#workflow.wf-live .wf-step.is-active .wf-node { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
#workflow .wf-step.is-active .wf-step-no { color: var(--text); }
#workflow.wf-live .wf-step .wf-mock { transition: transform .8s var(--ease-out), opacity .6s var(--ease-out); }
#workflow.wf-live .wf-step:not(.is-active) .wf-mock { transform: translateY(6px) scale(.985); }

/* ---------- mini mocks ---------- */
#workflow .wf-mock {
  position: relative; margin-top: 10px; max-width: 520px; border-radius: var(--r); padding: 14px;
  background: linear-gradient(180deg, rgba(17,17,19,.9), rgba(10,10,11,.9));
  box-shadow: inset 0 0 0 1px var(--line-2), 0 24px 60px -30px rgba(0,0,0,.9);
  font-size: 13px; color: var(--text-2);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#workflow .wf-mock::before {
  content: ""; position: absolute; left: 14%; right: 14%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
}
#workflow .wf-mock svg { width: 14px; height: 14px; flex: none; }
#workflow .wf-mock-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 2px 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
#workflow .wf-mock-bar > .mono:first-child { color: var(--text-2); }

/* 01 source chips */
#workflow .wf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
#workflow .wf-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 11px; border-radius: var(--r-sm);
  background: rgba(255,255,255,.025); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text);
  white-space: nowrap;
}
#workflow .wf-chip svg { color: var(--text-2); }
#workflow .wf-chip .ok-dot { margin-left: 2px; }
#workflow .wf-chip-sync {
  width: 10px; height: 10px; border-radius: 50%; margin-left: 2px;
  border: 1.5px solid rgba(255,255,255,.16); border-top-color: var(--text);
  animation: wf-spin 1s linear infinite;
}
@keyframes wf-spin { to { transform: rotate(360deg); } }
#workflow .wf-chip--add { color: var(--text-3); box-shadow: inset 0 0 0 1px var(--line); background: none; border: 1px dashed var(--line-2); }
#workflow .wf-sync { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
#workflow .wf-sync-meter { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.06); overflow: hidden; }
#workflow .wf-sync-meter i {
  display: block; width: 72%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, rgba(237,237,237,.25), var(--text));
  transform-origin: left center; animation: wf-sync 3.6s var(--ease-in-out) infinite;
}
@keyframes wf-sync { 0% { transform: scaleX(.2); } 70%, 100% { transform: scaleX(1.38); } }

/* 02 entity list */
#workflow .wf-file { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-family: var(--font-mono); font-size: 12px; }
#workflow .wf-file svg { color: var(--text-2); }
#workflow .wf-ents { display: grid; }
#workflow .wf-ents li {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 9px 2px; border-top: 1px solid var(--line);
}
#workflow .wf-ents li:first-child { border-top: 0; padding-top: 2px; }
#workflow .wf-ents b { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#workflow .wf-ent-conf { color: #7cf0b5; font-size: 11px; padding-right: 8px; }

/* 03 decision card */
#workflow .wf-dec-top { display: flex; align-items: center; gap: 12px; }
#workflow .wf-dec-ic { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none; background: var(--text); color: #0a0a0a; }
#workflow .wf-dec-ic svg { width: 16px; height: 16px; }
#workflow .wf-dec-t { display: grid; gap: 2px; min-width: 0; flex: 1; }
#workflow .wf-dec-t b { color: var(--text); font-weight: 500; font-size: 14px; }
#workflow .wf-dec-conf { display: grid; justify-items: end; gap: 2px; }
#workflow .wf-dec-conf b { font-size: 22px; font-weight: 400; letter-spacing: -0.04em; color: var(--text); line-height: 1; }
#workflow .wf-conf { position: relative; height: 6px; margin: 14px 0 12px; border-radius: var(--r-sm); background: rgba(255,255,255,.06); }
#workflow .wf-conf i {
  position: absolute; inset: 0; border-radius: inherit; transform-origin: left center; transform: scaleX(var(--w));
  background: linear-gradient(90deg, rgba(237,237,237,.3), var(--text));
}
/* auto-approve threshold: the decision mock's one red signal */
#workflow .wf-conf-th { position: absolute; top: -4px; bottom: -4px; left: calc(var(--t) * 100%); width: 2px; margin-left: -1px; border-radius: 1px; background: var(--accent); }
#workflow .wf-reasons { display: grid; gap: 7px; padding: 12px 0 14px; border-top: 1px solid var(--line); }
#workflow .wf-reasons li { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
#workflow .wf-dec-actions { display: flex; align-items: center; gap: 8px; }
/* mock buttons mirror .btn--sm (Vercel): 6px radius, #ededed primary, #0a0a0a + #2e2e2e ring secondary */
#workflow .wf-btn { height: 28px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 6px; font-size: 12.5px; font-weight: 500; color: #ededed; background: #0a0a0a; box-shadow: 0 0 0 1px #2e2e2e; }
#workflow .wf-btn--primary { background: #ededed; color: #0a0a0a; box-shadow: none; }
#workflow .wf-dec-policy { margin-left: auto; font-size: 11px; }

/* 04 delivered notifications */
#workflow .wf-notifs { display: grid; gap: 8px; }
#workflow .wf-notif {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm);
  background: rgba(255,255,255,.02); box-shadow: inset 0 0 0 1px var(--line);
}
#workflow .wf-notif:first-child { box-shadow: inset 0 0 0 1px var(--line-3); background: rgba(255,255,255,.045); }
#workflow .wf-notif-ic { width: 30px; height: 30px; border-radius: var(--r-sm); flex: none; display: grid; place-items: center; color: var(--text-2); background: var(--bg-4); box-shadow: inset 0 0 0 1px var(--line-2); }
#workflow .wf-notif-t { display: grid; gap: 1px; min-width: 0; flex: 1; font-size: 12.5px; }
#workflow .wf-notif-t > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#workflow .wf-notif-t b { color: var(--text); font-weight: 500; }
#workflow .wf-audit { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 4px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
#workflow .wf-audit .mono:nth-child(2) { color: var(--text); }
#workflow .wf-audit .mono:last-child { margin-left: auto; }

/* ---------- responsive ---------- */
@media (max-width: 991px) {
  #workflow .wf-layout { grid-template-columns: 1fr; border-top: 0; }
  #workflow .wf-aside { border-right: 0; }
  #workflow .wf-sticky { position: static; padding: 0 var(--pad) 40px; }
  #workflow .wf-sticky .h2 { max-width: 14ch; }
  #workflow .wf-counter { display: none; }
  #workflow .wf-steps-wrap { border-top: 1px solid var(--line); }
  #workflow .wf-backdrop-stick { width: 100%; }
  #workflow .wf-dial { opacity: .5; }
}
/* tablet: one column of steps, each step laid out text-left / mock-right so it fills the width */
@media (min-width: 768px) and (max-width: 991px) {
  #workflow .wf-step {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: clamp(24px, 4vw, 40px);
    grid-template-areas: "head mock" "title mock" "desc mock";
    grid-template-rows: auto auto 1fr;
  }
  #workflow .wf-step-head { grid-area: head; }
  #workflow .wf-step .h3 { grid-area: title; }
  #workflow .wf-step-desc { grid-area: desc; }
  #workflow .wf-mock { grid-area: mock; margin-top: 0; max-width: none; align-self: start; }
  #workflow .wf-ents li { grid-template-columns: 76px minmax(0, 1fr) auto; gap: 8px; }
  #workflow .wf-dec-actions { flex-wrap: wrap; row-gap: 10px; }
  #workflow .wf-dec-policy { white-space: nowrap; }
}
@media (max-width: 767px) {
  #workflow .wf-step { padding: 32px 16px 36px 24px; gap: 14px; }
  #workflow .wf-node { top: 38px; }
  #workflow .wf-mock { padding: 12px; }
  #workflow .wf-ents li { grid-template-columns: 76px minmax(0, 1fr) auto; gap: 8px; }
  #workflow .wf-dec-policy { display: none; }
  #workflow .wf-audit .mono:last-child { margin-left: 0; flex-basis: 100%; }
  #workflow .wf-cue .mono { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  #workflow .wf-arrow svg, #workflow .wf-chip-sync, #workflow .wf-sync-meter i, #workflow .wf-dial-ticks { animation: none; }
}
