/* Classless.css v1.1 - Custom Build
 * Includes: Theme Settings, Reset, Base Styles, Tooltips/Citations, Navbar, Aside (Margin Notes), Forms
 * Excludes: Auto-numbering, Cards, Drop caps, Ornaments, Grid system, Utility classes
 */

/* 1. Theme Settings ––––––––––––––––––––-–––––––––––––– */

:root,
html[data-theme="light"] {
    --rem: 12pt;
    --width: 50rem;
    /*--navpos: static;  fixed | absolute | static */
    --font-p:
        1em/1.7 "Open Sans", "DejaVu Sans", FreeSans, Helvetica, sans-serif;
    --font-h:
        0.9em/1.5 "Open Sans", "DejaVu Sans", FreeSans, Helvetica, sans-serif;
    --font-c: 0.9em/1.4 "DejaVu Sans Mono", monospace;
    --border: 1px solid var(--cmed);
    --ornament: "‹‹‹ ›››";
    /* foreground   | background color */
    --cfg: #433;
    --cbg: #fff;
    --cdark: #888;
    --clight: #f5f6f7;
    --cmed: #d1d1d1;
    --clink: #07c;
    --cemph: #088;
    --cemphbg: #0881;
}

/* 2. Reset –––––––––––––––––––––––––––––––––––––––––––– */

/* reset block elements  */
* {
    box-sizing: border-box;
    border-spacing: 0;
    margin: 0;
    padding: 0;
}
header,
footer,
figure,
video,
details,
blockquote,
ul,
ol,
dl,
fieldset,
pre,
pre > code {
    display: block;
    margin: 0.5rem 0 1rem;
    width: 100%;
    overflow: auto hidden;
    text-align: left;
}
video,
summary,
input,
select {
    outline: none;
}

/* reset clickable things  (FF Bug: select:hover prevents usage) */
a,
button,
select,
summary {
    color: var(--clink);
    cursor: pointer;
}

/* 3. Base Style ––––––––––––––––––––––––––––––––––––––– */
html {
    font-size: var(--rem);
    background: var(--cbg);
}
body {
    position: relative;
    margin: auto;
    /*max-width: var(--width);*/
    font: var(--font-p);
    color: var(--cfg);
    margin: 0 auto 0;
    overflow-x: hidden;
}
body > footer {
    margin: 10rem 0 0;
    font-size: 90%;
}

/* main container: constrained width for content */
main {
    max-width: var(--width);
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

/* utility: break out to full viewport width from within constrained container */
.full-bleed {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
}

p {
    margin: 0.6em 0;
}

/* links */
a[href] {
    text-decoration: underline solid 1.5px var(--cmed);
    text-underline-position: under;
}
a[href^="#"] {
    text-decoration: none;
}
a:hover,
button:not([disabled]):hover,
summary:hover,
select:hover {
    filter: brightness(92%);
    color: var(--cemph);
    border-color: var(--cemph);
}

a:visited {
    color: rebeccapurple;
}

/* lists */
ul,
ol,
dl {
    margin: 1rem 0;
    padding: 0 0 0 2em;
}
li:not(:last-child),
dd:not(:last-child) {
    margin-bottom: 0.5rem;
}
dt {
    font-weight: bold;
}

/* headings */
/*h1,*/
h2,
h3,
h4,
h5 {
    margin: 1.5em 0 0.5rem;
    font: var(--font-h);
    line-height: 1.2em;
    clear: both;
}
h1 + h2,
h2 + h3,
h3 + h4,
h4 + h5 {
    margin-top: 0.5em;
    padding-top: 0;
} /* non-clashing headings */
h1 {
    margin: 1.5em 0 0.5rem;
    font: var(--font-h);
    line-height: 1.2em;
    font-size: 2.2em;
    font-weight: 300;
    text-align: center;
}
h2 {
    font-size: 2em;
    font-weight: 300;
    font-variant: small-caps;
}
h3 {
    font-size: 1.5em;
    font-weight: 400;
}
h4 {
    font-size: 1.1em;
    font-weight: 700;
}
h5 {
    font-size: 1.2em;
    font-weight: 400;
    color: var(--cfg);
}
h6 {
    font-size: 1em;
    font-weight: 700;
    font-style: italic;
    display: inline;
}
h6 + p {
    display: inline;
}

/* tables */
td,
th {
    padding: 0.5em 0.8em;
    text-align: right;
    border-bottom: var(--border);
    white-space: nowrap;
    font-size: 95%;
}
thead th[colspan] {
    padding: 0.2em 0.8em;
    text-align: center;
}
thead tr:not(:only-child) td {
    padding: 0.2em 0.8em;
}
thead + tbody tr:first-child td {
    border-top: var(--border);
}
td:first-child,
th:first-child {
    text-align: left;
}
tr:hover {
    background-color: var(--clight);
}
table img {
    display: block;
}

/* figures */
img,
svg {
    max-width: 100%;
    vertical-align: text-top;
    object-fit: cover;
}
p > img:not(:only-child) {
    float: right;
    margin: 0 0 0.5em 0.5em;
}
figure > img {
    display: inline-block;
    width: auto;
}
figure > img:only-of-type,
figure > svg:only-of-type {
    max-width: 100%;
    display: block;
    margin: 0 auto 0.4em;
}
figure > *:not(:last-child) {
    margin-bottom: 0.4rem;
}

/* captions */
figcaption,
caption {
    text-align: left;
    font: var(--font-h);
    color: var(--cdark);
    width: 100%;
}
figcaption > *:first-child,
caption > *:first-child {
    display: inline-block;
    margin: 0;
}
table caption:last-child {
    caption-side: bottom;
    margin: 0.5em 0;
}

/* code */
pre > code {
    margin: 0;
    position: relative;
    padding: 0.8em;
    border-left: 0.4rem solid var(--cemph);
}
code,
kbd,
samp {
    padding: 0.2em;
    font: var(--font-c);
    background: var(--clight);
    border-radius: 4px;
}
kbd {
    border: 1px solid var(--cmed);
}

/* misc */
blockquote {
    border-left: 0.4rem solid var(--cmed);
    padding: 0 0 0 1rem;
}
time {
    color: var(--cdark);
}
hr {
    border: 0;
    border-top: 0.1rem solid var(--cmed);
}
nav {
    width: 100%;
    background-color: transparent;
    text-align: right;
    padding: 0 1rem;
}
::selection,
mark {
    background: var(--clink);
    color: var(--cbg);
}

div#TOC {
    float: left;
    width: 25%;
    border: black 1px solid;
    margin: 0 1rem 1rem 0;
}

/* 4. Extras: Tooltips & Citations ––––––––––––––––––––– */

/* tooltip + citation */
article p > cite:before {
    padding: 0 0.5em 0 0;
    counter-increment: ref;
    content: " [" counter(ref) "] ";
    vertical-align: super;
    font-size: 0.6em;
}
article p > cite > *:only-child {
    display: none;
}
article p > cite:hover > *:only-child,
[data-tooltip]:hover:before {
    display: inline-block;
    z-index: 40;
    white-space: pre-wrap;
    position: absolute;
    left: 1rem;
    right: 1rem;
    padding: 1em 2em;
    text-align: center;
    transform: translateY(calc(-100%));
    content: attr(data-tooltip);
    color: var(--cbg);
    background-color: var(--cemph);
    box-shadow: 0 2px 10px 0 black;
}
[data-tooltip],
article p > cite:before {
    color: var(--clink);
    border: 0.8rem solid transparent;
    margin: -0.8rem;
}
abbr[title],
[data-tooltip] {
    cursor: help;
}

/* 5. Extras: Navbar ––––––––––––––––––––––––––––––––––– */

/* navbar */
nav + * {
    margin-top: 3rem;
}
body > nav,
header nav {
    margin: 0 0 1rem;
}
nav ul {
    list-style-type: none;
}
nav ul:first-child {
    margin: 0;
    padding: 0;
    overflow: visible;
}
nav ul:first-child > li {
    display: inline-block;
    margin: 0;
    padding: 0.8rem 0.6rem;
}
nav ul > li > ul {
    display: none;
    width: auto;
    position: absolute;
    margin: 0.5rem 0;
    padding: 1rem 2rem;
    background-color: var(--clight);
    border: var(--border);
    border-radius: 4px;
    z-index: 42;
}
nav ul > li > ul > li {
    white-space: nowrap;
}
nav ul > li:hover > ul {
    display: block;
}
@media (max-width: 40rem) {
    nav ul:first-child > li:first-child:after {
        content: " \25BE";
    }
    nav ul:first-child > li:not(:first-child):not(.sticky) {
        display: none;
    }
    nav ul:first-child:hover > li:not(:first-child):not(.sticky) {
        display: block;
        float: none !important;
        padding: 0.3rem 0.6rem;
    }
}

/* 6. Extras: Aside (Margin Notes) –––––––––––––––––––– */

/* side menu (aside is not intended for use in a paragraph!) */
main aside {
    position: absolute;
    width: 8rem;
    right: -8.6rem;
    font-size: 0.8em;
    line-height: 1.4em;
}
@media (max-width: 70rem) {
    main aside {
        display: none;
    }
}

/* 7. Extras: Forms –––––––––––––––––––––––––––––––––––– */

/* forms and inputs  */
textarea,
input:not([type="range"]),
button,
select {
    font: var(--font-h);
    border-radius: 4px;
    border: 1.5px solid var(--cmed);
    padding: 0.4em 0.8em;
    color: var(--cfg);
    background-color: var(--clight);
}
fieldset select,
input:not([type="checkbox"]):not([type="radio"]) {
    display: block;
    width: 100%;
    margin: 0 0 1rem;
}
button,
select {
    font-weight: bold;
    margin: 0.5em;
    border: 1.5px solid var(--clink);
    color: var(--clink);
}
button {
    padding: 0.4em 1em;
    font-size: 85%;
    letter-spacing: 0.1em;
}
button[disabled] {
    color: var(--cdark);
    border-color: var(--cmed);
}
fieldset {
    border-radius: 4px;
    border: var(--border);
    padding: 0.5em 1em;
}
textarea:hover,
input:not([type="checkbox"]):not([type*="ra"]):hover {
    border: 1.5px solid var(--cemph);
}
textarea:focus,
input:not([type="checkbox"]):not([type*="ra"]):focus {
    border: 1.5px solid var(--clink);
    box-shadow: 0 0 5px var(--clink);
}
p > button {
    padding: 0 0.5em;
    margin: 0 0.5em;
}
p > select {
    padding: 0;
    margin: 0 0.5em;
}

