@import "compass/reset";
@import "compass/reset/utilities";
@import "compass/css3/font-face";
@import "compass/css3";
@import "compass/css3/user-interface";

$fast: 0.2s;
$slow: 0.6s;

@include font-face("Roboto Condensed",
                   font-files("../../vendor/Roboto-Condensed/" +
                              "RobotoCondensed-Regular.ttf"));

@include font-face("Roboto Condensed",
                   font-files("../../vendor/Roboto-Condensed/" +
                              "RobotoCondensed-Regular.ttf"),
                   "",
                   "bold");

@include font-face("FontAwesome",
                   font-files("../../vendor/font-awesome-4.1.0/" +
                              "fonts/fontawesome-webfont.woff"));

html {
    @include user-select("none");
}

a, input {
    @include reset-focus;
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-15px);
    }
}

body {
    margin: 5px;
    font-family: 'Roboto Condensed', sans-serif;
    background: black;
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    min-width: 220px;

    &::before {
        font-family: FontAwesome;
        font-weight: normal;
        font-size: 20px;
        position: fixed;
        bottom: 20px;
        right: 20px;
        display: block;
        content: ""; // Down arrow, suggesting to scroll
        z-index: -1;
        @include transition-property(opacity);
        @include transition-duration($slow);
        animation: bounce 0.4s ease-out 0s infinite alternate;
    }

    &.sufficiently-scrolled::before {
        opacity: 0;
    }
}

a {
    &, &:link {
        color: red;
        text-decoration: none;
    }
}

.button, input, label {
    cursor: pointer;
}

.disabled {
    cursor: default;
}

@keyframes spin {
    to { transform: rotate(1turn); }
}

@keyframes ellipsis {
    from {
        width: 0;
        margin-right: 0;
    }
    to {
        width: 16px;
        margin-right: -16px;
    }
}

.capture.button {
    position: relative;
    width: calc(100% - 2px);
    min-height: 200px;
    padding: 0;
    border: 1px solid white;
    margin-bottom: 20px;

    & > div {
        $width: 200px;
        $height: 200px;
        position: absolute;
        left: 50%;
        top: 50%;
        width: $width;
        height: $height;
        margin-left: -$width / 2;
        margin-top: -$height / 2;
        text-align: center;
        overflow: hidden;

        & .label {
            position: absolute;
            top: 80px;
            font-size: 30px;
            line-height: 40px;
            width: 100%;
        }

        & .status {
            $line-height: 22px;
            position: absolute;
            line-height: $line-height;
            width: 100%;
            white-space: nowrap;

            &.summary {
                top: $height - $line-height;
            }

            &.error {
                color: red;
            }
        }
    }

    &.disabled > div {
        & .label {
            display: none;
        }

        &::after {
            position: absolute;
            top: 80px;
            font-size: 40px;
            line-height: 40px;
            width: 100%;
            font-family: FontAwesome;
            font-weight: normal;
            display: block;
            content: ""; // Spinner
            animation: spin 1s infinite steps(8);
        }
    }

    &.is-capturing > div .momentary.status::after {
        display: inline-block;
        overflow: hidden;
        vertical-align: bottom;
        text-align: left;
        animation: ellipsis 1s infinite steps(4);
        content: "...";
    }

    &.is-capturing > div .momentary.error.status::after {
        display: none;
    }
}

dt {
    line-height: 40px;
}

dd {
    margin-left: 20px;
}

dl {
    $line-height: 22px;
    line-height: $line-height;

    dd.exposure-settings {
        & li {
            display: inline-block;
        }

        & li input {
            display: none;
        }

        & li label {
            display: inline-block;
            border: 1px solid white;
            width: 35px;
            overflow: hidden;
            text-align: center;
        }

        & li:last-of-type label {
            margin-right: 0;
        }

        & li input:checked ~ label {
            color: black;
            background: white;
        }

        & li.ev-0 label {
            color: red;
            border-color: red;
        }

        & li.ev-0 input:checked ~ label {
            background: red;
        }
    }

    dt.intervalometer-settings {
        & input {
            display: none;
        }

        & label {
            border: 1px solid white;
            padding: 0 5px;
        }

        & input:checked ~ label {
            color: black;
            background: white;
        }
    }

    dd.intervalometer-settings {
        overflow: hidden;

        & > div {
            @include transition-property(margin-top);
            @include transition-duration($fast);
            white-space: nowrap;
            height: $line-height + 2 * 1px;
            margin-top: -($line-height + 2 * 1px);
            line-height: $line-height;

            & input {
                width: 50px;
                background: transparent;
                color: white;
                padding: 0 1px;
                margin: 0;
                border: 1px solid white;
                font: inherit;
                border-radius: 0;
            }
        }
    }

    dd.battery-meter {
        div {
            display: inline-block;
            width: 20px;
            height: 10px;
            border: 1px solid white;
        }

        &.low {
            div:first-child {
                background: red;
            }
        }

        &.medium {
            div:first-child {
                &, & + div {
                    background: white;
                }
            }
        }

        &.high {
            div:first-child {
                &, & + div, & + div + div {
                    background: white;
                }
            }
        }
    }

    dd.volume-settings {
        line-height: 12px;

        $width: 200px;
        $height: 10px;
        $border-width: 1px;

        div, input {
            width: $width;
            height: $height;
        }

        div {
            border: $border-width solid black;
            background: white;
            margin-bottom: -($height + 2 * $border-width);
        }

        input {
            vertical-align: bottom;
            line-height: 12px;
            margin: 0;
            padding: 0;
            border: $border-width solid white;
            border-radius: 0;
            background: transparent;

            &::-moz-range-track {
                visibility: hidden;
            }

            &::-moz-range-thumb {
                height: 100%;
                width: 0;
                background: white;
                border-radius: 0;
                border: none;
            }
        }
    }

    dd.source-link {
        a::before {
            font-family: FontAwesome;
            font-weight: normal;
            content: " "; // link icon
        }
    }
}
