.lesson-resources {
  container-type: inline-size;
  display: grid;
  gap: 28px;
  margin: 16px 0 32px;
}
.lesson-resources > *, .resource-pair > * { min-width: 0; }
/* A line under a figure is plain muted text, half the resources' gap under the figure it speaks of. */
.resource-note { max-width: var(--measure); margin: -14px 0 0; color: var(--muted); font-size: var(--text-sm); line-height: 1.5; }
.lesson-resources .lesson-diagram { margin: 0; }
.lesson-resources h2 { margin: 0 0 10px; color: var(--ink); font: 600 var(--text-lg) / 1.3 var(--sans); }
/* A resource's figure is still or played as any figure is. Two side by side have one height. */
.lesson-resources .lead-figure { margin-top: 0; }
.resource-pair > section { display: grid; grid-template-rows: auto 1fr; }
/* Its rows keep their own height: the shorter of the two ends early, and never spreads its rows apart. */
.resource-pair .lead-figure { align-content: start; }
.lesson-resources .tw-head h2 { margin: 0; }
.resource-parts {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--raise);
  outline: 1px solid transparent;
}
.resource-part { min-width: 0; padding: 14px 24px; }
/* A plain list of parts in columns: the card holds them, a line parts two. */
.resource-specimen[data-layout="columns"] > .resource-parts { padding: 6px 0; }
.resource-specimen[data-layout="columns"] .resource-part { padding: 12px 22px; }
.resource-part + .resource-part { border-inline-start: 1px solid var(--line); }
.resource-part h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
  color: var(--muted);
  font: 600 var(--text-xs) / 1.4 var(--sans);
}
.resource-part h3 .part-mark { color: var(--fig-model); }
.resource-part p, .resource-terms dl {
  margin: 0;
  color: var(--ink);
  font: 400 var(--text-sm) / 1.45 var(--sans);
}
.resource-terms dl { line-height: 1.55; }
.resource-part p + p { margin-top: 5px; }
.lesson-resources strong, .lesson-heading .lesson-summary strong { font-weight: 600; color: var(--ink); }
/* Code in a resource's words is set as in a lesson's other text: the mono face, a step smaller, in ink, on the
   muted tint, so a lone character in it, as the `-` a report prints, reads as code. */
:is(.resource-terms, .resource-table, .resource-part p, .resource-note, .resource-context > 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;
}
.resource-specimen[data-layout="handoff"] .resource-parts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row;
}
.resource-specimen[data-layout="handoff"] .resource-part:first-child {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.resource-specimen[data-layout="handoff"] .resource-part:nth-child(2) { border-inline-start: 0; }
.resource-part pre {
  margin: 7px 0;
  padding: 0;
  overflow-x: auto;
  color: var(--ink);
  background: transparent;
  border: 0;
  font: 400 var(--text-sm) / 1.55 var(--mono);
}
.resource-part pre code { font: inherit; }
/* On a phone a line of code wraps, between words where it can, so what changes at its end stays in view: a scroll
   there shows no bar until it is moved. */
@media (max-width: 600px) {
  .resource-part pre { white-space: pre-wrap; overflow-wrap: break-word; }
}
.resource-specimen[data-layout="slip"] .resource-parts {
  width: fit-content;
  max-width: 100%;
}
.resource-specimen[data-layout="slip"] .resource-part:last-child strong { color: var(--warn); }
/* The table itself is the still figures' table (lead-ins.css). It measures its own width, so a table in a pair keeps
   its row names a third of it. */
.resource-comparison { container-type: inline-size; }
/* A row's name and a term: the name in ink at 600, and the detail its "Name: detail" gives it on a quieter line under
   it, a size smaller (lesson-resources.mjs, rowName). */
:is(.resource-table tbody th, .resource-terms dt) .row-detail {
  display: block; margin-top: 2px; font: 400 var(--text-xs) / 1.45 var(--sans); color: var(--muted);
}
:is(.resource-table tbody th, .resource-terms dt) .row-detail strong { font-weight: 500; }
/* A value and a meaning answer first: the bold span a cell opens with is its lead, a line of its own in ink at 600,
   and the rest its detail, a step softer (`--detail`, 4.5:1 or more in both themes). Bold later in a cell is 500, so
   the leads carry the scan (lesson-resources.mjs, cellText). */
:is(.resource-table, .resource-terms) { --detail: color-mix(in oklab, var(--ink) 30%, var(--muted)); }
:is(.resource-table td, .resource-terms dd) .cell-lead { display: block; font-weight: 600; color: var(--ink); }
:is(.resource-table td, .resource-terms dd) .cell-detail { display: block; margin-top: 2px; color: var(--detail); }
:is(.resource-table tbody td, .resource-terms dd) strong:not(.cell-lead) { font-weight: 500; }
/* What parted a name from its detail, or a lead from its, is read and copied, never seen: the line break shows it. */
.cell-sep { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* A total: one in each column, over a stronger rule. */
.resource-table:has(> tfoot.is-total) > tbody > tr:last-child > * { border-bottom-color: var(--line-strong); }
.resource-table > tfoot.is-total :is(th, td) { padding-bottom: 4px; border-top: 0; font-weight: 600; color: var(--ink); }
/* The table's conclusion, what its rows add up to ("Choose", "Limit"), stands under it as a block of its own: its label
   a small heading over its text at reading size, on a quiet panel. It is the table's last row, so a screen reader
   meets it in the table. */
.resource-table > tfoot.is-conclusion td { padding: 16px 0 0; border: 0; }
.resource-conclusion {
  display: grid; gap: 4px; padding: 14px 20px 16px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--stage) 60%, var(--paper));
}
.resource-conclusion > b { color: var(--muted); font: 600 var(--text-xs) / 1.4 var(--sans); }
.resource-conclusion > p {
  max-width: var(--measure); margin: 0; color: var(--ink); font: 400 var(--text-body) / 1.55 var(--sans);
}
/* A source, the citation the rows come from, is no conclusion: a small muted line under the last rule (R9C-02). */
.resource-table > tfoot.is-source td { padding: 10px 0 0; border: 0; }
.resource-source { max-width: var(--measure); margin: 0; color: var(--muted); font: 400 var(--text-xs) / 1.5 var(--sans); }
.resource-source > b { font-weight: 600; }
/* On a phone, where the rows stack, a total is one more block between the rules, and the conclusion or the source
   stands under the last rule. */
@media (max-width: 600px) {
  .resource-table.is-stacking > tfoot > tr { border-top: 0; }
  .resource-table.is-stacking:has(> tfoot.is-total) > tbody > tr:last-child { border-bottom-color: var(--line-strong); }
  .resource-table.is-stacking > tfoot.is-total > tr { border-bottom: 1px solid var(--line); }
  .resource-table.is-stacking > tfoot.is-conclusion > tr { padding: 16px 0 0; }
  .resource-table.is-stacking > tfoot.is-source > tr { padding: 10px 0 0; }
}
/* A row's verdict is coloured in the column its table names (lesson-resources.mjs, toneColumn): its lead, and any
   bold of a cell with none. */
.resource-table tr[data-tone="ok"] td[data-toned] strong { color: var(--ok); }
.resource-table tr[data-tone="bad"] td[data-toned] strong { color: var(--danger); }
.resource-table tr[data-tone="quiet"] :is(th, td, strong, .row-detail, .cell-detail) { color: var(--muted); }
/* A list of terms has a table's rhythm: a term and its meaning side by side, 14 over and under, 24 apart. */
.resource-terms dl > div {
  display: grid;
  grid-template-columns: minmax(130px, 24%) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  padding: 14px 0;
}
.resource-terms dl > div + div { border-top: 1px solid var(--line); }
/* Terms are words on the page, between two rules. Their words wrap, so the list never scrolls, and the ring of a link
   at its edge, as Code Mode's sources are, shows whole. */
.resource-terms .lead-figure { padding: 0; border-block: 1px solid var(--line); overflow: visible; }
.resource-terms dt { font-weight: 600; overflow-wrap: anywhere; }
.resource-terms dd { margin: 0; overflow-wrap: anywhere; }
/* The paragraph a list of terms may open with is set as a lead-in's text, 14 over its rules. */
.resource-terms > p {
  max-width: var(--measure); margin: 0 0 14px; color: var(--ink); font: 400 var(--text-body) / 1.55 var(--sans);
}
.resource-pair {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 24px;
}
.resource-pair .resource-terms dl > div { grid-template-columns: minmax(80px, 34%) minmax(0, 1fr); gap: 20px; }
.resource-replay > summary { width: fit-content; color: var(--accent-ink); cursor: pointer; }
.resource-replay[open] > summary { margin-bottom: 12px; }

@container (max-width: 710px) {
  .resource-pair { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}
@container (max-width: 520px) {
  .resource-specimen[data-layout] .resource-parts { grid-template-columns: minmax(0, 1fr); grid-auto-flow: row; }
  .resource-specimen[data-layout] .resource-part + .resource-part {
    border-inline-start: 0;
    border-top: 1px solid var(--line);
  }
  .resource-specimen[data-layout] .resource-part:first-child { display: block; }
  .resource-terms dl > div, .resource-pair .resource-terms dl > div { grid-template-columns: 1fr; gap: 4px; }
}
/* Requests to scale, as the compaction lesson draws them: a still figure on the page, with no frame. A line parts its
   groups, which have no box of their own. */
.resource-context { display: grid; gap: 14px; }
.resource-context .sf-groups > .sf-group { padding: 0; border: 0; border-radius: 0; }
.resource-context .sf-groups > .sf-group + .sf-group { padding-top: 16px; border-top: 1px solid var(--line); }
.resource-context > h2 { margin: 0; }
.resource-context > p {
  max-width: var(--measure); margin: 0; color: var(--ink); font: 400 var(--text-body) / 1.55 var(--sans);
}
.resource-context .sf-legend { padding-left: 166px; }
/* What the sizes are, under the requests: a note, quieter than the text over them. */
.resource-context > p.lead-note { margin: 0; font: 400 var(--text-sm) / 1.5 var(--sans); color: var(--faint); }
@container (max-width: 560px) {
  .resource-context .sf-bar-row, .resource-context .sf-bar-row:has(.sf-bar.is-open) {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label note" "bar bar"; gap: 4px 12px;
  }
  .resource-context .sf-bar-label { grid-area: label; }
  .resource-context .sf-bar { grid-area: bar; }
  .resource-context .sf-bar-note { grid-area: note; }
  .resource-context .sf-legend { padding-left: 0; }
}
/* A paper a table or a list of terms names is a link, as in a lesson's text. */
:is(.resource-table, .resource-terms) a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }

/* Search Indexes' demo: the handbook's chunks in their order, each with the score the chosen index gives it, its rank,
   and its words marked where the index matched them: the question's words, or the phrases of its concepts. A chunk
   keeps its place whatever is asked, so the reader's eye stays on a row while its bar and marks change; the context a
   model wrote stands over every chunk and reads as faint where the index does not read it. */
.search-demo .tw-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }
/* On a small phone (360px) the four indexes' names keep a little less room round them, so the track fits the card. */
@media (max-width: 380px) { .search-demo .tw-head .player-segmented button { padding-inline: 9px; } }
.sd-ask { display: grid; gap: 10px; padding: 16px 20px 6px; }
.sd-ask label { font: 600 var(--text-sm) / 1.3 var(--sans); color: var(--ink); }
.sd-input {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: 400 var(--text-body) / 1.3 var(--sans);
}
.sd-input:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.sd-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.sd-presets button {
  min-height: 30px; padding: 4px 12px; border: 0; border-radius: var(--radius-pill); background: var(--stage);
  color: var(--muted); font: 400 var(--text-xs) / 1.3 var(--sans); cursor: pointer;
}
.sd-presets button:hover { background: var(--stage-edge); color: var(--ink); }
.sd-presets button[aria-pressed="true"] { background: var(--accent-pale); color: var(--accent-ink); }
.sd-chunks { display: grid; margin: 0; padding: 6px 20px 12px; list-style: none; }
.sd-section {
  padding: 12px 0 4px; color: var(--faint); font: 600 var(--text-xs) / 1.3 var(--sans);
}
.sd-chunk {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 200px); align-items: center; gap: 4px 14px;
  padding: 8px 10px; border-radius: var(--radius); transition: background-color 180ms ease-out;
}
.sd-chunk + .sd-chunk { box-shadow: inset 0 1px var(--line); }
.sd-chunk.is-answer { background: color-mix(in srgb, var(--ok) 7%, transparent); }
.sd-rank {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-pill);
  color: var(--faint); font: 500 var(--text-xs) / 1 var(--mono); transition: background-color 180ms, color 180ms;
}
.sd-chunk.is-top .sd-rank { background: var(--accent); color: var(--on-accent); }
.sd-text { display: grid; gap: 2px; min-width: 0; }
.sd-context { color: var(--muted); font: 400 var(--text-xs) / 1.4 var(--sans); visibility: hidden; }
.sd-context.is-read { visibility: visible; }
.sd-line { color: var(--ink); font: 400 var(--text-sm) / 1.45 var(--sans); }
.sd-w { border-radius: 3px; box-shadow: 0 0 0 1px transparent; transition: background-color 180ms, box-shadow 180ms; }
.sd-w.is-word { background: var(--accent-pale); }
.sd-w.is-concept { box-shadow: inset 0 -2px var(--actor-session); }
.sd-score { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; }
.sd-track { height: 8px; border-radius: var(--radius-pill); background: var(--stage); overflow: hidden; }
.sd-track i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent);
  transition: width 320ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.sd-chunk:not(.is-top) .sd-track i { background: color-mix(in srgb, var(--accent) 45%, var(--stage)); }
.sd-score b { min-width: 6ch; color: var(--ink); font: 500 var(--text-xs) / 1 var(--mono); text-align: right; }
.sd-score small { grid-column: 1; min-height: 1.3em; color: var(--faint); font: 400 var(--text-xs) / 1.3 var(--mono); }
.sd-answer {
  grid-column: 2; justify-self: end; padding: 1px 8px; border-radius: var(--radius-pill); visibility: hidden;
  background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); font: 600 var(--text-xs) / 1.4 var(--sans);
}
.sd-chunk.is-answer .sd-answer { visibility: visible; }
.sd-meta { display: flex; gap: 8px; min-width: 0; align-items: baseline; }
.sd-id { flex: none; color: var(--faint); font: 400 var(--text-xs) / 1.4 var(--mono); }
.sd-meta .sd-context { min-width: 0; }
.sd-line-said { min-height: calc(3 * 1.5em); margin: 0; }
/* On a phone a chunk is read top down at the card's full width: its rank beside its line's name, with the answer
   mark and the score at the row's end, then the context it is read with, only under the index that reads it (the
   rows grow when Contextual is chosen, rather than keep that room blank under the other three), its text, and the
   bar with what the score adds up beside it. The last two columns are fixed, so every bar has one length and the
   widest sum ("BM25 12 · vec 12") stands whole beside it. */
@media (max-width: 640px) {
  .sd-chunk { grid-template-columns: 22px minmax(0, 1fr) 72px 6ch; gap: 3px 8px; padding: 8px 6px; }
  .sd-text, .sd-meta, .sd-score { display: contents; }
  .sd-rank { grid-area: 1 / 1; width: 22px; height: 22px; }
  .sd-id { grid-area: 1 / 2; }
  .sd-answer { grid-area: 1 / 3; }
  .sd-score b { grid-area: 1 / 4; }
  .sd-context { grid-area: 2 / 1 / 3 / -1; }
  .sd-context:not(.is-read) { display: none; }
  .sd-line { grid-area: 3 / 1 / 4 / -1; }
  .sd-track { grid-area: 4 / 1 / 5 / 3; }
  .sd-score small { grid-area: 4 / 3 / 5 / -1; justify-self: end; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .sd-track i, .sd-w, .sd-rank, .sd-chunk, .sd-context { transition: none; }
}

/* Program databases on the floor plan their routes cross (Evolve a Program): two still pictures set against each
   other, each under a short name with no frame and one line between them (DESIGN.md), one under the other on a phone.
   A square is the sunken ground, a wall the strong line's colour, an end the accent with its count in the accent's
   ink, the grid's blocks dashed and the route that arrived in the accent. A plan is never drawn narrower than 260px,
   so its 13-unit words stay 13px or more. */
.resource-floor { display: grid; gap: 14px; }
.resource-floor > p { max-width: var(--measure); margin: 0; }
.floor-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.floor-panel { margin: 0; padding: 4px 24px 8px 0; }
.floor-panel + .floor-panel { padding-inline-start: 24px; border-inline-start: 1px solid var(--line); }
.floor-panel figcaption { margin: 0 0 10px; color: var(--muted); font: 600 var(--text-xs) / 1.4 var(--sans); }
.floor-plan { display: block; width: 100%; max-width: 360px; height: auto; }
.floor-square { fill: var(--sunken); stroke: var(--surface); stroke-width: 2; }
.floor-square.is-wall { fill: var(--line-strong); }
.floor-name { fill: var(--muted); font: 600 13px var(--sans); }
.floor-end { fill: var(--accent); }
.floor-count { fill: var(--on-accent); font: 600 13px var(--sans); text-anchor: middle; }
.floor-block { stroke: var(--wire); stroke-width: 1.5; stroke-dasharray: 4 4; }
.floor-route { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.55; }
.floor-turn { fill: var(--accent); }
.floor-legend { max-width: var(--measure); margin: 0; color: var(--muted); font-size: var(--text-sm); }
/* The feature map: the floor's blocks as a table of their own, each its elite's id and score over the ones it
   replaced, struck out and muted; the ids on the line to the route that arrived take the accent. */
.feature-map {
  display: grid;
  grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
  gap: 3px;
  max-width: 360px;
}
.feature-cell {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  min-height: 72px;
  padding: 8px 4px;
  background: var(--sunken);
  font: 400 var(--text-xs) / 1.3 var(--mono);
  font-variant-numeric: tabular-nums;
}
.feature-cell b { color: var(--ink); font-weight: 600; font-size: var(--text-sm); }
.feature-cell s { color: var(--faint); }
.feature-cell .is-line { color: var(--accent-ink); }
/* Stacked on a phone, the line between the plans lies across, above the second. */
@media (max-width: 600px) {
  .floor-panel { padding: 4px 0 8px; }
  .floor-panel + .floor-panel { padding: 16px 0 8px; border-inline-start: 0; border-top: 1px solid var(--line); }
}
