/* CSS for the weewx SkyPirates skin
 * Copyright (c) Tom Keffer, Matthew Wall
 * Distributed under terms of GPLv3.  See LICENSE.txt for your rights.
 */

:root {
    --background-color:#ffffff;
    --title-background-color:#dddddd;
    --button-background-color:#bbbbbb;
    --element-background-color:#81F79F;
    --section-border-color:#aaaaaa;
    --cell-border-color:#dddddd;
    --highlight-color:#4282b4;
    --link-color:#4282b4;
    --visited-color:#4282b4;
    --hover-color:#4282b4;
    --timestamp-color:#aaaaaa;
    --hival-color:#aa4444;
    --loval-color:#4444aa;
    --ok-color:#44aa44;
    --low-color:#aa4444;
}

/* use the fonts from google */
/* @import url('https://fonts.googleapis.com/css?family=Open+Sans'); */

/* use the local fonts */
@font-face {
    font-family: 'Open Sans';
    src: url('font/OpenSans.woff') format('woff'),
         url('font/OpenSans.woff2') format('woff2');
}

/* ---------- GLOBAL MOBILE SAFETY ---------- */

* {
    box-sizing: border-box;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;
    border: 0;
    font-family: 'Open Sans', arial, sans-serif;
    background: linear-gradient(to bottom, #87ceeb, #ffffff);
    position: relative;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    text-decoration: none;
    cursor: pointer;
    color: var(--link-color);
}

a:link {
    color: var(--link-color);
}

a:visited {
    color: var(--visited-color);
}

a:hover {
    color: var(--hover-color);
}

#widget_group {
    float: none !important;
    width: 100%;
    max-width: 100%;
}

#plot_group {
    display: none;
}

#title_bar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    
    margin-bottom: 10px;
    padding: 10px 15px;
    
    background-color: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--section-border-color);
    
    position: relative;
    z-index: 10;
}

#contents {
    clear: both;
    margin: 20px;
    width: auto;
    max-width: 100%;
    position: relative;
    z-index: 10;
}

#title {
    grid-column: 1;
    grid-row: 1 / span 2;
}

#rss_link {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
}

#reports {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.85rem;
    text-align: right;
}

#reports select {
    margin-top: 4px;
    margin-bottom: 6px
}

.footnote {
    font-size: 80%;
    font-style: italic;
    clear: both;
    padding-left: 20px;
    position: relative;
    z-index: 10;
}

.page_title {
    font-size: 1.4rem;
    line-height: 1.2;
    margin: 0;
}

.lastupdate {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-top: 4px;
}

.widget {
    margin: 20px 10px !important;
    clear: none !important;
    float: left;
    max-width: 100%;
    position: relative;
    z-index: 10;
}

.widget_title {
    font-weight: bold;
    padding: 2px 10px 2px 10px;
    border-bottom: 2px solid var(--section-border-color);
    position: relative;
    z-index: 10;
    /* outlined titles */
/*
    background-color: var(--title-background-color);
    border: 1px solid var(--section-border-color);
*/
}

.label {
    font-size: 80%;
    vertical-align: top;
    text-align: right;
    padding-top: 4px;
    padding-right: 5px;
}

.data {
    font-weight: bold;
    font-size: 80%;
    vertical-align: top;
    text-align: left;
    padding-top: 4px;
}

.units {
    font-size: 80%;
    vertical-align: top;
    padding-top: 4px;
}

.timestamp {
    font-size: 80%;
    font-weight: normal;
}

.hival {
    color: var(--hival-color);
}

.loval {
    color: var(--loval-color);
}

.status_ok {
    color: var(--ok-color);
}

.status_low {
    color: var(--low-color);
}

.button {
    cursor: pointer;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 0px;
    padding-bottom: 0px;
    /* rounded box buttons */
/*
    border: 1px solid var(--section-border-color);
    webkit-radius: 3px;
    moz-radius: 3px;
    border-radius: 3px;
*/
}

.button_selected {
    cursor: pointer;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 0px;
    padding-bottom: 0px;
    border-bottom: 5px solid var(--highlight-color);
    /* rounded box buttons */
/*
    background-color: var(--button-background-color);
    border: 1px solid var(--section-border-color);
    webkit-radius: 3px;
    moz-radius: 3px;
    border-radius: 3px;
*/
}

.widget_control {
    float: right;
    cursor: pointer;
    margin-left: 20px;
    margin-right: 5px;
}

.widget img {
    width: 350px;
    max-width: 100%;
    border: 1px solid var(--section-border-color);
    margin-top: 4px;
}

.new_row {
    border-top: 1px solid var(--cell-border-color);
}

.celestial_body {
    margin-bottom: 30px;
    float: left;
}

.widget table th {
    font-weight: normal;
    text-align: right;
    border-bottom: 1px solid var(--cell-border-color);
}

#hilo_widget table th {
    font-size: 80%;
    text-align: right;
    border-bottom: none;
}

#hilo_widget .data {
    font-weight: bold;
    font-size: 80%;
    text-align: right;
    padding-left: 10px;
}

#sensors_widget table th {
    padding-top: 10px;
}

#history_widget img {
    border: none;
    margin-bottom: 10px;
    width: 500px;
    max-width: 100%;
}

#history_widget.widget_title {
    min-width: 500px;
}

.plot_container {
    margin-top: 4px;
    position: relative;
    z-index: 10;
}

#map_canvas {
    width: 350px;
    max-width: 100%;
    height: 350px;
    margin-top: 4px;
}

/* ---------- ANIMATED CLOUD LAYER ---------- */

.cloud-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.68);
    border-radius: 999px;
    filter: blur(4px);
}

.cloud::before,
.cloud::after {
    content: "";
    position: absolute;
    background: rgba(255, 255, 255, 0.68);
    border-radius: 50%;
}

.cloud1 {
    width: 180px;
    height: 54px;
    top: 5vh;
    left: -220px;
    animation: drift 95s linear infinite;
}

.cloud1::before {
    width: 70px;
    height: 70px;
    top: -18px;
    left: 26px;
}

.cloud1::after {
    width: 90px;
    height: 90px;
    top: -35px;
    left: 78px;
}

.cloud2 {
    width: 140px;
    height: 46px;
    top: 18vh;
    left: -180px;
    animation: drift 120s linear infinite;
}

.cloud2::before {
    width: 58px;
    height: 58px;
    top: -14px;
    left: 18px;
}

.cloud2::after {
    width: 76px;
    height: 76px;
    top: -28px;
    left: 58px;
}

.cloud3 {
    width: 170px;
    height: 52px;
    top: 34vh;
    left: -260px;
    animation: drift 105s linear infinite;
}

.cloud3::before {
    width: 66px;
    height: 66px;
    top: -16px;
    left: 24px;
}

.cloud3::after {
    width: 84px;
    height: 84px;
    top: -30px;
    left: 68px;
}

.cloud4 {
    width: 115px;
    height: 38px;
    top: 52vh;
    left: -150px;
    animation: drift 85s linear infinite;
}

.cloud4::before {
    width: 46px;
    height: 46px;
    top: -10px;
    left: 14px;
}

.cloud4::after {
    width: 58px;
    height: 58px;
    top: -22px;
    left: 42px;
}

@keyframes drift {
    from { transform: translateX(0); }
    to   { transform: translateX(125vw); }
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 800px) {
    #plot_group {
        overflow: visible;
        float: left;
    }
}

@media (min-width: 801px) {
    #plot_group {
        overflow: hidden;
        float: none;
    }
}

@media (max-width: 768px) {
    #title_bar {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    #title {
        margin: 0;
    }

    #reports {
        text-align: center;
        margin-left: 0;
        margin-top: 8px;
        font-size: 0.85rem
    }
    
    #rss_link {
        text-align: center;
        margin-left: 0;
        margin-top: 8px;
    }
    
    .page_title {
        font-size: 120%;
        line-height: 1.2;
    }

    .lastupdate {
        font-size: 85%;
        line-height: 1.3;
    }

    #contents {
        margin: 10px;
    }

    #widget_group {
        display: block;
        width: 100%;
    }

    .widget {
        float: none;
        display: block;
        width: 100%;
        margin: 15px 0 !important;
    }

    .widget table {
        width: 100%;
    }

    .widget img,
    #history_widget img {
        width: 100%;
        max-width: 100%;
        height: auto;
    }

    #map_canvas {
        width: 100%;
        height: 250px;
    }

    .label,
    .data,
    .units,
    .timestamp {
        font-size: 90%;
    }

    .cloud {
        filter: blur(3px);
        opacity: 0.6;
    }

    .cloud1 {
        width: 130px;
        height: 40px;
        top: 6vh;
    }

    .cloud1::before {
        width: 50px;
        height: 50px;
        top: -12px;
        left: 18px;
    }

    .cloud1::after {
        width: 64px;
        height: 64px;
        top: -24px;
        left: 54px;
    }

    .cloud2 {
        width: 105px;
        height: 34px;
        top: 20vh;
    }

    .cloud2::before {
        width: 40px;
        height: 40px;
        top: -10px;
        left: 14px;
    }

    .cloud2::after {
        width: 54px;
        height: 54px;
        top: -20px;
        left: 42px;
    }

    .cloud3 {
        width: 120px;
        height: 38px;
        top: 36vh;
    }

    .cloud3::before {
        width: 46px;
        height: 46px;
        top: -10px;
        left: 16px;
    }

    .cloud3::after {
        width: 60px;
        height: 60px;
        top: -22px;
        left: 46px;
    }

    .cloud4 {
        width: 90px;
        height: 30px;
        top: 54vh;
    }

    .cloud4::before {
        width: 34px;
        height: 34px;
        top: -8px;
        left: 12px;
    }

    .cloud4::after {
        width: 44px;
        height: 44px;
        top: -16px;
        left: 34px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cloud {
        animation: none;
    }
}
