/* Page explainers for the STAR story generator article: the request pipeline
   figure and the parser lab. Built on the v3 tokens and the kit aliases in
   /css/explainers.css. */

/* ---------- request pipeline ---------- */
.pipe { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.pipe ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: p; }
.pipe li { counter-increment: p; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; }
.pipe li::before { content: counter(p); font: 500 12px/24px var(--font-mono); width: 24px; height: 24px; text-align: center;
  border: 1px solid var(--line-strong); border-radius: 50%; color: var(--muted); }
.pipe b { display: block; font-size: 15px; color: var(--ink); font-weight: 600; }
.pipe code { font: 500 12.5px var(--font-mono); color: var(--ink); }
.pipe span { display: block; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.pipe .pipe__fn { display: inline-block; margin-top: 4px; font: 500 11.5px/1.4 var(--font-mono); color: var(--accent); background: var(--accent-tint); padding: 1px 6px; border-radius: 4px; }
@container (min-width: 640px) {
  .pipe ol { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
}

/* ---------- parser lab ---------- */
.pl { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.pl__bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); font: 500 12px/1.3 var(--font-mono); color: var(--muted); }
.pl__bar a { color: var(--ink-2); }
.pl__grid { display: grid; gap: 22px; padding: 20px 18px 22px; }
@container (min-width: 720px) { .pl__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 30px; padding: 24px 26px 26px; } }
.pl__grid > div { min-width: 0; }
.pl__label { font-size: 13px; color: var(--muted); margin: 14px 0 8px; }
.pl__label:first-child { margin-top: 0; }
.pl .chips { margin-bottom: 4px; }
.pl textarea { width: 100%; min-height: 15em; resize: vertical; box-sizing: border-box; margin: 0; padding: 12px 14px;
  background: var(--night); color: var(--bone); border: 1px solid var(--night-line); border-radius: 12px;
  font: 400 12.5px/1.6 var(--font-mono); white-space: pre; overflow: auto; }
.pl textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pl__note { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.psteps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.psteps li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); transition: border-color .25s var(--ease), opacity .25s var(--ease); }
.psteps b { font-size: 14.5px; color: var(--ink); font-weight: 600; }
.ps__state { font: 500 11px/20px var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ps__msg { grid-column: 1 / -1; font: 400 12.5px/1.5 var(--font-mono); color: var(--ink-2); overflow-wrap: anywhere; }
.ps__msg:empty { display: none; }
.psteps li[data-state="pass"] { border-color: color-mix(in srgb, var(--pass-ink) 45%, var(--line)); }
.psteps li[data-state="pass"] .ps__state { color: var(--pass-ink); }
.psteps li[data-state="pass"] .ps__state::after { content: "used"; }
.psteps li[data-state="skip"] .ps__state::after { content: "no change"; }
.psteps li[data-state="off"] { opacity: .5; }
.psteps li[data-state="off"] .ps__state::after { content: "skipped"; }
.psteps li[data-state="warn"] { border-color: color-mix(in srgb, var(--differs) 50%, var(--line)); }
.psteps li[data-state="warn"] .ps__state { color: var(--differs); }
.psteps li[data-state="warn"] .ps__state::after { content: "filtered"; }
.psteps li[data-state="fail"] { border-color: color-mix(in srgb, #b0344f 45%, var(--line)); }
.psteps li[data-state="fail"] .ps__state { color: #b0344f; }
[data-theme="dark"] .psteps li[data-state="fail"] .ps__state { color: var(--rose); }
.psteps li[data-state="fail"] .ps__state::after { content: "failed"; }
.pl__status { margin: 14px 0 8px; font: 600 13px/1.4 var(--font-mono); color: var(--ink); }
.pl__status[data-ok="yes"] { color: var(--pass-ink); }
.pl__status[data-ok="no"] { color: #b0344f; }
[data-theme="dark"] .pl__status[data-ok="no"] { color: var(--rose); }
.pl__out { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg); max-height: 22em; overflow: auto; }
.pl__out p, .pl__out li { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); margin: 0 0 6px; overflow-wrap: anywhere; }
.pl__out ul { margin: 0 0 6px; padding-left: 1.2em; }
.pl__out b { color: var(--ink); font-weight: 600; margin-right: 4px; }
.pl__story + .pl__story { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 6px; }
.pl__n { font: 500 11px var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pl__err { font-family: var(--font-mono); font-size: 12.5px; color: #b0344f; }
[data-theme="dark"] .pl__err { color: var(--rose); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .psteps li[data-state="fail"] .ps__state,
  :root:not([data-theme="light"]) .pl__status[data-ok="no"],
  :root:not([data-theme="light"]) .pl__err { color: var(--rose); }
}

/* Static fallback table, shown until the script takes over. */
.pl__static { padding: 0 18px 20px; }
.pl.is-live .pl__static { display: none; }
.pl__static table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pl__static th, .pl__static td { text-align: left; vertical-align: top; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.pl__static th { color: var(--ink); font-weight: 600; }
.pl:not(.is-live) .pl__grid { display: none; }

/* Tool ranking table */
.rank { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.rank th, .rank td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--color-line); color: var(--color-text-muted); }
.rank th { color: var(--color-text); font-weight: 600; border-bottom-color: var(--color-line-strong); }
.rank td:first-child { font: 500 13px var(--font-mono); color: var(--color-text-faint); white-space: nowrap; }
.rank td b { color: var(--color-text); font-weight: 600; }
.table-scroll { overflow-x: auto; }
@media (max-width: 560px) { .rank thead { display: none; } .rank tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--color-line); } .rank td { display: block; border: 0; padding: 2px 0; } }
.pl > figcaption { padding: 0 18px 16px; margin-top: 0; }
/* Long prompt lines wrap with a hanging indent instead of scrolling sideways. */
.code--wrap .ln { white-space: pre-wrap; overflow-wrap: anywhere; padding-left: 3.2em; text-indent: -3.2em; }
.code--wrap .ln::before { text-indent: 0; }

/* ---------- quality pass, October 2026 ---------- */
/* A code chip inside a link: the underline stays on the words, the chip takes the link color. */
.article-body a > code { display: inline-block; color: var(--color-accent); }
/* Links on the dark code bar keep their contrast on hover. */
.article-body .code .bar a:hover { color: var(--bone); }
/* Screenshots open full size, which matters most on a phone. */
.fig__open { display: block; border-radius: 12px; cursor: zoom-in; }
.fig__open:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* Native selects in the labs, drawn to match the chips and inputs. */
.article-body figure select { -webkit-appearance: none; appearance: none; min-height: 40px; padding: 8px 34px 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background-color: var(--bg); color: var(--ink); cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; transition: border-color .2s var(--ease); }
.article-body figure select:hover { border-color: var(--ink-2); }
.article-body figure select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.article-body figure input[type="checkbox"] { accent-color: var(--accent); }
.article-body figure input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Phones: 44px targets, and figure bars stack instead of squeezing the source link into a narrow column. */
@media (max-width: 640px) {
  .article-body .chips button, .article-body .cmp__tabs button, .article-body .pvl__switch button { min-height: 44px; }
  .article-body figure select, .article-body figure input[type="text"] { min-height: 44px; }
  .article-body .code .bar, .article-body .lab__bar { flex-direction: column; align-items: flex-start; gap: 4px; }
}
/* Parser lab: the reply wraps instead of hiding its ends, fills the column beside the steps,
   and the parsed stories show in full instead of cutting off mid-line. */
.pl textarea { white-space: pre-wrap; overflow-wrap: anywhere; }
@container (min-width: 720px) { .pl textarea { min-height: 30em; } }
.pl__out { max-height: none; }
/* A skipped step reads as skipped without fading its text below contrast. */
.psteps li[data-state="off"] { opacity: 1; border-style: dashed; background: transparent; }
.psteps li[data-state="off"] b, .psteps li[data-state="off"] .ps__msg { color: var(--muted); }
/* Pass 2: the one-line takeaway under the HTTP status */
.pl__takeaway { margin: 0 0 10px; font-size: 15px; line-height: 1.5; color: var(--ink); }
.pl__takeaway:empty { display: none; }
