:root {
    --dark: #070707;
    --light: #f3f2f0;
    --blue: #305ca9;
    --grey: #404040;
    --lgrey: #c0c0c0;
    --dllu-size: 32px;
    --dllu-thickness: 8px;
    --dllu-margin: 16px;
    --dllu-time: 0.8s;
}

@media (prefers-color-scheme: dark) {
    :root {
        --dark: #f3f2f0;
        --light: #111111;
        --blue: #7da7ff;
        --grey: #b9b9b9;
        --lgrey: #404040;
    }
}

* {
    margin: 0;
    padding: 0;
}

html {
    overflow-y: scroll;
}

body {
    font-family: 'Inter', 'Source Sans Pro', sans-serif;
    font-optical-sizing: auto;
    color: var(--dark);
    font-size: 16px;
    background: var(--light);
}

a, a:visited {
    text-decoration: none;
    color: var(--blue);
    outline: none;
    font-weight: 600;
}

a:hover, a:focus {
    background-color: var(--blue);
    color: var(--light);
    outline: none;
}

main {
    width: 80%;
    max-width: 600px;
    margin: 0 auto;
    font-kerning: normal;
}

nav {
    width: 80%;
    max-width: 600px;
    margin: 20px auto;
}

h1, h2, h3, h4, h5, h6 {
    display: flex;
    display: -webkit-flex;
}
h1 {
    font-weight: 900;
    font-size: 1.3em;
    line-height: 1em;
    margin: 2em 0 0.5em 0;
}
header>h1 {
    margin-top: 0em;
}
h2 {
    font-weight: 900;
    font-size: 1.1em;
    line-height: 1em;
    margin-top: 1.5em;
}
h3 {
    font-weight: 900;
    font-size: 1em;
    line-height: 1em;
    margin-top: 1.5em;
}
header h1 {
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}
.refname {
    font-size: 0.8em;
    padding: 0.1em;
    color: var(--grey);
}
.refname:before {
    content: "[";
    padding-right: 0.1em;
}
.refname:after {
    content: "]";
    padding-left: 0.1em;
}
a.refname {
    font-size: 0.7em;
    vertical-align: super;
    color: var(--blue);
}
a.refname:hover, a.refname:focus {
    background-color: var(--blue);
    color: var(--light);
}
a.hnum {
    flex-grow: 0;
    -webkit-flex-grow: 0;
    flex-shrink: 0;
    -webkit-flex-shrink: 0;
    display: inline-block;
    color: var(--grey);
    font-size: 0.8em;
    margin-right: 1em;
    height: 1.25em;
    line-height: 1.25em;
}
a.fignum {
    color: var(--grey);
    font-weight: 700;
}
a.eqnum {
    display: block;
    position: absolute;
    color: var(--grey);
    top: 0;
    left: 100%;
    text-align: center;
    font-size: 0.7em;
    height: 2em;
    width: 2em;
    line-height: 2em;
    border: 1px solid var(--grey);
    border-radius: 50%;
}
a.hnum:hover, a.hnum:focus, a.fignum:hover, a.fignum:focus, a.eqnum:hover, a.eqnum:focus {
    color: var(--light);
    background-color: var(--grey);
}
a.bigbutton {
    display: block;
    margin: auto;
    width: 30%;
    min-width: 160px;
    text-align: center;
    padding: 1em;
    background: var(--light);
    border: 2px solid var(--grey);
    color: var(--grey);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}
a.bigbutton:hover {
    background: var(--grey);
    color: var(--light);
}

p, ul, ol, blockquote, figure {
    font-size: 1em;
    line-height: 1.35em;
    margin: 1em 0;
    hyphens: auto;
}

figure.wide {
    width: 200%;
    max-width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

img {
    height: auto;
}
figure.wide figcaption {
    width: 600px;
    margin: 0 auto;
}
ol li, ul li {
    display: list-item;
    margin: 0.5em 0 0.5em 1em;
}
ol {
    list-style: outside decimal none;
}
ul {
    list-style: outside disc none;
}
ul ul {
    margin: 0;
}
pre, blockquote {
    border-top: 1px solid var(--grey);
    border-bottom: 1px solid var(--grey);
    padding: 1em;
    color: var(--grey);
}
pre, code {
    font-family: "Source Code Pro", monospace;
    font-size: 0.75em;
    font-weight: 500;
    background-color: --lgrey;
}
pre {
    white-space: pre-wrap;
}
code {
    color: var(--grey);
    font-weight: 600;
}
div.math {
    position: relative;
    text-align: center;
}
em {
    font-style: italic;
}
strong {
    font-weight: 700;
}

figure {
    position: relative;
    width: 100%;
}
figure img, figure picture {
    display: block;
    margin: 0 auto;
    max-width: 100%;
}
table img {
    display: inline-block;
    max-width: none;
}
figcaption {
    background: var(--light);
}
figcaption p {
    margin-top: 0;
}
figcaption img {
    display: inline-block;
    max-width: none;
}
figure>a {
    cursor: zoom-in;
}

figcaption {
    font-size: 0.9em;
    line-height: 1.1em;
    letter-spacing: 0.05em;
    color: var(--grey);
    hyphens: auto;
}

figcaption>ul {
    list-style: none;
}
figcaption>ul>li {
    display: inline-block;
    margin: 0em;
    height: 3em;
}
figcaption>ul>li>a {
    display: block;
    padding: 0 1em;
    line-height: 3em;
    vertical-align: middle;
    height: 3em;
}

table {
    width: 100%;
    text-align: center;
    color: var(--grey);
}
th {
    border-bottom: 1px solid var(--grey);
    font-weight: 700;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
th, td {
    padding: 0.3em;
}
tr:nth-child(even) {
    background-color: --lgrey;
}

.toc {
    font-size: 0.7em;
    line-height: 1.25em;
    letter-spacing: 0.05em;
    color: var(--grey);
}
.toc a {
    color: var(--grey);
    font-weight: 600;
}
.toc a:hover, .toc a:focus {
    color: var(--light);
    background-color: var(--grey);
}
.toc ol ol {
    margin: 0.5em 0 0.5em 0.5em;
}
.toc ol li {
    margin: 0;
    padding: 0;
    list-style: none;
    position: relative;
}
.tocnum {
    display: block;
    float: left;
    height: 100%;
    margin: 0 1em 0 1em;
    font-weight: 400;
}
.toc ol li a {
    display: flex;
    display: -webkit-flex;
}
.toc ol li a .tocnum {
    flex-grow: 0;
    -webkit-flex-grow: 0;
    flex-shrink: 0;
    -webkit-flex-shrink: 0;
}

canvas {
    max-width: 100%;
}

@media all and (min-width: 1200px) {
    figure:not(.wide)>figcaption {
        position: absolute;
        top: 0px;
        left: 100%;
        padding-left: 20px;
        width: 280px;
    }
    figure.wide>figcaption {
        position: relative;
        padding: 1em 2em;
    }
    .fignum {
        display: block;
        margin-bottom: 0.5em;
    }
    .toc {
        position: absolute;
        top: calc(2 * var(--dllu-thickness) + 2 * var(--dllu-size) + 2 * var(--dllu-margin));
        right: 50%;
        margin-right: 320px;
        width: 280px;
    }
    .toc>ol {
        margin: 3em 1em 3em 0;
    }
}

@media all and (max-width: 1199px) {
    figcaption {
        position: relative;
        padding: 1em 2em;
    }
    .fignum {
        display: inline-block;
        margin-right: 1em;
    }
}

@media all and (max-width: 750px) {
    body {
        font-size: 2.4vw;
    }
}

@media all and (max-width: 543px) {
    body {
        font-size: 13px;
    }
}

#hero {
    display: block;
    height: calc(2 * var(--dllu-thickness) + 2 * var(--dllu-size) + 2 * var(--dllu-margin));
}

#hero-a {
    display: block;
    height: calc(2 * var(--dllu-thickness) + 2 * var(--dllu-size) + 2 * var(--dllu-margin));
    width:  calc(2 * var(--dllu-thickness) + 2 * var(--dllu-size) + 2 * var(--dllu-margin));
    margin: 0 auto;
}

#hero-a:hover,
#hero-a:focus {
    background: none;
}

#dllu-hero {
    display: block;
    position: relative;
    cursor: pointer;
    margin: 0;
    height: calc(2 * var(--dllu-thickness) + 2 * var(--dllu-size) + 2 * var(--dllu-margin));
    width:  calc(2 * var(--dllu-thickness) + 2 * var(--dllu-size) + 2 * var(--dllu-margin));
    border-radius: 50%; /* so that the hover target is a perfect circle */
    transition: var(--dllu-time);
    animation-name: dllu-hero-keyframes;
    animation-duration: var(--dllu-time);
    animation-iteration-count: 1;
}

#D, #L0, #L1, #U {
    position: absolute;
    width:  calc(var(--dllu-size) - 2 * var(--dllu-thickness));
    height: calc(var(--dllu-size) - 2 * var(--dllu-thickness));
    transition: var(--dllu-time);
}

#D {
    padding-left: var(--dllu-thickness);
    border-top: var(--dllu-thickness) solid var(--grey);
    border-right: var(--dllu-thickness) solid var(--grey);
    border-bottom: var(--dllu-thickness) solid var(--grey);
    border-top-right-radius: 50%;
    border-bottom-right-radius: 50%;
    top: var(--dllu-margin);
    left: var(--dllu-margin);
    animation-name: D-keyframes;
    animation-duration: var(--dllu-time);
    animation-iteration-count: 1;
}

#L0, #L1 {
    padding-top: var(--dllu-thickness);
    padding-right: var(--dllu-thickness);
    border-left: var(--dllu-thickness) solid var(--grey);
    border-bottom: var(--dllu-thickness) solid var(--grey);
    animation-name: L-keyframes;
    animation-duration: var(--dllu-time);
    animation-iteration-count: 1;
}

#L0 {
    top:  calc(var(--dllu-size) + var(--dllu-margin) + 2 * var(--dllu-thickness));
    left: var(--dllu-margin);
}

#L1 {
    top:  var(--dllu-margin);
    left: calc(var(--dllu-size) + var(--dllu-margin) + 2 * var(--dllu-thickness));
}

#U {
    padding-top: var(--dllu-thickness);
    border-right: var(--dllu-thickness) solid var(--grey);
    border-left: var(--dllu-thickness) solid var(--grey);
    border-bottom: var(--dllu-thickness) solid var(--grey);
    border-bottom-right-radius: 50%
    ;
    border-bottom-left-radius: 50%;
    top:  calc(var(--dllu-size) + var(--dllu-margin) + 2 * var(--dllu-thickness));
    left: calc(var(--dllu-size) + var(--dllu-margin) + 2 * var(--dllu-thickness));
    animation-name: U-keyframes;
    animation-duration: var(--dllu-time);
    animation-iteration-count: 1;
}

#hero-a:hover #dllu-hero {
    transform: rotate(180deg);
}

#hero-a:hover #D,
#hero-a:hover #L0,
#hero-a:hover #L1,
#hero-a:hover #U {
    border-color: var(--blue);
}

#hero-a:hover #D {
    transform: rotate(-90deg);
}

#hero-a:hover #L0,
#hero-a:hover #L1 {
    transform: rotate(-180deg);
}

#hero-a:hover #U {
    transform: rotate(-270deg);
}

@keyframes dllu-hero-keyframes {
    from {
        transform: rotate(0deg);
    } to {
        transform: rotate(180deg);
    }
}
@keyframes D-keyframes {
    from {
        transform: rotate(0deg);
    } to {
        transform: rotate(-90deg);
    }
}
@keyframes L-keyframes {
    from {
        transform: rotate(0deg);
    } to {
        transform: rotate(-180deg);
    }
}
@keyframes U-keyframes {
    from {
        transform: rotate(0deg);
    } to {
        transform: rotate(-270deg);
    }
}

#blogposts {
    display: table;
    width: 100%;
}
#blogposts a, #blogposts a:visited {
    color: var(--dark);
}
.blogdate {
    color: var(--grey);
}
#blogposts a:hover, a:focus {
    background: var(--lgrey);
    color: var(--grey);
}
a:hover .blogdate, a:focus .blogdate {
    color: var(--light);
    background: var(--grey);
}
#blogposts a {
    display: table-row;
    font-weight: 400;
    line-height: 1.5em;
}
.blogdate {
    display: table-cell;
    color: var(--grey);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.8em;
    font-weight: 600;
    line-height: 1.5em / 0.8em;
    padding: 5px 10px;
    text-align: center;
    font-family: "Source Code Pro", monospace;
}
.blogtitle {
    display: table-cell;
    padding: 5px 10px;
}

#rootnav {
    display: flex;
    flex-flow: row wrap;
    background: var(--lgrey);
}
#rootnav a, #rootnav a:visited {
    color: var(--grey);
}
#rootnav a:hover, #rootnav a:focus {
    background: var(--grey);
    color: var(--light);
}
#rootnav a {
    text-align: center;
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.5em 0em;
    flex: 1 0 auto;
}

footer {
    color: var(--grey);
    margin: 3em auto;
    width: 80%;
    max-width: 600px;
}
