/* ==========================================================================
   Labour Life practice system: workflows.css. Owner: workflows (M5).
   Admin, Workflows and the workflow page (SPEC 7.5.7, 7.5.8). Prefix wf-.
     .wf-who, .wf-used                 the list: a person in a cell, the note in a row's menu
     .wf-form, .wf-card, .wf-h (__n)   the page: the cards and their headings
     .wf-seg                           the priority buttons
     .wf-steps (__foot), .wf-list      the Steps card
     .wf-step (__grip __n __b __name __meta __who __acts __rm)   one step
     .wf-drop                          the line that shows where a dragged step lands
     .wf-save (__row __hint)           the Save bar, which stays in sight
   Phone first: the base styles are the phone. This file only adds classes.
   ========================================================================== */

/* ---------- the list ---------- */

.wf-who { display: inline-flex; align-items: center; gap: var(--s2); min-width: 0; }

/* A sentence in the place of a menu heading: plain words, not a label. */
.wf-used {
  display: block; max-width: 30ch;
  font: 400 var(--fs-sm)/var(--lh-snug) var(--font-body);
  letter-spacing: 0; text-transform: none; color: var(--ink-soft);
}

/* ---------- the page ---------- */

.wf-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); }

.wf-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s3); margin-bottom: var(--s4); font-size: var(--fs-h3); }
.wf-h__n { font: 400 var(--fs-sm)/var(--lh-snug) var(--font-body); color: var(--ink-mute); }

.wf-card > .note { margin-bottom: var(--s4); }
.wf-seg { justify-self: start; }

/* ---------- the steps ---------- */

.wf-steps__foot { margin-top: var(--s4); }

.wf-list {
  position: relative;
  margin: 0; padding: 0; list-style: none;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface);
}

/* A phone: the number and the words on the first line, the four buttons under them. */
.wf-step {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s1) var(--s3);
  padding: var(--s3) var(--s2) var(--s1) var(--s3);
  border-top: 1px solid var(--line);
  transition: background-color var(--dur-3) ease;
}
.wf-step:first-child { border-top: 0; border-radius: var(--r-md) var(--r-md) 0 0; }
.wf-step:last-of-type { border-radius: 0 0 var(--r-md) var(--r-md); }
.wf-step.is-moved { background: var(--red-wash); transition: none; }
.wf-step.is-dragging { background: var(--sunken); opacity: .6; }

.wf-step__grip { display: none; }

.wf-step__n {
  display: grid; place-items: center; flex: none;
  min-width: 28px; height: 28px; padding: 0 var(--s1);
  border-radius: var(--r-sm); background: var(--sunken);
  color: var(--ink); font-size: var(--fs-sm); font-weight: 600;
}

.wf-step__b { flex: 1 1 0; min-width: 0; padding-top: 2px; }
.wf-step__name { font-weight: 600; line-height: var(--lh-snug); overflow-wrap: anywhere; }
.wf-step__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s4);
  margin-top: var(--s1);
  color: var(--ink-mute); font-size: var(--fs-sm); line-height: var(--lh-snug);
}
.wf-step__who { display: inline-flex; align-items: center; gap: var(--s2); min-width: 0; color: var(--ink-soft); }

.wf-step__acts { display: flex; flex: 1 1 100%; justify-content: flex-end; align-items: center; gap: var(--s1); }
.wf-step__rm:hover { color: var(--danger-ink); }

@media (min-width: 720px) {
  .wf-step { flex-wrap: nowrap; align-items: center; padding: var(--s2) var(--s2) var(--s2) var(--s3); }
  .wf-step__b { padding-top: 0; }
  .wf-step__acts { flex: none; }
}

/* The handle is for a mouse or a pen. A finger uses Move up and Move down. */
@media (min-width: 720px) and (pointer: fine) {
  .wf-step__grip {
    display: grid; place-items: center; flex: none;
    width: 28px; height: var(--tap); margin-left: calc(var(--s2) * -1);
    border-radius: var(--r-sm); color: var(--ink-mute);
    cursor: grab; touch-action: none;
  }
  .wf-step__grip:hover { background: var(--tint); color: var(--ink); }
}

.wf-list.is-sorting, .wf-list.is-sorting .wf-step__grip { cursor: grabbing; }
.wf-list.is-sorting { user-select: none; -webkit-user-select: none; }

.wf-drop {
  position: absolute; left: 0; right: 0; z-index: 1;
  height: 4px; margin-top: -2px;
  border-radius: var(--r-xs); background: var(--ink);
  pointer-events: none;
}
/* The step would stay where it is: the line is there, but quiet. */
.wf-drop.is-same { background: var(--field-line); }

/* ---------- Save ---------- */

.wf-save {
  position: sticky; bottom: 0; z-index: var(--z-sticky);
  display: grid; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow-lift);
}
.wf-save__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); }
.wf-save__hint {
  display: inline-flex; align-items: center; gap: var(--s2);
  color: var(--warning-ink); font-size: var(--fs-sm); font-weight: 600; line-height: var(--lh-snug);
}

/* ---------- motion, contrast, print ---------- */

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

@media (forced-colors: active) {
  .wf-drop { background: Highlight; }
  .wf-step.is-moved { outline: 2px solid Highlight; outline-offset: -2px; }
}

@media print {
  .wf-save, .wf-step__acts, .wf-step__grip, .wf-steps__foot { display: none !important; }
}
