/* Flow Lab (one-request-end-to-end post): token-driven only. Every colour is a site token and every size is rem/em or
   a --text-* / --space-* token, so light and dark themes follow the tokens. Loaded by the post itself, not site-wide.
   Ownership is never colour alone: You ◆ solid, Provider ▲ dashed, Model ● double, always with the word. */
.flow-lab {
  /* Minimum touch target: 44 CSS px at the default root size (WCAG 2.5.5). */
  --flow-lab-target: 2.75rem;
  --k: var(--color-text-muted);
  margin: var(--space-lg) 0;
  padding: var(--space-md);
  border: thin solid var(--color-border);
  border-radius: 0.5em;
  background: var(--color-bg-alt);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.45;
  max-width: 100%;
  min-width: 0;
}
.flow-lab[hidden], .flow-lab [hidden] { display: none; }
.flow-lab ol, .flow-lab ul { list-style: none; margin: 0; padding: 0; }
.flow-lab li { margin: 0; }
.flow-lab li::marker { content: none; }
.flow-lab p { margin: 0; }
.flow-lab__sr { position: absolute; width: 0.0625rem; height: 0.0625rem; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Owners: a glyph, a word and a border style each, so colour is never the only signal.
   You: solid ◆ · Provider: dashed ▲ · Model: double ● */
.flow-lab__owner--you { --k: var(--color-accent); --b: solid; }
.flow-lab__owner--provider { --k: var(--color-pop-gold-text); --b: dashed; }
.flow-lab__owner--model { --k: var(--color-pop-violet-text); --b: double; }
.flow-lab__owner {
  display: inline-block; padding: 0 0.4em; border: 0.15em var(--b) var(--k); border-radius: 0.3em;
  font-weight: 600; white-space: normal;
}
.flow-lab__glyph { color: var(--k); }

/* Buttons */
.flow-lab__btn {
  font: inherit; font-size: var(--text-ui); font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border: thin solid var(--color-border); border-radius: 0.4em;
  background: var(--color-bg); color: var(--color-text); cursor: pointer;
  min-height: var(--flow-lab-target); min-width: var(--flow-lab-target);
}
.flow-lab__btn:hover:not(:disabled) { border-color: var(--color-accent); }
.flow-lab__btn:disabled { opacity: 0.45; cursor: default; }
.flow-lab__btn--primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-bg); }
.flow-lab__btn--primary:hover:not(:disabled) { background: var(--color-accent-hover); }
.flow-lab__btn:focus-visible, .flow-lab summary:focus-visible, .flow-lab a:focus-visible { outline: 0.2em solid var(--color-accent); outline-offset: 0.1em; }

/* Head: preset switch and its unit note */
.flow-lab__presets { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.flow-lab__preset { flex: 1 1 12em; text-align: center; }
.flow-lab__preset[aria-pressed="true"] { border: 0.15em solid var(--color-accent); background: var(--color-bg-accent); }
.flow-lab__preset[aria-pressed="true"]::before { content: "\002713\000020"; color: var(--color-accent); }
.flow-lab__note { margin-top: var(--space-xs); font-size: var(--text-xs); color: var(--color-text-muted); }
.flow-lab__label { color: var(--color-text-muted); font-size: var(--text-xs); }
.flow-lab__count { font-size: var(--text-ui); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }

/* Verdicts: glyph and word */
.flow-lab__verdict { font-weight: 700; white-space: nowrap; }
.flow-lab__verdict.is-right { color: var(--color-accent); }
.flow-lab__verdict.is-wrong { color: var(--color-pop-coral-text); }

/* Caption */
.flow-lab__caption { font-family: var(--font-serif); font-size: var(--text-base); }

/* Meter: one row per part, bar width proportional to its size */
.flow-lab__meter { margin: var(--space-sm) 0 0; padding: var(--space-sm); border: thin solid var(--color-border); border-radius: 0.4em; background: var(--color-bg); }
.flow-lab__meter-title { font-size: var(--text-xs); font-weight: 700; margin-bottom: var(--space-xs); overflow-wrap: anywhere; }
.flow-lab__rows { display: flex; flex-direction: column; gap: var(--space-xs); }
.flow-lab__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--space-sm); font-size: var(--text-xs); }
.flow-lab__row-label { min-width: 0; overflow-wrap: anywhere; }
.flow-lab__row-value { font-variant-numeric: tabular-nums; color: var(--color-text-muted); text-align: right; }
.flow-lab__track { grid-column: 1 / -1; display: block; height: 0.6em; border: thin solid var(--color-border); border-radius: 0.2em; overflow: hidden; }
.flow-lab__fill { display: block; height: 100%; background: var(--color-text-muted); }
.flow-lab__row.is-resent .flow-lab__fill { background: repeating-linear-gradient(135deg, var(--color-text-muted) 0 0.3em, transparent 0.3em 0.6em); }
.flow-lab__tag { margin-left: 0.4em; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 0 0.3em; border: thin dashed var(--color-text-muted); border-radius: 0.3em; color: var(--color-text-muted); }
.flow-lab__meter-foot { margin-top: var(--space-xs); font-size: var(--text-xs); color: var(--color-text-muted); }
.flow-lab__meter-foot.is-empty { margin-top: 0; padding: var(--space-xs) var(--space-sm); border: thin dashed var(--color-border); border-radius: 0.3em; font-style: italic; }

/* Provenance of the tools array */
.flow-lab__prov { margin-top: var(--space-sm); }
.flow-lab__chain { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-top: var(--space-xs); font-size: var(--text-xs); }
.flow-lab__chain li { flex: 1 1 9em; padding: var(--space-xs) var(--space-sm); border: thin solid var(--color-border); border-radius: 0.4em; background: var(--color-bg); position: relative; }
.flow-lab__chain li + li::before { content: "\002192 "; color: var(--color-text-muted); }
.flow-lab__prov-note { margin-top: var(--space-xs); font-size: var(--text-xs); }

/* The model stage, opened */
.flow-lab__inside { margin-top: var(--space-sm); border: thin solid var(--color-border); border-radius: 0.4em; background: var(--color-bg); }
.flow-lab__inside summary { display: flex; align-items: center; min-height: var(--flow-lab-target); padding: 0 var(--space-sm); cursor: pointer; font-weight: 600; list-style: none; }
.flow-lab__inside summary::-webkit-details-marker { display: none; }
.flow-lab__inside summary::before { content: "\0025B8 "; white-space: pre; color: var(--color-text-muted); }
.flow-lab__inside[open] summary::before { content: "\0025BE "; }
.flow-lab__inside p { padding: 0 var(--space-sm) var(--space-sm); font-family: var(--font-serif); }

.flow-lab__chapter { margin-top: var(--space-sm); }
.flow-lab__chapter a { color: var(--color-accent); } /* an inline link in a sentence: exempt from the 44 px target (WCAG 2.5.8) */
.flow-lab__chapter .flow-lab-card__later { font-style: italic; color: var(--color-text-muted); }

/* Scorecard: the answer leads, large, in full ink; the reader's own count sits beside it, smaller and muted, so the big
   number is never mistaken for the reader's score. Each figure carries its own words, so size is never the only signal. */
.flow-lab__score { margin-top: var(--space-md); padding: var(--space-md); border: 0.15em solid var(--color-text); border-radius: 0.5em; background: var(--color-bg); }
.flow-lab__stats { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-xs) var(--space-lg); margin-bottom: var(--space-sm); }
.flow-lab__stat { display: flex; flex-direction: column; }
.flow-lab__stat-num { line-height: 1.1; font-variant-numeric: tabular-nums; }
.flow-lab__stat--truth .flow-lab__stat-label { font-size: var(--text-base); font-weight: 600; }
.flow-lab__stat--truth .flow-lab__stat-num { font-size: var(--text-2xl); }
.flow-lab__stat--yours { padding-left: var(--space-sm); border-left: thin solid var(--color-border); color: var(--color-text-muted); }
.flow-lab__stat--yours .flow-lab__stat-num { font-size: var(--text-lg); color: var(--color-text); }
.flow-lab__score-text { margin-top: var(--space-xs); font-family: var(--font-serif); font-size: var(--text-base); }
.flow-lab__score-sub { margin-top: var(--space-xs); color: var(--color-text-muted); }

.flow-lab__nav, .flow-lab__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-sm); margin-top: var(--space-sm); }

/* ---- The sort board ---- */
.flow-lab__status { margin: var(--space-sm) 0; font-weight: 600; }
.flow-lab__board { display: grid; gap: var(--space-sm); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 46em) { .flow-lab__board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* scroll-margin-top clears the sticky masthead when the trace opens a card: the masthead is 69 px tall at rest at 1280 and
   61 px while scrolled (masthead.css), so 4.5rem (72 px) clears it at every width. */
.flow-lab__card { min-width: 0; padding: var(--space-sm); border: thin solid var(--color-border); border-radius: 0.5em; background: var(--color-bg); scroll-margin-top: 4.5rem; }
.flow-lab__card[aria-current="step"] { grid-column: 1 / -1; border: 0.15em solid var(--color-accent); }
.flow-lab__card-top { display: flex; align-items: baseline; gap: var(--space-xs); margin-bottom: var(--space-xs); }
.flow-lab__num { font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.flow-lab__num::after { content: "."; }
.flow-lab__name { font-weight: 700; }

/* Segmented control: each native radio covers its whole segment, so the radio itself is the full-size target */
.flow-lab__seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xs); }
.flow-lab__opt { position: relative; display: grid; place-items: center; min-height: var(--flow-lab-target); min-width: var(--flow-lab-target); text-align: center; font-size: var(--text-ui); line-height: 1.2; }
.flow-lab__opt input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  border: thin solid var(--color-border); border-radius: 0.4em; background: var(--color-bg-alt);
}
.flow-lab__opt input:hover:not(:disabled) { border-color: var(--k); }
.flow-lab__opt input:checked { border: 0.2em var(--b) var(--k); background: var(--color-bg); }
.flow-lab__opt input:focus-visible { outline: 0.2em solid var(--color-accent); outline-offset: 0.1em; }
.flow-lab__opt input:disabled { cursor: default; }
.flow-lab__opt input:disabled:not(:checked) + .flow-lab__opt-text { opacity: 0.5; }
.flow-lab__opt-text { position: relative; pointer-events: none; padding: var(--space-xs); overflow-wrap: anywhere; }
.flow-lab__opt input:checked + .flow-lab__opt-text { font-weight: 700; }
.flow-lab__opt input:checked + .flow-lab__opt-text::before { content: "\002713\000020"; }

.flow-lab__result { margin-top: var(--space-xs); line-height: 1.9; }
.flow-lab__card.is-wrong { border-style: dashed; }
/* Not answered: plain words in muted ink, no chip and no verdict; the card keeps its plain border. */
.flow-lab__unanswered { color: var(--color-text-muted); font-style: italic; }
/* The answer's exception (the table's "or ..." clause), under the answer so the chip itself matches a button. */
.flow-lab__answer-note { display: block; line-height: 1.45; color: var(--color-text-muted); }
.flow-lab__slot:not(:empty) { margin-top: var(--space-sm); padding-top: var(--space-sm); border-top: thin solid var(--color-border); }
.flow-lab__slot .flow-lab__nav { justify-content: space-between; }

/* The printable card (the JS-off table, rendered by src/_includes/lifecycle-stages.njk). The site wraps every table in a
   sideways-scrolling box on narrow screens, so the card's one-line description sits outside the table as a lead paragraph
   and the caption is kept for assistive technology only. */
.flow-lab-card__lead { margin: 0 0 var(--space-xs); font-family: var(--font-sans); font-size: var(--text-sm); color: var(--color-text-muted); }
.flow-lab-card__caption { position: absolute; width: 0.0625rem; height: 0.0625rem; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.flow-lab-card__later { color: var(--color-text-muted); font-style: italic; }
