@import url('https://fonts.googleapis.com/css?family=Roboto:100,400,700');

$red: #E43030;
$green: #19A187;
$blue: #367bf0;
$dark-blue: #265AB1;
$maroon: #B8174C;
$purple: #8C42AB;

$bg-color: #f2f3f7;
$fg-color: #7b7e8c;

$glow-shadow: 0 0 .5em transparentize($blue, .3);

:root {
    --bg-color: #{$bg-color};
    --fg-color: #{$fg-color};

    --red: #{$red};
    --green: #{$green};
    --blue: #{$blue};
    --dark-blue: #{$dark-blue};
    --maroon: #{$maroon};
    --purple: #{$purple};
}

::-moz-focus-inner, :-moz-focusring {
    border: 0;
    color: transparent;
    text-shadow: 0 0 0 $fg-color;
}

::selection, ::-moz-selection {
    color: white;
    background: black;
}

* {
    box-sizing: border-box;
    outline: none;
    -webkit-touch-callout: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
    -webkit-touch-callout: none;
    font-family: 'Roboto', sans-serif;
    letter-spacing: 0;
}

.selectable {
    cursor: auto;
    user-select: text;
    -webkit-touch-callout: text;
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

html, body {
    background-color: $bg-color;
    color: $fg-color;
    margin: 0;
    padding: 0;
    font-size: 10pt;
    height: 100%;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.with-shadow {
    box-shadow: 6px 6px 10px transparentize(black, .9),
                -6px -6px 10px white;
}

.outset {
    @extend .with-shadow;

    border-radius: 10px;
    background: $bg-color;
}

.inset {
    border-radius: 10px;
    box-shadow: 0 0 transparent,
                0 0 transparent,
                inset 3px 3px 5px transparentize(black, .9),
                inset -3px -3px 5px white;
    background: lighten($bg-color, 2%);
}

.paper {
    @extend .outset;
    padding: 10px 20px 20px;
    margin-top: 20px;
    min-height: 100px;
    font-size: 1.2em;
    background: $bg-color;
}

section, article, .section, .article, .paper {
    line-height: 2em;
    word-wrap: break-word;
    word-break: normal;
    line-height: 2em;
}

input[type="text"], input[type="search"], input[type="tel"], input[type="url"],
input[type="email"],input[type="password"], input[type="date"],
input[type="month"], input[type="week"], input[type="time"],
input[type="number"], input[type="color"], select, textarea {
    border: 0;
    background: $bg-color;
    color: $fg-color;
    font-weight: normal;
    padding:  0 1.25em;
    line-height: 1.25em;
    height: 3.5em;
    margin: 10px 0;
    font-size: 1.1rem;
    cursor: text;
    user-select: text;
    -webkit-touch-callout: text;
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    transition: box-shadow .2s;

    &:not(select) {
        @extend .inset;

        &:focus { @extend .outset; }
    }
}

textarea {
    height: 350px;
    padding: 1.25em;
}

select {
    @extend .outset;

    cursor: pointer;
    background: url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAxOSAxOSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyB0cmFuc2Zvcm09Im1hdHJpeCguMDM0IDAgMCAuMDM0IC02LjggMS43ZS01KSIgc3R5bGU9ImZpbGw6IzdiN2U4YyI+PHBhdGggZD0ibTQ4MCAzNDQtMjExLTIxMmMtMTYtMTYtNDEtMTYtNTcgMC0xNiAxNi0xNiA0MiAwIDU3bDIzOCAyMzljOC40IDguNSAyMCAxMiAzMSAxMiAxMSAwLjU2IDIyLTMuMiAzMS0xMmwyMzgtMjM5YzE2LTE2IDE2LTQyIDAtNTdzLTQxLTE2LTU3IDB6IiBzdHlsZT0iZmlsbDojN2I3ZThjIi8+PC9nPjwvc3ZnPgo=) no-repeat right 1em center;
    background-size: 1.2em;
    padding-right: 3em;
}

input::placeholder, textarea::placeholder {
    opacity: 1;
    transition: opacity .2s;
    color: inherit;
}

input:focus::placeholder, textarea:focus::placeholder { opacity: .2; }

input:-ms-input-placeholder, textarea:-ms-input-placeholder {
    opacity: 1;
    transition: opacity .2s;
    color: inherit;
}

input:focus:-ms-input-placeholder, textarea:focus:-ms-input-placeholder { opacity: .2; }

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration { display: none; }

button, input[type="button"], input[type="submit"], input[type="reset"] {
    @extend .outset;

    border: 0;
    text-transform: capitalize;
    padding: 10px 0;
    width: 8em;
    text-align: center;
    cursor: pointer;
    color: inherit;
    font-size: 1.1rem;
    transition-property: background-color, box-shadow;
    transition-delay: .2s;
    transition-duration: .2s;

    &.active, &:active {
        @extend .inset;

        transition-delay: 0s;
        transition-duration: .1s;
    }

    @each $name, $color in ('red': $red, 'green': $green, 'blue': $blue) {
        @at-root .#{$name}-button, &.#{$name}-button {
            @extend button;

            color: white;
            font-weight: bold;
            background: $color;
            box-shadow: 0 0 .5em transparentize($color, .3),
                        0 0 transparent,
                        inset 0 -5px 0 transparentize(black, .95),
                        inset 0 2px 0 transparentize(white, 0.8);
            border-radius: 6px 6px 8px 8px;
            transition-property: box-shadow, border-radius;

            &.active, &:active {
                background: $color;
                border-radius: 6px;
                box-shadow: 0 0 transparent,
                            0 0 transparent,
                            inset 0 2px 5px 2px transparentize(black, 0.8);
            }
        }
    }
}

label {
    cursor: pointer;
    display: inline-block;
    padding: .56em 0;
}

a {
    &, &:link, &:visited, &:hover &:active {
        cursor: pointer;
        font-weight: bold;
        color: $blue;
        font-weight: bold;
        text-decoration: none;
    }
}

h1, h2, h3, h4, h5, h6 { line-height: 1.5em; }

h1 {
    font-size: 4em;
    font-weight: lighter;
    margin: .7em 0;
}

h2 {
    font-size: 3em;
    font-weight: lighter;
    margin: .8em 0;
}

h3 {
    font-size: 2.5em;
    font-weight: lighter;
    margin: .9em 0;
}

h4 {
    font-size: 2em;
    font-weight: lighter;
    margin: 1em 0;
}

h5 {
    margin: .5em 0;
    font-size: 1.2em;
    font-weight: normal;
}

h6 {
    margin: 1em 0 1em 1.4em;
    font-size: 1em;
    font-weight: bold;
}

input[type=checkbox], input[type=radio] {
    $_border-width: .15em;
    $_box-shadow: 2px 2px 3px transparentize(black, .8),
                  -2px -2px 3px white,
                  inset 1px 1px 2px transparentize(black, .8),
                  inset -1px -1px 2px white;
    font-size: 1em;
    cursor: pointer;
    height: 1.2em;
    width: 1.2em;
    margin: 0 .3em;
    box-shadow: $_box-shadow;
    border: $_border-width solid $bg-color;
    vertical-align: text-bottom;
    transition-property: background, box-shadow;
    transition-duration: .2s;

    &:active {
        box-shadow: $_box-shadow,
                    inset 0 .1em .25em transparentize(black, .8);
    }

    &:checked {
        border-width: .1em;
        border-color: darken($blue, 10%);
        background-color: $blue;
    }
}

input[type=checkbox] {
    border-radius: 25%;

    &:checked {
        box-shadow: $glow-shadow,
                    inset 0 -.1em 0 transparentize(black, .8),
                    inset 0 .1em .1em transparentize(white, .8);
    }
}

input[type=radio] {
    border-radius: 100%;

    &:checked {
        box-shadow: $glow-shadow;
        box-shadow: $glow-shadow,
                    inset 0 .12em .1em transparentize(white, .75);
        border-bottom-width: .15em;
    }
}

.checktext {
    width: auto;
    margin: .5em;

    input {
        display: none;

        + span {
            @extend button;

            font-weight: bold;
            padding: 1em;
            transition-delay: 0s;
        }

        &:checked + span {
            @extend .blue-button;

            padding: 1em;
        }
    }
}

.switch {
    $_height: 2.5rem;
    $_width: 5rem;
    $_handle-width: $_height;
    $_handle-translation: $_width - $_handle-width;

    height: $_height;
    width: $_width;
    padding: 0;
    position: relative;

    input {
        display: none;

        + div {
            height: 100%;
            width: 100%;
            border-radius: 999px;
            background: transparent;
            transition-property: box-shadow, background-color;
            transition-duration: .2s;
            transition-delay: .2s;
            box-shadow: 3px 3px 2px -2px transparentize(black, .9),
                        inset 2px 2px 2px 1px transparentize(black, .9),
                        inset -2px -2px 1px white;

            &::before {
                content: '';
                display: block;
                height: calc(#{$_handle-width} + 2px);
                width: calc(#{$_handle-width} + 2px);
                border-radius: 100%;
                background: white;
                box-shadow: 0 3px 10px transparentize(black, .8),
                            inset 0 -1px 3px transparentize(black, .9);
                transform: translate(0, -1px);
                transition: transform .2s;
            }
        }

        &:checked + div {
            background: $blue;
            box-shadow: $glow-shadow,
                        inset 0 2px 2px 2px transparentize(black, .7),
                        inset 0 0 transparent;

            &::before { transform: translate($_handle-translation, -1px); }
        }
    }
}

hr {
    @extend .inset;
    width: 50%;
    height: 7px;
    border: 0;
}

code, pre {
    padding: .5em 1em;
    border-radius: 4px;
    overflow: auto;
    box-shadow: 0 5px 30px 0 transparentize(black, .95);
}

code { background: #E6E6E6; }

pre {
    background: white;
    margin: 4em 0;
}

code, pre {
    font-size: .9rem;
    font-family: monospace;
    line-height: 2em;
    cursor: auto;
    user-select: text;
    -webkit-touch-callout: text;
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

blockquote {
    background-color: white;
    padding: .5em 1em;
    border-radius: 4px;
    box-shadow: 0 5px 30px 0 transparentize(black, .95);
    border-left: 6px solid $blue;
}
