
/* Basic elements */

body {
    margin-top: 38pt;
    padding: 0 16pt 16pt 0;
    background-color: #dddddd;
    font-family: sans-serif;
    font-size: 12pt;
}

a {
    color: #92394c;
}

a:hover {
    color:#ad5872;
}

a.current {
    font-weight: bold;
}

h1 {
    color: #3f5991;
}

h2 {
    color: #3f5991;
}

h3 {
    color: #3f5991;
}

hr {
    width: 90%;
    border: 0;
    border-top: 1pt dashed #444444;
}

/* Page body */

main {
    /* Make children position relative to this */
    position: relative;
    padding: 0 18pt;
    display: flex;
    flex-flow: row-reverse nowrap;
}

article {
    flex-grow: 10;
    /* Somehow this fixes horizontal overflow issues. Thanks @uki-nz ! */
    min-width: 0;
}

article p {
    text-align: justify;

    /* Readability fixes */
    line-height: 1.5;
}

article ol {
    /* Readability fixes */
    line-height: 1.5;
}

/* Table styling */

/* Overall style */
table {
    border: 1pt dashed #444444;
    border-collapse: collapse;
}

/* Even rows */
tr:nth-child(2n) td, .invert-stripes > tbody > tr:nth-child(2n+1) td {
    background-color: #dddddd;
}

/* Odd rows */
tr:nth-child(2n+1) td, .invert-stripes > tbody > tr:nth-child(2n) td {
    background-color: #cccccc;
}

th {
    background-color: #cccccc;
    border-bottom: 2pt solid #3f5991;
    color: black;
    padding: 5pt;
}

td {
    padding: 8pt;

    line-height: 1.4;
}

/* Code-related styles */

pre {
    overflow-x: auto;
    background-color: #c9c8a9;
    color:#444444;
    text-shadow: 1pt 1pt #44444433;
    border: 1pt dashed #444444;
    border-radius: 4pt 4pt 12pt 4pt;
    padding: 10pt;

    /* Readability fixes */
    line-height: 1.2;
}

code {
    white-space: nowrap;
    background-color: #c9c8a9;
    color: #444444;
    text-shadow: 1pt 1pt #44444433;
    border: 1pt solid #444444;
    border-radius: 3pt;
    padding: 0pt 3pt;
}

/* Top navbar */

#navbar {
    /* Use two colors reminiscient of a DMG shell. */
    background-color: #444444;
    color: #d8d8d8;
    padding: 10pt 2% 10pt 2%;
    font-size: 14pt;
    position: fixed;
    top: 0;
    height: 18pt;
    width: 98%;
}

#navbar a {
    text-decoration: none;
    color: inherit;
}

#navbar a:hover {
    text-decoration: underline;
}

#site-name {
    font-size: 16pt;
    font-weight: bold;
}

#to-top {
    float: right;
    margin-right: 16pt;
    background-color: #444444;
}

#logo {
    margin-right: 4pt;
}

/* Navigation sidebar */

#tutorial-index {
    flex-grow: 1;

    /* Fixed would work as well, I just want a tiny superfluous thingy */
    position: -webkit-sticky;
    position: sticky;
    top: 20pt;

    border: 1pt solid #444444;
    border-radius: 5pt 5pt 12pt 5pt;
    margin-right: 15pt;
    margin-top: 20pt;
    padding: 10pt;
    line-height: 1.3;
}

#index-title {
    font-size: 15pt;
}

/* List number formatting */
#tutorial-index > ol {
    list-style-type: upper-roman;
}

#tutorial-index > ol > li > ol {
    list-style-type: decimal;
}

#tutorial-index > ol > li > ol > li > ol {
    list-style-type: lower-alpha;
}

/* Collapsing styling for checkbox trick */
#tutorial-index > ol ol {
    /* Use visibility instead of display: none to avoid the box resizing horizontally when the sub-list pops up */
    visibility: hidden;
    height: 0;
    opacity: 0;
    transition: visibility 0.25s step-end, height 0.25s step-end, opacity 0.25s ease-in;
}

#tutorial-index > ol :checked + label + ol, #tutorial-index > :checked + label + ol ol {
    visibility: visible;
    height: 100%;
    opacity: 1;
    transition: visibility 0.25s step-start, height 0.25s step-start, opacity 0.25s ease-out;
}

/* Hide trick's checkbox */
#tutorial-index input[type="checkbox"] {
    display: none;
}

/* Dynamically alter displayed text (JS-less!) */
#tutorial-index > ol :checked + label::after {
    content: "Collapse";
    background-color: #cccccc;
    color: black;
    border: 1pt solid #444444;
    border-radius: 4pt;
    padding: 0pt 2pt
}

#tutorial-index > ol input[type="checkbox"]:not(:checked) + label::after {
    content: "Expand";
    background-color: #cccccc;
    color: black;
    border: 1pt solid #444444;
    border-radius: 4pt;
    padding: 0pt 2pt;
}

/* Root level has "Expand all" button */
#tutorial-index > :checked + label::after {
    content: "Collapse all";
    background-color: #cccccc;
    color: black;
    border: 1pt solid #444444;
    border-radius: 4pt;
    padding: 0pt 2pt;
}

#tutorial-index > input[type="checkbox"]:not(:checked) + label::after {
    content: "Expand all";
    background-color: #cccccc;
    color: black;
    border: 1pt solid #444444;
    border-radius: 4pt;
    padding: 0pt 2pt;
}

/* Eye-candy */
#tutorial-index label {
    font-size: 80%;
    cursor: pointer;
}

/* Other */

@media print {
    /* Hide the index if printing the page */
    #tutorial-index {
        display: none;
    }
}

@media screen and (max-width: 500px) {
    main {
        flex-flow: column-reverse nowrap;
    }
}