.so-lesson h2 { margin: 0 0 14px; font: 600 var(--text-lg) / 1.3 var(--sans); }
.so-lesson h3 { margin: 0 0 10px; font: 600 var(--text-body) / 1.3 var(--sans); }
/* A sentence over a figure runs the figure's width: cut short, its second line reads as an indent. */
.so-lesson p { margin: 0 0 14px; }
.so-lesson pre { margin: 0; overflow-x: auto; font: var(--text-xs) / 1.65 var(--mono); }
.so-lesson code { font-family: var(--mono); }
/* Code in the page's running text, its notes and the run's result, set as in every lesson's (DESIGN.md, Typography). */
.so-section > p code {
  font: 400 var(--text-xs) / 1 var(--mono);
  color: var(--ink);
  padding: 1px 4px; border-radius: calc(var(--radius-sm) / 2); background: var(--stage);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.so-lesson p code { white-space: nowrap; }
/* As a lead-in heading: the line beside the title wraps under it where the two do not fit on one line. */
.so-intro-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 14px; }
.so-intro-heading h2 { flex: none; margin: 0; }
.so-lesson .so-subtitle { margin: 0; color: var(--muted); font-size: var(--text-sm); }
/* The request and the answer it brings back, side by side where the section has room for both: the answer's lines
   whole, the request's whole or wrapped under their own start. Narrower, the answer stands under the request, the
   arrow pointing down. */
.so-intro { container: so-schema / inline-size; }
.so-contract {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 24px minmax(max-content, 1fr);
  align-items: center;
  gap: 20px;
  margin: 20px 0;
}
@container so-schema (max-width: 720px) {
  .so-contract { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .so-contract > .so-arrow { justify-self: center; transform: rotate(90deg); }
}
/* The request is a card as the response beside it is: its name inside, the code on the card. */
.so-request-source { min-width: 0; padding: 16px 20px; border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--raise); outline: 1px solid transparent; }
.so-lesson .so-request-source > h3 { margin: 0 0 10px; }
.so-lesson .so-request-context { padding: 0; color: var(--muted); line-height: 1.3; }
.so-request-context .syntax-key, .so-request-context .syntax-string,
.so-request-context .syntax-number, .so-request-context .syntax-literal { color: inherit; }
/* The schema lines are lit by a rounded band inside the card's padding. */
.so-lesson .so-request-focus {
  margin: 8px -10px;
  padding: 10px;
  border-radius: 8px;
  background: var(--accent-pale);
  font-size: var(--text-sm);
  line-height: 1.4;
}
.so-example { min-width: 0; padding: 16px 20px; border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--raise); outline: 1px solid transparent; }
.so-example > span { display: block; color: var(--muted); font-size: var(--text-xs); }
.so-example pre { margin-top: 16px; }
/* A note under a figure is plain muted text. */
.so-lesson .so-note { margin: 14px 0; color: var(--muted); font-size: var(--text-sm); }
/* The same request under three settings: an answer each, and what holds of it. Three equal cards. */
.so-formats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 20px 0 14px; }
.so-format {
  display: grid; grid-template-rows: auto auto 1fr auto; min-width: 0; padding: 16px 20px;
  border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--raise); outline: 1px solid transparent;
}
.so-lesson .so-format h3 { margin: 0 0 2px; font-size: var(--text-sm); }
.so-format-setting { color: var(--muted); font-size: var(--text-xs); overflow-wrap: anywhere; }
.so-lesson .so-format pre { margin: 14px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.so-format ul { display: grid; gap: 6px; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line); list-style: none; }
.so-format li { display: flex; align-items: center; gap: 8px; font: 400 var(--text-sm) / 1.3 var(--sans); }
.so-format li svg { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.so-format li.is-met svg { color: var(--ok); }
.so-format li.is-unmet { color: var(--muted); }
.so-format li.is-unmet svg { color: var(--danger); }
@media (max-width: 760px) { .so-formats { grid-template-columns: minmax(0, 1fr); } }
/* The two ways side by side. The words under the model's part hang below the picture, so both leave room for them. */
.so-ways .sf-map { margin-bottom: 28px; }
.so-section { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--line); }
.so-lesson .so-footnote { color: var(--muted); font-size: var(--text-sm); }
/* Clipped to its corners without scrolling, so its caption and transport can stand held at the screen's foot. */
.so-figure {
  margin: 24px 0 14px; overflow: clip; border-radius: var(--radius-card); background: var(--surface);
  box-shadow: var(--raise); outline: 1px solid transparent; container-type: inline-size;
}
/* The stage's title stands in a band over the scene, as a window's title bar does. */
.so-head { padding: 14px 20px; background: var(--band); border-bottom: 1px solid var(--line); }
.so-lesson .so-head h3 { margin: 0; font: 600 var(--text-body) / 1.35 var(--sans); letter-spacing: -0.01em; }
.so-animation { position: relative; padding: 20px; }
.so-provider-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.so-provider-head h3 { margin: 0; }
.so-schema-map { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); }
.so-schema-label { color: var(--muted); }
.so-field {
  display: grid;
  gap: 4px;
  min-width: 100px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--sunken);
}
.so-field.is-current { background: var(--accent-pale); }
.so-field > code { font-size: var(--text-xs); }
.so-type { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.so-type b { font: 600 var(--text-xs) / 1.2 var(--sans); color: var(--accent-ink); }
.so-pipeline {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr 24px 1fr 24px 1fr;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--sunken);
}
.so-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  transition: background-color 220ms ease-out, color 220ms ease-out;
}
.so-stage.is-active { color: var(--accent-ink); }
/* The mark of the current step has no outline. It moves as a stretch: the edge it is heading with goes first, and
   the other edge catches up and settles, so the eye is led to the next step before the mark has left the last. */
.so-stage-indicator {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: var(--radius-sm);
  background: var(--accent-pale);
  pointer-events: none;
  transition: right 260ms cubic-bezier(.2,.8,.2,1), left 460ms cubic-bezier(.3,1.35,.5,1) 110ms;
}
.so-stage-indicator[data-heading="back"] {
  transition: left 260ms cubic-bezier(.2,.8,.2,1), right 460ms cubic-bezier(.3,1.35,.5,1) 110ms;
}
.so-pipeline > .so-arrow { position: relative; z-index: 1; }
.so-arrow { display: block; color: var(--wire); }
.so-arrow svg { display: block; width: 24px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.so-generated { margin: 24px 0; }
.so-generated > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: var(--text-sm); }
.so-generated pre {
  overflow: visible;
  min-height: 56px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--sunken);
  font-size: var(--text-sm);
  line-height: 1.55;
}
.so-generated pre code { display: flex; align-items: center; width: max-content; min-height: 1.55em; }
.so-generated-text { display: inline-block; flex: none; min-width: 0; white-space: pre; }
.so-generated-text.is-typing { overflow: hidden; }
/* On a phone the answer's box keeps less room at its sides, so the whole answer stands in it on one line at 390px.
   Narrower, as at 375 and 360, it breaks after the comma between its fields (`{"title":"Travel report",` /
   `"total":125}`), and the box keeps room for both lines from the first frame, so nothing under it moves (R8-03): the
   text flows inline, the caret after its last letter, taking no room of the line. Typing, the text is one line. */
@media (max-width: 400px) { .so-generated pre { padding-inline: 12px; } }
@media (max-width: 387px) {
  .so-generated pre { min-height: calc(2 * 1.55em + 32px); }
  .so-generated pre code { display: block; width: auto; }
  .so-generated-text { display: inline; white-space: pre-wrap; }
  .so-generated-text .so-run { white-space: pre; }
  .so-generated-text.is-typing { display: inline-block; white-space: pre; vertical-align: bottom; }
  .so-generated .so-caret { display: inline-block; margin-right: -3px; vertical-align: text-bottom; }
}
@media (max-width: 380px) { .so-spot > .sf-part { padding-inline: 4px; } }
.so-fragment { position: relative; z-index: 2; display: inline-block; color: var(--accent-ink); }
[data-output-prefix] { display: inline-block; }
.so-caret {
  display: block;
  flex: none;
  width: 1px;
  height: 1.1em;
  margin-left: 2px;
  background: var(--accent);
  animation: so-caret-blink 1s steps(1, end) infinite;
}
.so-caret[hidden] { display: none; animation: none; }
.so-outside .so-caret, .so-document-hidden .so-caret { animation: none; }
@keyframes so-caret-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.so-candidate-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: var(--text-sm);
}
.so-candidate-head small { font-size: var(--text-xs); }
.so-candidate-row { display: grid; grid-template-columns: minmax(0, 1fr) 24px; align-items: center; gap: 14px; }
.so-candidates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.so-more { color: var(--muted); font: var(--text-xl) / 1 var(--sans); text-align: center; }
.so-candidate {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 180px;
  padding: 14px;
  border-radius: var(--radius);
  --choice-fill: var(--surface);
  --choice-ink: var(--muted);
  background: var(--sunken);
}
.so-token-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.so-token-status {
  display: grid;
  place-items: center;
  min-width: 8ch;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--choice-fill);
  color: var(--choice-ink);
  text-align: center;
  transition: background-color 240ms ease-out, color 240ms ease-out;
}
.so-token-box {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--choice-fill);
  color: var(--choice-ink);
  flex: none;
  transition: background-color 240ms ease-out, color 240ms ease-out;
}
.so-token-box svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.so-token-box code { font-size: var(--text-body); line-height: 1; color: inherit; }
.so-candidate strong { font: 600 var(--text-sm) / 1.2 var(--sans); }
.so-candidate.is-selected [data-output-token] { font-weight: 600; }
.so-probability { position: relative; min-height: 30px; }
.so-model-probability, .so-candidate .so-new-probability {
  position: absolute;
  bottom: 0;
  right: 0;
  margin: 0;
  color: var(--ink);
  font: 600 var(--text-lg) / 1.2 var(--mono);
  white-space: nowrap;
}
.so-model-probability { transform-origin: left bottom; text-decoration: none; }
.so-model-probability::after {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 250ms ease-out 350ms;
}
.so-candidate .so-new-probability { opacity: 0; }
.so-candidate.is-filtered .so-model-probability { left: 0; right: auto; transform: scale(.67); color: var(--muted); }
.so-candidate.is-filtered .so-model-probability::after { transform: scaleX(1); }
.so-candidate.is-filtered .so-new-probability { opacity: 1; }
.so-candidate.is-resetting .so-model-probability::after { transform: scaleX(0); transition: none; }
.so-probability-bar { height: 4px; background: var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.so-probability-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
  transition: background-color 220ms ease-out;
}
.so-token-reason { min-height: 2.7em; color: var(--muted); font-size: var(--text-xs); line-height: 1.35; }
.so-candidate.is-valid {
  --choice-fill: var(--ok-pale); --choice-ink: var(--ok);
}
.so-candidate.is-blocked {
  --choice-fill: var(--danger-pale); --choice-ink: var(--danger);
}
.so-candidate.is-selected {
  --choice-fill: var(--accent-pale); --choice-ink: var(--accent-ink);
}
.so-check { min-height: 180px; gap: 10px; }
.so-check > span:last-child { font-size: var(--text-xs); color: var(--ok); }
.so-figure .is-unrevealed { visibility: hidden; }
.so-figure .so-caption-stack {
  min-height: 56px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: var(--text-body);
  line-height: 1.4;
}
.so-caption-stack { display: grid; }
.so-figure .so-caption-stack p { grid-area: 1 / 1; max-width: none; margin: 0; visibility: hidden; }
.so-figure .so-caption-stack p.is-current { visibility: visible; }
.so-figure .so-caption-stack code {
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  background: var(--sunken);
  font: var(--text-xs) / 1.4 var(--mono);
}
.so-figure .so-caption-stack strong { font-weight: 600; }
/* The second figure's stage: the parts of the runtime, and one box that rides the arrows between them as the steps
   go. The box is under the parts, so it comes out of one and goes into the next. */
.so-map-frame { margin-bottom: 20px; overflow-x: auto; }
.so-map { position: relative; margin-inline: auto; }
.so-map > svg { position: absolute; inset: 0; fill: none; stroke: var(--wire); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.so-spot { position: absolute; z-index: 2; display: grid; }
.so-spot > .sf-part { padding-inline: 8px; }
.so-lesson .so-carry { position: absolute; left: 0; top: 0; padding-block: 3px; font-family: var(--sans); opacity: 1; }
/* An error travels in the colour of a refusal. */
.so-lesson .so-carry.is-error { background: var(--danger-pale); color: var(--danger); }
/* Where a line between two parts is shorter than the box, the box travels as a dot in its colour. */
.so-lesson .so-map.is-dot .so-carry {
  width: 12px; height: 12px; padding: 0; border-radius: 50%; overflow: hidden;
  background: var(--accent); color: transparent; font-size: 0; line-height: 0;
}
.so-lesson .so-map.is-dot .so-carry.is-error { background: var(--danger); }
/* What Tools found, in a box of its own under Tools, in the colour of the finding. */
.so-verdict {
  position: absolute; display: flex; align-items: center; gap: 5px; width: max-content;
  padding: 4px 9px; border-radius: var(--radius-sm); transform: translateX(var(--so-verdict-x, -50%));
  font: 400 var(--text-xs) / 1.3 var(--sans); white-space: nowrap; visibility: hidden;
}
.so-verdict.is-no { background: var(--danger-pale); color: var(--danger); visibility: visible; }
.so-verdict.is-yes { background: var(--ok-pale); color: var(--ok); visibility: visible; }
.so-verdict svg { flex: none; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.so-tool-json-flow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.so-tool-json-pane { min-width: 0; }
/* The call is written over a copy of its whole text that no one sees, so its pane has that room from the start. */
.so-lesson .so-tool-json {
  display: grid;
  align-content: start;
  height: 340px;
  padding: 12px 0;
  border-radius: var(--radius);
  background: var(--sunken);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.so-tool-json > code { grid-area: 1 / 1; min-width: 0; }
.so-tool-json > .so-tool-room { visibility: hidden; }
/* The definition's line the call is checked against, over the call where the definition is not beside it. */
.so-lesson .so-tool-against { display: none; }
.so-tool-json-line {
  display: block;
  min-height: 1.45em;
  padding: 0 12px 0 calc(12px + var(--hang-at));
  color: var(--muted);
  white-space: pre-wrap;
  transition: background-color 180ms ease-out, color 180ms ease-out;
}
.so-tool-json-line .syntax-key, .so-tool-json-line .syntax-string,
.so-tool-json-line .syntax-number { color: inherit; }
.so-tool-json-line.is-active { background: var(--accent-pale); color: var(--accent-ink); }
.so-value-invalid, .so-value-correct {
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--danger-pale);
  color: var(--danger);
}
.so-value-correct { background: var(--ok-pale); color: var(--ok); }
.so-tool-pane-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px;
}
.so-tool-pane-heading h3 { margin: 0; }
.so-tool-diff svg { display: block; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.so-tool-diff { display: flex; align-items: center; gap: 5px; font: var(--text-sm) / 1.3 var(--mono); }
.so-tool-diff del { color: var(--danger); }
.so-tool-diff strong { color: var(--ok); font-weight: 600; }
.so-tool-diff svg { width: 18px; color: var(--muted); }
.so-tool-caret {
  display: inline-block; width: 1px; height: 1em; margin-left: 2px; vertical-align: -.15em;
  background: var(--accent); animation: so-caret-blink 1s steps(1, end) infinite;
}
.so-outside .so-tool-caret, .so-document-hidden .so-tool-caret { animation: none; }
.so-conclusion { margin-bottom: 24px; }
/* Example 13's run, a row for each message as a film draws it: its role's chip, then what it says. */
.so-run { max-width: none; margin: 16px 0 12px; }
.so-run li {
  display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: baseline; gap: 10px; padding: 6px;
  border-radius: var(--radius-sm);
}
.so-run code { font: 400 var(--text-xs) / 1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.so-lesson .so-run-result { color: var(--muted); font-size: var(--text-sm); }
.so-lesson .so-run-result code { white-space: normal; overflow-wrap: anywhere; }
.so-instant *, .so-instant *::before, .so-instant *::after { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .so-figure *, .so-figure *::before, .so-figure *::after { transition: none !important; }
  .so-caret, .so-tool-caret { animation: none; }
}
/* The sentence under a section heading reads at the size every lesson's sentences do. */
.so-intro-heading + p { font-size: var(--text-body); line-height: 1.55; }
/* In a narrow figure each candidate is a row: its token and status, then its probability on the same line, with the
   bar and the reason under them; the candidates stand one under another. */
@container (max-width: 600px) {
  .so-animation { padding: 16px; }
  .so-pipeline { grid-template-columns: 1fr 16px 1fr 16px 1fr; gap: 4px; }
  .so-stage { min-height: 52px; padding: 6px; font-size: var(--text-xs); text-align: center; }
  .so-arrow svg { width: 16px; }
  .so-candidate-head { flex-direction: column; gap: 2px; }
  .so-candidate-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .so-more { text-align: left; }
  .so-candidates { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .so-candidate { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; min-height: 0; padding: 10px 12px; }
  /* A check is as tall as the candidate it replaces (its token and probability, the bar and the reason), so the
     last frame moves nothing under the figure, as `min-height: 180px` keeps it on a wider figure. */
  .so-candidate.so-check { grid-template-columns: auto minmax(0, 1fr); align-items: center; min-height: 96px; }
  .so-candidate > .so-probability { width: 120px; min-height: 38px; }
  .so-candidate > .so-probability-bar, .so-candidate > .so-token-reason { grid-column: 1 / -1; }
  .so-token-reason { min-height: 0; }
  .so-check > span:last-child { grid-column: 1 / -1; }
  /* The definition and the call take turns in one place under the map, each as tall as what it holds (R10-01): the
     definition while the request offers it, then the call, with the definition's line it is checked against over it,
     lit while the two are compared. The place keeps the definition's height, the taller, so nothing under it moves from
     step to step, and the map and the call's pane fit the room a held foot leaves at 360x780 together. */
  .so-map-frame { margin-bottom: 12px; }
  .so-tool-json-flow { grid-template-columns: minmax(0, 1fr); }
  .so-tool-json-flow > .so-tool-json-pane { grid-area: 1 / 1; transition: opacity 180ms ease-out, visibility 180ms; }
  .so-tool-json-flow[data-phase="send"] > .so-tool-json-pane:last-child,
  .so-tool-json-flow:not([data-phase="send"]) > .so-tool-json-pane:first-child { visibility: hidden; opacity: 0; }
  .so-tool-pane-heading { min-height: 24px; }
  .so-lesson .so-tool-json { height: auto; padding-block: 8px; font-size: var(--text-xs); }
  .so-lesson .so-tool-against {
    display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin: 2px 0 6px;
    color: var(--muted); font: 400 var(--text-xs) / 1.3 var(--sans);
  }
  .so-tool-against code {
    padding: 2px 6px; border-radius: var(--radius-sm); background: var(--sunken); color: var(--muted);
    font: var(--text-xs) / 1.3 var(--mono); white-space: pre;
    transition: background-color 180ms ease-out, color 180ms ease-out;
  }
  .so-tool-against.is-lit code { background: var(--accent-pale); color: var(--accent-ink); }
  .so-generated pre { font-size: var(--text-xs); }
  .so-token-head { justify-content: flex-start; }
  .so-figure .so-caption-stack { min-height: 0; padding: 14px 16px; font-size: var(--text-sm); }
}
