:root {
    --main-bg-color: #F8F8FF;
    --article-bg-color: #fdfdfd;
    --main-text-color: #555;
    --main-border-color: #888;
    --article-code-bg-color: #DDD;
    --article-code-text-color: #888;
    --padding-left: 2rem;
}

.rollable-dice {
    display: inline-block;
    text-decoration: none!important;
    margin-right: 1rem;
}

@view-transition {
  navigation: auto;
}

@keyframes rotation {
  50% {
    transform: rotate(90deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

.rollable-dice:hover {
  animation: rotation 1s infinite ease-in-out;
}

.rollable-dice:active {
    transform: rotate(3turn);
    transition: 1.5s;
}


@media (prefers-color-scheme: dark) {

    :root {
        --main-bg-color: #000;
        --main-text-color: #E0E0E0;
        --main-border-color: #888;
        --article-bg-color: #000;
        --article-code-bg-color: #888;
        --article-code-text-color: #F5F3F3;
        --visited-link: #E0485A;
        --unvisited-link: #F11616;
    }

    a {
        color: var(--unvisited-link)
    }

    a:visited {
        color: var(--visited-link)
    }
}

@media (max-width: 500px) {
    :root {
        --padding-left: 0rem;
    }
}

a {
    text-underline-offset: 2px;
}

nav ul {
    list-style: none;
    margin: 0;
    padding-left: calc(0.5rem + var(--padding-left));
}

nav ul li {
    display: block;
    float: left;
    padding: 0.5rem;
    position: relative;
    text-decoration: none;
    margin-right: 0.5rem;
}


nav ul li ul {
    background: var(--main-bg-color);
    visibility: hidden;
    opacity: 0;
    min-width: 5rem;
    position: absolute;
    margin-top: 0.5rem;
    left: 0;
    display: none;
}

nav ul li:hover>ul,
nav ul li:focus-within>ul,
nav ul li ul:hover {
    z-index: 1;
    visibility: visible;
    opacity: 1;
    border: 1px solid var(--main-text-color);
    border-bottom-left-radius: .5rem;
    border-bottom-right-radius: .5rem;
    border-top: 0;
    display: block;
    padding-left: 0;
}

nav ul li ul li {
    clear: both;
    width: 100%;
}

ul.intertwingle-toc {
    list-style: none;
}

ul.intertwingle-toc-top {
    list-style: none;
    padding: 0;
}

body {
    background-color: var(--article-bg-color);
    color: var(--main-text-color);
    font-family: Didot, 'Noto Serif Display', 'URW Palladio L', P052, Sylfaen, serif;
    margin: 0;
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100dvh;
    font-size: 1.25rem;
    line-height: 2rem;
}

main {
    overflow-y: auto;
}

body header h1 {
    font-weight: bold;
}

body h2 {
    font-size: 1.5rem;
    font-weight: bold;
}


section>article {
    position: relative;
    margin-top: 3rem !important;
    border: 1px solid var(--main-border-color);
    border-radius: 0.5rem;
    box-shadow: var(--main-border-color) 0.25rem 0.5rem .75rem 0.5rem;
}

section>article>time {
    position: absolute;
    border: 1px solid var(--main-border-color);
    top: -1.25rem;
    right: 1rem;
    background: var(--main-bg-color);
    padding: 0.25rem;
}

main>section {
    max-width: 45rem;
    height: calc(100% - 42px);
    align-self: flex-start;
    margin: 1rem calc(1rem + var(--padding-left)) 1rem calc(1rem + var(--padding-left));
}

main article {
    padding: 0.2rem 1rem 0.2rem 1rem;
}

p,
blockquote {
    hyphens: auto;
    text-align: justify;
}

@media (max-width: 49rem) {

    section,
    article {
        min-width: none;
    }

    section>aside,
    article>aside {
        padding-top: 1rem;
        border-top: 1px solid var(--main-border-color);
    }

}

@media (min-width: 49.1rem) and (max-width: 67.9rem) {

    section>aside,
    article>aside {
        padding-top: 1rem;
        border-top: 1px solid var(--main-border-color);
    }
}

@media (min-width: 68rem) {

    section:has(aside:last-child),
    article:has(aside:last-child) {
        display: grid;
        min-width: 65rem;
        grid-template-columns: auto 19rem;
        column-gap: 1rem;
    }

    section>aside,
    article>aside {
        padding-left: 1rem;
        border-left: 1px solid var(--main-border-color);
    }
}


@media only screen and (max-width: 819px) {
    main {
        background-color: var(--article-bg-color);
    }
}

@media only screen and (min-width: 820px) {

    main article {
        width: 100%;
        max-width: 45rem;
        margin: 1rem 0 1rem calc(1rem + var(--padding-left));
        background-color: var(--article-bg-color);
    }


}

dl dt {
    float: left;
    margin-right: .5rem;
}

main article pre {
    font-family: monospace;
    padding: 0.5rem;
    overflow: auto;
    font-size: 1rem;
    line-height: 1.5rem;
}

main article aside {
    border: 1px dashed var(--main-border-color);
    padding: 1rem;
    font-size: 1rem;
    line-height: 1.5rem;
}

code pre {
    border: 1px solid var(--main-border-color);
}

nav a {
    text-decoration: none;
}

nav a:hover {
    text-decoration: underline dotted;
}

nav a:focus {
    text-decoration: underline;
}

article a,
section a {
    text-decoration: underline dotted;
}


article a:hover,
section a:hover {
    text-decoration: underline;
}


article a:focus,
section a:focus {
    text-decoration: underline double;
}

article h1 {
    font-style: italic;
}

article h1 a {
    text-decoration: none;
}

article h2 {
    font-size: 1.5rem;
}

article h3 {
    font-weight: bold;
}

blockquote {
    border-left: .25rem solid var(--main-border-color);
    padding-left: .25rem;
    margin-left: 0.75rem;
}

header {
    background-color: var(--main-bg-color);
    border-bottom: 1px solid var(--main-text-color);
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

footer nav {
    display: flex; 
    justify-content: center; 
    border-top: 1px solid var(--main-border-color);
    border-top-right-radius: 0.5rem;
    border-top-left-radius: 0.5rem;
}

aside h2 {
    font-size: medium;
}

aside p {
    font-size: smaller;
}

img {
    max-width: 100%;
}

body article script,
body article style {
    display: block;
    font-size: 14px;
    line-height: 1rem;
    font-family: monospace;
    white-space: pre;
    background-color: var(--article-code-bg-color);
    color: var(--article-code-text-color);
}

body article script::before,
body article script::after,
body article style::before,
body article style::after {
    font-family: monospace;
    color: var(--article-code-text-color);
}

body article script::before {
    margin-bottom: -1em;
    content: '\3Cscript\3E\0A';
}

body article script::after {
    content: '\0A\3C/script\3E';
}

body article style::before {
    margin-bottom: -1em;
    content: '\3Cstyle\3E\0A';
}

body article style::after {
    content: '\0A\3C/style\3E';
}

th[data-sort-able-sort-order="asc"]::before {
    padding-left: 1rem;
    content: "⬆";
}

th[data-sort-able-sort-order="desc"]::before {
    padding-left: 1rem;
    content: "⬇";
}

header>nav>a:first-of-type {
    height: 30px;
    left: 50%;
    padding: 8px;
    position: absolute;
    transform: translateY(-200%);
    transition: transform 0.3s;
}

section pre {
    font-size: 1rem;
    line-height: 1rem;
    white-space: pre-wrap;
}

header>nav>a:first-of-type:focus {
    transform: translateY(0%);
}

details p {
    margin-left: 1rem;
}

summary h2 {
    display: inline;
}

@media print {

    body {
        display: block;
        padding: 40px 0;
    }

    body header {
        display: none;
        border: 0;
    }

    body main article {
        width: auto;
        border: 0;
        box-shadow: none;
        overflow: hidden;
    }

    section>article>time {
        position: unset;   
        background: unset;    
    }

}
