/*
[INPUT]: Markup from demos/trail.js (classes ux-*), inside the Open Index sheet in portfolio.html.
[OUTPUT]: One kit for all seven demos: four text sizes (13 / 15 / 17 / 20), ink and one accent, a status is
          always a word, one frame. Container queries, so a demo fits its column (784 px sheet, 390 px phone).
[POS]: Styles for the Portfolio demos only; the rows keep their own oi-* styles in portfolio.html.
[PROTOCOL]: When this file's logic changes, update this header.
*/
.ux {
  --ux-ink: #1f1f1f; --ux-muted: #5e5e5e; --ux-line: #e3e3e3; --ux-edge: #c7c7c7; --ux-wash: #f6f6f4;
  --ux-accent: #c2410c; --ux-paper: #fff; --ux-faint: #8a8a8a;
  --ux-ok: #1e6b40; --ux-ok-wash: #eef5f0; --ux-warn: #8a5300; --ux-warn-wash: #fbf4e6; --ux-stop: #a4262c; --ux-stop-wash: #fbefef;
  container-type: inline-size;
  font-family: Roboto, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--ux-ink); text-align: start; list-style: none;
  border: 1px solid var(--ux-line); background: var(--ux-paper);
}
.ux *, .ux *::before, .ux *::after { box-sizing: border-box; }
.ux :where(h4, h5, p, ol, ul, dl, dd, figure, table) { margin: 0; }
.ux :where(ol, ul) { padding: 0; list-style: none; }
.ux button, .ux input, .ux select { font: inherit; color: inherit; }
.ux :focus-visible { outline: 2px solid var(--ux-accent); outline-offset: 2px; }
.ux .num { font-variant-numeric: tabular-nums lining-nums; }
.ux .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Frame head: what this is, the technical layer, reset. The limit sentence lives once, in the sheet. */
.ux-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--ux-line); font-size: 13px; color: var(--ux-muted); }
.ux-head strong { color: var(--ux-ink); font-weight: 500; }
.ux-head .ux-tools { display: flex; gap: 4px; align-items: center; }
.ux-link { all: unset; cursor: pointer; font-size: 13px; color: var(--ux-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; padding: 6px 8px; border-radius: 2px; }
.ux-link:hover { text-decoration-color: var(--ux-accent); }
.ux-link:focus-visible { outline: 2px solid var(--ux-accent); outline-offset: 0; }
.ux-switch { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ux-ink); padding: 6px 8px; border-radius: 2px; }
.ux-switch i { width: 26px; height: 16px; border-radius: 8px; background: var(--ux-edge); position: relative; transition: background .15s ease; }
.ux-switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--ux-paper); transition: transform .15s ease; }
.ux-switch[aria-pressed="true"] i { background: var(--ux-ink); }
.ux-switch[aria-pressed="true"] i::after { transform: translateX(10px); }
.ux-switch:focus-visible { outline: 2px solid var(--ux-accent); }
.ux-body { padding: 20px; }

/* Step text */
.ux-title { font-size: 17px; line-height: 1.35; font-weight: 500; text-wrap: balance; }
.ux-title:focus { outline: none; }
.ux-lead { margin-top: 4px; color: var(--ux-muted); text-wrap: pretty; max-width: 62ch; }
.ux-tech { display: none; margin-top: 10px; padding: 8px 12px; border-left: 2px solid var(--ux-edge); font-size: 13px; color: var(--ux-muted); max-width: 66ch; }
.ux-tech b { font-weight: 500; color: var(--ux-ink); }
.ux.show-tech .ux-tech { display: block; }
.ux-stack > * + * { margin-top: 16px; }
.ux-status { font-size: 13px; color: var(--ux-muted); }
.ux-status:empty { display: none; }
.ux-status.is-warn { color: var(--ux-warn); }

/* Choices: one card grammar for every single-pick decision */
.ux-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.ux-choices.cols-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.ux-choice { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-height: 52px; padding: 11px 14px; border: 1px solid var(--ux-edge); background: var(--ux-paper); border-radius: 2px; }
.ux-choice b { font-weight: 500; font-size: 15px; line-height: 1.35; }
.ux-choice span { font-size: 13px; color: var(--ux-muted); line-height: 1.4; }
.ux-choice:hover { border-color: var(--ux-ink); }
.ux-choice[aria-pressed="true"] { border-color: var(--ux-ink); box-shadow: inset 0 0 0 1px var(--ux-ink); background: var(--ux-wash); }
.ux-choice[aria-pressed="true"] b::after { content: "\00a0✓"; }  /* no-break space: the tick stays with the last word */
.ux-choice:disabled { cursor: not-allowed; opacity: .45; }
.ux-choice:focus-visible { outline: 2px solid var(--ux-accent); outline-offset: 2px; }
.ux-legend { font-size: 13px; color: var(--ux-muted); margin-bottom: 6px; }
.ux-badge { align-self: flex-start; font-style: normal; font-size: 13px; line-height: 1.4; padding: 0 6px; margin-bottom: 4px; border: 1px solid var(--ux-ink); border-radius: 2px; }
/* Multi-select: a box before the label instead of a tick after it */
.ux-choices.is-multi .ux-choice b::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 1px solid var(--ux-ink); border-radius: 2px; background: var(--ux-paper); }
.ux-choices.is-multi .ux-choice[aria-pressed="true"] b::before { background: var(--ux-ink); box-shadow: inset 0 0 0 3px var(--ux-paper); }
.ux-choices.is-multi .ux-choice[aria-pressed="true"] b::after { content: none; }
/* Rows: a label beside longer text (an answer's bottom line, source and evidence) */
.ux-rows > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 4px 16px; padding: 9px 0; border-top: 1px solid var(--ux-line); }
.ux-rows > div:last-child { border-bottom: 1px solid var(--ux-line); }
.ux-rows dt { font-size: 13px; color: var(--ux-muted); padding-top: 2px; }

/* Facts: label over value */
.ux-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; }
.ux-facts dt { font-size: 13px; color: var(--ux-muted); }
.ux-facts dd { font-weight: 500; }
.ux-facts dd.stop { color: var(--ux-stop); }

/* Checks and statuses: a word always carries the state; the dot only repeats it */
.ux-checks-title { font-size: 13px; color: var(--ux-muted); margin-bottom: 6px; }
.ux-checks li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--ux-line); }
.ux-checks li:last-child { border-bottom: 1px solid var(--ux-line); }
.ux-checks.numbered { counter-reset: c; }
.ux-checks.numbered li { grid-template-columns: 24px minmax(0, 1fr) auto; }
.ux-checks.numbered li::before { counter-increment: c; content: counter(c); font-size: 13px; color: var(--ux-muted); }
.ux-checks .meta { font-size: 13px; color: var(--ux-muted); margin-left: 6px; }
.ux-tag { font-size: 13px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.ux-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ux-edge); }
.ux-tag.ok { color: var(--ux-ok); } .ux-tag.ok::before { background: var(--ux-ok); }
.ux-tag.warn { color: var(--ux-warn); } .ux-tag.warn::before { background: var(--ux-warn); }
.ux-tag.stop { color: var(--ux-stop); } .ux-tag.stop::before { background: var(--ux-stop); }
.ux-tag.wait { color: var(--ux-muted); }
.ux-checks li.caution > span:first-child { color: var(--ux-warn); }

/* Pipeline: what happens after the visitor's part */
.ux-pipeline { counter-reset: p; }
.ux-pipeline li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 0 0 14px; }
.ux-pipeline li::before { counter-increment: p; content: counter(p); width: 22px; height: 22px; border: 1px solid var(--ux-ink); border-radius: 50%; font-size: 13px; line-height: 20px; text-align: center; }
.ux-pipeline li:not(:last-child)::after { content: ""; position: absolute; left: 11px; top: 24px; bottom: 2px; width: 1px; background: var(--ux-edge); }
.ux-pipeline .meta { font-size: 13px; color: var(--ux-muted); white-space: nowrap; }

/* Notes: tone + a title word, never colour alone */
.ux-note { padding: 10px 14px; border-left: 3px solid var(--ux-ink); background: var(--ux-wash); }
.ux-note b { display: block; font-weight: 500; }
.ux-note.ok { border-color: var(--ux-ok); background: var(--ux-ok-wash); } .ux-note.ok b { color: var(--ux-ok); }
.ux-note.warn { border-color: var(--ux-warn); background: var(--ux-warn-wash); } .ux-note.warn b { color: var(--ux-warn); }
.ux-note.stop { border-color: var(--ux-stop); background: var(--ux-stop-wash); } .ux-note.stop b { color: var(--ux-stop); }

.ux-quote { margin: 0; padding-left: 14px; border-left: 1px solid var(--ux-edge); }
.ux-quote p::before { content: "“"; } .ux-quote p::after { content: "”"; }
.ux-quote figcaption { font-size: 13px; color: var(--ux-muted); margin-top: 2px; }
.ux-text.muted { color: var(--ux-muted); }
.ux-text.small { font-size: 13px; }
.ux-value { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ux-value b { font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums lining-nums; }
.ux-value span { font-size: 13px; color: var(--ux-muted); }

/* Tables */
.ux-table-wrap { overflow-x: auto; }
.ux-table caption { text-align: left; font-size: 13px; color: var(--ux-muted); padding-bottom: 4px; }
.ux-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.ux-table th { font-weight: 400; font-size: 13px; color: var(--ux-muted); text-align: left; padding: 6px 12px 6px 0; border-bottom: 1px solid var(--ux-ink); }
.ux-table td { padding: 7px 12px 7px 0; border-bottom: 1px solid var(--ux-line); vertical-align: baseline; }
.ux-table .r { text-align: right; padding-right: 0; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }

/* Forms */
.ux-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 16px; }
.ux-field label { display: block; font-size: 13px; color: var(--ux-muted); margin-bottom: 4px; }
.ux-field input, .ux-field select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--ux-edge); border-radius: 2px; background: var(--ux-paper); font-size: 15px; font-variant-numeric: tabular-nums; }
.ux-field input:hover, .ux-field select:hover { border-color: var(--ux-ink); }
.ux-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; align-self: end; }
.ux-check input { width: 24px; height: 24px; accent-color: var(--ux-ink); margin: 0; }

/* Disclosure */
.ux-more > summary { cursor: pointer; list-style: none; display: inline-flex; gap: 8px; align-items: center; min-height: 32px; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.ux-more > summary::-webkit-details-marker { display: none; }
.ux-more > summary::after { content: "+"; text-decoration: none; display: inline-block; width: 1ch; }
.ux-more[open] > summary::after { content: "−"; }
.ux-more > summary:hover { text-decoration-color: var(--ux-accent); }
.ux-more > .ux-stack { margin-top: 10px; }

/* Documents the product produces */
.ux-doc { border: 1px solid var(--ux-ink); padding: 16px 18px; }
.ux-doc-meta { font-size: 13px; color: var(--ux-muted); }
.ux-doc-title { font-size: 17px; font-weight: 500; margin-top: 2px; }
.ux-record pre { margin: 8px 0 0; padding: 12px; background: var(--ux-wash); font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; max-height: 280px; overflow: auto; }

/* Buttons: verbs; one primary per moment */
.ux-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ux-btn { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--ux-edge); border-radius: 2px; background: var(--ux-paper); font-size: 15px; font-weight: 500; }
.ux-btn:hover { border-color: var(--ux-ink); }
.ux-btn.primary { background: var(--ux-ink); border-color: var(--ux-ink); color: var(--ux-paper); }
.ux-btn.primary:hover { background: var(--ux-ink); }
.ux-btn:disabled { cursor: default; color: var(--ux-muted); background: var(--ux-wash); border-color: var(--ux-line); }
.ux-btn:focus-visible { outline: 2px solid var(--ux-accent); outline-offset: 2px; }

/* Pallet patterns (05): the solver's output drawn to scale-ish, one cell per case */
.ux-pallets { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.ux-pallet { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--ux-edge); border-radius: 2px; background: var(--ux-paper); }
.ux-pallet:hover { border-color: var(--ux-ink); }
.ux-pallet[aria-pressed="true"] { border-color: var(--ux-ink); box-shadow: inset 0 0 0 1px var(--ux-ink); background: var(--ux-wash); }
.ux-pallet:disabled { cursor: not-allowed; opacity: .5; }
.ux-pallet b { font-weight: 500; }
.ux-pallet b::after { content: ""; }
.ux-pallet[aria-pressed="true"] b::after { content: "\00a0✓"; }
.ux-pal-svg { display: block; width: 100%; height: auto; }
.ux-pal-svg .pal { fill: var(--ux-paper); stroke: var(--ux-ink); stroke-width: 6; stroke-dasharray: 24 12; }
.ux-pal-svg .case { fill: var(--ux-wash); stroke: var(--ux-ink); stroke-width: 5; }
.ux-pallet[aria-pressed="true"] .case { fill: var(--ux-paper); }
.ux-pal-empty { display: grid; place-items: center; aspect-ratio: 3 / 2; border: 1px dashed var(--ux-edge); font-size: 13px; color: var(--ux-muted); }
.ux-pallet .stats { font-size: 13px; color: var(--ux-muted); }
.ux-pallet .stats .num { color: var(--ux-ink); }

/* ---------- Direction 2 · Decision trail ---------- */
.ux-trail { padding: 20px 20px 8px; }
.ux-trail > li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; padding-bottom: 18px; }
.ux-trail > li:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 26px; bottom: 2px; width: 1px; background: var(--ux-edge); }
.ux-trail .n { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--ux-edge); background: var(--ux-paper); font-size: 13px; line-height: 24px; text-align: center; color: var(--ux-muted); position: relative; }
.ux-trail [data-state="done"] .n { border-color: var(--ux-ink); color: var(--ux-ink); }
.ux-trail [data-state="current"] .n { background: var(--ux-ink); border-color: var(--ux-ink); color: var(--ux-paper); }
.ux-trail .label { font-size: 13px; color: var(--ux-muted); line-height: 26px; }
.ux-trail [data-state="todo"] .label { color: var(--ux-faint); }
.ux-trail [data-state="skipped"] .n { border-style: dashed; color: var(--ux-faint); }
.ux-trail [data-state="skipped"] .label, .ux-trail .recap .skip { color: var(--ux-faint); }
.ux-trail .recap { display: flex; gap: 4px 12px; align-items: baseline; flex-wrap: wrap; }
.ux-trail .recap p { font-size: 15px; }
.ux-trail [data-state="current"] > .main > .ux-stack { margin-top: 2px; }
.ux-trail .done-all { padding: 0 20px 18px 62px; }

@container (max-width: 480px) {
  .ux-body, .ux-trail { padding-left: 14px; padding-right: 14px; }
  .ux-foot { padding-left: 14px; padding-right: 14px; }
  .ux-trail > li { grid-template-columns: 26px minmax(0, 1fr); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { .ux-switch i, .ux-switch i::after { transition: none; } }
