: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;

  --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;
  }
}

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

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;
}

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

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%;
}

h2 { font-weight: 400; }
strong { font-weight: 500; }

main h1 { padding: 10px 0 10px 0; }
main h2 { font-size: 18px; }
main h3 { font-size: 1.15rem; }
main h2, h3 { padding: 20px 0 0.4rem 0; }

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

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

/* utilities */

.nowrap { white-space: nowrap; }
.fill { width: 100%; }
.muted { color: var(--gray); }

.size { text-align: right; }

.mode, .size,
.commit-hash, .commit-email,
.diff-type { font-family: var(--mono-font); }

/* 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);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 10;
  font-size: 0.85em;
  line-height: 1.3;
  max-width: 48ch;
  white-space: nowrap;
}

.author, .age { position: relative; }

.author:hover .tooltip,
.author:focus-within .tooltip,
.age:hover .tooltip,
.age:focus-within .tooltip {
  display: block;
}

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

.box + .box {
  margin-top: 0.8rem;
}

/* repo header */
.repo-header { margin-bottom: 1.25rem; }

.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;
}

.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; }

/* 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.author .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;
}

.line-numbers {
  white-space: pre-line;
  -moz-user-select: -moz-none;
  -khtml-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
  user-select: none;
  padding-right: 1ch;
}

.file-content {
  padding-left: 1.5ch;
  overflow-y: hidden;
  overflow-x: auto;
}
.image-viewer, .binary-viewer { padding: 1rem 0; }
.image-viewer img {
  max-width: 100%;
  height: auto;
}

.line-numbers pre,
.file-content pre {
  margin: 0;
  line-height: 1.5;
}

/* commit */
.commit { margin-bottom: 1rem; }

.commit pre {
  padding-bottom: 0;
  white-space: pre-wrap;
}

.commit .box { margin-bottom: 0.25rem; }
.commit .commit-info {
  padding-bottom: 0.25rem;
}

.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:before { content: '<'; }
.commit-email:after { content: '>'; }

.commit-refs {
  margin: 0.5rem 0 1rem 0;
}

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

.commit-refs td.label {
  padding-right: 1rem;
}

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

.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); }

.jump { margin-top: 0.5rem; }
.jump-table { margin-top: 0.25rem; }

.jump-table td {
  padding: 0.15rem 0.5rem;
  border-color: var(--medium-gray);
}

.jump-table .diff-type {
  width: 2ch;
}

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

.refs pre {
  padding-bottom: 0.5rem;
  white-space: pre-wrap;
}

.refs strong {
  padding-right: 1em;
}

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

/* readme */
.readme { padding: 0.6rem 0; }
.readme pre { white-space: pre-wrap; }
.readme ul  { padding: revert; }
.readme img { max-width: 100%; }

@media (max-width: 600px) {
  .repo-index {
    flex-direction: column;
  }

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

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

  pre {
    font-size: 0.8rem;
  }
}
