/* Tiza docs theme. Own code, no third-party CSS. System fonts only. */

:root {
  --accent: #f08b5b;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --header-h: 56px;
  --side-w: 264px;
  --toc-w: 224px;
  --radius: 6px;
}

:root[data-theme="light"] {
  --bg: #fbfaf7;
  --bg-side: #f4f2ed;
  --bg-elev: #ffffff;
  --fg: #22272b;
  --fg-muted: #5c6268;
  --fg-faint: #858a8f;
  --rule: #e2dfd7;
  --code-bg: #f1efe9;
  --code-fg: #24292e;
  --link: #b2501f;
  --accent-soft: rgba(240, 139, 91, 0.16);
  --mark: rgba(240, 139, 91, 0.35);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1b1f22;
  --bg-side: #1f2427;
  --bg-elev: #262c30;
  --fg: #ebe8df;
  --fg-muted: #a7aba6;
  --fg-faint: #7d827f;
  --rule: #343b40;
  --code-bg: #22282c;
  --code-fg: #e1e4e8;
  --link: #f08b5b;
  --accent-soft: rgba(240, 139, 91, 0.14);
  --mark: rgba(240, 139, 91, 0.32);
  color-scheme: dark;
}

/* Without JavaScript the script in <head> does not set data-theme: follow the system. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #1b1f22; --bg-side: #1f2427; --bg-elev: #262c30; --fg: #ebe8df; --fg-muted: #a7aba6;
    --fg-faint: #7d827f; --rule: #343b40; --code-bg: #22282c; --code-fg: #e1e4e8; --link: #f08b5b;
    --accent-soft: rgba(240, 139, 91, 0.14); --mark: rgba(240, 139, 91, 0.32); color-scheme: dark;
  }
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #fbfaf7; --bg-side: #f4f2ed; --bg-elev: #fff; --fg: #22272b; --fg-muted: #5c6268;
    --fg-faint: #858a8f; --rule: #e2dfd7; --code-bg: #f1efe9; --code-fg: #24292e; --link: #b2501f;
    --accent-soft: rgba(240, 139, 91, 0.16); --mark: rgba(240, 139, 91, 0.35); color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 var(--font);
  overflow-wrap: break-word;
}
a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
img { max-width: 100%; height: auto; }

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; top: 8px; z-index: 100; background: var(--bg-elev); padding: 6px 10px; }

/* Release line and header */
.release-bar {
  font-size: 13px;
  line-height: 1.4;
  padding: 6px 16px;
  text-align: center;
  color: var(--fg-muted);
  background: var(--bg-side);
  border-bottom: 1px solid var(--rule);
}
.release-bar code { font-size: 12px; }

.top {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; margin-right: 12px; }
.brand img { border-radius: 6px; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: 0.01em; }
.top-link { color: var(--fg-muted); text-decoration: none; font-size: 14px; }
.top-link:hover { color: var(--fg); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius);
  background: none; color: var(--fg-muted); cursor: pointer;
}
.icon-btn:hover { color: var(--fg); background: var(--bg-side); }
.nav-toggle { display: none; }
:root[data-theme="dark"] .i-moon, :root[data-theme="light"] .i-sun { display: none; }

/* Search */
.search { position: relative; flex: 0 1 380px; margin-left: auto; }
.search input {
  width: 100%; height: 36px;
  padding: 0 34px 0 34px;
  font: 14px var(--font); color: var(--fg);
  background: var(--bg-side);
  border: 1px solid var(--rule); border-radius: var(--radius);
}
.search input::placeholder { color: var(--fg-faint); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input::-webkit-search-cancel-button { display: none; }
.search-icon { position: absolute; left: 11px; top: 10px; color: var(--fg-faint); pointer-events: none; }
.search-key {
  position: absolute; right: 8px; top: 8px;
  font: 12px var(--mono); color: var(--fg-faint);
  border: 1px solid var(--rule); border-radius: 4px; padding: 0 6px; line-height: 18px;
}
.search-results {
  position: absolute; left: 0; right: 0; top: 42px;
  max-height: min(70vh, 560px); overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 6px;
}
.search-results ol { list-style: none; margin: 0; padding: 0; }
.search-results a { display: block; padding: 8px 10px; border-radius: 4px; color: var(--fg); text-decoration: none; }
.search-results a[aria-selected="true"], .search-results a:hover { background: var(--accent-soft); }
.search-results .r-title { display: block; font-weight: 600; font-size: 14px; }
.search-results .r-section { color: var(--fg-faint); font-weight: 400; font-size: 12px; margin-left: 6px; }
.search-results .r-snippet { display: block; font-size: 13px; color: var(--fg-muted); line-height: 1.45; margin-top: 2px; }
.search-results mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.search-results .r-empty { padding: 10px; font-size: 14px; color: var(--fg-muted); }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--toc-w);
  align-items: start;
  max-width: 1440px;
  margin: 0 auto;
}
.sidebar, .toc {
  position: sticky; top: var(--header-h);
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 24px 16px 40px;
}
.sidebar { border-right: 1px solid var(--rule); background: var(--bg-side); min-height: calc(100vh - var(--header-h)); }
.nav-group { margin-bottom: 14px; }
.nav-group summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; font-size: 15px; padding: 4px 8px; border-radius: 4px;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after {
  content: ""; width: 7px; height: 7px; margin-right: 4px;
  border-right: 1.5px solid var(--fg-faint); border-bottom: 1.5px solid var(--fg-faint);
  transform: rotate(45deg) translateY(-2px);
}
.nav-group:not([open]) > summary::after, .nav-sub details:not([open]) > summary::after { transform: rotate(-45deg); }
.nav-group ul { list-style: none; margin: 4px 0 0 8px; padding: 0 0 0 8px; border-left: 1px solid var(--rule); }
/* A page with a group of pages: the arrow of the group is on the row of the
   page, at the same place as the arrow of a section. */
.nav-sub { position: relative; }
.nav-sub > a { padding-right: 36px; }
.nav-sub summary { position: absolute; top: 0; right: 0; width: 40px; height: 28px; padding: 0 8px; justify-content: flex-end; }
.nav-group li a {
  display: block; padding: 4px 10px; margin-left: -9px;
  font-size: 14px; line-height: 1.4; color: var(--fg-muted); text-decoration: none;
  border-left: 2px solid transparent; border-radius: 0 4px 4px 0;
}
.nav-group li a:hover { color: var(--fg); }
/* "true": a page under this entry that the navigation does not show, such as the notes of one release. */
.nav-group li a[aria-current="page"], .nav-group li a[aria-current="true"] { color: var(--fg); font-weight: 600; background: var(--accent-soft); border-left-color: var(--accent); }
.nav-group code, .toc code { font-size: 0.9em; background: none; padding: 0; }
.nav-foot { font-size: 13px; padding: 8px; margin: 16px 0 0; border-top: 1px solid var(--rule); }
.nav-foot a { color: var(--fg-muted); }
.nav-scrim { display: none; }

.toc { font-size: 13px; padding-left: 20px; }
.toc-title { font-weight: 600; font-size: 14px; margin: 0 0 8px; color: var(--fg); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc ul ul { padding-left: 14px; }
.toc a { display: block; padding: 3px 0; color: var(--fg-muted); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--fg); }
.toc a.active { color: var(--link); }

/* Content */
.main { min-width: 0; padding: 32px 48px 80px; }
.doc { max-width: 46rem; margin: 0 auto; }
.crumb { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--accent); letter-spacing: 0.02em; text-transform: uppercase; }
.doc h1 { font-size: 2.25rem; line-height: 1.2; margin: 0 0 24px; letter-spacing: -0.01em; }
.doc h2 { font-size: 1.5rem; line-height: 1.3; margin: 1.8em 0 0.6em; padding-top: 0.9em; border-top: 1px solid var(--rule); }
.doc h3 { font-size: 1.15rem; margin: 1.8em 0 0.5em; }
.doc h4 { font-size: 1rem; margin: 1.5em 0 0.4em; }
.doc h1 code, .doc h2 code, .doc h3 code { font-size: 0.9em; }
.doc .heading-link { color: inherit; text-decoration: none; }
.doc .heading-link:hover { text-decoration: underline; text-decoration-color: var(--fg-faint); text-underline-offset: 4px; }
/* The padding makes a touch target of about 44 px; the negative margin keeps
   the line as it was. */
.doc .anchor { color: var(--fg-faint); text-decoration: none; font-weight: 400; opacity: 0; padding: 10px 12px; margin: -10px -12px -10px -8px; }
.doc :is(h2, h3, h4):hover .anchor, .doc :is(h2, h3, h4):focus-within .anchor { opacity: 1; }
@media (hover: none) { .doc .anchor { opacity: 0.7; } }
.doc .anchor-copied { margin-left: 10px; font-size: 0.8rem; font-weight: 400; color: var(--fg-muted); }
.doc .anchor-copied:empty { display: none; }
.doc p, .doc ul, .doc ol { margin: 0 0 1em; }
/* The numbers and the bullets of a list line up with the left edge of the
   text. 1.6em leaves room for a number with two digits, such as "10.". */
.doc ul, .doc ol { padding-left: 1.6em; }
.doc li { margin: 0.25em 0; }
.doc li > p { margin: 0; }
.doc hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.doc blockquote { margin: 0 0 1em; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--fg-muted); background: var(--bg-side); border-radius: 0 var(--radius) var(--radius) 0; }
.doc blockquote p { margin: 0.5em 0; }
/* Options of a command: each option is a block with space around it, and
   its text is indented under the option. */
.doc dl { margin: 0 0 1.4em; }
.doc dt { margin: 1.3em 0 0; font-weight: 600; }
.doc dt:first-child { margin-top: 0.4em; }
.doc dd { margin: 0.35em 0 0 1.25em; padding-left: 12px; border-left: 2px solid var(--rule); }
.doc dd > p { margin: 0 0 0.4em; }
.doc dd > p:last-child { margin-bottom: 0; }

code, kbd, pre { font-family: var(--mono); }
.doc :not(pre) > code {
  font-size: 0.86em; padding: 0.12em 0.36em;
  background: var(--code-bg); border: 1px solid var(--rule); border-radius: 4px;
  overflow-wrap: break-word;
}
.doc a code { color: var(--link); }
.doc pre {
  position: relative;
  margin: 0 0 1.2em; padding: 14px 16px;
  font-size: 13.5px; line-height: 1.2;
  background: var(--code-bg) !important; color: var(--code-fg);
  border: 1px solid var(--rule); border-radius: var(--radius);
  overflow-x: auto;
  tab-size: 4;
}
.doc pre code { font-size: inherit; background: none; border: 0; padding: 0; white-space: pre; }
/* A Tiza frame in a folded block (<details>) is a text export of 92
   columns. At this size the whole frame shows, without a scroll, in a
   window of 1280 px or more. */
.doc details pre { font-size: 11.5px; }
/* site.js marks a block of `:` commands: a long command wraps, and its next
   rows are indented, so it still reads as one command. */
.doc pre.cmds code { white-space: normal; }
.doc pre.cmds .cmd {
  display: block; white-space: pre-wrap; overflow-wrap: anywhere;
  padding-left: 2ch; text-indent: -2ch;
}
/* site.js puts each block in a .code-block with a "Copy" button. The button
   is text with no border, and it always shows, also on a touch screen. */
.doc .code-block { position: relative; margin: 0 0 1.2em; }
.doc .code-block > pre { margin: 0; padding-right: 4.5em; }
.copy-btn {
  position: absolute; top: 6px; right: 6px;
  font: 12px/1 var(--font); color: var(--fg-muted);
  background: var(--code-bg); border: 0; border-radius: 4px;
  padding: 5px 8px; cursor: pointer;
}
.copy-btn:hover { color: var(--fg); background: var(--bg-side); }
.copy-btn.done { color: var(--link); }
/* A frame: the image, and the block that makes it. site.js makes the two
   panels tabs: words in capitals, a thin rule under the band, and a bar in
   the accent color under the open tab. Without the script, the two panels
   show one under the other. */
.doc .frame { margin: 0 0 1.4em; }
.doc .frame-tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--rule); }
.doc .frame-tabs [role="tab"] {
  margin-bottom: -1px; padding: 10px 16px 9px;
  font: 600 12.5px/1 var(--font); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-muted); background: none; border: 0; border-bottom: 3px solid transparent;
  cursor: pointer;
}
.doc .frame-tabs [role="tab"]:hover { color: var(--fg); background: var(--bg-side); }
.doc .frame-tabs [role="tab"][aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.doc .frame-image img { display: block; max-width: 100%; height: auto; }
.doc .frame:not(.tabbed) .frame-source { margin-top: 14px; }
.doc .frame-file { margin: 0 0 6px; font: 12px/1.4 var(--mono); color: var(--fg-muted); }
.doc .frame-source .code-block { margin: 0; }
.doc .frame-how { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--fg-muted); }
/* On paper: both panels of a frame, and no tabs or buttons. */
@media print {
  .doc .frame-tabs, .copy-btn { display: none; }
  .doc .frame-panel[hidden] { display: block; content-visibility: visible; }
  .doc .frame-source { margin-top: 14px; }
}
/* A prompt block: text that the reader copies and gives to an agent. It is
   prose, so it wraps and uses the text font. */
.doc .prompt-block { margin: 0 0 1.4em; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--code-bg); }
.doc .prompt-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--rule);
  font-size: 0.85rem; font-weight: 600; color: var(--fg-muted);
}
.doc .prompt-copy {
  font: 600 0.85rem var(--font); color: var(--fg);
  background: var(--bg-elev); border: 1px solid var(--rule); border-radius: 4px;
  min-height: 34px; padding: 4px 12px; cursor: pointer;
}
.doc .prompt-copy:hover { border-color: var(--fg-faint); }
.doc pre.prompt { margin: 0; padding: 18px 20px 20px; border: 0; border-radius: 0 0 var(--radius) var(--radius); }
.doc pre.prompt code { font: 0.95rem/1.5 var(--font); white-space: pre-wrap; overflow-wrap: anywhere; }
.doc pre.prompt .prompt-line { display: block; margin-bottom: 0.6em; }
.doc pre.prompt .prompt-line:last-child { margin-bottom: 0; }
.doc pre.prompt .prompt-line:empty { height: 0.6em; }
.doc pre.prompt .prompt-url { font: 0.85rem/1.5 var(--mono); color: var(--fg-muted); }

/* Tables: thin rules. build.py puts each table in .table-wrap: a wide table
   scrolls in that box, and the page does not scroll sideways. */
.doc .table-wrap { max-width: 100%; overflow-x: auto; margin: 0 0 1.4em; }
.doc table {
  border-collapse: collapse; margin: 0; font-size: 14.5px; line-height: 1.5;
}
.doc th, .doc td { text-align: left; vertical-align: top; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--rule); }
.doc th { font-weight: 600; border-bottom-color: var(--fg-faint); white-space: nowrap; }
.doc td:last-child, .doc th:last-child { padding-right: 0; }

/* The GitHub alerts. */
.doc .markdown-alert {
  margin: 0 0 1.5em; padding: 10px 16px;
  border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--accent-soft); color: var(--fg);
}

/* Home: the README. */
.home > p:first-child { margin: 8px 0 28px; }
.home > p:first-child img { width: 480px; }
.home h2 { font-size: 1.4rem; }

.section-list { font-size: 17px; }

.page-foot { margin-top: 64px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 14px; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.pager a { display: block; padding: 10px 14px; border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; color: var(--fg); max-width: 48%; }
.pager a:hover { border-color: var(--accent); }
.pager a span { display: block; font-size: 12px; color: var(--fg-faint); }
.pager .next { text-align: right; margin-left: auto; }
.source-link a { color: var(--fg-muted); }

/* Medium: no "On this page" column. */
@media (max-width: 1180px) {
  .layout { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .toc { display: none; }
  .main { padding: 32px 36px 80px; }
}

/* Narrow: the navigation becomes a drawer, the search gets its own row. */
@media (max-width: 860px) {
  .top { height: auto; flex-wrap: wrap; padding: 8px 12px; row-gap: 8px; }
  .nav-toggle { display: inline-flex; margin-left: -6px; }
  .brand { margin-right: auto; }
  .top-link { display: none; }
  .search { order: 5; flex: 1 1 100%; margin: 0; }
  .search-key { display: none; }
  .search input { font-size: 16px; }
  html { scroll-padding-top: 120px; }
  .layout { display: block; }
  .sidebar {
    position: fixed; z-index: 40; top: 0; bottom: 0; left: 0;
    width: min(300px, 85vw); max-height: none; min-height: 0;
    transform: translateX(-100%); transition: transform 0.18s ease, visibility 0.18s;
    visibility: hidden;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0, 0, 0, 0.25); }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.4); }
  .main { padding: 24px 16px 64px; }
  .doc h1 { font-size: 1.8rem; }
  .doc h2 { font-size: 1.3rem; }
  .pager a { max-width: none; flex: 1; }
  .home > p:first-child img { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* Inline code in a page title: no box. */
.doc h1 code { background: none; border: 0; padding: 0; color: var(--accent); font-size: 0.92em; }
