/*
Copyright (C) 2016 Ben North

This file is part of literate-git tools --- render a literate git repository

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

.markdown-body {
    box-sizing: border-box;
    min-width: 200px;
    max-width: 960px;
    margin: 0 auto;
    /* Use more padding on left and right to prevent expand buttons
     * being cut off on smaller viewports
     */
    padding: 45px 102px 45px 102px;
    line-height: 1.4444;
}

table.diff { width: 100%; margin: 0px; }
table.diff tr:nth-child(1) td { padding-top: 0.3333ex; }
table.diff tr:nth-last-child(1) td { padding-bottom: 0.25ex; }
table.diff tr { width: 100%; }
table.diff tr td:nth-child(1),
table.diff tr td:nth-child(2) {
    width: 3em;
    padding-left: 1em;
    padding-right: 2em;
    text-align: right;
    font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
}
table.diff tr td:nth-child(3) { width: 100%; }
table.diff tr td:nth-child(3) pre::before { margin-right: 1em; }
table.diff tr.diff-del { background-color: #ffcaca; }
table.diff tr.diff-del td:nth-child(3) pre::before { content: '-'; }
table.diff tr.diff-add { background-color: #caffca; }
table.diff tr.diff-add td:nth-child(3) pre::before { content: '+'; }
table.diff tr.diff-unch { background-color: #f7f7f7; }
table.diff tr.diff-unch td:nth-child(3) pre::before { content: ' '; }
table.diff tr, table.diff tr:nth-child(2n) { padding: 0px; margin: 0px; border: none; }
table.diff tr td { padding: 0px; margin: 0px; border: none; }
table.diff tr td pre {
    line-height: 100%;
    padding: 2px;
    margin: 0px;
    border: none;
    border-radius: 0px;
    background-color: inherit;
}
div.content > div.literate-git-node { display: none; }
div.literate-git-node,
div.literate-git-node > div.diff-or-children { position: relative; }

div.literate-git-node > h2.nav,
div.literate-git-node > div.diff-or-children > h2.nav {
    box-sizing: border-box;
    position: absolute;
    top: 0px;
    margin: 0px;
    width: 2em;
    text-align: center;
    padding-left: 16px;
    padding-right: 16px; }

span.sec-num { margin-right: 0.75em; font-weight: normal; }

div.literate-git-node h2.nav {
    border-radius: 6px;
}

div.literate-git-node h2.nav.prev,
div.literate-git-node h2.nav.expand,
div.literate-git-node h2.nav.collapse { left: -96px; }
div.literate-git-node h2.nav.collapse { display: none; }
div.literate-git-node h2.nav.next { right: -80px; }
div.literate-git-node > div.diff-or-children > h2,
div.literate-git-node > h2 {
    margin-top: 2.25em;
    padding-top: 8px;
    padding-left: 24px;
    margin-left: -24px;
    background-color: #d0d0ff;
}
div.literate-git-node > div.diff-or-children > div.children
> div.literate-git-node { margin-left: 12px; }
div.literate-git-node > div.diff-or-children > div.children
> div.literate-git-node > h2 { font-size: 125%; background-color: #e0e0ff; }
div.literate-git-node > div.diff-or-children > div.children
> div.literate-git-node:nth-child(1) > h2 { margin-top: 8px; }
div.literate-git-node > div.diff-or-children > div.children
> div.literate-git-node > h2 { margin-top: 7.5ex; }

div.literate-git-node p.links { margin-top: 2ex; text-align: right; font-size: 90%; }
div.literate-git-node p.links span {
    color: #222;
    padding: 4px;
    background-color: #8e8;
    border: 2px solid #6a6;
}
div.literate-git-node p.links a { margin-left: 2em; }
div.literate-git-node p.links a:hover { text-decoration: none; }

div.literate-git-node h2.nav { cursor: pointer; }

div.expand-collapse { background-color: #ccf; padding: 8px; text-align: center; }
div.expand-collapse p { margin: 0px; }

div.literate-git-node > div.diff-or-children { margin-top: 5ex; }

div.literate-git-node > div.diff-or-children > div.children { display: none; }

div.literate-git-node h4 {
    padding: 8px 8px 8px 12px;
    margin-left: -12px;
    margin-top: 0px;
    font: 100% Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-weight: bold;
    background-color: #e8e8e8;
}

div.diff > div.patch { margin-top: 5ex; }
div.diff > div.patch:nth-child(1) { margin-top: 0px; }

p.inter-hunk {
    text-align: center;
    font-size: 125%;
    margin-top: 0.5ex;
    margin-bottom: 0.5ex;
}

div.project-link-footer {
    margin: 4ex 3em 0px 3em;
    background-color: #ffd;
    border: 1px solid #dda;
}

div.project-link-footer p {
    text-align: center;
    font-style: italic;
    font-size: 90%;
    padding: 16px;
    margin: 0px;
}

.nav-tooltip {
    background-color: #040;
    padding: 2ex 1em 0ex 1em;
    width: 18em;
    border-radius: 6px;
    display: none;
}

.nav-tooltip p {
    color: white;
}

.nav-tooltip p.dismiss {
    text-align: right;
    font-size: 90%;
}

.nav-tooltip p.dismiss span {
    cursor: pointer;
}

.nav-tooltip[data-popper-placement^='top'] .tooltip-arrow { bottom: -4px; }
.nav-tooltip[data-popper-placement^='bottom'] .tooltip-arrow { top: -4px; }
.nav-tooltip[data-popper-placement^='left'] .tooltip-arrow { right: -4px; }
.nav-tooltip[data-popper-placement^='right'] .tooltip-arrow { left: -4px; }

.tooltip-arrow,
.tooltip-arrow::before {
  position: absolute;
  width: 8px;
  height: 8px;
  z-index: -1;
}

.tooltip-arrow::before {
  content: '';
  transform: rotate(45deg);
  background: #040;
}

/* Thanks, https://stackoverflow.com/questions/826782 */
.noselect, div.literate-git-node h2.nav {
  -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Safari */
     -khtml-user-select: none; /* Konqueror HTML */
       -moz-user-select: none; /* Old versions of Firefox */
        -ms-user-select: none; /* Internet Explorer/Edge */
            user-select: none; /* Non-prefixed version, currently
                                  supported by Chrome, Opera and Firefox */
}
