/*
 *
 * Header
 *
 */

nav {
    display: flex;
    flex-direction: row;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.title-header {
    width: 100%;
    margin-bottom: 10px;
}

.site-title {
    margin-bottom: 5px;
}

.page-title {
    margin-top: 5px;
    margin-bottom: 0px;
}

/*
 *
 * Footer
 *
 */

footer {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer {
    margin-top: 0px;
    margin-bottom: 0px;
}

/* 
 *
 * Elements
 *
 */

html {
    display: flex;
    flex-direction: row;
    justify-content: center;

    text-align: center;
}

body {
    max-width: calc(var(--content-max-width) + var(--sidebar-max-width));
    width: 100%;

    /* include padding inside the element's width to avoid overflow on small viewports */
    box-sizing: border-box;

    padding: 15px;
    display: flex;
    flex-direction: column;
}

ul {
    /* shrink-to-fit */
    display: inline-block;
    text-align: left;
    margin: 0;
    padding-left: 1.25em;

    /* reserve space for the marker so wrapped lines align with the first line */
    list-style-position: outside;
    list-style-type: disc;
    max-width: 100%;
    overflow: visible;
}

hr {
    width: 100%;
}

video {
    display: block;
    max-width: 100%;
    min-width: 30%;
    margin-left: auto;
    margin-right: auto;
}

pre,
code {
    text-wrap-mode: wrap;
    text-align: left;
    font-weight: bold;
}

img {
    display: block;
    max-width: 100%;
    min-width: 30%;

    margin-left: auto;
    margin-right: auto;
}

.block {
    border: 1px dotted var(--laghari);
    padding: 5px 15px;
    margin: 0 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.block h1 {
    text-align: center;
    margin-bottom: 0;
}

.pronouns {
    display: inline-block;
    vertical-align: super;
    line-height: 100%;
}

/* 
 *
 * Sidebar
 *
 */

.sidebar {
    max-width: var(--sidebar-max-width);
    width: 100%;

    /* follow the user's scrollbar but stay confined to the sidebar column */
    position: sticky;
}

.main-content {
    max-width: var(--content-max-width);
    width: 100%;
}

.layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: var(--layout-gap);
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.layout .sidebar::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(-1 * (var(--layout-gap) / 2));
    width: 2px;
    background: var(--laghari);
    opacity: 0.95;
    pointer-events: none;
}

/* main stretches, sidebar keeps a fixed/limited width */
.layout main {
    flex: 1 1 60%;
    min-width: 0;
    /* allows proper shrinking in flex layouts */
}

.layout .sidebar {
    flex: 0 0 var(--sidebar-max-width);
    max-width: var(--sidebar-max-width);
    width: var(--sidebar-max-width);
    /* make the sidebar follow the user's scroll while staying inside its column */
    position: sticky;
    top: 15px;
    /* matches body padding so it won't touch the viewport edge */
    align-self: flex-start;
    /* prevent stretching in the flex container */
    /* containing block for the pseudo-element (absolute separator) */
}

.sidebar>hr:first-of-type,
.sidebar>hr:last-of-type {
    display: none;
}

/* stack on small screens */
@media (max-width: 1000px) {
    .layout {
        flex-direction: column;
    }

    .layout .sidebar::before,
    #back-to-top {
        display: none;
    }

    .sidebar>hr:first-of-type,
    .sidebar>hr:last-of-type {
        display: inherit;
    }

    .layout main,
    .layout .sidebar {
        flex: none;
        width: 100%;
    }

    /* ensure sidebar appears above main content when stacked and stop sticking */
    .layout .sidebar {
        order: -1;
        max-width: 100%;
        position: static;
        top: auto;
    }
}