/* Full House specifications — the site stylesheet (ops/sandbox/spec-site,
   served beside the pages under the box-wide CSP: style-src 'self').
   Rendered by gen-spec-site.py from docs/*.md; nothing here is platform
   logic. Two colour schemes follow the reader's system setting; no
   remote font, no remote anything. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --fg: #1c2127;
  --muted: #5d6673;
  --rule: #d8dde4;
  --accent: #0e6b6b;
  --link: #0b5fa5;
  --code-bg: #eceff3;
  --focus: #e0761a;
  --measure: 78ch;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1318;
    --surface: #161c23;
    --fg: #e4e8ee;
    --muted: #97a1ac;
    --rule: #2a333d;
    --accent: #4fc4b8;
    --link: #82b9ff;
    --code-bg: #1c232c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; padding: .5rem .75rem; background: var(--surface); }
.skip:focus { left: 16px; top: 8px; z-index: 10; }

/* ── frame ─────────────────────────────────────────────────────────────── */
.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}
.brand { color: var(--fg); font-weight: 650; letter-spacing: .01em; }
.brand span { color: var(--accent); font-weight: 500; }
.build { color: var(--muted); font-size: .85rem; }
.shell {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr) 14rem;
  gap: 2.5rem;
  max-width: 88rem;
  margin: 0 auto;
  padding: 1.5rem 16px 3rem;
}
nav.docs, nav.toc { font-size: .9rem; align-self: start; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
nav h2 { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 .5rem; font-weight: 600; }
nav ol { list-style: none; margin: 0; padding: 0; }
nav li { margin: 0; }
nav a { display: block; padding: .25rem .5rem; border-radius: 4px; color: var(--fg); }
nav a:hover { background: var(--code-bg); text-decoration: none; }
nav.docs li.current a { background: var(--code-bg); color: var(--accent); font-weight: 600; }
nav.toc li.l3 a { padding-left: 1.25rem; color: var(--muted); }
main { min-width: 0; }
article.doc, article.index { max-width: var(--measure); }
.doc-foot { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .9rem; max-width: var(--measure); }

@media (max-width: 70rem) {
  .shell { grid-template-columns: 14rem minmax(0, 1fr); }
  nav.toc { display: none; }
}
@media (max-width: 50rem) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  nav.docs { position: static; max-height: none; }
  nav.docs ol { display: flex; flex-wrap: wrap; gap: .25rem; }
  nav.docs a { border: 1px solid var(--rule); }
}

/* ── text ──────────────────────────────────────────────────────────────── */
h1, h2, h3, h4 { line-height: 1.25; text-wrap: balance; scroll-margin-top: 1rem; }
h1 { font-size: 2rem; margin: 0 0 1rem; letter-spacing: -.01em; }
h2 { font-size: 1.45rem; margin: 2.5rem 0 .75rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
h3 { font-size: 1.15rem; margin: 1.75rem 0 .5rem; }
h4 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
p, ul, ol, blockquote { margin: 0 0 1rem; }
li { margin: .2rem 0; }
li > p { margin-bottom: .5rem; }
a.anchor { color: var(--muted); font-weight: 400; opacity: 0; margin-left: .25em; }
h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, a.anchor:focus { opacity: 1; }
blockquote { border-left: 3px solid var(--accent); padding: .25rem 0 .25rem 1rem; color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
strong { font-weight: 650; }
.unpublished { border-bottom: 1px dotted var(--muted); cursor: help; }
del { color: var(--muted); }

/* ── code ──────────────────────────────────────────────────────────────── */
code, pre, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
code { font-size: .9em; background: var(--code-bg); padding: .1em .3em; border-radius: 3px; overflow-wrap: anywhere; }
pre { background: var(--code-bg); padding: .9rem 1rem; border-radius: 6px; overflow-x: auto; line-height: 1.45; margin: 0 0 1rem; }
pre code { background: none; padding: 0; font-size: .86rem; overflow-wrap: normal; }
kbd { font-size: .85em; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 3px; padding: 0 .3em; }

/* ── tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 0 0 1.25rem; }
table { border-collapse: collapse; font-size: .9rem; min-width: 100%; }
th, td { border: 1px solid var(--rule); padding: .4rem .6rem; vertical-align: top; text-align: left; }
th { background: var(--code-bg); font-weight: 600; }
td code, th code { font-size: .88em; }

/* ── diagrams ──────────────────────────────────────────────────────────── */
figure.diagram {
  margin: 1.5rem 0;
  padding: 1rem 1rem .5rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
}
figure.diagram pre.mermaid {
  background: none; padding: 0; margin: 0; overflow-x: auto;
  font: inherit; white-space: normal; text-align: center;
}
/* Natural size (spec.js asks Mermaid for it): a wide diagram scrolls inside
   its figure instead of shrinking its text to the column. */
figure.diagram pre.mermaid svg { max-width: none; }
figure.undrawn pre.mermaid { white-space: pre; text-align: left; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; }
details.source { margin-top: .5rem; font-size: .85rem; color: var(--muted); }
details.source summary { cursor: pointer; }
details.source pre { margin: .5rem 0 0; }

/* ── index ─────────────────────────────────────────────────────────────── */
.intro { font-size: 1.05rem; color: var(--muted); max-width: 65ch; }
.cards { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 1rem; }
.cards li { padding: 1rem 1.25rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); }
.cards h3 { margin: 0 0 .35rem; font-size: 1.1rem; }
.cards .lead { margin: 0 0 .5rem; color: var(--fg); font-size: .95rem; }
.cards .meta { margin: 0; color: var(--muted); font-size: .85rem; }

@media print {
  .top, nav.docs, nav.toc, .skip, details.source, a.anchor { display: none; }
  .shell { display: block; padding: 0; }
  body { background: #fff; color: #000; }
  figure.diagram, .cards li { break-inside: avoid; }
}
