/* zabagit theme "plain": a starting point, owner-curated (DESIGN section 10).
   Contract: colors and spacing live in custom properties on :root; markup class names
   are stable, so themes stay pure CSS. Dark mode via prefers-color-scheme. */

:root {
    color-scheme: light dark;  /* the browser's own widgets (fields, scrollbars) follow too */
    --bg: #ffffff;
    --fg: #1a1a1a;
    --muted: #5a5a5a;
    --link: #0b57d0;
    --border: #d8d8d8;
    --code-bg: #f4f4f4;
    --accent: #0b57d0;
    --select: #fff3bf;
    --add: #3f9b3f;
    --del: #c0392b;
    --hl-keyword: #a626a4;
    --hl-string: #50a14f;
    --hl-comment: #6a737d;
    --hl-number: #986801;
    --hl-name: #4078f2;
    --hl-builtin: #c18401;
    --gap: 1rem;
    --measure: 60rem;
    --font: system-ui, sans-serif;
    --mono: ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121212;
        --fg: #e6e6e6;
        --muted: #a0a0a0;
        --link: #8ab4f8;
        --border: #333333;
        --code-bg: #1e1e1e;
        --accent: #8ab4f8;
        --select: #4a3f10;
        --add: #3f9b3f;
        --del: #c0392b;
        --hl-keyword: #c678dd;
        --hl-string: #98c379;
        --hl-comment: #7f848e;
        --hl-number: #d19a66;
        --hl-name: #61afef;
        --hl-builtin: #e5c07b;
    }
}

html {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    line-height: 1.5;
}

body {
    margin: 0 auto;
    padding: 0 var(--gap);
    max-width: var(--measure);
    overflow-wrap: break-word;  /* an unbroken string breaks instead of widening the page */
}

a {
    color: var(--link);
}

header {
    border-bottom: 1px solid var(--border);
    padding: var(--gap) 0;
}

header .site {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

header h1 {
    margin: 0.2rem 0;
    font-size: 1.6rem;
}

header h1 a {
    color: inherit;
    text-decoration: none;
}

header .description {
    margin: 0 0 var(--gap);
    color: var(--muted);
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--gap) / 2) var(--gap);
}

nav a {
    text-decoration: none;
    padding: 0.2rem 0;
    border-bottom: 2px solid transparent;
}

nav a[aria-current="page"] {
    border-bottom-color: var(--accent);
    font-weight: bold;
}

main {
    padding: var(--gap) 0;
}

.readme img {
  max-width: 100%;
  height: auto;
}
table.log,
table.refs,
table.repos {
  border-collapse: collapse;
  width: 100%;
}
table.log th,
table.log td,
table.refs th,
table.refs td,
table.repos th,
table.repos td {
  text-align: left;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
td {
  overflow-wrap: anywhere;  /* a long name or subject narrows its column, not the page */
}
table.repos td.name {
  overflow-wrap: break-word;  /* a repo name breaks only if it alone is too wide */
}
table.log time,
table.refs time,
table.repos time {
  white-space: nowrap;
}
.refs-link {
  color: var(--muted);
}
.branch-deco,
.tag-deco,
.tag-annotated-deco {
  font-size: 0.85em;
  padding: 0 0.3em;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.branch-deco {
  color: var(--accent);
}
.tag-annotated-deco {
  font-weight: bold;
}
.search input {
  width: 100%;
  max-width: 40em;
  font: inherit;
  padding: 0.3em;
}
.search-results li[aria-selected="true"] {
  background: var(--border);
}
.issue-new input[type="text"],
.issue-new textarea {
  width: 100%;
  max-width: 40em;
  font: inherit;
  padding: 0.3em;
}
.issue-new .hp {
  display: none; /* the honeypot: people never see it, form-filling bots do */
}
table.tasks td {
  white-space: normal;
}
table.issues .number,
table.issues .replies {
  white-space: nowrap;
}
.status-closed > td,
dd.status-closed {
  color: var(--muted);
}
a.label,
span.label {
  font-size: 0.85em;
  padding: 0 0.3em;
  border-radius: 3px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.filter .label {
  border-color: var(--accent); /* the label this list is filtered by */
}
.issue h2 .number {
  color: var(--muted);
}
article.comment {
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  margin-top: 1rem;
}
article.comment .who {
  color: var(--muted);
  margin: 0;
}
.pager {
  margin-top: 1rem;
}
dl.meta dt {
  font-weight: bold;
  float: left;
  clear: left;
  width: 6rem;
}
dl.meta dd {
  margin-left: 6.5rem;
}
pre.message {
  white-space: pre-wrap;
}
table.diffstat td {
  padding: 0.1rem 0.5rem;
}
table.diffstat .counts {
  font-family: var(--mono);
  white-space: nowrap;
}
.bar {
  display: inline-block;
  height: 0.6em;
}
.bar.add {
  background: var(--add);
}
.bar.del {
  background: var(--del);
}
.w0 { width: 0; } .w1 { width: 0.6em; } .w2 { width: 1.2em; } .w3 { width: 1.8em; }
.w4 { width: 2.4em; } .w5 { width: 3em; } .w6 { width: 3.6em; } .w7 { width: 4.2em; }
.w8 { width: 4.8em; } .w9 { width: 5.4em; } .w10 { width: 6em; }
pre.diff {
  overflow-x: auto;
}
pre.diff span {
  display: block;  /* one line per span, its newline inside: an empty line keeps its height */
}
pre.diff .add {
  background: color-mix(in srgb, var(--add) 18%, var(--code-bg));
}
pre.diff .del {
  background: color-mix(in srgb, var(--del) 18%, var(--code-bg));
}
pre.diff .hunk {
  color: var(--muted);
}
pre.diff .meta {
  color: var(--muted);
}
pre.diff .file {
  font-weight: bold;
  margin-top: 0.8em;
}
.asset-stub {
  font-style: italic;
}
a.download {
  display: inline-block;
  padding: 0.3em 0.8em;
  border: 1px solid var(--accent);
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
}
article.release {
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--gap);
  margin-bottom: var(--gap);
}
article.release .meta {
  color: var(--muted);
}
ul.artifacts {
  padding-left: 1.2rem;
}
table.repos tr.section th {
  padding-top: var(--gap);
  font-size: 1.1em;
}
table.repos .name .provenance {
  display: inline;
  margin-left: 0.5em;
}
.provenance span,
.process span {
  font-size: 0.85em;
  padding: 0 0.4em;
  border-radius: 3px;
  border: 1px solid var(--border);
  margin-right: 0.3em;
}
.provenance .prov-text,
.process .proc-text {
  border: none;
  color: var(--muted);
}
section.latest.empty p,
ul.recent .author {
  color: var(--muted);
}
ul.recent {
  list-style: none;
  padding: 0;
}
pre {
    background: var(--code-bg);
    padding: calc(var(--gap) / 2) var(--gap);
    overflow-x: auto;
    font-family: var(--mono);
}

details summary {
    cursor: pointer;
    color: var(--muted);
}

.readme.empty p {
    color: var(--muted);
}

footer {
    border-top: 1px solid var(--border);
    padding: var(--gap) 0;
    color: var(--muted);
    font-size: 0.9rem;
}

/* files page */
table.tree {
    border-collapse: collapse;
    width: 100%;
}
table.tree td {
    padding: 0.15rem 0.6rem 0.15rem 0;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
table.tree .mode {
    font-family: var(--mono);
    color: var(--muted);
    white-space: nowrap;
}
table.tree .size {
    text-align: right;
    color: var(--muted);
    white-space: nowrap;
}

/* file page */
code.ref {
    background: var(--code-bg);
    padding: 0.1em 0.3em;
}
table.blob {
    border-collapse: collapse;
    width: 100%;
}
table.blob td {
    padding: 0;
    vertical-align: top;
}
table.blob pre {
    margin: 0;
    background: none;
    border: none;
    padding: 0.5rem 0;
}
table.blob .lines {
    width: 1%;
    text-align: right;
    user-select: none;
    padding-right: 0.8rem;
    border-right: 1px solid var(--border);
}
table.blob .lines a {
    color: var(--muted);
    text-decoration: none;
}
table.blob .lines a.sel {
    color: var(--accent);
    font-weight: bold;
}
table.blob .code span[id] {
    display: block;  /* line spans only: token spans from zabagit-highlight are inline */
}
table.blob .code span[id]:target,
table.blob .code span[id].sel {
    background: var(--select);
}
button.copy {
    font: inherit;
    font-size: 0.85em;
    margin-left: 0.5rem;
    padding: 0.1rem 0.5rem;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
}
table.blob .code {
    width: 99%;
    max-width: 0;  /* the cell takes the rest of the row: a long line scrolls inside its pre */
}
table.blob .code pre {
    padding-left: 0.8rem;
    overflow-x: auto;
}
.stub,
.symlink {
    color: var(--muted);
}

/* syntax highlighting: the zabagit-highlight plugin marks tokens with the pygments short
   names (DESIGN section 6 v0.50); without the plugin no element carries these classes */
.code .k, .code .kc, .code .kd, .code .kn, .code .kp, .code .kr, .code .kt,
.code .ow, .code .nt {
    color: var(--hl-keyword);
}
.code .s, .code .sa, .code .sb, .code .sc, .code .dl, .code .sd, .code .s2, .code .se,
.code .sh, .code .si, .code .sx, .code .sr, .code .s1, .code .ss {
    color: var(--hl-string);
}
.code .c, .code .ch, .code .cm, .code .cp, .code .cpf, .code .c1, .code .cs {
    color: var(--hl-comment);
    font-style: italic;
}
.code .m, .code .mb, .code .mf, .code .mh, .code .mi, .code .il, .code .mo {
    color: var(--hl-number);
}
.code .nf, .code .fm, .code .nc, .code .nn, .code .nd, .code .ne {
    color: var(--hl-name);
}
.code .na, .code .nb, .code .bp, .code .no {
    color: var(--hl-builtin);
}
.code .gh, .code .gu, .code .gs {
    font-weight: bold;
}
.code .ge {
    font-style: italic;
}
.code .gi {
    color: var(--hl-string);
}
.code .gd {
    color: var(--hl-keyword);
}

/* wiki pages */
.wiki {
    display: grid;
    grid-template-columns: 14rem 1fr;
    gap: var(--gap);
    align-items: start;
}
@media (max-width: 40rem) {
    .wiki { grid-template-columns: 1fr; }
}
nav.sidebar {
    display: block;
    border-right: 1px solid var(--border);
    padding-right: calc(var(--gap) / 2);
}
nav.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
nav.sidebar ul ul {
    padding-left: 1rem;
}
nav.sidebar a,
nav.crumbs a {
    border: none;
    padding: 0;
}
nav.sidebar a[aria-current="page"] {
    font-weight: bold;
    color: var(--accent);
}
nav.crumbs {
    display: block;
    color: var(--muted);
    margin-bottom: var(--gap);
}
.wiki article {
    min-width: 0;
}
