/* starlens/site/media/house/reference.css — the reference's pages (D3 of the reference lane, 2026-11-05), after
   media/house/prose.css (the house's reading sheet, a whole copy of love-shared's) under star-web's starlens_dark
   shell. Her layout (2026-11-05): the API reference on the left, collapsed (the `[[nav:]]` block's tree: every group
   folded but the page's own, sticky, its own scroll); the documentation on the right with its examples live (the
   `[[view:]]` block's figures, which media/house/ref-view.js runs, and the boards). Under 60rem the tree is one fold
   above the page (a checkbox, as the shell's drawer: no script). Tokens only: tools/house_lint.py holds it. */

:root {
  --prose-max: 1180px;
  --tree-w: 16rem;
  --doc-measure: 76ch;
  --tap: 44px;
}

/* the two panes */
main.reference { display: grid; grid-template-columns: var(--tree-w) minmax(0, 1fr); column-gap: var(--space-8); align-items: start; }
main.reference > nav.tree { position: sticky; top: var(--space-6); max-height: calc(100vh - 2 * var(--space-6)); overflow-y: auto; overscroll-behavior: contain; padding: var(--space-4) var(--space-4) var(--space-6) 0; }
main.reference > .doc { min-width: 0; }
main.reference .doc > p, main.reference .doc > ul, main.reference .doc > ol { max-width: var(--doc-measure); }
main.reference .doc > h1:first-child { margin-top: var(--space-6); }

/* the tree */
nav.tree { font-size: var(--t-small); line-height: 1.4; }
nav.tree .tree-group { border-bottom: 1px solid var(--line); }
nav.tree summary { display: flex; align-items: center; gap: var(--space-3); min-height: var(--size-row-h-md); cursor: pointer; color: var(--text); list-style: none; }
nav.tree summary::-webkit-details-marker { display: none; }
nav.tree summary::before { content: ""; flex: none; width: var(--space-3); height: var(--space-3); border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform var(--motion-ui); }
nav.tree details[open] > summary::before { transform: rotate(45deg); }
nav.tree summary:hover { color: var(--accent); }
nav.tree a { display: block; padding: var(--space-1) var(--space-4); color: var(--muted); border-left: 2px solid transparent; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav.tree a:hover { color: var(--text); text-decoration: none; }
nav.tree a[aria-current="page"] { color: var(--text); border-left-color: var(--accent); }
nav.tree a.tree-top { margin: 0 0 var(--space-2); }
nav.tree .tree-sec { margin: var(--space-4) 0 var(--space-1); padding-left: var(--space-4); font-size: var(--t-micro); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
nav.tree ul { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
nav.tree code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
nav.tree .tree-open, nav.tree .tree-toggle { display: none; }
/* the search over the tree (media/house/ref-search.js, 2026-11-08): while a query stands, its results stand in for
   the groups */
nav.tree .tree-search { margin: 0 0 var(--space-3); }
nav.tree .tree-search input { width: 100%; box-sizing: border-box; min-height: var(--size-row-h-md); padding: 0 var(--space-4); font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-button); }
nav.tree .tree-search input:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
nav.tree .tree-said { margin: 0 0 var(--space-2); padding-left: var(--space-4); font-size: var(--t-micro); color: var(--faint); }
nav.tree .tree-said:empty { display: none; }
nav.tree .tree-results { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
nav.tree .tree-results a { display: grid; white-space: normal; padding: var(--space-2) var(--space-4); }
nav.tree .tree-results a:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
nav.tree .tree-hit { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav.tree .tree-hit mark { background: none; color: var(--accent); font-weight: 600; }
nav.tree .tree-where { font-size: var(--t-micro); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the text's results (2026-11-12): under the entries by name, each with the stretch of text around the word found */
nav.tree .tree-more { margin: var(--space-4) 0 var(--space-2); padding-left: var(--space-4); font-size: var(--t-micro); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
nav.tree .tree-snip { font-size: var(--t-micro); line-height: 1.45; color: var(--muted); white-space: normal; overflow-wrap: anywhere; }
nav.tree .tree-snip mark { background: none; color: var(--accent); }
nav.tree .tree-body.tree-searching > .tree-group { display: none; }

/* an entry */
pre.sig { white-space: pre-wrap; padding: var(--space-4) var(--space-5); margin: var(--space-3) 0 var(--space-4); }
.doc .meta { margin: calc(-1 * var(--space-2)) 0 var(--space-5); font: var(--t-micro) var(--mono); color: var(--faint); }
.doc h3 code { font-size: inherit; }
.doc .witness, .doc .plain { font-size: var(--t-micro); color: var(--faint); }
.doc .pinned { margin-top: calc(-1 * var(--space-3)); font-size: var(--t-small); color: var(--muted); }
/* the listings (2026-11-09): Copy in a listing's corner (ref-code.js), a demo's words folded under its figure, the
   door to StarBoard under an editable board */
.doc pre.has-copy { position: relative; padding-right: calc(var(--space-6) + 3.6rem); }
.doc pre .copy { position: absolute; top: var(--space-2); right: var(--space-2); font: var(--t-micro) var(--mono); color: var(--muted);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-1); padding: var(--space-1) var(--space-2); cursor: pointer; }
.doc pre .copy:hover, .doc pre .copy:focus-visible { color: var(--text); border-color: var(--line-strong); }
.doc pre .run { position: absolute; top: var(--space-2); right: calc(var(--space-2) + 3.6rem); font: var(--t-micro) var(--mono); color: var(--seal);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-1); padding: var(--space-1) var(--space-2); cursor: pointer; }
.doc pre.has-run { padding-right: calc(var(--space-6) + 7rem); }
figure.view[data-pinned="match"] .v-read { color: var(--ok); }
.doc pre .copy-said, .doc .sb-open-said { position: absolute; left: -999em; }
.doc details.ops { margin: calc(-1 * var(--space-2)) 0 var(--space-5); font-size: var(--t-small); }
.doc details.script { margin-top: var(--space-2); }
.doc details.ops summary { color: var(--muted); cursor: pointer; }
.doc details.ops pre { margin-top: var(--space-3); }
.doc .sb-open { margin: var(--space-2) 0 var(--space-5); font-size: var(--t-small); }
/* the work on the page (2026-11-10): its sources' commits of the last 30 days, what is open, its checks, folded above
   the pager (star-web's [[timeline:]] and [[work:]] draw the inside) */
.doc details.changes { margin: var(--space-7) 0 var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); font-size: var(--t-small); }
.doc details.changes summary { color: var(--muted); cursor: pointer; }
.doc details.changes summary:hover { color: var(--text); }
@media (pointer: coarse) {
  .doc pre .copy, .doc pre .run, .doc .sb-open .chip { min-height: var(--tap); min-width: var(--tap); }
  .doc details.ops summary, .doc details.changes summary { min-height: var(--tap); display: flex; align-items: center; }
}
nav.pager { display: flex; justify-content: space-between; gap: var(--space-5); margin: var(--space-8) 0 var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--line); font-size: var(--t-small); }

/* a live view */
figure.view { margin: var(--space-7) 0; max-width: var(--doc-measure); }
figure.view .v-slot { position: relative; aspect-ratio: 16 / 9; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-2); overflow: hidden; }
figure.view .v-slot canvas, figure.view .v-still { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: pan-y; }
figure.view .v-still { object-fit: cover; }
figure.view .v-hint { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: var(--space-4) var(--space-5); font-size: var(--t-small); color: var(--muted); }
figure.view.live .v-slot { border-color: var(--line-strong); }
figure.view.flash .v-slot canvas { filter: brightness(1.8); }
figure.view .v-ctl { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-4); }
figure.view .v-ctl button { min-height: var(--size-row-h-md); min-width: var(--size-row-h-md); padding: 0 var(--space-5); border: 1px solid var(--line-strong); border-radius: var(--radius-button); background: var(--panel2); color: var(--text); font: inherit; font-size: var(--t-small); cursor: pointer; }
figure.view .v-ctl button:hover { border-color: var(--accent); }
figure.view .v-ctl button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
figure.view .v-read { margin: var(--space-3) 0 0; min-height: 1.4em; font-size: var(--t-micro); color: var(--muted); font-variant-numeric: tabular-nums; }
figure.view .v-read.bad { color: var(--danger); }
figure.view .v-read.warn { color: var(--seal); }
figure.view figcaption { margin-top: var(--space-3); font-size: var(--t-small); color: var(--muted); }
figure.view figcaption .title { color: var(--text); }
figure.view figcaption .shows { margin-left: var(--space-4); }

/* a narrow screen: one column, the tree one fold above the page */
@media (max-width: 60rem) {
  main.reference { display: block; }
  main.reference > nav.tree { position: static; max-height: none; overflow: visible; padding: 0; margin: 0 0 var(--space-5); border-bottom: 1px solid var(--line); }
  nav.tree .tree-open[hidden] { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); cursor: pointer; color: var(--text); }
  nav.tree .tree-open::before { content: ""; width: var(--space-3); height: var(--space-3); border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform var(--motion-ui); }
  nav.tree .tree-toggle:checked + .tree-open::before { transform: rotate(45deg); }
  nav.tree .tree-toggle[hidden] { display: block; position: absolute; left: -999em; }
  nav.tree .tree-toggle:focus-visible + .tree-open { outline: 2px solid var(--ring); outline-offset: 2px; }
  nav.tree .tree-body { display: none; padding-bottom: var(--space-4); }
  nav.tree .tree-toggle:checked ~ .tree-body { display: block; }
}
@media (pointer: coarse) {
  nav.tree summary, nav.tree a { min-height: var(--tap); display: flex; align-items: center; }
  nav.tree .tree-search input { min-height: var(--tap); }
  nav.tree .tree-results a { align-content: center; }
  figure.view .v-ctl button { min-height: var(--tap); min-width: var(--tap); }
  nav.pager a { display: inline-flex; align-items: center; min-height: var(--tap); }
}
@media (prefers-reduced-motion: reduce) {
  nav.tree summary::before, nav.tree .tree-open::before { transition: none; }
}
