/* Source Serif 4 of the book (book/fonts, OFL), for the SVG output of
   the live examples of ztcl::typeset. */
@font-face { font-family: "Source Serif 4"; src: url("../book/fonts/SourceSerif4-Regular.ttf") format("truetype"); font-display: swap; }

/* The style of the ztcl and ztk sites. The two sites use the same file.
   Only the accent tokens in the first two blocks differ. */
:root {
  color-scheme: light dark;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #ccfbf1;
  --accent-ink: #ffffff;
  --sib: #6d28d9;
  --bg: #ffffff;
  --bg-soft: #f6f7f8;
  --surface: #ffffff;
  --code-bg: #f3f4f6;
  --text: #16181d;
  --text-2: #4b5160;
  --text-3: #6b7180;
  --line: #e3e5ea;
  --line-strong: #cfd3da;
  --bar-muted: #9aa1ad;
  --warn: #9a5b00;
  --warn-soft: #fff6e5;
  --tok-kw: #7c3aed;
  --tok-str: #047857;
  --tok-var: #b45309;
  --tok-com: #6b7180;
  --tok-num: #be123c;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --wrap: 1120px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: #123b38;
    --accent-ink: #04201d;
    --sib: #8b5cf6;
    --bg: #0d0f12;
    --bg-soft: #13161b;
    --surface: #171a20;
    --code-bg: #1b1f26;
    --text: #eceef2;
    --text-2: #b4bac6;
    --text-3: #8b92a0;
    --line: #262b33;
    --line-strong: #353b45;
    --bar-muted: #5d6573;
    --warn: #f5b754;
    --warn-soft: #2a2114;
    --tok-kw: #c4a5ff;
    --tok-str: #6ee7b7;
    --tok-var: #fbbf6b;
    --tok-com: #8b92a0;
    --tok-num: #fb8aa3;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { color: var(--accent-strong); }
code, pre, kbd { font-family: var(--mono); }
img, svg { max-width: 100%; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 20; }
.skip:focus { left: 8px; }

/* The top bar of each page. */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 24px; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 700 19px/1 var(--mono); letter-spacing: -.01em; }
.logo:hover { color: var(--text); }
.logo .glyph { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 14px; }
.toplinks { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.toplinks a { color: var(--text-2); text-decoration: none; font-size: 15px; padding: 6px 10px; border-radius: 8px; }
.toplinks a:hover, .toplinks a[aria-current] { color: var(--text); background: var(--bg-soft); }
.toplinks .sib { display: inline-flex; gap: 6px; align-items: center; }
.toplinks .sib::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sib); }

/* Buttons. */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 10px; font-weight: 600; font-size: 15px; text-decoration: none; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); color: var(--accent-ink); }
.btn.ghost { border-color: var(--line-strong); color: var(--text); background: var(--surface); }
.btn.ghost:hover { border-color: var(--text-3); color: var(--text); }

/* The landing page. */
.hero { padding: 44px 0 40px; border-bottom: 1px solid var(--line); background:
  radial-gradient(1200px 400px at 85% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.pill { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px; margin-bottom: 14px; background: var(--surface); }
.pill b { color: var(--accent); font-weight: 600; }
.hero h1 { font-size: clamp(32px, 3.8vw, 46px); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 14px; font-weight: 750; }
.hero h1 em { display: block; font-style: normal; color: var(--accent); font-size: .62em; line-height: 1.2; letter-spacing: -.02em; margin-top: 6px; }
.hero .sub { font-size: 17px; line-height: 1.55; color: var(--text-2); margin: 0 0 20px; max-width: 36em; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero .meta { margin-top: 22px; font-size: 14px; color: var(--text-3); }

.codecard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.codecard .bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); font: 13px var(--mono); color: var(--text-3); background: var(--bg-soft); }
.codecard .bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); display: inline-block; }
.codecard .bar span { margin-left: 8px; }
.codecard pre { margin: 0; padding: 18px 20px; font-size: 14px; line-height: 1.6; overflow-x: auto; background: none; border-radius: 0; }
.codecard pre + pre { border-top: 1px dashed var(--line); }
.term { color: var(--text-2); }
.term .p { color: var(--accent); user-select: none; }
.k { color: var(--tok-kw); } .s { color: var(--tok-str); } .v { color: var(--tok-var); } .c { color: var(--tok-com); } .n { color: var(--tok-num); }

.stats { border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.stats .wrap { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 28px 24px 26px 0; }
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--line); }
.stat b { display: block; font-size: 30px; line-height: 1.1; letter-spacing: -.02em; font-weight: 700; }
.stat span { display: block; margin-top: 6px; color: var(--text-2); font-size: 14px; line-height: 1.45; }

.section { padding: 56px 0; border-bottom: 1px solid var(--line); }
.section.alt { background: var(--bg-soft); }
.eyebrow { font: 600 13px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }
.section h2 { font-size: clamp(26px, 3vw, 34px); line-height: 1.15; letter-spacing: -.025em; margin: 0 0 16px; font-weight: 720; max-width: 22em; }
.lede { font-size: 18px; color: var(--text-2); max-width: 40em; margin: 0 0 40px; }
.section h3 { font-size: 18px; margin: 0 0 8px; letter-spacing: -.01em; }
.section p { margin: 0 0 12px; }
.muted { color: var(--text-3); }
.small { font-size: 14px; }

.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; min-width: 0; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
.card .tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong); margin-bottom: 12px; }
.card .tag.plan { background: var(--bg-soft); color: var(--text-2); border: 1px solid var(--line); }
.card ul { padding-left: 20px; margin: 8px 0 0; color: var(--text-2); }
.card li + li { margin-top: 4px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: start; }

/* Bar charts: HTML rows. Each bar has its value as text. */
.chart { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px 24px 18px; }
.chart h3 { margin-bottom: 4px; }
.chart .how { font-size: 14px; color: var(--text-3); margin: 0 0 20px; }
.bars { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 10px 14px; align-items: center; margin: 0; }
.bars dt { font-size: 14px; color: var(--text-2); white-space: nowrap; }
.bars dd { margin: 0; display: contents; }
.bars .track { height: 22px; display: flex; align-items: center; }
.bars .fill { height: 100%; min-width: 3px; border-radius: 0 4px 4px 0; background: var(--accent); }
.bars .fill.base { background: var(--bar-muted); }
.bars .fill.t1 { background: color-mix(in srgb, var(--accent) 70%, var(--bg)); }
.bars .fill.t0 { background: color-mix(in srgb, var(--accent) 42%, var(--bg)); }
.bars .val { font: 600 14px var(--mono); text-align: right; }
.bars .val small { font-weight: 400; color: var(--text-3); }
.chart .note { font-size: 13px; color: var(--text-3); margin: 16px 0 0; }
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.multiples .chart { padding: 18px 18px 14px; }
.multiples h4 { font: 600 14px var(--mono); margin: 0 0 12px; }
.multiples .bars { gap: 6px 10px; }
.multiples .bars .track { height: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--text-2); margin: 0 0 16px; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; background: var(--accent); }
.legend i.base { background: var(--bar-muted); }
.legend i.t1 { background: color-mix(in srgb, var(--accent) 70%, var(--bg)); }
.legend i.t0 { background: color-mix(in srgb, var(--accent) 42%, var(--bg)); }

/* The benchmark charts of bench/compare/chart.py, in tabs by task family. */
.benchtabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.benchtabs[hidden] { display: none; }
.benchtabs button { font: 600 14px var(--sans); padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--text-2); cursor: pointer; }
.benchtabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.benchfig { margin: 0 0 16px; }
.prose .chart-img { display: block; width: 100%; max-width: 600px; height: auto; margin: 0 0 20px; }
.benchfig[hidden] { display: none; }
.benchfig img { display: block; width: 100%; max-width: 600px; height: auto; border: 1px solid var(--line); border-radius: 12px; }

.ktable { overflow-x: auto; }
.ktable table { border-collapse: collapse; width: 100%; font-size: 14px; }
.ktable th, .ktable td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: bottom; }
.ktable td { white-space: nowrap; }
.ktable tbody th, .ktable tbody td { vertical-align: middle; }
.chart .how code { white-space: nowrap; }
@media (max-width: 480px) { .ktable th, .ktable td { padding: 6px 4px; } .ktable td { font-size: 13px; } }
.ktable td { font: 600 14px var(--mono); }
.ktable thead th { font-size: 13px; font-weight: 600; color: var(--text-2); }
.ktable th[scope=row], .ktable thead th:first-child { text-align: left; font-weight: 400; color: var(--text-2); padding-left: 0; }
.ktable tbody tr:last-child td, .ktable tbody tr:last-child th { border-bottom: 0; }

.callout { border: 1px solid var(--line); border-left: 4px solid var(--warn); background: var(--warn-soft); border-radius: 0 12px 12px 0; padding: 16px 20px; margin: 24px 0 0; }
.callout p { margin: 0; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { position: relative; padding-left: 28px; margin: 0 0 10px; color: var(--text-2); }
.checks li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 12px; height: 7px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.checks li b { color: var(--text); }
.status { list-style: none; padding: 0; margin: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.status li { background: var(--surface); padding: 16px 20px; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; align-items: baseline; }
.status .st { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.st.ok { color: var(--accent); } .st.wip { color: var(--warn); } .st.plan { color: var(--text-3); } .st.no { color: var(--tok-num); }
.family { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; border: 1px solid var(--line); border-radius: 16px; padding: 28px 32px; background: var(--surface); }
.family h3 { font-size: 22px; margin: 0 0 6px; }
.family p { margin: 0; color: var(--text-2); }
.family .btn.sib-btn { background: var(--sib); color: #fff; }

/* The docs pages. */
.docs { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.sidebar { position: sticky; top: 60px; align-self: start; max-height: calc(100vh - 60px); overflow: auto; padding: 32px 4px 48px 0; font-size: 15px; }
.sidebar h2, .sidebar summary { font: 600 12px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); margin: 24px 0 8px; }
.sidebar h2:first-child { margin-top: 0; }
.sidebar summary { cursor: pointer; list-style-position: outside; }
.sidebar a.item { display: block; padding: 5px 10px; margin: 1px 0; border-radius: 8px; color: var(--text-2); text-decoration: none; line-height: 1.4; }
.sidebar a.item:hover { color: var(--text); background: var(--bg-soft); }
.sidebar a.item[aria-current] { color: var(--accent-strong); background: var(--accent-soft); font-weight: 600; }
.toc-toggle { position: absolute; opacity: 0; pointer-events: none; }
.toc-button { display: none; }
.prose { padding: 40px 0 80px; max-width: 780px; min-width: 0; }
.prose h1 { font-size: 38px; line-height: 1.15; letter-spacing: -.025em; margin: 0 0 24px; }
.prose h2 { font-size: 26px; line-height: 1.25; letter-spacing: -.015em; margin: 48px 0 12px; padding-top: 8px; }
.prose h3 { font-size: 20px; margin: 32px 0 8px; }
.prose h4 { font-size: 17px; margin: 24px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; overflow-wrap: break-word; }
.prose li + li { margin-top: 4px; }
.prose code { font-size: .88em; background: var(--code-bg); padding: .14em .36em; border-radius: 5px; }
.prose pre { background: var(--code-bg); border: 1px solid var(--line); padding: 16px 18px; border-radius: 10px; overflow: auto; line-height: 1.5; font-size: 14px; margin: 0 0 20px; }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose .table { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 10px; }
.prose table { border-collapse: collapse; min-width: 100%; font-size: 14.5px; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }
.prose th { background: var(--bg-soft); font-weight: 600; }
.prose td + td, .prose th + th { border-left: 1px solid var(--line); }
.prose blockquote { margin: 0 0 20px; padding: 4px 18px; border-left: 3px solid var(--line-strong); color: var(--text-2); }
.prose .alert { margin: 0 0 20px; padding: 12px 18px; border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--bg-soft); border-radius: 0 10px 10px 0; }
.prose .alert.warning { border-left-color: var(--warn); background: var(--warn-soft); }
.prose .alert p { margin: 0; }
.prose h1 + p, .prose h1 + .alert { margin-top: 0; }
.pager { margin-top: 56px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pager a { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; text-decoration: none; color: var(--text); }
.pager a:hover { border-color: var(--accent); color: var(--text); }
.pager a span { display: block; font-size: 13px; color: var(--text-3); }
.pager .next { text-align: right; grid-column: 2; }

.foot { padding: 40px 0 48px; color: var(--text-3); font-size: 14px; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; }
.foot a { color: var(--text-2); text-decoration: none; }
.foot a:hover { color: var(--text); }
.foot .right { margin-left: auto; display: flex; gap: 20px; flex-wrap: wrap; }
.docs-foot { border-top: 1px solid var(--line); }

@media (max-width: 960px) {
  .hero { padding: 32px 0 32px; }
  .hero .wrap, .split { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .g3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stats .wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .docs { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc-button { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; width: max-content; }
  .toc-button::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); }
  .toc-toggle:focus-visible + .toc-button { outline: 2px solid var(--accent); outline-offset: 2px; }
  .sidebar { display: none; position: static; max-height: none; padding: 8px 0 16px; border-bottom: 1px solid var(--line); }
  .toc-toggle:checked ~ .sidebar { display: block; }
  .prose { padding-top: 24px; }
}
@media (max-width: 640px) {
  .wrap, .docs { padding: 0 16px; }
  .top .wrap { gap: 12px; }
  .toplinks a { padding: 6px 7px; font-size: 14px; }
  .section { padding: 40px 0; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .hero .sub { font-size: 17px; }
  .stat { padding: 20px 12px 18px 0; }
  .stat + .stat { padding-left: 12px; }
  .stat:nth-child(3) { padding-left: 0; }
  .stat b { font-size: 24px; }
  .codecard pre { font-size: 13px; padding: 14px 16px; }
  .bars { grid-template-columns: minmax(0, 1fr) max-content; }
  .bars dt { grid-column: 1 / -1; margin-bottom: -6px; white-space: normal; }
  .multiples { grid-template-columns: minmax(0, 1fr); }
  .status li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .family { grid-template-columns: minmax(0, 1fr); padding: 22px; }
  .prose h1 { font-size: 30px; }
  .prose h2 { font-size: 22px; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager .next { grid-column: 1; }
  .foot .right { margin-left: 0; }
}
figure.chart { margin: 0; }
.bars dt code { font-size: 13px; color: var(--text-2); }
.bars .track.budget { position: relative; }
.bars .track.budget::after { content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px; border-left: 2px dashed var(--text-3); }
.bars .fill.over { background: var(--warn); }
.prose :not(pre) > code { overflow-wrap: anywhere; }

/* Live examples (assets/live.js): the code as an editor, and its output. */
.o { color: var(--accent); }
.live-demo { margin: 8px 0 28px; display: grid; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.live-demo .ld-code { position: relative; min-width: 0; background: var(--code-bg); }
.live-demo .ld-code pre, .live-demo .ld-code textarea { margin: 0; padding: 14px 16px; border: 0; border-radius: 0; background: none; font: 13px/1.55 var(--mono); tab-size: 4; white-space: pre-wrap; overflow-wrap: break-word; box-sizing: border-box; }
.live-demo .ld-code textarea { position: absolute; inset: 0; width: 100%; height: 100%; resize: none; overflow: hidden; color: transparent; caret-color: var(--text); outline: none; }
.live-demo .ld-code textarea::selection { background: var(--accent-soft); color: transparent; }
.live-demo .ld-code:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.live-demo .ld-out { margin: 0; padding: 10px 16px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: var(--bg-soft); font: 13px/1.5 var(--mono); white-space: pre-wrap; min-height: 1.5em; max-height: 16em; overflow: auto; }
.live-demo .ld-out:empty::before { content: "The output shows here."; color: var(--text-3); }
/* The files that an example of ztcl::typeset or ztcl::pdf writes: each
   SVG image inline, side by side, and each PDF in a viewer with a link to
   open it and a link to download it. The images keep a white page in
   each theme, as paper. */
.live-demo .ld-files { display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--line); }
.live-demo .ld-files[hidden] { display: none; }
.live-demo .ld-file { margin: 0; min-width: 0; }
.live-demo .ld-file figcaption { font: 12px/1.6 var(--mono); color: var(--text-3); }
.live-demo .ld-file figcaption a { margin-left: 10px; }
.live-demo .ld-file .ld-svg { background: #fff; color: #000; padding: 8px; border: 1px solid var(--line); border-radius: 4px; overflow: auto; max-width: 100%; }
.live-demo .ld-file .ld-svg svg { display: block; max-width: 100%; height: auto; }
.live-demo .ld-file iframe { display: block; width: min(560px, 80vw); height: 380px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.live-demo .ld-result { color: var(--text-3); }
.live-demo .ld-error { color: var(--warn); }
.live-demo .ld-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-3); }
.live-demo .ld-bar button { font: inherit; color: var(--text-2); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 3px 10px; cursor: pointer; }
.live-demo .ld-bar button:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.live-demo .ld-tag { font-weight: 650; }
.live-demo[data-live="1"] .ld-tag { color: var(--accent); }
.live-demo .ld-hud { margin-left: auto; font: 12px var(--mono); }

/* The shell in the page (assets/shell.js). The poster and the canvas have the same size. */
.zshell { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.zshell .bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); font: 13px var(--mono); color: var(--text-3); background: var(--bg-soft); }
.zshell .bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); display: inline-block; }
.zshell .bar span { margin-left: 8px; }
.zshell .bar label { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; font: 13px var(--sans); color: var(--text-2); cursor: pointer; }
.zshell-poster, .zshell-screen { margin: 0; padding: 10px 14px; font: 14px/21px var(--mono); background: none; border-radius: 0; color: var(--text); white-space: pre; overflow: hidden; }
.zshell-poster { height: calc(var(--rows, 14) * 21px + 20px); box-sizing: border-box; }
.zshell-poster .p { color: var(--tok-str); font-weight: 600; }
.zshell-screen { position: relative; padding: 0; cursor: text; }
.zshell-screen canvas { display: block; }
.zshell-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; resize: none; border: 0; padding: 0; color: transparent; background: transparent; caret-color: transparent; }
.zshell-screen:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.zshell-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--bg-soft); font-size: 13px; color: var(--text-3); }
.zshell-foot kbd { font: 12px var(--mono); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; color: var(--text-2); background: var(--surface); }
.zshell-meter { flex-basis: 100%; justify-content: flex-end; display: inline-flex; gap: 8px; align-items: center; font: 12px var(--mono); white-space: nowrap; min-width: 0; }
.zshell-meter progress { width: 56px; height: 6px; flex: none; accent-color: var(--accent); }
@media (max-width: 480px) { .zshell-meter { font-size: 10px; justify-content: flex-start; } }
.zshell-editor { border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--text); padding: 18px; width: min(640px, calc(100vw - 32px)); }
.zshell-editor::backdrop { background: rgba(0, 0, 0, .35); }
.zshell-editor label { display: grid; gap: 8px; font-weight: 600; }
.zshell-editor textarea { font: 14px/1.5 var(--mono); color: var(--text); background: var(--code-bg); border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px; width: 100%; box-sizing: border-box; }
.zshell-inspect h2 { margin: 0 0 6px; font-size: 18px; }
.zshell-inspect .note { margin: 0 0 12px; color: var(--text-2); font-size: 14px; }
.zshell-inspect .tree { max-height: 60vh; overflow: auto; font: 14px/1.5 var(--mono); }
.zshell-inspect .kids { margin-left: 18px; border-left: 1px solid var(--line); padding-left: 10px; }
.zshell-inspect summary, .zshell-inspect .leaf > b { cursor: pointer; }
.zshell-inspect .leaf { padding-left: 18px; }
.zshell-inspect .leaf span, .zshell-inspect summary span { color: var(--text-3); overflow-wrap: anywhere; }
.zshell-inspect .row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin: 2px 0 6px; font-size: 13px; }
.zshell-inspect .row code { overflow-wrap: anywhere; }
.zshell-inspect .row .btn { padding: 2px 10px; font-size: 13px; }
.zshell-editor .btns { display: flex; gap: 10px; margin-top: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.live-demo .ld-term { margin: 0; padding: 10px 16px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: var(--surface); color: var(--text); font: 13px/1.3 var(--mono); white-space: pre; overflow: auto; max-height: 24em; }
/* The helpers of a docs page (helper.js) and the shell of the page. */
.zpage-shell { margin: 24px 0 8px; }
.zshell .bar .zshell-dock { margin-left: auto; font: 13px var(--sans); color: var(--text-2); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.zshell .bar .zshell-dock + label { margin-left: 12px; }
.zshell .bar .zshell-dock[hidden] { display: none; }
.zshell .bar .zshell-dock[hidden] + label { margin-left: auto; }
.zshell-docked { position: fixed; z-index: 30; right: 16px; bottom: 16px; width: min(var(--dock-w), calc(100vw - 32px)); margin: 0; box-shadow: 0 12px 40px rgb(0 0 0 / 0.3); }
@media (max-width: 640px) {
  .zshell-docked { left: 0; right: 0; bottom: 0; width: 100%; border-radius: 14px 14px 0 0; }
}
.zsetup { margin: 0 0 24px; font-size: 14px; color: var(--text-2); }
.zsetup pre { margin-top: 8px; }
.zhelper { margin: 24px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; min-width: 0; }
.zhelper-bar { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--bg-soft); font-size: 13px; color: var(--text-3); }
.zhelper-bar .zhelper-tag { font: 600 11px var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; }
.zhelper-bar .zhelper-title { font: 600 14px var(--sans); color: var(--text); }
.zhelper-bar .zhelper-caption { flex-basis: 100%; font-size: 14px; color: var(--text-2); }
.zhelper-app { position: relative; overflow: hidden; }
.zhelper-open { margin-left: auto; padding: 2px 12px; font-size: 13px; }
@media (max-width: 640px) {
  .zhelper:not(.zhelper-opened) .zhelper-app { display: none; }
  .zhelper:not(.zhelper-opened) .zhelper-hint { display: none; }
}
.zhelper-poster { margin: 0; padding: 16px 14px; color: var(--text-3); font-size: 14px; }
.zhelper details { border-top: 1px solid var(--line); padding: 8px 14px; font-size: 14px; color: var(--text-2); }
.zhelper details pre { margin: 8px 0 0; }
.zfile { margin: 16px 0; }
.zfile figcaption { font-size: 13px; color: var(--text-3); margin-bottom: 4px; }

/* The Learn course: the shell is fixed in the window and starts closed,
   as the button Try it at the bottom right. The lesson keeps the page,
   and the button never covers its text: a wide window keeps a gutter at
   the right of the text, and a narrow window keeps a strip at the
   bottom. Open, the shell is a panel at the bottom right of a wide
   window, with a grip at its top left corner for its size, and a sheet
   at the bottom of a narrow one. shell.js opens and closes it. The page
   never scrolls to it, and a Run link never moves the page. */
body.course { --dock-w: 520px; --dock-h: 560px; --sheet: 42vh; --tab: 144px; }
.zcourse-dock { position: fixed; z-index: 20; right: 16px; bottom: 16px; display: flex; flex-direction: column; align-items: flex-end; }
.zcourse-open { font: 600 14px var(--sans); color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 999px; padding: 10px 18px; box-shadow: var(--shadow); cursor: pointer; }
.zcourse-open::before { content: "\25B6\FE0E"; font-size: .75em; margin-right: .5em; vertical-align: .1em; }
.zcourse-open:hover { background: var(--accent-strong); }
.zcourse-open:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.zcourse-dock.open .zcourse-open, .zcourse-dock:not(.open) .zcourse { display: none; }
.zcourse { position: relative; margin: 0; width: var(--dock-w); height: var(--dock-h); max-width: calc(100vw - 32px); max-height: calc(100vh - 92px); box-sizing: border-box; display: flex; flex-direction: column; min-height: 0; min-width: 0; box-shadow: var(--shadow); }
.zcourse .zshell-meter { white-space: normal; }
.zcourse .zshell-meter > span { min-width: 0; }
.zcourse .zshell-poster { flex: 1; height: auto; }
.zcourse .zshell-screen { flex: 1; min-height: 0; }
.zcourse .bar button { font: 13px var(--sans); color: var(--text-2); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.zcourse .bar button:first-of-type { margin-left: auto; }
.zcourse .bar button:hover { color: var(--text); }
.zcourse-grip { position: absolute; z-index: 1; left: 0; top: 0; width: 16px; height: 16px; cursor: nwse-resize; touch-action: none; border-top-left-radius: inherit; background: linear-gradient(135deg, var(--line-strong) 0 3px, transparent 3px 6px, var(--line-strong) 6px 7px, transparent 7px); }
@media (min-width: 961px) {
  body.course.zcourse-ready .docs { padding-right: max(24px, calc(var(--tab) - max(0px, (100vw - var(--wrap)) / 2))); }
}
@media (max-width: 960px) {
  .zcourse-dock { left: 0; right: 0; bottom: 0; align-items: stretch; }
  .zcourse-dock:not(.open) { align-items: flex-end; padding: 8px 16px; background: var(--bg); border-top: 1px solid var(--line); }
  body.course.zcourse-ready { padding-bottom: 57px; }
  .zcourse { width: auto; height: var(--sheet); max-width: none; max-height: none; border-radius: 14px 14px 0 0; box-shadow: 0 -8px 30px rgb(0 0 0 / 0.18); }
  .zcourse-grip { display: none; }
  body.course.zcourse-on .prose { padding-bottom: calc(var(--sheet) + 40px); }
  body.course.zcourse-on .docs-foot { padding-bottom: var(--sheet); }
}
/* A Run link: a command in code type that runs in the shell. */
.prose .zrun { cursor: pointer; }
.prose .zrun code { color: var(--accent-strong); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.prose .zrun code::before { content: "\25B6\FE0E"; font-size: .7em; margin-right: .4em; vertical-align: .1em; }
.prose .zrun:hover code, .prose .zrun:focus-visible code { background: var(--accent-soft); }
.prose .zrun:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 5px; }
.zdefine { margin: 0 0 20px; }
.zdefine pre { margin: 0; border-radius: 10px 10px 0 0; }
.zdefine figcaption { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; padding: 8px 12px; background: var(--bg-soft); }
.zdefine button { font: 600 14px var(--sans); color: #fff; background: var(--accent); border: 0; border-radius: 8px; padding: 6px 14px; cursor: pointer; }
#try-this + ul { border-left: 4px solid var(--accent); background: var(--bg-soft); border-radius: 0 10px 10px 0; padding: 12px 18px 12px 38px; }
@media (max-width: 420px) {
  .toplinks { gap: 0; }
  .toplinks a { padding: 6px 5px; }
}
@media (max-width: 640px) { .zcourse .zshell-hint { display: none; } }
.course .prose code { font-variant-ligatures: none; }
/* The index of the command reference. */
.ref-search input { font: 16px var(--mono); width: min(100%, 420px); padding: 8px 12px; margin-left: 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text); }
.ref-list { list-style: none; padding: 0; margin: 0 0 16px; }
.ref-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.ref-list li a { margin-right: 8px; }
.ref-cap { font: 600 11px var(--sans); letter-spacing: .05em; text-transform: uppercase; color: var(--warn); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; margin-right: 6px; }
.prose a.ref-link { text-decoration: none; }
.prose a.ref-link code { box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--accent) 55%, transparent); }
/* The stage of a live example of `dom` (docs/site/live.js): the root
   element of the script, with plain form controls. */
.live-demo .ld-stage { padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 15px; }
.live-demo .ld-stage p { margin: 0 0 8px; }
.live-demo .ld-stage ul { margin: 0 0 8px; padding-left: 22px; }
.live-demo .ld-stage input { font: inherit; padding: 5px 9px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); color: var(--text); max-width: 100%; box-sizing: border-box; }
.live-demo .ld-stage button { font: inherit; padding: 5px 12px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: var(--bg); cursor: pointer; }
