:root {
  --white: #fff;
  --light: #f4f4f4;
  --cyan: #509c93;
  --light-gray: #eee;
  --medium-gray: #ddd;
  --gray: #6a6a6a;
  --dark: #444;
  --darker: #222;

  --sans-font: -apple-system, BlinkMacSystemFont, "Inter", "Roboto", "Segoe UI", sans-serif;
  --display-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;
  }
}

html {
  background: var(--white);
  -webkit-text-size-adjust: none;
  font-family: var(--sans-font);
  font-weight: 380;
}

pre {
  font-family: var(--mono-font);
  overflow-x: auto;
}

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

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

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

main, footer {
  font-size: 1rem;
  padding: 0;
  line-height: 160%;
}

header h1, h2, h3 {
  font-family: var(--display-font);
}

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 {
  padding: 0;
  margin: 0;
  list-style: none;
  padding-bottom: 20px;
}

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

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

.repo-breadcrumb {
  color: var(--gray);
}

.repo-breadcrumb:before {
  content: "<"; /* TODO: add an  arrow */
}

.repo-breadcrumb a {
  color: var(--gray);
}

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

.repo-header .desc {
  color: var(--gray);
  margin-top: 0.35rem;
}

.repo-header .repo-nav {
  padding: 0.5rem 0 0 0;
}

.repo-header .repo-nav ul {
  padding-bottom: 0;
}

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

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

/* index page */
.index {
  width: 100%;
  margin-top: 2em;
  border-collapse: collapse;
  table-layout: auto;
}

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

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

.index .url { white-space: nowrap; }
.index .desc { width: 100%; }
.index .desc .unset { color: var(--gray); }
.index .idle { white-space: nowrap; }


.index tbody tr.nohover:hover {
  background: transparent;
}

.index tbody tr:hover {
  background: var(--light);
}

/* tree page */

.tree {
  width: 100%;
  margin-bottom: 2em;
  border-collapse: collapse;
  table-layout: auto;
}

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

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

.tree .mode {
  white-space: nowrap;
  font-family: var(--mono-font);
}

.tree .size {
  white-space: nowrap;
  text-align: right;
  font-family: var(--mono-font);
}

.tree .name { width: 100%; }

.tree tbody tr.nohover:hover {
  background: transparent;
}

.tree tbody tr:hover {
  background: var(--light);
}

/* log/repo page */

.repo-index {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 2em;
  align-items: flex-start;
}

.repo-index-main {
  flex: 0 0 72ch;
}

.repo-index-side {
  flex: 0 0 26rem;
  min-width: 0;
}

.repo-index-main .box {
  width: 100%;
}

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

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

.log {
  width: 100%;
  margin-bottom: 2em;
  border-collapse: collapse;
  table-layout: auto;
}

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

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

.log .msg { width: 100%; }
.log .author { white-space: nowrap; position: relative; }
.log .age { white-space: nowrap; }

.log td.author .author-short {
  display: inline-block;
  max-width: 25ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

.log td.author .author-tip {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 0.25rem;
  padding: 0.35rem 0.5rem;
  background: var(--white);
  border: 1px solid var(--medium-gray);
  max-width: 48ch;
  z-index: 2;
}

.log td.author:hover .author-tip,
.log td.author:focus-within .author-tip {
  display: block;
}

.log tbody tr.nohover:hover {
  background: transparent;
}

.log tbody tr:hover {
  background: var(--light);
}

.clone-url pre {
  overflow-x: auto;
  white-space: pre;
  max-width: 100%;
}

.mode, .size {
  font-family: var(--mono-font);
}
.size {
  text-align: right;
}

/* readme stuff */

.readme pre {
  white-space: pre-wrap;
  overflow-x: auto;
}

.readme {
  background: var(--light-gray);
  padding: 0.5rem;
}

.readme ul {
  padding: revert;
}

.readme img {
  max-width: 100%;
}

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

.diff pre {
  overflow-x: auto;
}

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

.commit-refs td {
  padding: 0.15rem 0.5rem 0.15rem 0;
  vertical-align: top;
}

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

.diff-stat {
  padding: 1rem 0 1rem 0;
}

.jump {
  margin-top: 0.5rem;
}

.jump-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  margin-top: 0.25rem;
}

.jump-table td {
  padding: 0.15rem 0.5rem;
  border-bottom: 1px solid var(--medium-gray);
  vertical-align: top;
}

.jump-table .diff-type {
  font-family: var(--mono-font);
  white-space: nowrap;
  width: 2ch;
}

.jump-table .path {
  width: 100%;
}

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

.commit-email:before {
  content: '<';
}

.commit-email:after {
  content: '>';
}

.commit {
  margin-bottom: 1rem;
}

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

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

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

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

.diff-add {
  color: green;
}

.diff-del {
  color: red;
}

.diff-noop {
  color: var(--gray);
}

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

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

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

.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;
  display: flex;
  float: left;
  flex-direction: column;
  margin-right: 1ch;
}

.file-wrapper {
  display: flex;
  flex-direction: row;
  grid-template-columns: 1rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.5rem;
  background: var(--light-gray);
  overflow-x: auto;
}

.file-content {
  background: var(--light-gray);
  overflow-y: hidden;
  overflow-x: auto;
}

.diff-type {
  font-family: var(--mono-font);
}

.diff-type.diff-add { color: green; }
.diff-type.diff-del { color: red; }
.diff-type.diff-mod { color: var(--cyan); }

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

.commit-date {
  float: right;
}

@media (max-width: 600px) {
  .index {
    grid-row-gap: 0.8em;
  }

  .repo-index {
    flex-direction: column;
  }

  .repo-index-main {
    flex: none;
  }

  .repo-index-side {
    flex: none;
  }

  .log {
    grid-template-columns: 1fr;
    grid-row-gap: 0em;
  }

  .index {
    grid-template-columns: 1fr;
    grid-row-gap: 0em;
  }

  .index-name:not(:first-child) {
    padding-top: 1.5rem;
  }

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

  pre {
    font-size: 0.8rem;
  }
}
