/* to do:
- indented paragraphs, search for   text-indent: 3rem;
but some issues with placement, e.g. summaries
- on short pages, copyright is in middle of page, because main content is short
make it lower
- prism.css is at 60% width atm, like everything else, which really squishes code?
but maybe not an issue

n.b. in prism.css, if getting a new one change overflow to:
    overflow:auto;width:60%;}
    @media screen and (max-width: 760px) {
        pre[class*=language-]
        {width:95%;}
    }
    */

/* Inspired by https://lawler.io 's css, itself inspired by https://edwardtufte.github.io/tufte-css/ */

/* Pages should have this structure:
main
article
header /header

section
h2 - title
/section

section ... /section
/article

footer /footer
/main
*/

/*  <span class="marginnote">Make a margin note like this</span> */

@charset "UTF-8";

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center, dl, dt, dd, li, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
    /* text-wrap: balance; */
}

em {
    font-style: italic;
}

strong {
    font-weight: bold;
}

body {
    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
    align-items: flex-start;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

footer {
    text-align: right;
}
article footer { /* the links to other articles */
    display: flex;
    justify-content:space-around;
    text-align: left;
    width: 70%;
}

sub, sup {
    position: relative;
    font-size: 75%;
    line-height: 0;
    vertical-align: baseline;
}
sup {
    top: -0.5em;
}
sub {
    bottom: -0.25em;
}

/* inline code styles with pre and code */
pre, .page pre {
    padding: .8em;
    line-height: 1.1em;
    overflow: auto;
}
code {
    font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 1.0rem;
}
p > code, li > code, span.sidenote > code, span.marginnote > code {
    box-sizing: border-box;
    padding: 2px 4px;
}

header .header_box {
    padding-top: 4.5em;
}

footer p {
    margin: 0;
    font-size: 1.2rem;
}

main {
    padding: 0 0rem 0 2rem; /* unsure what's best */
    max-width: 1000px;
    width: 70%;
    text-align: justify;
}

/* aside + nav-bar = asidebar! */
aside {
    padding: 8rem 0 0 4rem; /* don't change first 3, last may be 2 or 4 though */
    padding-left: 1rem;
    }

aside, logo {
    text-align: center;
    margin-bottom: 2rem;
    min-height: 123px;
}

aside .main-menu ul {
    text-align: center;
    margin: 0;
    padding: 0;
}

aside .main-menu ul li {
    margin: 0 0 5px 0;
    padding: 0;
    list-style: none;
    text-size-adjust: 80%;
}

/* Links: replicate underline that clears descenders */
aside .main-menu ul li a, a:visited, a:link {
    color: rgb(17, 17, 17);
    text-decoration: none;
    position: relative;
}
aside .main-menu ul li a{ 
    padding: 8px 8px;
}  /* padding these two held a lot of stress and pain */
a:link {
    padding: 0 0 8px 0;
    text-decoration: underline; /* overrides above, but how do i stop it when effect */
}
a:hover, a:active {
    text-decoration: none;
}
aside .main-menu ul li a:after, a::after {
    content: "";
    position: absolute;
    height: 2px;
    bottom: 7px;
    left: 10px;
    right: 10px;
    background-color: rgba(17, 17, 17, 0.7);
    visibility: hidden;
    transform: scaleX(0);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
}
aside .main-menu ul li a:hover:after, a:hover::after {
    visibility: visible;
    transform: scaleX(1);
    text-decoration: none;
}

aside #social {
    text-align: center;
    padding: 0;
    margin: 2rem 0 0;
    display: flex;
    flex-flow: row wrap;
    justify-content: space-evenly;
    align-items: center;
}

aside #social li {
    margin: 0;
    display: inline;
    list-style: none;
    flex: 1;
}

section.available {
    padding-top: 0;
    padding-bottom: 2rem;
}

.available p {
    padding-top: 1rem;
    padding-bottom: 1rem;
    border-top: 1px dashed rgba(17,17,17,0.2);
    border-bottom: 1px dashed rgba(17,17,17,0.2);
}

@media screen and (min-width: 1220px) {
    aside {
        padding-right: 3rem;
    }
}

@media screen and (max-width: 1220px) {
    main {
        padding-right: 0;
    }
    aside logo {
        min-height: initial;
    }
    aside logo img {
        max-width: 100px;
    }
    aside {
        width: 21%;
    }
    .sidenote, .marginnote {
        margin-right: -44%;
        width: 38%;
    }
}

@media screen and (max-width: 950px) {
    main {
        padding-left: 1rem;
    }
    aside {
        padding-left: 1rem;
    }
}

/* sidebar and sidenotes disappear, mobile views this */
@media screen and (max-width: 760px) {
    body {
        display: block;
    }
    main {
        padding-right: 2rem;
        overflow-x: hidden;
        box-sizing: border-box;
        width: 100%;
    }
    body > main > article:first-of-type {
        padding-top: 0;
    }
    aside {
        display: flex;
        flex-flow: row nowrap;
        justify-content: flex-start;
        align-items: center;
        padding: 1rem 0 0 4rem;
    }
    aside logo img {
        max-width: 90px;
    }
    aside logo {
        margin-bottom: 0;
    }
    aside .main-menu ul {
        margin: 0 0 1em 0;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
    }
    aside nav {
        padding-left: 2rem
    }
    aside .main-menu ul {
        text-align: left
    }
    aside .main-menu ul li {
        float: left;
        margin: 0;
        padding: 0 0.25rem;
    }
    aside .main-menu ul li a:hover:after {
        display: none;
        /* padding makes the cool effect not work here */
    }
    aside .main-menu ul li a {
        padding: 0;
        margin-left: 0.25rem;
    }
    aside #social {
        padding-left: 2rem;
        display: block;
        margin: 0;
    }
    aside #social li {
        padding-left: 0.25rem
    }
    .hamburger-menu { 
        display: none;
    }
}

@media screen and (max-width: 600px) {
    main {
        padding: 0 2rem;
    }
    aside {
        padding: 2rem 2rem 0 2rem
    }
}

@media screen and (max-width: 420px) {
    aside logo img {
        max-width: 80px;
    }
    aside .main-menu ul {
        display: flex;
        flex-flow: row wrap;
        align-items: center;
        justify-content: space-between;
        margin: 0;
    }
    aside .main-menu ul li {
        float:none;
        margin-bottom: 8px;
    }
    aside #social {
        display: none;
    }
    aside nav {
        max-width: 170px;
    }
    main > footer {
        padding-bottom: 0.3rem;
    }
}

/* make <del> accessible to screen readers */
del::before, del::after {
    clip-path: inset(100%);
    clip: rect(1px, 1px, 1px, 1px);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

html {
    font-size: 12px; /* maybe 12? */
}

/* makes variables */
:root {
    --mybackground: #f3f3e9;
}

body {
    font-family: "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
    background-color: var(--mybackground);
    color: #111;
}

h1, header { /* header used for title display */
    font-weight: 400;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
    font-size: 3.2rem;
    line-height: 1;
}
h2, h3 {
    font-weight: 400;
    font-size: 1.8rem;
    margin-top: 2.5rem;
    margin-bottom: 1.4rem;
    line-height: 1;
    /* text-indent: 3rem; */
}

h4 {
    font-weight: 400;
    font-size: 1.6rem;
}

hr {
    display: block;
    height: 1px;
    width: 60%;
    border: 0;
    border-top: 2px solid rgba(17, 17, 17, 0.1);
    margin: 1em 0;
    padding: 0;
}
hr.separator {
    margin: 0;
}
hr.separator.extra {
    margin: 4rem 0;
}

article {
    counter-reset: sidenote-counter;
    position: relative;
}
article:first-of-type {
    padding: 4rem 0;
}

section {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

p {
    margin-top: 1.4rem;
    margin-bottom: 1.4rem;
    padding-right: 0;
    vertical-align: baseline;
    /* text-indent: 3rem; */
}
p {
    font-size: 1.4rem;
    line-height: 2rem;
}
ol {
    list-style: outside decimal;
    font-size: 1.4rem;
    line-height: 1.6rem;
}
ul, ul > ul  {
    list-style: outside '∙ ';
    font-size: 1.4rem;
    line-height: 1.6rem;
}
li:has(details[open]) {
    list-style-type: none; 
} /* Change list style when details is expanded, to look like an arrow */
li:has(details:not([open])) {
    list-style-type: '- ';
}
li:not(:first-child) {
    margin-top: 0.25rem;
}

blockquote {
    margin: 3%;
    font-size: 1.4rem;
    padding-left: 1rem;
    border-left: 2px solid rgba(17, 17, 17, 0.1);
    width: 64%;
    text-align: left;
}

section > p, section > footer, section > table, section > hr  {
    width: 70%; /* this is a super important part */
}
details > div > pre {
    width: 100%
}
section pre {
    width: 70%
}
/* 64 + 3 <70, to be about same width as paragraph above */
section > ol, section > ul, section > ul > ul {
    width: 64%;
    -webkit-padding-start: 3%;
    -moz-padding-start: 3%;
}

/* sidenotes have a number before them - to align with one in the text
marginnotes don't */
.sidenote, .marginnote {
    text-align: left;
    float: right;
    clear: right;
    margin-right: -48%;
    width: 35%;
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1.1rem;
    line-height: 1.3;
    vertical-align: baseline;
    position: relative;
    /* Otherwise, highlighting a paragraph correctly grabs the sidenotes
     TODO: figure out how to improve this later
     clickable would be nice */
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
    user-select: none;
}

.sidenote-number {
    counter-increment: sidenote-counter;
}
.sidenote-number:after {
    content: counter(sidenote-counter);
    font-size: 1rem;
    top: -0.5rem;
    left: 0.1rem;
}
.sidenote:before {
    content: counter(sidenote-counter) " ";
    font-size: 1rem;
    top: -0.5rem;
}
blockquote .sidenote, blockquote .marginnote {
    margin-right: -82%;
    min-width: 59%;
    text-align: left;
}

article img {
    max-width: 100%;
}

h1 > code, h2 > code, h3 > code {
    font-size: 0.80em;
}

label.sidenote-number {
    display: inline;
}

label.margin-toggle:not(.sidenote-number) {
    display: none;
}

.iframe-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    padding-top: 25px;
    height: 100%;
}
.iframe-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 75%;
    height: 50%;
}

sup {
    font-size: 50%;
    vertical-align: .5em;
    content: "+";
    left: -0.3em;
}

@media (max-width: 760px) {
    h1, header {
        margin-top: 0rem;
    }
    hr,  section > p,  section > footer,  section > table {
        width: 100%;
    }
    pre.code {
        width: 97%;
    }
    section > ol {
        width: 90%;
    }
    section > ul {
        width: 90%;
    }
    figure {
        max-width: 90%;
    }
    figcaption, figure.fullwidth figcaption {
        margin-right: 0;
        max-width: none;
    }
    blockquote {
        margin-left: 0;
        margin-right: 0;
        width: 90%;
    }
    label.sidenote-number {
        text-decoration: underline;
        color: #6087dd;
    }
    label {
        cursor: pointer;
    }
    div.table-wrapper, table {
        width: 85%;
    }
}