@media (width >= 1000px) {
    html, body {
        height: 100%;
    }

    body {
        display: flex;
        flex-direction: column;
    }

    #middle {
        flex: 1 0 0;
        width: 100%;
        margin: 1em auto;
        padding: 0 0.75rem;
        display: flex;
        gap: 1em;
        justify-content: center;
    }

    #column-projects {
        width: 15em;
    }

    #editor-frame,
    #output {
        flex: 1 0 0;
    }

    #editor-frame {
        display: flex;
        flex-direction: column;
    }

    #editor {
        flex: 1 0 0;
    }
}

@media (width < 1000px) {
    #editor-frame,
    #output,
    #column-projects {
        margin: 0.75em;
    }

    #editor {
        resize: vertical;
    }

    #editor:not([style*="height"]) {
        /* set a default max-height of 20 lines that is resizable (resizing will set
         * style="height: ..." which invalidates this style) */
        max-height: calc(20em * var(--bs-body-line-height) + .375rem * 2);
    }
}

body:not([data-transport=ble]) {
    #connect-button {
        display: none;
    }
    #connect-status {
        display: none;
    }
    #brightness-slider {
        display: none;
    }
}

#editor {
    /* make the editor scrollable */
    overflow: auto;
}

/* Match the appearance of a Bootstrap <textarea>, including the focused state
 * (for accessibility). */
#editor {
    border: solid 1px var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--bs-box-shadow-inset);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
#editor > .cm-editor {
    background-color: var(--bs-body-bg);
    outline: initial;
    height: 100%;
}
#editor .cm-content {
    padding: .375rem 0; /* match Bootstrap in vertical padding */
}
#editor .cm-scroller {
    line-height: var(--bs-body-line-height); /* match Bootstrap */
}
#editor:has( > .cm-focused) {
    box-shadow: var(--bs-box-shadow-inset), 0 0 0 0.25rem rgba(4, 110, 143, 0.25);
    border-color: #82b7c7;
}

/* Integrate editor into the tabbar */
#editor {
    border-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

#output {
    display: flex;
    flex-direction: column;
}

#output-svg-wrapper {
    text-align: center;
}

#program-size-info {
    --size-free: #333;
    --size-header: green;
    --size-program: blue;
}
#program-size-chart {
    height: 16px;
    background: var(--size-free);
}
#program-size-info .size-example {
    width: 12px;
    height: 12px;
    display: inline-block;
}

#compiler-output {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    flex: 1 1 0;
    font-family: monospace;
    white-space: pre-wrap;
    padding: 8px 20px;
    overflow: scroll;
}

@media (width < 1000px) {
    #compiler-output {
        flex: 1 1 auto;
        max-height: 80vh;
    }
}
