/*
Copyright (c) 2021 GFXFundamentals
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

* Neither the name of greggman.com nor the names of its contributors
  may be used to endorse or promote products derived from this software
  without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
html {
    box-sizing: border-box;
}
*, *:before, *:after {
    box-sizing: inherit;
    user-select: none;
}

body {
    background-color: #aaa;
    font-family: Sans-Serif;
}

canvas {
    background-color: #fff;
    border: 1px solid black;
    /* NOTE: This size is changed if in iframe - see below '.iframe canvas' */
    width: 400px;
    height: 300px;
    display: block;
}

#uiContainer {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    font-family: monospace;
    pointer-events: none;

    text-shadow:
            -1px -1px 0 #FFF,
            1px -1px 0 #FFF,
            -1px 1px 0 #FFF,
            1px 1px 0 #FFF;
}
#ui {
    opacity: 0.8;
}
#ui>div {
    pointer-events: none;
}
#ui input,
#ui label,
#ui select,
#ui option,
#ui canvas {
    pointer-events: auto;
}

.gman-slider-label, .gman-widget-label, .gman-checkbox-label {
    font-size: medium;
    min-width: 10em;
    text-align: right;
}
.gman-checkbox-label {
    pointer-events: auto;
}
.gman-widget-value {
    float: right;
    font-size: medium;
    order: 1;
    min-width: 3em;
}

.gman-slider-upper {
    height: 1.5em;
}
.gman-slider-outer, .gman-widget-outer {
    float: right;
    display: flex;
    align-items: center;
    height: 1.7em;
}
.gman-widget-slider, .gman-widget-checkbox, .gman-widget-select {
    opacity: 0.5;
    font-size: large;
    margin-left: .3em;
    margin-right: .3em;
}
.gman-widget-select {
    font-size: small;
}
.gman-widget-slider {
    min-width: 120px;
}


/* styles to apply if in an iframe */

html.iframe {
    height: 100vh;
}
body.iframe {
    width: 100vw;
    height: 100vh;
    margin: 0;
}

.iframe>.description {
    display: none;
}
.iframe .divcanvas {
    width: 100vw;
    height: 100vh;
}
.iframe canvas {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    border: none;
}

.iframe>#example {
    width: 100%;
    height: 100%;
}
#ui #rotation>canvas {
    background-color: rgba(255, 255, 255, 0.6);
}
#ui {
    width: 200px;
}

@media (max-width: 390px) {
    pre {
        font-size: xx-small !important;
        max-width: 300px !important;
    }
    canvas {
        width: 100vw;
    }
    .iframe canvas {
        width: 100vw;
        height: 100vh;
        border: none;
    }
    #uiContainer {
        top: 120px;
    }
    .iframe #uiContainer {
        top: 10px;
    }
}

@media (prefers-color-scheme: dark) {
    #ui .ui-dark-support {
        color: white;
        text-shadow:
                -1px -1px 0 #000,
                1px -1px 0 #000,
                -1px 1px 0 #000,
                1px 1px 0 #000;
    }
}
body {
    margin: 0;
}
canvas {
    width: 100vw;
    height: 100vh;
    display: block;
}
