/*
 * Copyright 2022 Cendio AB.
 * For more information, see http://www.cendio.com
*/

/*
 * NOTE: Use multiples of 6px for alignments (margins, padding, etc.)
 */

@import "constants.css";
@import "fonts.css";
@import "input.css";
@import "baseelems.css";

/* ------- TOP ELEMENTS -------- */

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 100dvh;
    background-color: white;
    margin: 0px;
}
@supports not (min-height: 100dvh) {
    body {
        min-height: 100vh;
    }
    :root.noVNC_connected body {
        min-height: unset;
    }
}
body.branding_bg {
    background-image:
        /* Put a light overlay on the image */
        linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)),
        url('../branding/background');
    background-position: center;
    background-size: cover;
}
body.branding_bg .main_box {
    background-color: white;
}
@media (max-width: 958px) {
    body.branding_bg {
        /* Don't show the background image on small devices */
        background-image: none !important;
        background-color: white;
    }
}

/* This is just to get the main box centered */
body::before {
    content: "";
}

.main_box {
    width: 500px;
    /*
     * This has the same effect as justify-content: safe center;
     * but works on all browsers.
     */
    margin: 48px;
    padding: 0 180px;
    border: 1px solid var(--thinlinc-lightgrey);
    border-radius: 12px;
    /*
     * Almost everything here will be some small UI, meaning Poppins
     * should be used. It's easier to style the execptions back to
     * Mulish.
     */
    font-family: Poppins, sans-serif;
    text-align: center;
    transition: margin 0.3s linear;
}
@media (max-width: 958px) {
    /* Hide border on small devices. The limit of 958px stems from the main box
       width of 862px + 2*48px. Horizontal margins are set to be at least 48px
       above and below the max-width condition.
   */
    .main_box {
        max-width: calc(100% - 48px * 2);
        border: none;
        padding: 0;
        margin: 0px 48px 0px 48px;
    }
}
@media (max-width: 400px) {
    .main_box {
        max-width: calc(100% - 30px * 2);
        margin: 0px 30px 0px 30px;
    }
}

/* Switch between noVNC and our elements based on state */

:root:not(.noVNC_connected) #noVNC_container {
    display: none;
}
:root:not(.noVNC_connected),
:root:not(.noVNC_connected) body {
    height: unset;
    touch-action: unset;
}

:root.noVNC_loading .main_box,
:root.noVNC_connecting .main_box,
:root.noVNC_connected .main_box,
:root.noVNC_disconnecting .main_box {
    display: none;
}

:root.noVNC_loading .bottom_graphic,
:root.noVNC_connecting .bottom_graphic,
:root.noVNC_connected .bottom_graphic,
:root.noVNC_disconnecting .bottom_graphic {
    display: none;
}
:root.noVNC_loading body,
:root.noVNC_connecting body,
:root.noVNC_connected body,
:root.noVNC_disconnecting body {
    margin-bottom: 0px;
}

/* ------- MAIN CONTENT -------- */

#content {
    width: 100%;
}

#logo {
    display: block;
    margin: 4em auto;
}
#logo.branding_active {
    margin: 0;
    margin-left: auto;
    margin-right: auto;
}
#branding_logo {
    display: block;
    max-width: min(360px, 100%); /* Limited by main_box */
    max-height: 360px;
    margin: auto;
}

.main_box > *,
[id="content"] > * {
    margin: 2em auto;
}

[id="content"] form > * {
    display: block;
    width: 100%;
    /* We want strict adherence to the above width */
    box-sizing: border-box;
    margin: 1em auto;
}

[id="content"] form > button {
    width: unset;
    box-sizing: unset;
    margin: 2em auto;
}

/* ------- FOOTER -------- */

#footer {
    font-size: 0.8em;
}

#footer a {
    color: black;
}

#footer .version {
    font-weight: 600;
}

/* ------- BOTTOM GRAPHIC -------- */

.bottom_graphic {
    /* match the colors at ends of the bottom_graphic image */
    background-image: url("../images/bottom_graphic.svg"),
        linear-gradient(to right, #ab7d2f 0%, #ab7d2f 45%, #c5923b 55%, #c5923b 100%);
    background-position: center;
    min-height: 6px;
    height: 3vh;
    max-height: 48px;
    width: 100%;
}

/* --- HR-Office Branding Overrides --- */
#logo {
    max-width: 240px !important;
    max-height: 80px !important;
    width: auto !important;
    height: auto !important;
    margin: 0 auto 20px auto !important;
    display: block !important;
    content: url("/images/hro_logo.png") !important;
}

#bottom_graphic, .bottom_graphic, footer {
    background-color: transparent !important;
    filter: sepia(100%) hue-rotate(5deg) saturate(180%) brightness(85%) !important;
}

:root {
    --primary-color: #c5923b !important;
    --primary-hover: #ab7d2f !important;
    --primary-active: #8f6724 !important;
    --brand-dark: #333333 !important;
    --brand-light: #f6f7f8 !important;
}

/* Hide copyright notice */
#copyright, .copyright, [class*="copyright"], footer p {
    display: none !important;
    visibility: hidden !important;
}
