form {

    padding: 0;
    margin: 0;

    & > div.content > * {
      display: block;
      width: 100%;
    }


    body > header &,
    main #content > article & {

        & > .content,
        & > .controls {
            padding: 0;
            background: transparent;
        }
    }

    div.field {
        padding: 0.5rem 0;
    }

    datalist {
        display: none !important;
    }

    img {
        width: auto;
    }


    & > .controls {

        width: 100%; /* avoids controls being squished real smol with floating content around */
        margin-top: 0.5rem;
        display: flex;
        flex-direction: row;
        justify-content: right;
        background: $color_background_dark;

        button {
            &:hover,
            &:focus {
                width: 100%;
            }
        }
    }

    &#DeleteForm {

        & > .controls {
            justify-content: center;
            padding: 1rem 0;
        }

        button[name="submit"] {

            display: block;
            width: 7rem;
            height: 7rem;
            border-radius: 3.5rem;
            float: none;
            background: desaturate($color_danger, 50%);
            box-shadow: 0 0.75rem 0 desaturate($color_danger, 80%);
            font-size: 4.5rem;
            transition: margin 0.3s, box-shadow 0.3s, background 0.3s;
            margin-bottom: 0.75rem;
            outline: none;
            padding: 0 !important;

            &:hover,
            &:focus {
                padding: 0 !important;
                background: desaturate($color_danger, 20%);
                box-shadow: 0 0.3rem 0 desaturate($color_danger, 80%), 0 0 1rem $color_danger;
                margin-top: 0.45rem;
                margin-bottom: 0.3rem;
                outline: none;
            }

            &:active {
                padding: 0 !important;
                background: $color_danger;
                box-shadow: 0 0.1rem 0 $color_danger, 0 0 1rem $color_danger;
                text-shadow: 0 0 1rem opacify($color_danger, -1);
                margin-top: 0.65rem;
                margin-bottom: 0.1rem;
                outline: none;
                animation: dangerflash 0.3s linear infinite;
            }
        }
    }
}

input,
select,
textarea,
button {

    border: 0;
    background: $color_background_form;
    font-size: 1rem;
    line-height: 150%;
    color: $color_font_dark;
    outline: none;
    transition: background 0.3s ease-in-out, width 0.3s ease-in-out;
    width: 100%; /* take full width of form as default */
    margin-bottom: 0.25rem; /* leave a bit of space between form elements */


    &:hover,
    &:focus {
      background: $color_highlight;
    }

    &:invalid,
    &.invalid {
        box-shadow: none; /* override default red border of user agents */
        background: opacify(lighten($color_danger, 15%), -20%);
    }

    &::-moz-focus-inner { /* Goddammit firefox, this shit has been going on since 2010 */
        border: 0;
    }
}

input {

    &:required {
    }

    &[type="checkbox"] {

        width: auto;
        display: none;

        & + label {
            padding-left: 20px;
            background: url('/theme/icons/checkbox.svg') no-repeat;
            background-position: 0 center;
        }

        &:checked {

            & + label {
                /*  checkbox.svg and checkbox-fuckchrome.svg are identical. 
                    needed because chrom[e|ium] is fucking retarded.        */
                background-image: url('/theme/icons/checkbox-fuckchrome.svg#checked'); 
            }
        }
    }
}

button {

    cursor: pointer; /* no clue why this isn't the default */
    white-space: nowrap; /* avoides forms jumping in height when animating their width */
    overflow: hidden;
    font-family: 'Orbitron', sans;
    min-height: 1.8rem;
    padding-top: 0.25rem;
    margin-right: 0.5rem;
    width: 50%;

    &:last-child {
        margin-right: 0;
    }


}

textarea {

    width: 100%;
    resize: vertical;
    background: $color_background_form;
    min-height: 12rem;
    font-size: 0.8rem;
}

select {

  option {
    outline: none;
  }
}

fieldset {
   
    box-sizing: border-box;
    margin: 1.5rem 0;
    border: 0;
    border-top: 0.25rem $color_background_light solid;
    border-bottom: 0.25rem $color_background_light solid;
    background: rgba($color_background_light, 0.05);
    padding: 1rem;
}

