:root {
    --standard-width: 50rem;
    --standard-small-width: 20rem;
    --text-color: rgb(226 232 240);
    --error-red: rgb(127 29 29);
}


body {
    background-color: rgb(30 41 59);
    color: var(--text-color);
    flex-direction: column;
    align-items: center;
    display: flex;
    max-width: 100vw;
}

div.block-view {
    background-color: inherit;
    color: inherit;
    flex-direction: inherit;
    align-items: start;
    display: inherit;
    width: var(--standard-width);
    max-width: 100vw;
    h1 {
        word-break: break-word;
    }
}

.spacing {
    margin-top: 0.2rem;
    margin-bottom: 0.2rem;
}

div.wrapper {
    background-color: inherit;
    color: inherit;
    flex-direction: inherit;
    align-items: inherit;
    display: inherit;
    width: inherit;
    max-width: inherit;
}

.section-headline {
    font-size: 1.7rem;
    line-height: 2rem;
    width: fit-content;
}


form {
    flex-direction: column;
    align-items: start;
    display: flex;
    width: var(--standard-width);
    max-width: 100vw;
    > details.advanced-search {
        flex-direction: inherit;
        align-items: inherit;
        display: inherit;
        width: inherit;
        max-width: inherit;
        > summary {
            font-weight: bold;
            padding: 0.3rem 0;
        }
    }
}

.error-div {
    background-color: var(--error-red);
}

.success-div {
    background-color: rgb(20 83 45);
}

.success-div, .error-div {
    color: rgb(226 232 240);
    padding: 0.2rem;
    margin: 1rem;
    font-size: 1.1rem;
    width: fit-content;
    height: fit-content;
    max-width: var(--standard-width);
    white-space: pre-wrap;
}

header {
    width: 100%;
    ul {
        list-style-type: none;
        padding: 0;
        margin: 0;
        li:hover ul,li:focus-within ul {
            display: block;
        }
        li {
            display: inline-block;
            background-color: rgb(29 78 216);
            position: relative;
            min-width: 10rem;
            margin: 0.1rem 0;
            a {
                text-decoration: none;
                padding: 6px 10px;
                color: var(--text-color);
                display: block;
                min-width: inherit;
                text-align: center;
                user-select: none;
            }
            ul {
                z-index: 99;
                list-style-type: none;
                padding: 0;
                margin: 0;
                display: none;
                position: absolute;
                background-color: rgb(51 65 85);
                min-width: inherit;
                box-shadow: 0 2px 5px 0 rgba(0,0,0,.16), 0 2px 10px 0 rgba(0,0,0,.12);
                li {
                    background-color: rgb(30 41 59);
                    min-width: inherit;
                    margin: 0 0;
                    a {
                        color: var(--text-color);
                    }
                }
                li:hover,li:focus-within {
                    background-color: rgb(51 65 85);
                }
            }
        }
    }
}

button {
    background-color: rgb(51 65 85);
    color: var(--text-color);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border: none;
    font-family: inherit;
    font-size: inherit;
}

input {
    background-color: rgb(51 65 85);
    color: var(--text-color);
    padding: 0.5rem;
    user-select: none;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    width: 100%;
    box-sizing:border-box;
    border: none;
    font-family: inherit;
    font-size: inherit;
}

textarea {
    resize: vertical;
    width: 100%;
    box-sizing:border-box;
    background-color: rgb(51 65 85);
    color: var(--text-color);
    padding: 0.5rem;
    font-family: inherit;
    font-size: inherit;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

input[type="checkbox"], input[type="radio"] {
    width: 1.2rem;
    height: 1.2rem;
}

select {
    background-color: rgb(51 65 85);
    color: var(--text-color);
    padding: 0.5rem;
    user-select: none;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    width: fit-content;
    border: none;
    font-family: inherit;
    font-size: inherit;
}

a.button-link {
    background-color: rgb(51 65 85);
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    text-decoration: none;
}

a.dropdown {
    background-color: inherit;
    color: var(--text-color);
    text-decoration: none;
    font-weight: bold;
    padding: 0.3rem;
    margin: 0.2rem 0;
    cursor: pointer;
}

div.note {
    max-width: 100vw;
    width: var(--standard-width);
    a:not(.markdown a) {
        box-sizing:border-box;
        background-color: rgb(51 65 85);
        color: rgb(34 211 238);
        padding: 0.3rem;
        margin: 0.2rem 0;
        text-decoration: none;
        cursor: pointer;
        width: 100%;
        word-break: break-word;
        &.fit-content {
            width: fit-content;
            max-width: inherit;
        }
        &.read {
            box-sizing:border-box;
            background-color: rgb(15 23 42);
            color: var(--text-color);
            padding: 0.3rem;
            margin: 0.2rem 0;
            text-decoration: none;
            cursor: pointer;
            width: 100%;
            word-break: break-word;
        }
    }
    h1:not(.markdown h1) {
        box-sizing:border-box;
        font-size: 2rem;
        line-height: 2.2rem;
        color: var(--text-color);
        word-break: break-word;
    }
    h2:not(.markdown h2) {
        box-sizing:border-box;
        font-size: 1.5rem;
        line-height: 1.7rem;
        word-break: break-word;
    }
}

div.name-list {
    flex-direction: row;
    align-items: start;
    display: flex;
    width: inherit;
    input {
        width: 95%;
    }
    button {
        width: 5%;
        margin: 0.5rem 0.2rem;
        background-color: var(--error-red);
    }
}

div.pager {
    flex-direction: row;
    width: fit-content;
    a:not(.markdown a) {
        margin: 0.5rem;
        width: fit-content;
    }
}

div.hierarchy-view {
    box-sizing:border-box;
    width: var(--standard-width);
    max-width: 100vw;
    word-break: break-word;
    align-items: start;
    a {
        color: var(--text-color);
        cursor: pointer;
        font-size: 2.075rem;
        line-height: 2.25rem;
        margin: 0 0 0.4rem 0;
    }

    > div {
        > a {
            font-size: 1.7rem;
            line-height: 2rem;
            padding: 0 0 0.4rem 0;
        }
        border-inline-start: 0.25rem;
        border-inline-start-color: var(--text-color);
        border-inline-start-style: solid;
        padding-inline-start: 0.4rem;
        margin-inline-end: 0;
        margin-inline-start: 0.85rem;
        margin-top: 0.4rem;
        margin-bottom: 0.4rem;
        > div {
            border-inline-start: 0.25rem;
            border-inline-start-color: rgb(148 163 184);
            border-inline-start-style: solid;
            padding-inline-start: 0.4rem;
            margin-inline-end: 0;
            margin-inline-start: 0.65rem;
            margin-top: 0.4rem;
            margin-bottom: 0.4rem;
            > div {
                > a {
                    font-size: 1.45rem;
                    line-height: 1.75rem;
                    padding: 0 0 0.4rem 0;
                }
                > a > i.link-color {
                    color: rgb(34 211 238);
                }
                border-inline-start: 0;
                padding-inline-start: 0;
                margin: 0;
                > div {
                    border-inline-start: 0.25rem;
                    border-inline-start-color: rgb(71 85 105);
                    border-inline-start-style: solid;
                    padding-inline-start: 0.4rem;
                    margin-inline-end: 0;
                    margin-inline-start: 0.55rem;
                    margin-top: 0.4rem;
                    margin-bottom: 0.4rem;
                    > i.alert-red {
                        color: rgb(244 63 94);
                    }
                }
            }
        }
    }
}

div.article {
    hr:not(.markdown hr) {
        width: var(--standard-width);
        margin: 0.3rem 0;
    }
    h1:not(.markdown h1) {
        font-size: 2rem;
        line-height: 2.2rem;
        color: var(--text-color);
    }
    h2:not(.markdown h2) {
        font-size: 1.5rem;
        line-height: 1.7rem;
    }
}

h1.big-header {
    font-size: 3rem;
    line-height: 3.2rem;
    color: var(--text-color);
}

div.aside-tags {
    position: absolute;
    top: 12rem;
    left: calc(50vw + 2rem + (var(--standard-width) / 2));
    width: var(--standard-small-width);
}

div.tag-holder {
    max-width: var(--standard-small-width);
    box-sizing:border-box;
    overflow-wrap:break-word;
    padding: 0.5rem;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    background-color: var(--background);
    color: var(--text);
    a {
        background-color: inherit;
        color: var(--link);
    }
}

hr.splitter {
    width: var(--standard-width);
    margin: 0.3rem 0;
}

table.view-vote {
    border-collapse: collapse;
    max-width: 95vmax;

    th, td {
        border: 0.1rem solid var(--text-color);
        padding: 0.4rem;
    }

    .contrast {
        background-color: rgb(15 23 42);
    }
}

.hide {
    display: none !important;
    opacity: 0 !important;
    background-color: transparent !important;
}

.box-on-update.htmx-settling {
    opacity: 0;
    transition: none;
}

.box-on-update {
    opacity: 1;
    transition: opacity 1s ease-in;
}

.chat-window {
    > div#load-messages {
        display: none;
    }
    > div#chat-room {
        > div#message {
            width: var(--standard-width);
            max-width: 100vw;
            filter: drop-shadow(0.3rem 0.3rem 0.125rem rgb(2 6 23));
            padding: 0.6rem;
            margin: 0.5rem 0;
            color: #e4e4e7;
            box-sizing: border-box;

            > h1 {
                font-size: 1rem;
                padding: 0;
                margin: 0;
                word-break: break-word;
            }
            > i {
                font-size: 0.8rem;
                padding: 0;
                margin: 0;
            }
            > p {
                margin: 0;
                padding-top: 0.4rem;
                color: white;
                word-break: break-word;
            }
        }
        > div#message.message-self {
            background-color: #1e3a8a;
        }
        > div#message.message-other {
            background-color: #0f172a;
        }
    }
}

.admin-heading {
    font-size: 2.075rem;
    line-height: 2.25rem;
}

span.message {
    color: #f97316;
}

/* Markdown stuff */

div.markdown {
    box-sizing:border-box;
    width: var(--standard-width);
    max-width: 100vw;
    background-color: rgb(15 23 42);
    filter: drop-shadow(0.3rem 0.3rem 0.125rem rgb(2 6 23));
    padding: 1rem;
    margin: 0.6rem;
    word-break: break-word;
}

div.markdown.removed {
    background-color: rgb(70, 8, 9);
}

div.markdown dl {
    padding-top: 0.2rem;
}

div.markdown dt {
    font-weight: bold;
}

div.markdown dd {
    padding-bottom: 0.2rem;
}

/* Dont forget thead, tr, tbody */

div.markdown table {
    border-collapse: collapse;
    padding: 0.2rem;
    th {
        background-color: rgb(30 41 59);
        border: 1px solid;
        border-bottom: 2px solid;
        padding: 0.2rem 0.2rem 0.4rem;
    }
    td {
        border: 1px solid;
        padding: 0.2rem;
    }
    tfoot {
        font-style: italic;
        td {
            border-top: 2px solid;
            padding: 0.4rem 0.2rem 0.2rem;
        }
    }
}

div.markdown h1 {
    font-size: 2.075rem;
    line-height: 2.25rem;
}

div.markdown h2 {
    font-size: 1.7rem;
    line-height: 2rem;
}

div.markdown h3 {
    font-size: 1.45rem;
    line-height: 1.75rem;
}

div.markdown h4 {
    font-size: 1.325rem;
    line-height: 1.425rem;
    text-decoration-line: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

div.markdown h5 {
    font-size: 1.325rem;
    line-height: 1.375rem;
    text-decoration-line: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

div.markdown h6 {
    font-size: 1.325rem;
    line-height: 1.35rem;
    margin-block: 2rem;
}

div.markdown pre {
    background-color: rgb(30 41 59);
    overflow: scroll;
    padding: 0.5rem;
}

div.markdown code {
    display: inline-block;
    overflow-wrap: break-word;
}

div.markdown :not(pre) > code {
    background-color: rgb(30 41 59);
    padding: 0.1rem 0.5rem;
}

div.markdown hr {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

div.markdown ul {
    list-style-type: disc;
    list-style-position: inside;
}

div.markdown ol {
    list-style-type: upper-roman;
    list-style-position: inside;
}

div.markdown li {
    margin-top: 0.2rem;
}

div.markdown p {
    text-align: start;
    overflow-wrap: break-word;
}

div.markdown a {
    color: rgb(34 211 238);
}



div.markdown figure {
    margin-inline: 0;
    &.footnotes ol {
        list-style-type: decimal;
    }
}

div.markdown img {
    max-width: 100%;
}

div.markdown img[alt$="full-width"] {
    width: 100%;
}

div.markdown img[alt$="align-left"] {
    float: left;
    margin-right: 0.4rem;
}

div.markdown img[alt$="align-right"] {
    float: right;
    margin-left: 0.4rem;
}

div.markdown mark {
    background-color: #93c5fd;
    color: black;
}

div.markdown mark.added {
    background-color: #bef264;
    color: black;
}

div.markdown blockquote {
    border-inline-start: 0.2rem solid #bfdbfe;
    margin: 0;
    padding-inline-start: 0.4rem;
}

div.markdown sub {}

div.markdown sup {}

div.markdown details {}

div.markdown summary {}

div.markdown small {}

div.markdown del.removed {
    color: #fca5a5;
}

div.markdown strong {}

div.markdown em {}

/* symbols */

@font-face {
    font-family: "bootstrap-icons";
    src: url("./fonts/bootstrap-icons.woff2") format("woff2"),
    url("./fonts/bootstrap-icons.woff") format("woff");
}

.bi::before,
[class^="bi-"]::before,
[class*=" bi-"]::before {
    display: inline-block;
    font-family: bootstrap-icons, serif !important;
    font-style: normal;
    font-weight: normal !important;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    vertical-align: -.125em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.bi-public::before { content: "\f33e"; }
.bi-private::before { content: "\f537\f33e"; }
.bi-secret::before { content: "\f33f"; }
.bi-x-lg::before { content: "\f659"; }
.bi-not-found::before { content: "\f506"; }
.bi-list-closed::before { content: "\f231"; }
.bi-list-opened::before { content: "\f229"; }
.bi-important::before { content: "\f281"; }
.bi-letter-closed::before { content: "\f32c"; }
.bi-letter-open::before { content: "\f32d"; }
.bi-discussion::before { content: "\f249"; }
.bi-post::before { content: "\f38a"; }
.bi-vote::before { content: "\f270"; }
.bi-outgoing::before { content: "\f1c3"; }
.bi-incoming::before { content: "\f1be"; }
.bi-link-to::before { content: "\f1c0"; }

/* Info Box */

.hover-container {
    position: relative;
}

.hover-target {
    position: relative;
}

.hover-popup {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    top: 70%;
    left: 5%;
    width: 50ch;
    margin: min(1rem, 20px);
    font-size: .8rem;
    background-color: rgb(15 23 42);
    border-radius: 8px;
    padding: 1em;
    z-index: 42;
    transform: scale(0);
    transition: transform 200ms ease;
    transform-origin: 8% -10px;
}

.hover-target:hover + .hover-popup,
.hover-target:focus + .hover-popup,
.hover-popup:hover{
    transform: scale(1);
}

.hover-popup :not(:first-child) {
    margin-top: 1rem;
}

.hover-popup {
    span {
        color: rgb(190, 20, 0);
        font-weight: 700;
    }
    a {
        color: rgb(34 211 238);
    }
    a:visited {
        color: rgb(64 100 278);
    }
}

.hover-popup::before {
    /* This is the triangle/arrow */
    content: '';
    position: absolute;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid rgb(15 23 42);
    top: -10px;
}

.hover-popup::after {
    /* This is merely here to expand the hoverable area, as a buffer between the "Hover me" text and the popup. */
    content: '';
    position: absolute;
    top: -1rem;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
}

@media (prefers-reduced-motion: reduce) {
    *,
    ::before,
    ::after {
        animation-delay: -1ms !important;
        animation-duration: -1ms !important;
        animation-iteration-count: 1 !important;
        background-attachment: initial !important;
        scroll-behavior: auto !important;
        transition-duration: 0s !important;
        transition-delay: 0s !important;
    }
}

@counter-style bracket-numbers {
    system: extends decimal;
    prefix: "(";
    suffix: ") ";
}

@counter-style bracket-letters {
    system: extends lower-latin;
    prefix: "(";
    suffix: ") ";
}