/* Theme for cgit at srdusr.com/git/.
 *
 * cgit renders its own markup and does not load the site's stylesheet or
 * its custom properties, so the palette is repeated here rather than
 * referenced. Keep the two in step by eye: these are the same values as
 * --rgbBackground, --rgbText and --rgbPrimary in style.css.
 *
 * Served by the site, not by cgit, so it deploys with site-deploy.sh and
 * lives in the website repository next to the theme it copies. */

:root {
  --bg: #ffffff;
  --fg: #111111;
  --dim: rgba(17, 17, 17, 0.6);
  --line: rgba(17, 17, 17, 0.12);
  --accent: #5b46e0;
  --panel: rgba(17, 17, 17, 0.04);
  --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0f;
    --fg: #e8e8ea;
    --dim: rgba(232, 232, 234, 0.6);
    --line: rgba(232, 232, 234, 0.14);
    --accent: #9b8cff;
    --panel: rgba(232, 232, 234, 0.05);
  }
}

/* The bar cgit has no idea about. Without it these pages are an island:
   no wordmark, no way back to the site, nothing saying whose repositories
   these are beyond the heading. Injected by cgit's own header= include,
   so it is on every page including a blob three levels down. */
.site-bar {
  max-width: 1100px; margin: 0 auto 1.5rem; padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 1.25rem; flex-wrap: wrap;
}
.site-bar-mark { font-weight: 700; font-size: 1.05rem; color: var(--fg); }
.site-bar-nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.site-bar-nav a { color: var(--dim); }
.site-bar-nav a:hover { color: var(--fg); text-decoration: none; }
.site-bar-nav a.here { color: var(--accent); }

body {
  margin: 0;
  padding: 2rem 1.5rem 6rem;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
}

div#cgit { max-width: 1100px; margin: 0 auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header: the wordmark, the repo name and its description. */
table#header { width: 100%; border-collapse: collapse; margin-bottom: 1.25rem; }
table#header td.logo { display: none; }
table#header td.main { font-size: 1.5rem; font-weight: 700; padding: 0; }
table#header td.main a { color: var(--fg); }
table#header td.sub { color: var(--dim); padding: 0.25rem 0 0; border-top: none; }
table#header td.form { text-align: right; }
/* cgit prints the repository directory's owner beside the description.
   Here that is www-data, which is how the repositories are served and
   not information about the repository. */
table#header td.sub.right { display: none; }

/* Tab strip. */
table.tabs {
  width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
}
table.tabs td { padding: 0; }
table.tabs td a {
  display: inline-block; padding: 0.5rem 0.9rem;
  color: var(--dim); border-bottom: 2px solid transparent;
}
table.tabs td a.active, table.tabs td a:hover {
  color: var(--fg); border-bottom-color: var(--accent); text-decoration: none;
}

/* The repository index and every file listing. */
table.list { width: 100%; border-collapse: collapse; }
table.list th {
  text-align: left; font-weight: 700; color: var(--dim);
  padding: 0.4rem 0.75rem 0.4rem 0; border-bottom: 1px solid var(--line);
  font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.04em;
}
table.list td { padding: 0.4rem 0.75rem 0.4rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:hover td { background: var(--panel); }
table.list td.logsubject { font-weight: 600; }
/* cgit emits the Links column as bare anchors with no separator, so the
   three of them rendered as one word: "summarylogtree". */
table.list td a + a { margin-left: 0.75rem; }
/* Same fault in the commit list: the ref decorations are emitted hard
   against the subject, so a tip commit read "...pixel iterationHEADmain". */
a.branch-deco, a.tag-deco, a.remote-deco, a.deco { margin-left: 0.5rem; padding: 0 0.35rem; border: 1px solid var(--line); border-radius: 4px; font-size: 0.85em; color: var(--dim); }
table.list td.logmsg { color: var(--dim); }

/* Code, diffs and blobs - the reason any of this exists. */
table.blob, table.ssdiff { width: 100%; border-collapse: collapse; }
table.blob td, div.content pre {
  font-family: var(--mono); font-size: 13px; line-height: 1.55;
}
table.blob td.linenumbers { color: var(--dim); text-align: right; padding-right: 1rem; user-select: none; }
table.blob td.lines { width: 100%; }
table.blob pre { margin: 0; }
div.content { overflow-x: auto; }
div.error { color: #d33; }

/* The README, rendered under the tree. Prose, not code. */
div.markdown-body, div#cgit div.about-body {
  font-family: inherit; max-width: 78ch;
  padding: 1.25rem 0 0; border-top: 1px solid var(--line); margin-top: 1.5rem;
}
div.about-body h1, div.about-body h2, div.about-body h3 { line-height: 1.25; }
div.about-body pre, div.about-body code {
  font-family: var(--mono); background: var(--panel); border-radius: 4px;
}
div.about-body pre { padding: 0.75rem; overflow-x: auto; }
div.about-body code { padding: 0.1rem 0.3rem; }
div.about-body pre code { padding: 0; background: none; }
div.about-body img { max-width: 100%; height: auto; }
div.about-body table { border-collapse: collapse; }
div.about-body th, div.about-body td { border: 1px solid var(--line); padding: 0.3rem 0.6rem; }

/* Commit and diff metadata. */
table.commit-info, div.commit-subject, div.commit-msg { margin-bottom: 1rem; }
div.commit-subject { font-weight: 700; font-size: 1.1em; }
div.commit-msg { color: var(--dim); white-space: pre-wrap; }
div.diffstat-header { margin-top: 1rem; font-weight: 700; }
table.diff td { font-family: var(--mono); font-size: 13px; }
div.add, span.add { color: #1a7f37; }
div.del, span.del { color: #cf222e; }
@media (prefers-color-scheme: dark) {
  div.add, span.add { color: #57ab5a; }
  div.del, span.del { color: #f47067; }
}

/* Footer: cgit's own credit line. Kept, quietly. */
div.footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--dim); font-size: 0.85em; }

/* The clone URL, which is what most visitors actually came for. */
div.content ul { padding-left: 1.2rem; }

input, select, button {
  font-family: var(--mono); font-size: 13px;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.3rem 0.5rem;
}

@media (max-width: 700px) {
  body { padding: 1rem 0.75rem 4rem; font-size: 13px; }
  table.list th:nth-child(3), table.list td:nth-child(3) { display: none; }
}
