html, body {
    background-color: white;
    margin: 0;
    padding: 0;
    color: #333;
    width: 100%;
    height: 100%;
}

body {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    padding-top: 64px;
    height: calc(100% - 64px);
}

h1, h2, h3, h4, h5 {
    margin-top: 0.4em;
    margin-bottom: 0.3em;
}

h2, h3, h4, h5 {
    font-weight: normal;
}


a {
    color: #00b4ff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
.button,
button:focus,
.button:focus {
    /*line-height: 16px;*/
    /*font-size: 16px;*/
    padding: 1em .5em;
    color: #fff;
    background-color: #000;
    border: 1px solid #000;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: bold;
}

button:hover,
.button:hover {
    background: #00b4ff;
    border: 1px solid #00b4ff;
}

button:focus,
.button:focus {
    outline: none;
}

button.right {
    margin-left: 5px;
    margin-right: 0;
}

header {
    position: fixed;
    top: 0;
    background: #00b4ff;
    padding: 0 2em;
    line-height: 64px;
    /*font-size: 2em;*/
    max-height: 64px;
    width: 100%;
    box-sizing: border-box;
    z-index: 10000;
}

/* ugly hack, I'm tired of not finding a neat solution */
header .logo{
    display: inline-block;
    position: relative;
    height: 64px;
    line-height: inherit;
    margin: 0;
    vertical-align: top;
    margin-right: 2em;
    /*top: -7px;*/
}

header .logo img{
    display: inline-block;
    max-height: 48px;
    margin: 0;
    vertical-align: middle;
    padding: 0;
}

header a {
    color: black;
    display: inline-block;
    height: 64px;
    padding: 0;
    margin: 0;
    vertical-align: top;
}

header h1{
    display: inline;
    font-weight: normal;
    line-height: inherit;
    font-size: 1.5em;
    margin: 0;
    /*vertical-align: middle;*/
}

header div.right {
    float: right;
}

header div.right a{
    margin-left: 1em;
    font-weight: normal;
}

header .mobile {
    display: none;
    vertical-align: top;
}

@media (max-width: 900px) {
    header .brand {
        display: none;
    }

    header .mobile {
        display: inline-block;
    }
}


/*******************************************************************************
 * Object Recogniser
 ******************************************************************************/

.or-main {
    position: relative;
    padding-top: 56.25%;
    border: 1px solid #000;
}

.or-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.or-container > video,
.or-container > canvas {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.or-container > video.mirrored {
  -webkit-transform: scaleX(-1);
  transform: scaleX(-1);    
}


/*******************************************************************************
 * Editor
 ******************************************************************************/

.editor {
    display: flex;
    flex-direction: column;
}

.editor > :not(:last-child) {
    margin-bottom: 2ch;
}

.editor .controls {
    display: flex;
    justify-content: space-between;
}

.editor .code {
    flex: 1 1;
    border: 1px solid #000;
    overflow: auto;
}

.editor .CodeMirror {
    font: 14px Consolas, Monaco, monospace;
    height: auto;
    min-height: 100%;
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
}

.editor .CodeMirror-scroll {
    padding-bottom: 5em;
    min-height: 100%;
    height: auto;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-basis: 100%;
    flex-grow: 1;
}


/*******************************************************************************
 * Color/device picker
 ******************************************************************************/

.color-picker,
.device-picker {
    padding: .5em;
    border: 1px solid #000;
}


.color-picker label,
.device-picker label {
    display: table;
    margin-bottom: .5em;
}

.device-picker label,
.color-picker label:not(.color-picker-input) {
    font-weight: bold;
}

.color-picker .color-picker-input {
    cursor: pointer;
}

.color-picker .color-indicator.visible {
    display: inline-block;
    box-sizing: border-box;
    border-radius: 3px;
    height: 2em;
    width: 2em;
    vertical-align: middle;
    border: 1px solid #000;
}

.color-picker .color-indicator.visible:hover {
    border: 1px solid #00b4ff;
}

.color-picker .color-dest {
    margin-left: .5em;
}

.color-picker input[type=color].invisible {
    visibility: hidden;
    width: 0;
    padding: 0;
    border: none;
}

.device-picker select {
    display: block;
    width: 100%;
    margin-bottom: .5em;
    border: 1px solid #000;
    border-radius: 3px;
    padding: 1em .5em;
}

/*******************************************************************************
 * Documentation
 ******************************************************************************/

.documentation {
    max-width: 70ch;
    padding: 2ch;
    margin: 0 auto;
}

.documentation h2 {
    margin-top: 0;
}

.documentation section.intro p {
    font-style: italic;
}

.documentation .hljs {
    -moz-tab-size: 4;
    tab-size: 4;
    padding: 0.5em;
    border: 1px solid #000;
}

.documentation pre {
    position: relative;
}

.documentation pre button {
    display: none;
}

.documentation pre:hover button {
    display: block;
    position: absolute;
    top: .5em;
    right: .5em;
}


/*******************************************************************************
 * Main page
 ******************************************************************************/

.container {
    width: 100%;
    max-width: 100vw;
    display: flex;
    height: 100%;
}

.container .editor {
    flex: 1 1 50%;
    padding: 2ch;
    overflow: hidden;
    order: -1;
}

.container .instructions {
    flex: 0 2 70ch;
    padding: 2ch;
    overflow: auto;
    box-shadow: -0.25em 0 .5em -0.0625em rgba(0, 0, 0, .1);
    border-left: 1px solid #eee;
    z-index: 1000;
}

.container .instructions .documentation {
    max-width: none;
    padding: 0;
    margin: 0;
}


@media (max-width: 900px) {
    .container {
        display: block;
        height: auto
    }

    .container .editor {
        padding-top: 64px;
    }

    .container .instructions {
        box-shadow: none;
    }

}


/*******************************************************************************
 * Demo
 ******************************************************************************/


.demo .container {
    padding: 0;
    height: 100%;
    width: 100%;
    position: relative;
    display: flex;
}

.demo .container .or-main {
    border: none;
    padding: 0;
    width: 100%;
    height: 100%;
}

.demo .container .cta {
    background: #fff;
    flex: 0 0 25ch;
    text-align: center;
    font-size: 2em;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.demo .container .cta p {
    padding: 0 1ch;
}


.demo .container .cta .qr {
    width: 80%;
    height: auto;
}

.demo #demo-settings-form {
    display: none;
    font-size: 1rem;
    text-align: left;
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 2ch;
    background: #fff;
}

.demo .container .cta:hover #demo-settings-form {
    display: block;
}

.demo form,
.demo form * {
    box-sizing: border-box;
}

.demo form label,
.demo form label + input,
.demo form label + select {
    display: block;
    width: 100%;
}

.demo form label:not(.checkbox) {
    font-weight: bold;
    margin-bottom: .5em;
}

.demo form p {
    padding: 0 !important;
}

.demo form p:first-child {
    margin-top: 0;
}

.demo form p:last-child {
    margin-bottom: 0;
}
