/*
 * Copyright (c) 2018 James Tanner
 */

.documentation > h1 {
    margin-top: 0;
    margin-bottom: 0;
}

.documentation > h2 {
    padding-top: 0.2rem;
    border-top: 2px solid black;
    font-size: xx-large;
    margin-bottom: 0;
}

.documentation > h3 {
    padding-top: 0.1rem;
    border-top: 1px solid darkslategray;
    font-size: x-large;
    margin-bottom: 0;
}

.documentation > h4 {
    padding-top: 0.1rem;
    border-top: 1px solid lightslategray;
    font-size: larger;
    margin-bottom: 0;
}

.documentation > h5 {
    font-size: large;
    margin-bottom: 0;
}

.documentation > h6 {
    font-size: smaller;
    margin-bottom: 0;
}

.documentation > h6:before {
    content: '■  ';
    padding-right: 0.1rem;
}

.documentation > :target {
    border-top: 0;
    margin-top: 0;
    color: mediumslateblue
}

.documentation > :target::before {
    content: " ";
    display: block;
    height: 1.8rem;
    border-bottom: 1px solid mediumslateblue;
    margin-bottom: 0.1rem;
}

.documentation > :not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(table):not(blockquote) {
    margin: 0.8rem;
}

.documentation > blockquote {
    padding: 0.3rem;
    background: lightgray;
}

.documentation > blockquote > :first-child{
    margin-top: 0;
}

.documentation > blockquote > :last-child{
    margin-bottom: 0;
}

.documentation > ul {
    padding-left: 1.5rem;
}

.documentation > table {
    border-collapse: collapse;
    margin: 0 1.5rem;
}

.documentation > table th {
    background-color: black;
    color: white;
}

.documentation > table td, .documentation > table th {
    border: 1px solid lightgray;
    padding: 0.2rem 1rem;
}

.documentation > table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.documentation > table tr:hover {
    background-color: lightgray;
}

.documentation a {
    color: darkblue;
    text-decoration: none;
    font-style: italic;
}

.documentation a:hover {
    color: blue;
    text-decoration: underline;
}

.sidebar {
    margin: 0.5rem;
    white-space: nowrap;
}

.toc {
    position: sticky;
    top: 2.5rem;
    box-sizing: border-box;
    height: 100vh;
    padding-bottom: 5rem;
    display: flex;
    flex-direction: column;
}

.toc-contents {
    flex: 1 1 auto;
    overflow: auto;
    margin: 0 0 0.5rem;
}

.toc ul {
    border-left: 1px solid lightgray;
    padding-left: 0.3rem;
    margin-left: 1rem;
}

.toc ul:first-child {
    border: unset;
    padding: 0;
    margin: 0 0.5rem;
}

.toc li {
    list-style-type: none;
    margin-top: 0.2rem;
}

.toc a:not(.back-to-top) {
    color: inherit;
    text-decoration: none;
}

.toc a:hover:not(.back-to-top) {
    color: blue;
}

.back-to-top {
    display: block;
    position: sticky;
    top: calc(100vh - 2rem);

    background: darkslategray;
    color: white;
    text-decoration: none;
    font-weight: bold;
    text-align: center;
    border: 2px solid black;
    border-radius: 1rem;
    padding: 0.1rem;
}

.back-to-top:hover {
    background: darkblue;
}

@media print {
    h1, h2:not(:first-of-type){
        break-before: left;
    }

    .documentation :not(h1):not(h2):not(h3):not(h4):not(h5):not(h6) {
        break-before: avoid-page;
        break-inside: avoid;
    }

    .sidebar {
        display: none;
    }

    .documentation {
        margin: 0;
        box-sizing: border-box;
        width: 100%;
    }
}
