:root {
  --white: #fff;
  --light: #f4f4f4;
  --cyan: #509c93;
  --light-gray: #eee;
  --medium-gray: #ddd;
  --gray: #6a6a6a;
  --dark: #444;
  --darker: #222;
  --diff-add: green;
  --diff-del: red;
  --sel-bg: rgba(0, 0, 0, 0.08);

  --sans-font: -apple-system, BlinkMacSystemFont, "Inter", "Roboto", "Segoe UI", sans-serif;
  --mono-font: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark light;
    --light: #181818;
    --cyan: #76c7c0;
    --light-gray: #333;
    --medium-gray: #444;
    --gray: #aaa;
    --dark: #ddd;
    --darker: #f4f4f4;
    --white: #000;
    --sel-bg: rgba(255, 255, 255, 0.08);
  }
}

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

::selection { background: var(--medium-gray); }

html {
  background: var(--white);
  -webkit-text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: var(--sans-font);
  font-weight: 400;
}

body {
  max-width: 1200px;
  padding: 0 13px;
  margin: 40px auto;
}

a {
  text-decoration: none;
  word-wrap: break-word;
  color: var(--darker);
  border-bottom: 0;
}

a:hover { border-bottom: 1.5px solid var(--gray); }
.link { border-bottom: 1.5px solid var(--medium-gray); }

pre {
  font-family: var(--mono-font);
  overflow-x: auto;
  tab-size: 4;
  -moz-tab-size: 4;
}

main, footer {
  padding: 0;
  line-height: 160%;
}

nav { padding: 0.4rem 0 1.5rem 0; }
nav ul {
  list-style: none;
  padding-bottom: 1.25rem;
}

nav ul li {
  padding-right: 10px;
  display: inline-block;
}

/* utilities */
.mono { font-family: var(--mono-font); }
.nowrap { white-space: nowrap; }
.fill { width: 100%; }
.muted { color: var(--gray); }
.pt { padding-top: 1rem; }
.mb { margin-bottom: 1rem; }
.center {
  display: flex;
  justify-content: center;
}

/* tables */
.table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.table th {
  text-align: left;
  font-weight: 500;
  border-bottom: 1.5px solid var(--medium-gray);
  padding: 0.25em 0.5em;
}

.table td {
  border-bottom: 1px solid var(--light-gray);
  padding: 0.25em 0.5em;
  vertical-align: top;
}

.table tbody tr:hover { background: var(--light); }
.table tbody tr.nohover:hover { background: transparent; }

/* tooltip */
.tooltip {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.7rem;
  background: var(--white);
  border: 1px solid var(--medium-gray);
  z-index: 10;
  font-size: 0.85em;
  line-height: 1.3;
  max-width: 48ch;
  white-space: nowrap;
}

.has-tip { position: relative; }
.has-tip:hover .tooltip,
.has-tip:focus-within .tooltip { display: block; }

/* box */
.box + .box { margin-top: 0.8rem; }
.box {
  background: var(--light-gray);
  padding: 0.6rem;
}

/* repo header */
.repo-header { margin-bottom: 1.25rem; }
.repo-header .desc { margin-top: 0.35rem; }
.repo-header .repo-nav { padding: 0.5rem 0 0 0; }
.repo-header .repo-nav ul { padding-bottom: 0; }


.repo-breadcrumb,
.repo-breadcrumb a { color: var(--gray); }
.repo-breadcrumb:before { content: "<"; }

.repo-name {
  font-size: 1.6rem;
  line-height: 1.1;
  margin-top: 0.25rem;
}

/* index page */
.index { margin-top: 2em; }

/* repo index */
.repo-index {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.repo-index-main { flex: 0 0 72ch; }
.repo-index-main .box { width: 100%; }
.repo-index-side {
  flex: 0 0 26rem;
  min-width: 0;
}

.repo-index-side h2 {
  font-size: 1.4rem;
  padding: 0;
}

/* log page */
.log td.has-tip .author-short {
  display: inline-block;
  max-width: 25ch;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

/* tree */
.tree, .log, .repo-index { margin-bottom: 2em; }

/* file View */
.file-wrapper {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  padding: 0 0.5rem;
  background: var(--light-gray);
  overflow-x: auto;
}

.file-contents {
  width: 100%;
  padding: 0.3em 0 0.3em 0;
}

.line-number {
  width: 1%;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -khtml-user-select: none;
  -o-user-select: none;
  text-align: right;
  color: var(--gray);
}

.line-number a:hover { border-bottom: none; }
.line-number a {
  display: block;
  padding: 0 1rem;
  text-decoration: none;
}

.line:has(a:target) { background-color: var(--sel-bg); }

.image-viewer, .binary-viewer { padding: 1rem 0; }
.image-viewer img {
  max-width: 100%;
  height: auto;
}

/* commit */
.commit { margin-bottom: 1rem; }
.commit .box { margin-bottom: 0.25rem; }
.commit .commit-info { padding-bottom: 0.25rem; }
.commit pre {
  padding-bottom: 0;
  white-space: pre-wrap;
}

.commit-message {
  margin-top: 0.25rem;
  font-size: 1rem;
  line-height: 1.35;
  margin-bottom: 1rem;
}

.commit-info {
  color: var(--gray);
  font-size: 0.85rem;
}

.commit-date { float: right; }

.commit-email { font-family: var(--mono-font); }
.commit-email:before { content: '<'; }
.commit-email:after { content: '>'; }

.commit-refs { margin: 0.5rem 0 1rem 0; }
.commit-refs td.label { padding-right: 1rem; }
.commit-refs td {
  padding: 0.15rem 0.5rem 0.15rem 0;
  border: none;
}

/* diff */
.diff {
  margin: 1rem 0 1rem 0;
  padding: 0.6rem;
  border-bottom: 1.5px solid var(--medium-gray);
  background: var(--light-gray);
}

.diff pre {
  padding: 0;
  margin: 0;
}

.diff-line { display: flex; }
.diff-line:target { background: var(--sel-bg); }
.diff-line .line-number {
  flex-shrink: 0;
  border-right: 1px solid var(--light-gray);
  padding: 0 0.5rem;
  min-width: 3rem;
}

.diff-line .line-number a {
  display: inline;
  padding: 0;
}

.diff-line > span:last-child {
  flex-grow: 1;
  padding: 0 0.5rem;
}

.diff-stat { padding: 1rem 0 1rem 0; }
.diff-add { color: var(--diff-add); }
.diff-del { color: var(--diff-del); }
.diff-mod { color: var(--cyan); }
.diff-noop { color: var(--gray); }
.diff-separator {
  justify-content: center;
  background: var(--medium-gray);
}

.jump { margin-top: 0.5rem; }
.jump-table { margin-top: 0.25rem; }
.jump-table .diff-type { width: 2ch; }
.jump-table td {
  padding: 0.15rem 0.5rem;
  border-color: var(--medium-gray);
}

/* refs */
.ref {
  font-size: 1rem;
  color: var(--gray);
  display: inline-block;
  padding-top: 0.7em;
}

.refs strong { padding-right: 1em; }
.refs pre {
  padding-bottom: 0.5rem;
  white-space: pre-wrap;
}

.tag-message { margin-left: 0.5rem; }
.tag-message summary {
  cursor: pointer;
  color: var(--gray);
}

/* readme */
.readme {
  padding: 1.5rem 0;
  line-height: 1.6;
}
.readme > *:first-child { margin-top: 0; }

.readme h1, .readme h2, .readme h3, .readme h4, .readme h5, .readme h6 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.25;
}
.readme h1 { font-size: 2rem; }
.readme h2 { font-size: 1.5rem; }
.readme h3 { font-size: 1.25rem; }
.readme h4, .readme h5, .readme h6 { font-size: 1rem; }

.readme p, .readme ul, .readme ol, .readme pre { margin-bottom: 1em; }
.readme ul, .readme ol { padding-left: 2em; }
.readme li { margin-bottom: 0.25em; }
.readme a { border-bottom: 1.5px solid var(--medium-gray); }
.readme a > img { border-bottom: none; }
.readme img { max-width: 100%; }
.readme pre {
  background: var(--light-gray);
  padding: 0.6rem;
}

.readme pre.raw {
  background: unset;
  padding: unset;
}

.readme details > * { padding-left: 1em; }
.readme details[data-callout] {
  border-left: 4px solid var(--gray);
  background: var(--light);
  padding: 0.5em 1em;
  margin: 1em 0;
}
.readme details[data-callout] .callout-content { padding-left: 0.5em; }
.readme details[data-callout] summary {
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.5em;
}

.readme blockquote {
  border-left: 3px solid var(--gray);
  padding-left: 1em;
  color: var(--gray);
  margin: 1em 0;
}

@media (max-width: 600px) {
  pre { font-size: 0.8rem; }

  .repo-index { flex-direction: column; }
  .repo-index-main, .repo-index-side {
    flex: none;
    width: 100%;
  }

  .commit-info:not(:last-child) { padding-bottom: 1.5rem; }
}
