/* A small TUI: panes carry their title on the top border, tabs up top, a
   status bar at the bottom. Slate palette: every text colour passes WCAG AA
   (4.5:1) on the background and on code blocks. */
:root {
  color-scheme: dark;
  --bg: #15181c; --code: #1c2025; --ink: #d5d9de; --dim: #8a929c; --line: #343a42;
  --accent: #ff8a3d; --link: #8fb8de; --hot: #ffb27a;
  --ok: #6cc4a1; --warn: #f2c14e; --bad: #ef6b6b;
  --sel: #262b32; --sel-ink: #eef1f4; --bar: #1c2025; --bar-ink: #c5cad0; --pick: #3a2a1f;
  --mono: ui-monospace, "JetBrains Mono", "IBM Plex Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 14px/1.55 var(--mono);
  /* Ligatures would draw -- and -> as dashes and arrows; commands must look
     exactly as they are typed. */
  font-variant-ligatures: none;
}
a { color: var(--link); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; outline: none; }
pre { margin: 0; white-space: pre; overflow-x: auto; font: inherit; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
b, strong { font-weight: 700; color: var(--hot); }

.screen { max-width: 1180px; margin: 0 auto; padding: 8px 12px 0; min-height: 100vh; display: flex; flex-direction: column; }

.hd { display: flex; justify-content: space-between; align-items: end; gap: 12px; padding: 6px 2px 8px; }
.hd a { color: inherit; text-decoration: none; }
.logo { color: var(--accent); font-size: clamp(8px, 1.5vw, 14px); line-height: 1.1; }
.meta { text-align: right; color: var(--dim); font-size: 13px; }

.tabs { display: flex; flex-wrap: wrap; gap: 0 2px; border-bottom: 1px solid var(--line); }
.tabs a { color: var(--dim); padding: 3px 12px; }
.tabs a.on { color: var(--sel-ink); background: var(--sel); }
.tabs k, .status k { color: var(--accent); }

.grid { flex: 1; display: grid; gap: 16px 12px; padding: 18px 0 16px; align-content: start; }

.pane { position: relative; border: 1px solid var(--line); border-radius: 6px; padding: 14px 12px 10px; min-width: 0; }
.pane.focus { border-color: var(--accent); }
.pane > .t { position: absolute; top: -.8em; left: 1ch; margin: 0; padding: 0 1ch; background: var(--bg); font: inherit; color: var(--accent); }
.pane > .t span { color: var(--dim); }
.pane p { margin: 0 0 8px; }
.pane > :last-child { margin-bottom: 0; }

/* commands: a render hook adds the $ prompt and dims comments */
.cmd, .doc pre { background: var(--code); padding: 6px 8px; margin: 6px 0 12px; }
.cmd .p { color: var(--dim); user-select: none; }
.cmd .c { color: var(--dim); }
.cursor { background: var(--ink); color: var(--bg); }

/* home */
.home { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); grid-template-areas: "pastor live" "install live" "can why" "can not"; grid-template-rows: 1fr auto auto auto; }
/* the tall terminal's extra height goes to the pitch; install keeps its own height */
.home > .pane.focus { padding-bottom: 28px; } /* install: a little of that room */
.pitch { font-size: 1.1em; }
.pitch b { color: var(--accent); }
.feats b { display: inline-block; min-width: 8ch; }
.not { margin: 0; padding: 0; list-style: none; }
.not li { display: grid; grid-template-columns: 2ch 1fr; margin-bottom: 4px; }
.not li::before { content: "×"; color: var(--bad); }
.not b { color: var(--ink); }
.uses { margin: 0 0 8px; padding: 0; list-style: none; }
.uses li { display: grid; grid-template-columns: 2ch 1fr; margin-bottom: 4px; }
.uses li::before { content: "›"; color: var(--accent); }
.uses b { color: var(--ink); }

/* the live terminal: term.js types the transcript into it */
/* a fixed window that scrolls up as lines arrive, like a real terminal */
.term { background: var(--code); padding: 8px 10px; margin: 6px 0 8px; font-size: 12px; line-height: 1.55; height: 30em; overflow: auto; }
/* on the home it fills its column, as tall as the panes beside it */
.home .live { display: flex; flex-direction: column; }
.home .live .term { flex: 1 1 auto; height: 0; min-height: 33em; }
.term .p { color: var(--dim); user-select: none; }
.term .lbl { color: var(--accent); }
.term .in { color: var(--sel-ink); }
.term .ask { color: var(--hot); }
.term .out { color: var(--dim); }
.term .say { color: var(--ink); }
.term .dot { color: var(--ink); }
.term .call { color: var(--ink); }
.term .call .dot { color: var(--ok); }
.term .call .in { color: var(--sel-ink); }
.term .res { color: var(--dim); }
/* its controls sit on the pane's top border, like the title on the left */
/* only the lower half is painted: enough to hide the border under it, and
   nothing shows above the border where the page, or a popup's backdrop, is */
.term-ctl { position: absolute; top: -10px; height: 20px; right: 1ch; display: flex; align-items: center; gap: 1ch; padding: 0 1ch; background: linear-gradient(transparent 45%, var(--bg) 45%); }
.term-ctl[hidden] { display: none; }
.term-ctl .act { width: 11px; height: 11px; padding: 0; border: 1.5px solid var(--ink); border-radius: 50%; background: transparent; cursor: pointer; }
.term-ctl .act.on { background: var(--accent); border-color: var(--accent); }
.term-ctl .act:hover, .term-ctl .act:focus-visible { border-color: var(--accent); outline: none; }
.term-ctl .btn { display: grid; place-items: center; width: 22px; height: 20px; padding: 0; color: var(--dim); background: var(--code); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.term-ctl .btn svg { width: 12px; height: 12px; fill: currentColor; }
.term-ctl .btn:hover, .term-ctl .btn:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.term-ctl .act + .btn { margin-left: 1ch; }

/* the terminal's bigger view: a centred dialog, 60% of the window each way */
.term-big { width: 60vw; height: 60vh; max-width: none; max-height: none; padding: 0; border: 0; background: transparent; color: var(--ink); overflow: visible; }
.term-big::backdrop { background: rgb(0 0 0 / .65); }
/* in the popup the title and controls sit inside the frame, as a header */
.term-big .pane { height: 100%; display: grid; grid-template: "t ctl" auto "term term" 1fr / minmax(0, 1fr) auto; gap: 8px 12px; background: var(--bg); padding: 10px 12px 12px; }
.term-big .pane > .t { grid-area: t; position: static; padding: 0; background: none; align-self: center; }
.term-big .term-ctl { grid-area: ctl; position: static; padding: 0; background: none; }
.term-big .term { grid-area: term; height: auto; min-height: 0; margin: 0; font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* docs */
/* the docs nav: a tree of sections, the open one's pages, the page's topics */
.docs { grid-template-columns: 35ch minmax(0, 1fr); }
.list { align-self: start; position: sticky; top: 12px; }
/* the nav reads as a list of names, easier in a proportional face than in
   the monospace the rest of the site keeps */
.list { line-height: 1.75; font-family: system-ui, -apple-system, "Segoe UI", Inter, "Helvetica Neue", Arial, sans-serif; font-size: 15px; }
.list > .t { font-family: var(--mono); font-size: 14px; }
.list a { display: block; color: var(--ink); padding: 1px 1ch; }
.list a:hover, .list a:focus { background: var(--sel); color: var(--sel-ink); text-decoration: none; }
.list .grp { margin: 2px 0; }
.list .grp summary { list-style: none; cursor: pointer; color: var(--accent); padding: 0 1ch; }
.list .grp summary::-webkit-details-marker { display: none; }
.list .grp summary::before { content: "▸ "; color: var(--dim); }
.list .grp[open] summary::before { content: "▾ "; }
.list .grp summary:hover, .list .grp summary:focus-visible { background: var(--sel); outline: none; }
.list .grp { margin: 4px 0; }
.list .grp[open] { margin-bottom: 8px; }
.list a.top { color: var(--accent); margin-bottom: 4px; }
.list a.top::before { content: "≡ "; color: var(--dim); }
.list a.top.sel { background: var(--sel); box-shadow: inset 2px 0 0 var(--accent); }
.list a.pg { padding-left: 2ch; margin-left: 1.5ch; border-left: 1px solid var(--line); }
.list a.pg.sel { background: var(--sel); color: var(--sel-ink); box-shadow: inset 2px 0 0 var(--accent); }
.list .topics { margin: 2px 0 6px; }
.list .topics ul { list-style: none; margin: 0; padding: 0; }
.list .topics a { padding-left: 4ch; margin-left: 1.5ch; border-left: 1px solid var(--line); color: var(--bar-ink); }
.list .topics a::before { content: "· "; color: var(--dim); }

.doc { line-height: 1.6; }
.doc p, .doc ul, .doc ol { margin: 0 0 10px; max-width: 88ch; }
.doc ul, .doc ol { padding-left: 3ch; }
.doc li { margin: 2px 0; }
.doc h1 { margin: 4px 0 10px; font-size: 1.15em; color: var(--accent); }
.doc h2, .doc h3, .doc h4 { margin: 20px 0 6px; font: inherit; color: var(--accent); }
.doc h2:not(.t)::before { content: "── "; color: var(--line); }
.doc h3 { color: var(--ink); }
.doc h3::before { content: "·· "; color: var(--line); }
.doc h4 { color: var(--dim); }
.anchor { color: var(--dim); opacity: 0; margin-left: .5ch; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; }
.doc a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.doc a:hover { text-decoration-color: var(--link); }
:not(pre) > code { background: var(--code); padding: 0 .4ch; color: var(--sel-ink); overflow-wrap: anywhere; }

.doc table { display: block; overflow-x: auto; border-collapse: collapse; margin: 6px 0 12px; }
.doc th, .doc td { text-align: left; padding: 3px 16px 3px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.doc th { color: var(--dim); font-weight: 400; }
.doc td:first-child { white-space: nowrap; }
.doc td:first-child code { background: none; padding: 0; color: var(--hot); }

.more { margin-top: 18px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--dim); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }

/* docs index: a card per section */
.index { columns: 2 40ch; column-gap: 14px; margin-top: 14px; }
.index .card { break-inside: avoid; border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; margin-bottom: 14px; }
.index h2 { margin: 0; font: inherit; }
.doc .index h2::before { content: none; }
.index h2 a { color: var(--accent); text-decoration: none; }
.index .sum { margin: 0 0 8px; color: var(--dim); }
.index ul { list-style: none; margin: 0; padding: 0; }
.index li { margin: 0 0 6px; }
.index li:last-child { margin-bottom: 0; }
.index li a { color: var(--link); text-decoration: none; }
.index li a::before { content: "› "; color: var(--accent); }
.index li a:hover, .index h2 a:hover { text-decoration: underline; }
.index li span { display: block; padding-left: 2ch; color: var(--dim); font-size: 13px; }

.toc { margin: 0 0 12px; }
.toc summary { cursor: pointer; color: var(--dim); }
.toc ul { margin: 6px 0 0; padding-left: 2ch; list-style: none; }
.toc ul ul { color: var(--dim); }

.status { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 0 18px; padding: 3px 0; background: var(--bar); color: var(--bar-ink); border-top: 1px solid var(--line); }
.status .mode { background: var(--accent); color: var(--bg); padding: 0 1ch; font-weight: 700; }
.status .right { margin-left: auto; padding-right: 1ch; color: var(--dim); }

@media (max-width: 760px) {
  .home { grid-template-columns: minmax(0, 1fr); grid-template-areas: "pastor" "live" "install" "can" "why" "not"; }
  .term, .home .live .term { font-size: 11px; height: 26em; min-height: 0; flex: none; }
  .term-big { width: 94vw; height: 70vh; }
  .docs { grid-template-columns: minmax(0, 1fr); }
  .list { position: relative; top: 0; }
  .list .topics { display: none; }
  .meta { display: none; }
  .status .right { display: none; }
}

/* the leave-the-site prompt: a pane floating over a dimmed screen */
.confirm { padding: 0; border: 0; background: transparent; color: var(--ink); width: min(56ch, calc(100vw - 32px)); overflow: visible; }
.confirm::backdrop { background: rgb(0 0 0 / .6); }
.confirm .pane { background: var(--bg); padding: 18px 16px 14px; margin-top: .8em; }
.confirm b { color: var(--link); font-weight: 400; overflow-wrap: anywhere; }
.choices { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 14px !important; }
.choices button { font: inherit; color: var(--ink); background: var(--sel); border: 1px solid var(--line); border-radius: 4px; padding: 2px 12px; cursor: pointer; }
.choices button:hover, .choices button:focus { border-color: var(--accent); color: var(--sel-ink); outline: none; }
.choices button:focus { background: var(--pick); }
.choices k { color: var(--accent); }
.confirm .hint { margin: 10px 0 0; color: var(--dim); font-size: 13px; }
.confirm .hint k { color: var(--accent); }
