/* skrrt docs. One theme: the Vim/Neovim "murphy" colorscheme.
   Colors are murphy's own highlight groups (runtime/colors/murphy.vim). */
@font-face {
  font-family: "BigBlueTerm437";
  src: url("fonts/BigBlueTerm437.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
/* BigBlue Terminal by VileR, Nerd Fonts build, CC BY-SA 4.0. One weight only: keep the pixels crisp instead of faking bold. */
html { font-synthesis: none; }

:root {
  --normal: #87ff87;      /* Normal fg */
  --bg: #000000;          /* Normal bg */
  --title: #ff00ff;       /* Title, Special */
  --comment: #ffa700;     /* Comment, WarningMsg */
  --ident: #00ffff;       /* Identifier, Directory, Question */
  --statement: #ffff00;   /* Statement, LineNr */
  --constant: #ffffff;    /* Constant */
  --preproc: #ffd7af;     /* PreProc */
  --type: #bcbcbc;        /* Type */
  --nontext: #00afaf;     /* NonText, Underlined */
  --eob: #0000ff;         /* EndOfBuffer, Search bg, Todo fg */
  --statusline: #00008b;  /* StatusLine bg */
  --statusline-nc: #3a3a3a; /* StatusLineNC bg, VertSplit */
  --pmenu: #444444;       /* Pmenu bg, TabLine bg, CursorLine */
  --tabfill: #303030;     /* TabLineFill */
  --colorcolumn: #262626; /* ColorColumn */
  --visual: #005f00;      /* Visual bg */
  --error: #ff0000;       /* Error bg */
  --diffadd: #5f875f;     /* DiffAdd bg */
  --mono: "BigBlueTerm437", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", "Courier New", monospace;
  --sl-h: 3rem;           /* statusline height (phone) */
  --gutter: 1rem;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--normal);
  font-family: var(--mono);
  font-size: 0.9375rem;
  line-height: 1.65;
  padding-bottom: calc(var(--sl-h) + env(safe-area-inset-bottom, 0px));
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--visual); color: var(--constant); }

a { color: var(--ident); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { background: var(--ident); color: var(--bg); text-decoration: none; }
:focus-visible { outline: 2px solid var(--statement); outline-offset: 2px; }

.skip {
  position: absolute; left: -999rem; top: 0;
  background: var(--statement); color: var(--bg); padding: 0.75rem 1rem; z-index: 50;
}
.skip:focus { left: 0; }

/* ---------- tabline (top) ---------- */
.tabline {
  background: var(--tabfill);
  display: flex;
  align-items: stretch;
  min-height: 2.75rem;
}
.tabline a {
  display: flex; align-items: center;
  padding: 0 1ch;
  min-height: 2.75rem;
  color: var(--normal);
  background: var(--pmenu);
  text-decoration: none;
  white-space: nowrap;
  border-right: 1px solid var(--tabfill);
}
.tabline a:hover { background: var(--statement); color: var(--bg); }
.tabline a[aria-current="page"], .tabline .here { background: var(--bg); color: var(--constant); }
.tabline .brand { font-weight: 700; color: var(--title); background: var(--bg); letter-spacing: 0.02em; }
.tabline .brand:hover { color: var(--bg); background: var(--title); }
.tabline .here {
  display: flex; align-items: center; padding: 0 1ch; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--type); background: var(--tabfill);
}
.tabline nav { display: none; }
.tabline .fill { flex: 1; }

/* ---------- buffer (main) ---------- */
main {
  display: block;
  max-width: 84ch;
  margin: 0 auto;
  padding: 1.25rem var(--gutter) 0;
}

h1, h2, h3 { color: var(--title); font-weight: 700; line-height: 1.3; margin: 2.2em 0 0.7em; }
h1 { font-size: 1.3rem; margin-top: 0.5em; }
h2 { font-size: 1.1rem; padding-top: 0.6em; border-top: 1px solid var(--statusline-nc); }
h3 { font-size: 1rem; }
h1::before { content: "# "; content: "# " / ""; }
h2::before { content: "## "; content: "## " / ""; }
h3::before { content: "### "; content: "### " / ""; }
h1::before, h2::before, h3::before { color: var(--nontext); font-weight: 400; }

p, ul, ol, dl, figure, .tablewrap, .note { margin: 0 0 1.15em; }
.lede { color: var(--constant); }
strong { color: var(--constant); font-weight: 700; }
em { font-style: italic; }
dfn { font-style: normal; color: var(--statement); }
abbr { text-decoration: none; }

ul, ol { padding-left: 3ch; }
ul { list-style: none; }
ul > li { position: relative; }
ul > li::before { content: "-"; position: absolute; left: -2ch; color: var(--statement); }
ol > li::marker { color: var(--statement); }
li { margin-bottom: 0.45em; }
li > ul, li > ol { margin-top: 0.45em; margin-bottom: 0; }

code, kbd, pre, samp { font-family: var(--mono); font-size: 1em; }
:not(pre) > code {
  color: var(--preproc);
  background: var(--colorcolumn);
  padding: 0.05em 0.35em;
  overflow-wrap: anywhere;
}
a > code { color: inherit; background: none; padding: 0; }

dl.opts dt { color: var(--ident); margin-top: 0.9em; overflow-wrap: anywhere; }
dl.opts dt code { color: var(--ident); background: none; padding: 0; }
dl.opts dt .def { color: var(--type); }
dl.opts dd { margin: 0.15em 0 0 2ch; }

dl.terms dt { color: var(--statement); font-weight: 700; margin-top: 1em; }
dl.terms dd { margin: 0.2em 0 0 2ch; }

.note {
  border-left: 2px solid var(--statement);
  padding: 0.1em 0 0.1em 1.5ch;
}
.note > :last-child { margin-bottom: 0; }
.tag { background: var(--statement); color: var(--eob); padding: 0 0.6ch; font-weight: 700; }   /* Todo */
.warn .tag { background: none; color: var(--comment); padding: 0; }                             /* WarningMsg */
.warn { border-left-color: var(--comment); }
.ok { background: var(--diffadd); color: var(--constant); padding: 0 0.6ch; }                   /* DiffAdd */
.err { background: var(--error); color: var(--constant); padding: 0 0.6ch; }                    /* ErrorMsg */

/* ---------- code windows ---------- */
figure.code { border: 1px solid var(--statusline-nc); background: var(--bg); }
.code-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--statusline-nc); color: var(--constant);
  padding-left: 1ch; min-height: 2.75rem; font-size: 0.875rem;
}
.code-bar .copy {
  font: inherit; color: var(--bg); background: var(--statement); border: 0; border-radius: 0;
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 1.5ch; cursor: pointer;
}
.code-bar .copy:hover { background: var(--constant); }
.code-bar .copy.done { background: var(--diffadd); color: var(--constant); }
pre {
  margin: 0; padding: 0.7em 1ch 0.7em 0;
  overflow-x: auto; overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  line-height: 1.5; font-size: 0.875rem;
  tab-size: 2; white-space: pre;
  color: var(--normal);
  scrollbar-color: var(--type) var(--tabfill);       /* PmenuThumb / PmenuSbar */
}
pre code { counter-reset: ln; display: block; width: max-content; min-width: 100%; }
pre .l::before {
  counter-increment: ln; content: counter(ln);
  display: inline-block; width: 3ch; margin-right: 1.5ch;
  text-align: right; color: var(--statement);          /* LineNr */
  -webkit-user-select: none; user-select: none;
}
/* a quoted report: prose lines wrap, table rows keep their shape and scroll inside the block */
figure.code[data-wrap] pre { white-space: pre-wrap; overflow-wrap: anywhere; }
figure.code[data-wrap] pre code { width: auto; }
figure.code[data-wrap] .l { display: block; padding-left: 4.5ch; text-indent: -4.5ch; min-height: 1.5em; }
figure.code[data-wrap] .l::before { text-indent: 0; }
figure.code[data-wrap] .l.tr { white-space: pre; }
.c { color: var(--comment); }      /* Comment */
.k { color: var(--statement); }    /* Statement */
.i { color: var(--ident); }        /* Identifier */
.s { color: var(--constant); }     /* Constant */
.p { color: var(--preproc); }      /* PreProc */
.t { color: var(--type); }         /* Type */
.x { color: var(--title); }        /* Special */
.h { color: var(--title); font-weight: 700; }  /* Title */
.n { color: var(--nontext); }      /* NonText */

/* ---------- ASCII art ---------- */
figure.art { margin-left: 0; margin-right: 0; container-type: inline-size; }
pre.ascii {
  padding: 0; overflow: hidden; line-height: 1.25;
  /* never wider than the viewport: 1 column is about 0.61em in every monospace stack above */
  font-size: min(0.9375rem, calc((100vw - 2 * var(--gutter)) / (var(--cols) * 0.67)));
  font-size: min(0.9375rem, calc(100cqw / (var(--cols) * 0.67)));   /* measured against the figure where supported */
}
.wide { display: none; }
figcaption { color: var(--comment); font-size: 0.875rem; margin-top: 0.7em; }
figcaption::before { content: "\" "; content: "\" " / ""; }

.hero { padding-top: 0.5rem; }
.hero pre.ascii { color: var(--normal); font-weight: 700; }
.hero pre.word { line-height: 1.1; }
.nw { white-space: nowrap; }
.hero pre.marks { color: var(--type); font-weight: 400; margin-top: 0.35em; }
.hero h1 { font-size: 1.2rem; margin: 1.2em 0 0.6em; color: var(--constant); }
.hero h1::before { content: none; }
.hero h1 b { color: var(--title); }

/* a little Neovim window holding the dithered loop: tabline, buffer, statusline */
.nvwin { display: block; width: 322px; max-width: 100%; margin: 1.2em 0 1.4em; border: 1px solid var(--statusline-nc); background: var(--bg); }
.nvwin img { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; }
.nvwin-tab, .nvwin-status { display: flex; font-size: 0.75rem; line-height: 1.7; white-space: nowrap; overflow: hidden; }
.nvwin-tab { background: var(--tabfill); color: var(--type); }
.nvwin-tab .cur { background: var(--bg); color: var(--constant); padding: 0 1ch; }
.nvwin-tab .ro { padding: 0 1ch; color: var(--comment); }
.nvwin .fill { flex: 1; }
.nvwin-status { background: var(--statusline); color: var(--constant); }
.nvwin-status .mode { background: var(--statement); color: var(--bg); padding: 0 1ch; }
.nvwin-status .f, .nvwin-status .r { padding: 0 1ch; }
.nvwin-status .r { color: var(--type); }
@media (min-width: 760px) { .nvwin { width: 642px; } }
@media (prefers-reduced-motion: reduce) { .nvwin img { visibility: hidden; height: 0; } .nvwin-status .r::after { content: " (motion off)"; } }
.cmdline { color: var(--constant); margin: 1.2em 0; overflow-wrap: anywhere; }
.cmdline .n { color: var(--statement); }
.cursor { display: inline-block; width: 1ch; height: 1.15em; vertical-align: text-bottom; background: var(--normal); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } html { scroll-behavior: auto; } }

/* ---------- tables ---------- */
.tablewrap { scrollbar-color: var(--type) var(--tabfill); overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--statusline-nc); }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
th, td { text-align: left; vertical-align: top; padding: 0.5em 1ch; border-bottom: 1px solid var(--statusline-nc); }
tr:last-child td { border-bottom: 0; }
th { color: var(--constant); background: var(--tabfill); font-weight: 700; white-space: nowrap; }
td.nw, th.nw { white-space: nowrap; }
td code { background: none !important; padding: 0 !important; }

/* ---------- FAQ ---------- */
.faq h3 { color: var(--ident); }               /* Question */
.faq h3::before { content: "Q: "; content: "Q: " / ""; color: var(--nontext); }

/* ---------- pager, end of buffer, footer ---------- */
.pager { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 2.5em 0 1em; }
.pager a {
  flex: 1 1 14ch; min-height: 2.75rem; display: flex; align-items: center;
  padding: 0.4em 1ch; background: var(--pmenu); color: var(--constant); text-decoration: none;
}
.pager a:hover { background: var(--statement); color: var(--bg); }
.pager a.next { justify-content: flex-end; text-align: right; }
.pager .n { color: var(--normal); }
.pager a:hover .n { color: var(--bg); }

.eob { color: var(--eob); margin: 0; padding: 0 var(--gutter); max-width: 84ch; margin: 0 auto; line-height: 1.5; -webkit-user-select: none; user-select: none; }
.eob span { display: block; }

footer {
  max-width: 84ch; margin: 0 auto; padding: 0.5rem var(--gutter) 1.5rem;
  color: var(--type); font-size: 0.875rem;
}
footer p { margin: 0 0 0.5em; }
footer a { display: inline-flex; align-items: center; min-height: 2.75rem; }

/* ---------- statusline (bottom, fixed) ---------- */
.statusline {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--statusline); color: var(--constant);
  display: flex; align-items: stretch;
  min-height: var(--sl-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  font-size: 0.875rem;
}
.statusline .file { flex: 1; min-width: 0; display: flex; align-items: center; padding: 0 1ch; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.statusline .ruler { display: flex; align-items: center; padding: 0 1ch; white-space: nowrap; }
.statusline .enc { display: none; }

.menu { display: flex; }
.menu > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  min-width: 5.5rem; min-height: var(--sl-h); padding: 0 1.5ch;
  background: var(--statement); color: var(--bg); font-weight: 700;     /* WildMenu */
  -webkit-user-select: none; user-select: none;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--constant); }
.menu .panel {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--sl-h) + env(safe-area-inset-bottom, 0px));
  max-height: calc(100vh - var(--sl-h) - 1rem); max-height: calc(100dvh - var(--sl-h) - 1rem);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--pmenu);                                             /* Pmenu */
  border-top: 1px solid var(--type);
}
.menu .panel a {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 3rem; padding: 0 2ch;
  color: var(--constant); text-decoration: none; font-size: 1rem;
}
.menu .panel a .n { color: var(--type); font-size: 0.8125rem; }
.menu .panel a:hover, .menu .panel a:focus-visible, .menu .panel a[aria-current="page"] {
  background: var(--statement); color: var(--bg);                       /* PmenuSel */
}
.menu .panel a:hover .n, .menu .panel a:focus-visible .n, .menu .panel a[aria-current="page"] .n { color: var(--bg); }

/* ---------- small phones ---------- */
@media (max-width: 23.5rem) {
  body { font-size: 0.875rem; }
  pre { font-size: 0.8125rem; }
}

/* ---------- wide enough for the 73-column art ---------- */
@media (min-width: 50rem) {
  .wide { display: block; }
  .narrow { display: none; }
}

/* ---------- desktop: tabs on top, slim statusline ---------- */
@media (min-width: 62rem) {
  :root { --sl-h: 1.9rem; --gutter: 2ch; }
  body { font-size: 1rem; }
  .tabline { position: sticky; top: 0; z-index: 20; min-height: 2.1rem; }
  .tabline a { min-height: 2.1rem; padding: 0 1.4ch; }
  .tabline nav { display: flex; }
  .tabline .here { display: none; }
  html { scroll-padding-top: 3.2rem; }
  .menu { display: none; }
  .statusline .enc { display: flex; align-items: center; padding: 0 1ch; color: var(--type); }
  .code-bar { min-height: 2rem; }
  .code-bar .copy { min-height: 2rem; }
  h1 { font-size: 1.45rem; }
  .hero h1 { font-size: 1.35rem; }
  h2 { font-size: 1.15rem; }
  main { padding-top: 2rem; }
}

@media print {
  .tabline, .statusline, .eob, .pager, .code-bar .copy { display: none; }
  body { padding: 0; }
}
