/*
 * SPDX-FileCopyrightText: 2020, 2021 Julien Lepiller <julien@lepiller.eu>
 *
 * SPDX-License-Identifier: CC0-1.0
 */

:root {
  --font-base: 14px;
  --font-sans: "DejaVu Sans", "Noto Sans", sans-serif;
  --font-mono: "DejaVu Sans Mono", "Noto Sans Mono", monospace;

  /* header colors */
  --blue: #6eaee6;
  --darkblue: #176ecb;
  --lightblue: #a1d9f4;
  --top-link-white: #fff;

  /* footer */
  --darkgreen: #2cae0e;

  /* elements */
  --white: #fff;
  --darkwhite: #faf5f0;
  --darkerwhite: #eae5e0;
  --gray: #ccc;
  --lighterblack: #777;
  --black: #333;

  /* diffs */
  --lightgreen: #ddfbe6;
  --lightergreen: #ecfdf0;
  --bordergreen: #b0eab9;

  --lightred: #f9d7dc;
  --lighterred: #fbe9eb;
  --borderred: #eac0c9;

  --hunk-delim: #fafafa;
  --diff-name-background: #cccac5;

  /* code blocks in readme */
  --code-color: #353;
  --code-background: #ded;
  --code-shadow: #efe;
  --code-border: #bdb;
  --pre-shadow: #efe;
  --pre-border: #bdb;
}

@media screen and (prefers-color-scheme: dark) {
  :root {
    --blue: #0e2e46;
    --darkblue: #1e3e56;
    --lightblue: #073766;
    --top-link-white: #d0daff;

    --darkgreen: #2cae0e;

    --white: #000;
    --darkwhite: #110d0a;
    --darkerwhite: #151311;
    --gray: #333;
    --lighterblack: #777;
    --black: #ddd;

    --lightgreen: #0d2b16;
    --lightergreen: #0c1d10;
    --bordergreen: #304a39;

    --lightred: #29070c;
    --lighterred: #1b090b;
    --borderred: #4a3039;

    --hunk-delim: #0a0a0a;
    --diff-name-background: #3c3a35;

    --code-color: #ded;
    --code-background: #111511;
    --code-shadow: #010;
    --code-border: #343;
    --pre-shadow: #232;
    --pre-border: #343;
  }

  a {
    color: #81b9e4;
  }
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--darkwhite);
  font-family: var(--font-sans);
  font-size: var(--font-base);
}

body {
  display: flex;
  flex-direction: column;
  color: var(--black);
  height: 100%;
}

#content {
  flex: 1;
  width: 1200px;
  margin: auto;
  text-align: justify;
  line-height: 1.25em;
  padding: 2em;
}

header {
  background: var(--blue);
}

footer {
  background: var(--darkerwhite);
}

header, footer {
  text-align: center;
}

a {
  text-decoration: none;
}

header ul {
  list-style: none;
  margin: 0;
}

header li {
  display: inline-block;
}

header li a {
  display: inline-block;
  padding: 1em;
  color: var(--top-link-white);
}

header li a:hover {
  background-color: var(--darkblue);
}

header li.first {
  margin-right: 2em;
}

footer a {
  color: var(--darkgreen);
}

.content {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.content p:first-child {
  flex: 1;
}

.content img {
  max-height: 1.5em;
  max-width: 1.5em;
}

.content p {
  margin: 0;
}

.content, thead {
  background: var(--darkerwhite);
  padding: 0.5em;
  margin: 0;
  border: 1px solid var(--gray);
  border-bottom: none;
}

pre, article.formatted-file-content {
  border: 1px solid var(--gray);
  border-top: none;
  padding: 0.5em;
  margin: 0;
  background: var(--white);
}

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

article.formatted-file-content > * {
  margin-left: auto;
  margin-right: auto;
}

.formatted-file-content ul {
  padding-left: 1em;
}

.formatted-file-content pre {
  border: 1px solid var(--pre-border);
  box-shadow: 1px 1px 0 var(--pre-shadow);
  overflow: auto;
  color: #353;
}

.formatted-file-content h1 {
  text-align: left;
  padding-bottom: 0.3em;
  border-bottom: 1px solid #ddd;
}

.formatted-file-content h2 {
  padding-bottom: 0.2em;
  border-bottom: 1px solid #ddd;
}

article.formatted-file-content {
  padding: 1em 5em;
}

table {
  background: var(--white);
  border-collapse: collapse;
  width: 100%;
  border: 1px solid var(--gray);
  margin-bottom: 1em;
  font-size: var(--font-base);
}

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

tbody tr {
  transition-duration: 300ms;
}

tbody tr:hover {
  background: var(--lightblue);
}

td {
  padding: 0.5em;
}

table.file-diff, table.file-content {
  margin-bottom: 1em;
  user-select: none;
}

table.file-diff td, table.file-content td {
  padding: 0;
  line-height: 1em;
}

table.file-diff td:target + td, table.file-content td:target + td {
  background: #ffffd0;
}

table.file-diff .hunk-delim {
  background: var(--hunk-delim);
  border-bottom: 1px solid var(--darkerwhite);
  border-top: 1px solid var(--darkerwhite);
  text-align: center;
}

table.file-diff .hunk-delim td {
  padding: 0.25em;
}

table.file-diff .diff-no-data {
  background: var(--darkerwhite);
}

table.file-diff .diff-no-data td {
  padding: 1em;
  user-select: text;
  text-align: center;
}

table.file-diff td:nth-child(3) {
  text-align: center;
}

table.file-diff .diff-line-num, table.file-content .content-line-num {
  background: var(--darkerwhite);
  color: var(--lighterblack);
  text-align: center;
  border-right: 1px solid var(--gray);
  border-left: 1px solid var(--gray);
}

table.file-diff .diff-line, table.file-content .content-line {
  border-right: 1px solid var(--gray);
  user-select: text;
}

table.file-diff pre, table.file-content pre {
  border: none;
  background: none;
  padding: 0.2em;
}

table.file-diff .diff-minus,
table.file-diff .diff-minus:hover {
  background: var(--lighterred);
  border-color: var(--red);
}

table.file-diff .diff-plus,
table.file-diff .diff-plus:hover{
  background: var(--lightergreen);
}

table.file-diff tr:hover, table.file-content tr:hover {
  background: none;
}

table.file-diff .diff-minus .diff-line-num {
  background: var(--lightred);
}

table.file-diff .diff-plus .diff-line-num {
  background: var(--lightgreen);
}

table.file-diff .diff-minus td {
  border-color: var(--borderred);
}

table.file-diff .diff-plus td {
  border-color: var(--bordergreen);
}

p.diff-file-name {
  background: var(--diff-name-background);
  margin: 0;
  padding: 0.5em;
  border: 1px solid var(--gray);
  border-bottom: none;
}

.commit-info, .tag-box {
  border: 1px solid var(--gray);
  margin-top: 1em;
  margin-bottom: 1em;
  padding: 1em;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-content: center;
  background: var(--white);
}

.commit-info .commit, .tag-box .tag {
  flex: 1
}

.commit-info .message, .tag-box .tag-name {
  font-weight: bold;
}

.commit-info .author, .commit-info .date, .tag-box .date {
  display: inline-block;
  padding: 0.5em 0;
}

.tag-box .tag p {
  margin: 0;
}

.tag-box img {
  margin-right: 0.5em;
}

.commit-info img {
  max-width: 64px;
  max-height: 64px;
  margin-right: 1em;
}

.commit-info .commit-id {
  margin-left: 1em;
  border: 1px solid var(--gray);
  padding: 0;
  background: var(--darkerwhite);
  height: 2.5em;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  overflow: hidden;
}

.commit-info .commit-id .short-id {
  background: var(--darkwhite);
  display: inline-block;
  padding: 0 0.5em;
  border-right: 1px solid var(--gray);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
}

.commit-info p {
  margin: 0;
}

.commit-info .commit-id button {
  background: none;
  border: none;
  cursor: pointer;
}

.commit-info .commit-id img {
  max-width: 1.5em;
  max-height: 1.5em;
  margin-right: 0.3em;
}

.commit-info .commit-id a {
  display: flex;
  align-items: center;
}

.commit-info .date, .tag-box .date {
  font-style: italic;
  margin-left: 1em;
}

.commit-info .author::before, .tag-box .author::before {
  content: "Authored by: ";
}

h1 {
  text-align: center;
}

code {
  background: var(--darkerwhite);
  display: inline-block;
  padding: 3px;
  font-family: var(--font-mono);
}

.formatted-file-content pre code {
  padding: 0;
  background: none;
  box-shadow: none;
  display: block;
  color: var(--black);
}

.formatted-file-content code {
  background: var(--code-background);
  padding: 0.15em;
  display: inline-block;
  box-shadow: 1px 1px 1px var(--code-shadow);
  color: var(--code-color);
}

.clone {
  text-align: right;
}

.icon-link {
  display: flex;
  flex-direction: row;
  align-content: center;
}

.icon-link img {
  height: 1em;
  width: 1em;
  margin-right: 0.3em;
}

.path-box a {
  display: inline-block;
  padding: 0.5em;
}

.button-row a {
  display: inline-block;
  background: var(--white);
  padding: 0.5em;
  border: 1px solid var(--gray);
  margin: 0.5em;
}


/* syntax highlighting */
.syntax-comment {
  color: var(--comment);
}

.syntax-string {
  color: var(--string);
}

/* for scheme */
.syntax-special {
  color: var(--keyword2);
  font-weight: bold;
}

.syntax-keyword {
  color: var(--keyword);
  font-weight: bold;
}

@media screen and (max-width: 1250px) { 
  #content {
    width: 100%;
    padding: 0;
  }
  article.formatted-file-content {
    padding: 0.25em;
  }
}
