* {
    box-sizing: border-box;
}

body {
    background-color: #1a1a1a;
    font-family: Arial, Helvetica, sans-serif;
    color: #e0e0e0;
    max-width: calc(900px);
    width: calc(100% - 20px);
    margin-inline: auto;
    line-height: 1.5;
    font-size: 1.1rem;
}

nav {
    display: flex;
    gap: 1rem;

    &>a:first-child {
        margin-right: auto;
    }
}

h1 {
    font-size: 3rem;
    margin-bottom: 0;
}

h1+p {
    margin: 0;
    margin-bottom: 3rem;
    font-size: 1rem;
    color: gray;
}

a {
    color: inherit;

    &:hover {
        text-decoration: none;
    }
}

dl {
    font-family: 'Times New Roman', Times, serif;
    color: gray;
    border-left: 2px solid;
    padding-left: 1rem;

    dt {
        font-style: italic;

        &::after {
            content: ":";
            font-style: normal;
        }
    }

    dd {
        margin-left: 2rem;
    }
}

table {
    background-color: #111;
    width: 100%;
    outline: 1px solid;
    border-collapse: collapse;
    border-radius: 5px;
    overflow: hidden;
    margin-block: 1rem;

    th,
    td {
        outline: 1px solid #555;
        padding: 5px;
    }
}

p code {
    font-family: monospace;
    background-color: #111;
    padding: 3px;
    border-radius: 3px;
    border: 1px solid #555;
}


blockquote {
    margin-inline: 0;
    padding: 10px;
    border-radius: 5px;

    &.markdown-alert-note {
        background-color: #1a1a33;
        border: 1px solid blue;

        &::before {
            content: "NOTE: ";
        }
    }

    &.markdown-alert-warning {
        background-color: #33331a;
        border: 1px solid yellow;

        &::before {
            content: "WARNING: ";
        }
    }
}

.rendering-canvas {
    position: fixed;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    display: grid;
    gap: 3px;

    canvas {
        background-color: white;
        border: 2px solid black;
        box-shadow: 10px 10px 10px black;
        border-radius: 5px;
    }

    button {
        width: 2rem;
        height: 2rem;
        border: 1px solid;
        box-shadow: 10px 10px 10px black;
        background-color: #1a1a1a;
        color: #eee;
        border-radius: 2px;
        font-weight: bold;
        font-size: 1rem;
        cursor: pointer;
    }
}

.code-block {
    display: grid;
    background-color: #333;
    padding: 5px;
    font-family: monospace;
    gap: 1rem;
    border-radius: 5px;
    line-height: 1.15;
    border: 1px solid gray;
    margin-block: 1rem;
}

.code-block .buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.code-block .buttons button {
    background-color: #1a1a1a;
    border: 1px solid;
    font: inherit;
    color: inherit;
    font-size: 1.15em;
    border-radius: 3px;
    cursor: pointer;
}

.code-block[runnable=false] .buttons {
    display: none;
}

.code-block .editor {
    display: grid;
    grid-template-columns: auto 1fr;
    font-size: 1rem;
}

.code-block .editor .numbers {
    text-align: center;
    white-space: pre-line;
    border-right: 1px solid;
    margin-right: 3px;
    padding-right: 3px;
}

.code-block .editor .text {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    overflow: auto;

    * {
        grid-column: 1;
        grid-row: 1;
        font-size: inherit;
        padding: 0;
        margin: 0;
        white-space: pre;
        width: fit-content;
        height: fit-content;
        field-sizing: content;
        min-width: 100%;
        line-height: inherit;
        font: inherit;
        border: unset;
        overflow: visible;
        padding-right: 1rem;
    }
}

.code-block .editor .text pre span {
    margin: 0;
    padding: 0;
}

.code-block .editor .text textarea {
    color: transparent;
    caret-color: white;
    background-color: transparent;
    resize: none;
    outline: none;
}

.code-block[runnable=false] .editor .text textarea {
    display: none;
}

.code-block .output {
    border-top: 1px solid;
    margin: 0;
    padding: 5px;
    white-space: pre-wrap;
}

.code-block[runnable=false] .output {
    display: none;
}

.code-block .output .err {
    color: yellow;

    .err {
        color: red;
        font-weight: bold;
    }
}

.highlight {
    &>.operator {
        color: #66d200
    }

    &>.keyword {
        color: #e13166
    }

    &>.builtin {
        color: #e88035
    }

    &>.boolean {
        color: #ff00fb
    }

    &>.number {
        color: #149be3
    }

    &>.comment {
        color: #707070
    }

    &>.string {
        color: #d7a65f
    }

    &>.user {
        color: gray
    }
}
