@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100;0,200;0,300;1,200&display=swap');

* {
    margin: 0;
    padding: 0;

    font-family: 'Roboto Mono', monospace;
}

body {
    display: grid;
    grid-template-areas: 
        ". heading ."
        "tape tape tape"
        ". . ."
        "input input input"
        "output-text . ."
        "output output output"
        "hr hr hr"
        "docs docs docs";

    grid-template-columns: 100px 750px 100px;
    grid-template-rows: auto 50px 25px 500px 50px 100px 50px auto;

    justify-content: center;
}

/* Heading styling */
div.heading {
    grid-area: heading;
    text-align: center;
    margin-bottom: 100px;
}

div.heading > h1 {
    margin: 20px;
}

div.heading > h2 {
    font-size: 18px;
    margin-top: -10px;
}

/* Visualization styling */
div.brainfuck-visualization {
    grid-area: tape;

    width: 100%;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.05);

    display: grid;
    grid-template-areas: "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20";

    border: 1px solid black;
}

div.brainfuck-visualization > div.cell {
    position: relative;
    display: grid;
    justify-content: center;
    align-items: center;
    border-right: 1px solid black;
    width: 45px;

    overflow: visible;
}

div.brainfuck-visualization > div.cell:last-child {
    border-right: none;
}

div.brainfuck-visualization > div.cell.targeted::before {
    content: "▼";
    position: absolute;
    margin-top: -75px;
    margin-left: 17px;
}

/* Input styling */
div.brainfuck-input {
    grid-area: input;

    display: grid;
    grid-template-areas: 
        "run stop . delay"
        "text text text text";

    grid-template-rows: 75px auto;
    grid-template-columns: 120px 120px auto 150px;

    width: calc(100% - 20px);
    margin-bottom: 40px;
}

div.brainfuck-input > textarea {
    grid-area: text;

    width: 100%;
    height: 100%;
    padding: 10px;
    font-size: 16px;

    resize: none;
    color: green;
    caret-color: black;
}

div.brainfuck-input > textarea:focus {
    outline: none;
}

div.brainfuck-input > button {
    width: 100px;
    height: 50px;

    outline: none;
}

div.brainfuck-input > button#run-button {
    grid-area: run;
}

div.brainfuck-input > button#stop-button {
    grid-area: stop;
    width: 150px;
}

div.brainfuck-input > button:hover {
    cursor: pointer;
}

div.brainfuck-input > div#delay {
    grid-area: delay;
    font-size: 14px;
    width: 100%;
    height: calc(100% - 10px);
    margin-left: 20px;
    padding-top: 10px;
}

div.brainfuck-input > div#delay > p {
    float: right;
}

div.brainfuck-input > div#delay > p.change {
    font-size: 20px;
    margin-left: 10px;

    -webkit-user-select: none; /* Safari */        
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+/Edge */
    user-select: none; /* Standard */
}

div.brainfuck-input > div#delay > p.change:hover {
    text-decoration: underline;
    cursor: pointer;
}

/* Output styling */
div.output-wrap {
    grid-area: output;

    width: 100%;
    height: 75px;
    background-color: rgba(0, 0, 0, 0.05);

    font-size: 12px;
    margin-top: -20px;

    display: grid;
    align-items: center;

    overflow: scroll !important;
}

div.output-wrap > h2 {
    margin-left: 20px;
    color: gray;
}

h2.output-text {
    grid-area: output-text;
    font-size: 16px;
    color: gray;
}

/* HR */
.hr {
    grid-area: hr;
    align-self: center;

    height: 1px;
    border: none;
    background-color: lightgray;
}

/* Docs styling */
div.docs {
    margin-top: 40px;
    grid-area: docs;
    margin-bottom: 50px;
}

div.docs > p.intro {
    margin-top: 25px;
}

div.docs > p {
    margin: 10px 0;
}

div.docs > div.syntax {
    margin: 35px 0;
    width: calc(100%-20px);
    padding: 20px;

    background-color: rgba(0, 0, 0, 0.05);
}

div.docs > div.syntax > p {
    display: inline;
}

div.docs > div.syntax > p.command {
    font-weight: 300;
    color: green;
}

span.command {
    font-weight: 300;
    color: green;
}

div.docs > h2.hello, div.docs > h2.more {
    margin-top: 75px;
    margin-bottom: 25px;
}

p.comment {
    float: right;
    color: gray;
}

div.docs > button {
    width: 250px;
    height: 45px;
    margin-top: -10px;

    outline: none;
}

div.docs > button:hover {
    cursor: pointer;
}

div.docs > p.copyright {
    color: gray;
}

div.docs > ul.implementation-details {
    margin-left: 40px;
    list-style-type: "- ";
}

/* Dark mode toggle */
button#toggle, a#share {
    position: fixed;
    background-color: rgba(0, 0, 0, 0);
    border: none;
    top: 25px;
    right: 25px;
    font-size: 13px;
}

a#share {
    top: 50px;
    color: black;
    text-decoration: none;
}

button#toggle:hover, a#share {
    cursor: pointer;
}

/* Generate own Brainfuck code */
textarea#type {
    width: calc(100% - 20px);
    padding: 10px;
    margin-right: 20px;
    font-size: 16px;

    resize: none;
    color: black;
    caret-color: black;
}

textarea#type:focus {
    outline: none;
}

div.output-generator {
    height: 75px;
    overflow: scroll;
    margin-top: 0 !important;
}

div.output-generator > p.gray {
    color: gray;
}

div#output-generator {
    color: green;
}

button:disabled {
    text-decoration: line-through;
}

button:disabled:hover {
    cursor: initial !important;
}
