@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-BlackItalic.otf);
    font-weight: 900;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-Black.otf);
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-ExtraBold.otf);
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-ExtraBoldItalic.otf);
    font-weight: 800;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-Bold.otf);
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-BoldItalic.otf);
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-SemiBold.otf);
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-SemiBoldItalic.otf);
    font-weight: 600;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-Medium.otf);
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-MediumItalic.otf);
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-Regular.otf);
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-RegularItalic.otf);
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-Light.otf);
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Serotiva";
    src: url(/assets/font/Serotiva-LightItalic.otf);
    font-weight: 300;
    font-style: italic;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html{
    scroll-behavior:smooth;
}

:root{
    --pad:24px;
    --widget-sm:150px;
    --hamburger-size:32px;
    --text-light:#EAE9E8;
    --text-dark:#253126;
    --gray-dark:#A7A6A6;
    --gray-light:#D1D0D1;
    --bg:#EAE9E8;
    --bg-dark:#253126;
    --accent:#ff3b30;
}

html,
body.page-login{
    background:black;
    color:var(--text-light);
    margin: 0;
    padding: 0;
    height:100%;
    overflow:hidden;
    font-family: "tt-commons-pro", sans-serif;
}

.hero{
    position:relative;
    min-height:100vh;
    padding:var(--pad);
}

.hero-overlay{
    position:relative;
    height:calc(100vh - (var(--pad) * 2));
    z-index:5;
    pointer-events:none;
}


.page-login .hero{
    min-height:0;
    padding:0;
}

.page-login .hero-overlay{
    height:auto;
}

.page-login .logo-blur{
    display:none !important;
}

.page-loader{
    position:fixed;
    inset:0;
    background:var(--bg-dark);
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:999;
    opacity:1;
    transition:opacity 400ms ease;
}

.page-loader.is-hidden{
    opacity:0;
    pointer-events:none;
}

.page-loader__card{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:14px;
    text-transform:lowercase;
    font-family: "tt-commons-pro", sans-serif;
    color:var(--text-light);
    letter-spacing:0.04em;
}

.page-loader__spinner{
    width:36px;
    height:36px;
    position:relative;
    border-radius:50%;
    border:2px solid var(--gray-dark);
    border-top-color:var(--accent);
    animation:loader-spin 900ms linear infinite;
}

.page-loader__spinner::before{
    content:"";
    position:absolute;
    top:50%;
    left:50%;
    width:8px;
    height:8px;
    border-radius:50%;
    background:var(--accent);
    transform:rotate(20deg) translate(0, -18px);
    transform-origin:center;
}

.page-loader__text{
    margin:0;
    font-size:20px;
}

@keyframes loader-spin{
    to{ transform:rotate(360deg); }
}

.login{
    position:relative;
    height:100vh;
    padding:clamp(112px,14vh,128px) clamp(16px,3vw,calc(var(--pad) * 2)) clamp(16px,3vw,calc(var(--pad) * 2));
    overflow:visible;
    box-sizing:border-box;
}

.login-bg{
    position:fixed;
    inset:0;
    background:url("/assets/img/login.png") right top/130% no-repeat;
    opacity:0.85;
    z-index:0;
}

.login::after{
    content:"";
    position:fixed;
    inset:0;
    background:linear-gradient(120deg, rgba(18,18,18,0.35) 10%, rgba(18,18,18,0.05) 60%);
    z-index:0;
}

.widgets-shell{
    position:relative;
    z-index:1;
    display:grid;
    flex-direction: row;
    gap:clamp(16px,2vw,18px);
    grid-template-columns: 1fr 1fr 1fr;
    align-items:start;
    width:100%;
    height:100%;
    max-width:none;
    margin:0;
}

.widgets-left{
    display:flex;
    flex-direction:column;
    gap:clamp(16px,2vw,18px);
    height:100%;
}

.widgets-center{
    display:flex;
    flex-direction:column;
    gap:clamp(16px,2vw,18px);
    height:100%;
}

.widgets-right{
    display:flex;
    flex-direction:column;
    gap:clamp(16px,2vw,18px);
    height:100%;
}

.widgets-bottom{
    display:flex;
    gap:clamp(16px,2vw,18px);
    height:var(--widget-sm);
}

.widget{
    background:var(--bg-dark);
    border-radius:20px;
    min-height:140px;
    height:100%;
    padding:20px;
    overflow: hidden;
}

.widget--status{
    background:var(--text-light);
    height:300px;
    margin-top:auto;
    position:relative;
    overflow:visible;
    display:flex;
    align-items:center;
    gap:24px;
}

.widget--tall{
    min-height:420px;
    flex:1;
}

.widget--wide{
    min-height:190px;
    flex:1;
}

.widget--compact{
    height:var(--widget-sm);
}

.widget--small{
    height:100%;
}

/* Title */
.login-intro{
    display:flex;
    flex-direction:column;
    gap:12px;
}

.login-kicker{
    font-size:clamp(48px,2.4vw,56px);
    text-transform:uppercase;
    margin:0;
    font-family: "Serotiva", sans-serif;
    font-weight: 600;
}

.login-title{
    font-size:clamp(20px,4vw,28px);
    line-height:1.08;
    margin:0;
    font-weight:400;
    font-family: "tt-commons-pro", sans-serif;
}

/* wood */

/* 3D */
.container-3d{
    position:relative;
    flex:0 0 55%;
    height:100%;
    border-radius:18px;
    overflow:visible;
}

#canvas3d {
    transform: scale(1) translateY(0) translateX(0);
}

.canvas3d{
    display:block;
}

.status-meta{
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    gap:0px;
    color:var(--text-dark);
    font-family:"tt-commons-pro", sans-serif;
    height:100%;
}

.status-state{
    display:flex;
    align-items:center;
    gap:10px;
    align-self:flex-end;
}

.status-dot{
    width:8px;
    height:8px;
    border-radius:50%;
    background:var(--accent);
    display:inline-block;
}

.status-label{
    font-size:20px;
    text-transform:lowercase;
}

.status-details p{
    margin:0;
    font-size:16px;
    line-height:1.4;
}

.status-label-text{
    font-size:12px;
    color:var(--gray-dark);
    text-transform:lowercase;
}

.status-date{
    font-size:16px;
    color:var(--text-dark);
}

/* conversion widget (additive only) */
.conversion{
    display:flex;
    flex-direction:column;
    justify-content: space-between;
    color:var(--text-light);
    height: 100%;
}

.conversion-title{
    margin:0;
    font-size:16px;
    font-weight:400;
    color:var(--gray-dark);
}

.conversion-scale{
    display:flex;
    flex-direction:column;
    gap:8px;
}

.conversion-scale-top,
.conversion-scale-bottom{
    display:grid;
    grid-template-columns:repeat(13, minmax(0, 1fr));
    font-size:8px;
    color:var(--gray-dark);
}

.conversion-scale-top span,
.conversion-scale-bottom span{
    text-align:center;
    white-space:nowrap;
}

.conversion-line{
    position:relative;
    height:24px;
    display:grid;
    grid-template-columns:repeat(13, minmax(0, 1fr));
    align-items:center;
    --co2-inset:calc(100% / 26);
    --co2-progress:0.62;
    --co2-dot:0.60;
}

.conversion-line::before{
    content:"";
    position:absolute;
    left:var(--co2-inset);
    right:var(--co2-inset);
    top:50%;
    height:1px;
    transform:translateY(-50%);
    background:var(--bg);
}

.conversion-line::after{
    content:"";
    position:absolute;
    left:var(--co2-inset);
    width:calc((100% - (2 * var(--co2-inset))) * var(--co2-progress));
    top:50%;
    height:2px;
    transform:translateY(-50%);
    background:var(--accent);
    pointer-events:none;
}

.conversion-tick{
    width:1px;
    height:12px;
    justify-self:center;
    background:var(--bg);
    z-index:1;
}

.conversion-tick.is-active{
    background:var(--accent);
}

.conversion-tick-tall{
    width:2px;
    height:16px;
    justify-self:center;
    background:var(--bg);
    z-index:1;
}

.conversion-tick-tall.is-active{
    background:var(--accent);
}

.conversion-dot{
    position:absolute;
    left:calc(var(--co2-inset) + (100% - (2 * var(--co2-inset))) * var(--co2-dot));
    transform:translateX(-50%);
    width:8px;
    height:8px;
    border-radius:50%;
    background:var(--accent);
    z-index: 1;
}

.conversion-meta{
    display:flex;
    justify-content:space-between;
    font-size:12px;
}

.conversion-day{
    color:var(--gray-dark);
}

.conversion-daily{
    color:var(--text-light);
}

.conversion-total{
    display:flex;
    align-items:baseline;
    gap:12px;
}

.conversion-value{
    font-size:64px;
    font-weight:400;
    line-height:0.9;
    letter-spacing:-0.02em;
}

.conversion-unit{
    font-size:16px;
    padding-bottom:6px;
}

.status-details{
    align-self:flex-start;
}

.widgets-bottom > .widget{
    flex:1;
}

/* widget entrance */
@keyframes widget-rise-in{
    from{
        opacity:0;
        transform:translateY(36px);
    }
    to{
        opacity:1;
        transform:translateY(0);
    }
}

.widget{
    animation:widget-rise-in 1000ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.page-login:not(.is-ready) .widget{
    animation:none;
    opacity:0;
    transform:translateY(36px);
}

.page-login.is-ready .widget{
    animation:widget-rise-in 1000ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* per-widget stagger */
.widgets-left .widget:nth-child(1){ animation-delay:120ms; }
.widgets-left .widget:nth-child(2){ animation-delay:220ms; }
.widgets-left .widget:nth-child(3){ animation-delay:320ms; }

.widgets-center .widget:nth-child(1){ animation-delay:160ms; }
.widgets-center .widget:nth-child(2){ animation-delay:260ms; }
.widgets-center .widget:nth-child(3){ animation-delay:360ms; }

.widgets-right .widget:nth-child(1){ animation-delay:200ms; }
.widgets-right .widget:nth-child(2){ animation-delay:300ms; }

.widgets-bottom .widget:nth-child(1){ animation-delay:400ms; }
.widgets-bottom .widget:nth-child(2){ animation-delay:500ms; }

/* water widget */

.water-widget{
    height:100%;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    color:var(--text-light);
}

.water-copy{
    display:flex;
    flex-direction:column;
    gap:0px;
}

.water-kicker{
    margin:0;
    font-size:16px;
    font-weight:400;
    color:var(--gray-dark);
}

.water-desc{
    margin:0;
    font-size:12px;
}

.water-total{
    display:flex;
    align-items:baseline;
    gap:12px;
}

.water-value{
    font-size:48px;
    font-weight:400;
    letter-spacing:-0.02em;
}

.water-unit{
    font-size:16px;
    padding-bottom:6px;
    color:var(--text-light);
}

/* pm widget (additive only) */

.pm-widget{
    height:100%;
    display:flex;
    justify-content:space-between;
    color:var(--text-light);
}

.pm-copy{
    display:flex;
    flex-direction:column;
    gap:12px;
}

.pm-kicker{
    margin:0;
    font-size:16px;
    font-weight:400;
    color:var(--gray-dark);
}

.pm-kicker sub{
    font-size:0.5em;
    vertical-align:baseline;
    position:relative;
    bottom:-0.1em;
}

.pm-desc{
    margin:0;
    font-size:12px;
}

.pm-gauge{
    position:relative;
    flex:1;
    min-width:220px;
    min-height:250px;
    overflow:visible;
}

.pm-gauge canvas{
    transform: scale(1) translateY(-110px) translateX(0);
    width:100% !important;
    height:100% !important;
    overflow:visible;
}

/* energy widget */
.energy-widget{
    height:100%;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    color:var(--text-light);
}

.energy-header{
    display:flex;
    flex-direction:column;
    gap:6px;
}

.energy-title{
    font-size:16px;
    font-weight:400;
    color:var(--gray-dark);
}

.energy-subtitle{
    font-size:12px;
    color:var(--text-light);
}

.energy-chart{
    position:relative;
    flex:1;
    min-height:260px;
}

.energy-chart canvas{
    width:100% !important;
    height:100% !important;
    display:block;
}

.energy-total{
    display:flex;
    align-items:baseline;
    gap:12px;
}

.energy-total-value{
    font-size:96px;
    line-height:0.85;
    letter-spacing:-0.03em;
    font-weight:400;
}

.energy-total-unit{
    font-size:16px;
    color:var(--text-light);
}

@media (max-width: 900px){
    html,
    body.page-login{
        height:auto;
        overflow:auto;
    }

    .login{
        height:auto;
        min-height:100vh;
        padding:clamp(96px,12vh,112px) clamp(16px,5vw,28px) 24px;
        overflow:auto;
    }

    .login-bg{
        background:url("/assets/img/login.png") center / cover no-repeat;
        opacity:0.9;
    }

    .login::after{
        background:linear-gradient(180deg, rgba(18,18,18,0.65) 0%, rgba(18,18,18,0.35) 55%, rgba(18,18,18,0.75) 100%);
    }

    .widgets-shell{
        grid-template-columns:1fr;
        height:auto;
    }

    .widgets-left,
    .widgets-center,
    .widgets-right{
        height:auto;
    }

    .widgets-left{
        order:1;
    }

    .widgets-center{
        order:3;
    }

    .widgets-right{
        order:4;
    }

    .widget{
        height:auto;
        padding: 15px;
    }

    .widget--status{
        min-height:190px;
        flex-direction:column;
        align-items:flex-start;
    }

    .widget--wide{
        min-height:190px;
    }

    .widget--tall{
        min-height:320px;
    }

    .widgets-bottom{
        order:5;
        display:grid;
        grid-template-columns:1fr 1fr;
        gap:clamp(16px,2vw,18px);
        height:auto;
    }

    .widgets-bottom .widget{
        height:auto;
    }

    .conversion-value{
        font-size:52px;
    }

    .energy-total-value{
        font-size:64px;
    }

    .water-kicker{
        white-space:nowrap;
        letter-spacing:-0.01em;
    }

    .pm-widget{
        flex-direction:column;
        align-items:flex-start;
        justify-content:space-between;
        height:100%;
        max-height: 200px;
    }

    .pm-copy{
        min-width:auto;
    }

    .pm-gauge{
        min-width:100%;
        min-height:200px;
    }
    
    .pm-gauge canvas{
    transform: scale(1) translateY(-50px) translateX(0);
    }
    .container-3d{
        flex:1 1 auto;
        width:100%;
        height:220px;
        min-height:220px;
    }

    .canvas3d{
        width:100%;
        height:100%;
    }

    .conversion,
    .water-widget,
    .status-meta,
    .energy-widget{
        height:100%;
        justify-content:space-between;
        width: 100%;
    }

    .energy-chart{
        min-height:180px;
        max-height:220px;
    }
}

@media (max-width: 820px){
    .hero-header{
        padding:24px clamp(16px,5vw,calc(var(--pad) * 2)) 0;
    }
    .logo-wrap{
        --logo-h:28px;
    }
}

@media (max-width: 520px){
    .hero-header{
        padding:18px clamp(14px,5vw,24px) 0;
    }
    .logo-wrap{
        --logo-h:24px;
    }
}
