:root {
    --dark: #070707;
    --light: #f3f2f0;
    --blue: #305ca9;
    --grey: #404040;
    --lgrey: #c0c0c0;
    --accent: #780096;
    --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: #c5c5c5;
        --lgrey: #404040;
        --accent: #a755f9;
    }
}

* {
    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;
    padding: 0.3em;
    margin: -0.3em;
    border-radius: 9999px;
    transition: 0.2s ease-out;
}

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(--accent);
}
.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(--accent);
    font-size: 0.8em;
    margin-right: 1em;
    height: 1.25em;
    line-height: 1.25em;
}
a.fignum {
    color: var(--accent);
    font-weight: 700;
}
a.eqnum {
    display: block;
    position: absolute;
    color: var(--accent);
    top: 0;
    left: 100%;
    text-align: center;
    font-size: 0.7em;
    height: 2em;
    width: 2em;
    line-height: 2em;
    border: 1px solid var(--accent);
    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(--accent);
}
a.bigbutton {
    display: block;
    margin: auto;
    width: 30%;
    min-width: 160px;
    text-align: center;
    padding: 1em;
    background: var(--light);
    border: 2px solid var(--accent);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}
a.bigbutton:hover, a.bigbutton:focus {
    background: var(--accent);
    color: var(--light);
}

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

time.date {
    display: block;
}
time.date, time.blogdate {
    font-variant-numeric: tabular-nums;
}

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

img {
    height: auto;
    image-orientation: from-image;
}
figure.wide figcaption {
    max-width: calc(600px - 4em);
    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;
}
header {
    border-bottom: 1px solid var(--accent);
}
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-weight: 500;
    background-color: --lgrey;
}
pre {
    white-space: pre-wrap;
    font-size: 0.75em;
}
code {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85em;
}
div.math {
    position: relative;
    text-align: center;
}
em {
    font-style: italic;
}
strong {
    font-weight: 700;
}

figure {
    position: relative;
    width: 100%;
}
figure img, figure picture, figure video {
    display: block;
    margin: 0 auto;
    max-width: 100%;
}
figure video {
    height: auto;
}
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;
}

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

figcaption details {
    transition: 300ms ease;
}

figcaption details > summary {
    background: var(--lgrey);
    color: var(--dark);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.85em;
    border-radius: 9999px;
    padding: 0.6em;
    margin-top: 0.5em;
    text-align: center;
    cursor: pointer;
    transition: 0.2s ease-out;
    font-weight: 600;
    list-style: none;
}
figcaption details > summary::before {
    content: "";
}
figcaption details > summary::-webkit-details-marker {
    display:none;
}
figcaption details > summary::after {
    padding-right: 0.7em;
    content: "+";
    display: block;
    float: right;
    font-family: "Source Code Pro", monospace;
    font-weight: 900;
}
figcaption details[open] > summary::after {
    content: "-";
}

figcaption details summary:hover {
    background: var(--accent);
    color: var(--light);
}

figcaption details > dl {
    margin: 0;
    padding: 0.2em 0.9em;
    font-size: 0.85em;
    line-height: 1.5;
    color: var(--grey);
    opacity: 0;
    overflow: hidden;
}
figcaption details[open] > dl {
    opacity: 1;
}
figcaption details > dl > dt {
    float: left;
    clear: left;
    width: 9.5ch;
    color: var(--dark);
    font-weight: 700;
}
figcaption details > dl > dd {
    margin: 0 0 0.25em 0;
    padding-left: 10.5ch; /* dt width + gap */
    font-variant-numeric: tabular-nums;
}

figcaption details nav {
    margin: 0;
    padding: 0 1em;
}
figcaption details nav ul {
    display: flex;
    flex-wrap: wrap; 
    gap: 0.4em 0.8em;
    list-style: none;
    margin: 0.4em 0 0.8em;
    padding: 0;
}

figcaption details nav li {
    margin: 0;
}

figcaption details nav a,
figcaption details nav a:visited {
    display: inline-block;
    padding: 0.25em 0.65em;
    font-size: 0.9em;
    line-height: 1.4;
    border-radius: 9999px;
    background: var(--light);
    text-decoration: none;
    color: var(--blue);
    transition: background 0.15s ease, border-color 0.15s ease;
}

figcaption details nav a:hover,
figcaption details nav a:focus {
    background: var(--blue);
    color: var(--light);
}

.figure-image,
.figure-image + figcaption {
    --figure-control-height: max(44px, 2.4em);
    --figure-control-padding: 0.85em;
    --figure-caption-gap: 0.65em;
}

/* The panel shares the image row; the summary has its own caption-side row. */
.figure-image {
    display: grid;
    grid-template-rows: auto auto;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}
.figure-image > img,
.figure-image > .figure-controls {
    min-width: 0;
    min-height: 0;
}
.figure-image > img {
    grid-area: 1 / 1;
    margin: 0;
}
.figure-controls {
    display: grid;
    grid-area: 1 / 1 / 3 / 2;
    grid-template-rows: subgrid;
    pointer-events: none;
    color: var(--dark);
    font-size: 0.9em;
    line-height: 1.5;
}
/* Size containment keeps long metadata from changing the rendered image bounds. */
.figure-controls::details-content {
    grid-area: 1 / 1;
    min-width: 0;
    min-height: 0;
    contain: size;
    /* Let the inner panel finish fading before visibility hides it. */
    content-visibility: visible;
}
.figure-controls > summary {
    display: grid;
    grid-area: 1 / 1 / 3 / 2;
    grid-template-rows: subgrid;
    min-width: 0;
    min-height: 0;
    list-style: none;
    outline: none;
}
.figure-image-toggle {
    grid-area: 1 / 1;
    position: relative;
    min-width: 0;
    min-height: 0;
    cursor: pointer;
    pointer-events: auto;
}
.figure-controls[open] .figure-image-toggle {
    pointer-events: none;
}
.figure-controls > summary:focus-visible .figure-image-toggle {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
.figure-close {
    position: absolute;
    z-index: 2;
    top: 0.5em;
    right: 0.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--figure-control-height);
    height: var(--figure-control-height);
    border-radius: 9999px;
    background: var(--light);
    color: var(--accent);
    font-size: 1em;
    line-height: 1;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 200ms ease, visibility 0s linear 200ms;
}
.figure-controls[open] .figure-close {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}
.figure-close:hover,
.figure-controls > summary:focus-visible .figure-close {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
/* These names describe the current action on the single keyboard control. */
.figure-action-open,
.figure-action-close {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.figure-action-close,
.figure-controls[open] .figure-action-open {
    display: none;
}
.figure-controls[open] .figure-action-close {
    display: block;
}
.figure-controls .figure-label {
    grid-area: 2 / 1;
    align-self: start;
    width: fit-content;
    display: flex;
    align-items: center;
    height: var(--figure-control-height);
    margin: 0.5em calc(2em - var(--figure-control-padding)) var(--figure-caption-gap);
    padding: 0.65em var(--figure-control-padding);
    box-sizing: border-box;
    max-width: 100%;
    background: transparent;
    color: var(--accent);
    border-radius: 9999px;
    font-size: 1em;
    font-weight: 700;
    line-height: 1.1em;
    letter-spacing: 0.05em;
    text-align: left;
    cursor: pointer;
    list-style: none;
    pointer-events: auto;
    transition: 0.2s ease-out;
}
.figure-controls > summary::-webkit-details-marker {
    display: none;
}
.figure-controls[open] .figure-label {
    background: var(--accent);
    color: var(--light);
}
.figure-controls .figure-label:hover,
.figure-controls > summary:focus-visible .figure-label {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.figure-info {
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease, visibility 0s linear 200ms;
    box-sizing: border-box;
    height: 100%;
    overflow: auto;
    padding: 1.5em;
    pointer-events: none;
    overflow-wrap: anywhere;
    background: color-mix(in srgb, var(--light) 80%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.figure-controls[open] .figure-info {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
    pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
    .figure-info,
    .figure-close,
    .figure-controls .figure-label {
        transition: none;
    }
}
.figure-info > * {
    flex-shrink: 0;
}
.figure-info p {
    padding-right: var(--figure-control-height);
    margin: 0 0 1.25em;
}
.figure-info .figure-permalink {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    min-height: var(--figure-control-height);
    margin: 0 0 0 calc(-1 * var(--figure-control-padding));
    padding: 0.65em var(--figure-control-padding);
    font-size: 1em;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: 9999px;
    line-height: 1.1;
    color: var(--accent);
}
.figure-info .figure-permalink:hover,
.figure-info .figure-permalink:focus {
    background: var(--accent);
    color: var(--light);
}
.figure-info dl {
    display: grid;
    grid-template-columns: minmax(0, 9.5ch) minmax(0, 1fr);
    gap: 0.5em 1.5ch;
    font-size: 1em;
    color: var(--grey);
}
.figure-info dt {
    color: var(--dark);
    font-weight: 700;
}
.figure-info dd {
    font-variant-numeric: tabular-nums;
}
.figure-info nav {
    padding-top: 1.5em;
    width: auto;
    max-width: none;
    margin: auto 0 0;
}
.figure-info nav ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10em), 1fr));
    grid-auto-rows: 1fr;
    gap: 0.75em;
    list-style: none;
    margin: 0;
    padding: 0;
}
.figure-info nav li {
    display: flex;
    min-width: 0;
    margin: 0;
}
.figure-info nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    margin: 0;
    padding: 0.5em;
    text-align: center;
    font-size: 0.9em;
    line-height: 2.5;
    background: var(--light);
    border: 2px solid var(--grey);
    color: var(--grey);
}
.figure-info nav a:hover,
.figure-info nav a:focus-visible {
    background: var(--blue);
    color: var(--light);
    border: 2px solid var(--blue);
}

.figure-image + figcaption,
figure.wide > .figure-image + figcaption {
    padding-top: 0;
}
@media all and (min-width: 1200px) {
    figure:not(.wide) .figure-controls .figure-label {
        position: absolute;
        z-index: 1;
        top: 0;
        left: 100%;
        margin: 0 0 0 calc(20px - var(--figure-control-padding));
        white-space: nowrap;
    }
    figure:not(.wide) > .figure-image + figcaption {
        padding-top: calc(var(--figure-control-height) + var(--figure-caption-gap));
    }
}
figure.wide .figure-controls .figure-label {
    margin-left: calc(max(2em, (100% - (600px - 4em)) / 2) - var(--figure-control-padding));
}

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%;
    height: auto;
    display: block;
}

iframe {
    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(--accent);
}

#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, #blogposts a:hover, #blogposts a:focus {
    color: var(--dark);
    background: none;

}
time.blogdate {
    color: var(--grey);
}
a:hover .blogtitle, a:focus .blogtitle {
    color: var(--grey);
    background: var(--lgrey);
}
a:hover time.blogdate, a:focus time.blogdate {
    color: var(--light);
    background: var(--accent);
}
#blogposts a {
    display: table-row;
    font-weight: 400;
    line-height: 1.5em;
    border-radius: 9999px;
}
time.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-variant-numeric: tabular-nums;
    white-space: nowrap;

    border-top-left-radius: 9999px;
    border-bottom-left-radius:9999px;
    transition: 0.2s ease-out;
}
.blogtitle {
    display: table-cell;
    padding: 5px 10px;

    border-top-right-radius: 9999px;
    border-bottom-right-radius:9999px;
    transition: 0.2s ease-out;
}

#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;
}
