/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Variables
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

:root {
    --proto-font-normal: Helvetica, Arial, sans-serif;
    --proto-font-monospace: 'Courier New', monospace;

    --proto-text: #222222;
    --proto-text-2: #333333;
    --proto-bg: #eeeeee;
    --proto-bg-2: #cccccc;

    --proto-red: #cc4444;
    --proto-green: #44cc44;
    --proto-blue: #4444cc;
    --proto-cyan: #44cccc;
    --proto-yellow: #cccc44;
    --proto-magenta: #cc44cc;

    --proto-primary: var(--proto-red);
    --proto-secondary: var(--proto-blue);
    --proto-error: var(--proto-red);

}

@media (prefers-color-scheme:dark) {
    :root {
        --proto-text: #eeeeee;
        --proto-text-2: #cccccc;
        --proto-bg: #222222;
        --proto-bg-2: #333333;
    }
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   * Reset
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

* {
    padding: 0px;
    margin: 0px;
    box-sizing: border-box;
}

ul,
ol {
    list-style-position: inside;
}

table {
    border-collapse: collapse;
}

a {
    text-decoration: none;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   * General
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

body {
    display: grid;

    max-width: 2048px;
    min-height: 100vh;
    grid-template-areas:
        "link"
        "head"
        "main"
        "info";
    grid-template-rows:
        min-content min-content 1fr min-content;
    grid-template-columns:
        1fr;

    margin: auto;
    color: var(--proto-text);
    background-color: var(--proto-bg);
    font: 12pt var(--proto-font-normal);
    padding: 8px;
}

a[target="_blank"]::after {
    content: '»';

    color: var(--proto-text);
}

a[href^="#"]::after {
    content: '↓';

    color: var(--proto-text);
}

button {
    margin: 4px 0px;
    padding: 4px;
    background-color: var(--proto-bg);

    border: 1px solid var(--proto-text);
    border-radius: 4px;
}

button:hover {
    background-color: var(--proto-bg-2);
}

button:active {
    background-color: var(--proto-primary);
    color: var(--proto-bg-2);

    border-color: var(--proto-bg-2);
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   * link
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

nav {
    grid-area: link;

    text-align: center;
}

nav a[target="_blank"]::after {
    content: none;
}

nav a+a::before {
    content: ' • ';

    color: var(--proto-text);
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   * head
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

header {
    grid-area: head;

    text-align: center;

    margin-bottom: 4px;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   * main
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

.top-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background:#f8f8f82c;
}

img#proto-logo {
    max-height: 40px;
    width:auto;
    display: flex;
    justify-content: left;
}

main {
    grid-area: main;
}

span[data-closed] {
    display: none;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   * info
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

footer {
    grid-area: info;

    text-align: center;
    font-size: 10pt;
    color: var(--proto-text-2);
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   * Window Size Error Page.
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

div#window-size-error {
    display: none;
    text-align: center;
    padding: 16px;
}

div#window-size-error h2 {
    color: var(--proto-error);
}

@media (max-width:512px) {
    div#window-size-error {
        display: block;
    }
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   * General Editor
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

span.save-code-buttons {
    grid-area: buttons;
    display: flex;
    gap: 8px;
    padding: 8px;
}

span.save-code-buttons button {
    flex: auto;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   * Line editor
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

div#line-editor {
    border: 2px solid var(--proto-text);
    border-radius: 8px;

    margin: auto;
    width: 90vw;
}

div#line-editor[data-closed] {
    display: none;
}

code#line-editor-text {
    display: block;
    padding: 8px;
    margin: 8px;
}

#line-editor {
    border: 2px solid var(--proto-text);
    border-radius: 8px;
    margin: 4px;
    padding: 8px;
    background-color: var(--proto-bg);
}

div#line-editor[data-closed] {
    display: none;
}

.code-editor-container {
    position: relative;
    overflow: visible;
    width: 80vw;
    min-height: 60vh;
    background-color: var(--proto-bg);
    font-family: 'Courier New', Courier, monospace;
    font-size: 12pt;
    line-height: 1.5;
    padding: 8px;
    margin: 0 auto;
    margin-bottom: 16px;
}

.code-input {
    background: var(--proto-bg);
    outline: none;
    border: none;
    width: 100%;
    height: 100%;
    padding: 8px;
    color: var(--proto-text);
    caret-color: var(--proto-text);
    font-family: 'Courier New', Courier, monospace;
    font-size: 12pt;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
    z-index: 1;
}

div#suggestion-box {
    position: absolute;
    z-index: 1000;
    display: none;
    font-family: 'Courier New', Courier, monospace;
    background-color: var(--proto-bg);
    border: 1px solid var(--proto-text-2);
    padding: 4px;
    max-width: 256px;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   * Block editor
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

div#blocks-save-load-buttons {
    display: flex;
    gap: 8px;
    justify-content: left;
    margin-top: 4px;
}

div#block-editor {
    display: grid;

    grid-template-areas:
        "edit code";
    grid-template-rows:
        1fr;
    grid-template-columns:
        1fr 300px;
    width: 100%;
    height: 100%;
    min-height: 512px;
    height: 80vh;
}

div#block-editor[data-closed] {
    display: none;
}

@media (max-width:800px) {
    span#block-editor {
        grid-template-areas:
            "edit"
            "code";
        grid-template-rows:
            1fr min-content;
        grid-template-columns:
            1fr;
    }

    @media (max-width:512px) {
        span#block-editor {
            display: none;
        }
    }
}

div#block-editor section {
    border: 2px solid var(--proto-text);
    border-radius: 8px;

    margin: 4px;
}

section#blockly-canvas {
    grid-area: edit;
    min-height: 512px;

    overflow: hidden;
}

section#line-preview {
    grid-area: code;
    min-height: 256px;

    display: grid;

    grid-template:
        "code" 1fr
        "buttons" min-content
        / 1fr;

    overflow: auto;
    background-color: var(--proto-bg-2);
}

section#line-preview pre {
    margin: 0px;
}

code#line-preview-text {
    grid-area: code;
    font: 10pt var(--proto-font-monospace);
}