:root {
    --bg-top: #3987d7;
    --bg-middle: #73b9e8;
    --bg-bottom: #d5eafa;

    --text: #ffffff;
    --muted: rgba(255, 255, 255, .72);

    --glass: rgba(255, 255, 255, .14);
    --glass-border: rgba(255, 255, 255, .20);
    --shadow: rgba(0, 0, 0, .18);

    --cloud-opacity: 0;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: var(--text);

    background:
        linear-gradient(
            180deg,
            var(--bg-top),
            var(--bg-middle) 48%,
            var(--bg-bottom)
        );

    background-attachment: fixed;

    transition:
        background 1.5s ease,
        color .4s ease;

    overflow-x: hidden;
}


/* ==============================
   BACKGROUND
   ============================== */

#weather-background {
    position: fixed;
    inset: 0;

    pointer-events: none;
    overflow: hidden;

    z-index: -1;
}

.sky-glow {
    position: absolute;

    width: 65vw;
    height: 65vw;

    max-width: 900px;
    max-height: 900px;

    right: -15vw;
    top: -25vw;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(255, 238, 174, .35),
            rgba(255, 255, 255, 0) 65%
        );
}


.moon {
    position: absolute;

    right: 7vw;
    top: 10vh;

    width: 90px;
    height: 90px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle at 35% 35%,
            #fffef0,
            #d8d8c2 70%
        );

    box-shadow:
        0 0 30px rgba(255,255,220,.35),
        0 0 90px rgba(200,220,255,.2);

    opacity: 0;

    transition:
        opacity 1s ease,
        filter 1s ease,
        transform 1s ease;
}


.cloud-layer {
    position: absolute;
    inset: 0;

    opacity: var(--cloud-opacity);

    background:
        radial-gradient(
            ellipse at 20% 20%,
            rgba(255,255,255,.25) 0 7%,
            transparent 17%
        ),
        radial-gradient(
            ellipse at 65% 16%,
            rgba(255,255,255,.18) 0 8%,
            transparent 20%
        ),
        radial-gradient(
            ellipse at 80% 45%,
            rgba(255,255,255,.15) 0 8%,
            transparent 22%
        );

    animation: clouds 25s ease-in-out infinite alternate;
}

@keyframes clouds {
    from {
        transform: translateX(-3%);
    }

    to {
        transform: translateX(3%);
    }
}


/* precipitation */

.drop,
.snowflake {
    position: fixed;

    top: -30px;

    animation:
        fall linear infinite;

    opacity: .7;
}

.drop {
    width: 2px;
    height: 20px;

    background:
        linear-gradient(
            rgba(255,255,255,0),
            rgba(190,220,255,.9)
        );
}

.snowflake {
    font-size: 18px;
}

@keyframes fall {
    to {
        transform:
            translateY(110vh)
            translateX(40px);
    }
}


/* ==============================
   LAYOUT
   ============================== */

.app {
    width: min(1500px, 100%);
    margin: auto;

    padding:
        max(24px, env(safe-area-inset-top))
        clamp(16px, 4vw, 60px)
        40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 40px;
}

.brand {
    font-size: clamp(25px, 3vw, 38px);
    font-weight: 700;

    letter-spacing: -.03em;
}

.brand span {
    font-weight: 300;
}

.date {
    margin-top: 8px;

    color: var(--muted);
    font-size: 15px;
}

.clock-wrapper {
    text-align: right;
}

.clock {
    font-size: clamp(27px, 4vw, 46px);
    font-weight: 300;

    letter-spacing: -.04em;
}

.timezone {
    color: var(--muted);

    font-size: 12px;
    letter-spacing: .15em;

    margin-top: 3px;
}


/* ==============================
   GLASS
   ============================== */

.glass {
    background: var(--glass);

    border:
        1px solid
        var(--glass-border);

    border-radius: 28px;

    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);

    box-shadow:
        0 25px 70px var(--shadow);
}


/* ==============================
   HERO
   ============================== */

.hero {
    display: grid;

    grid-template-columns:
        minmax(0, 2fr)
        minmax(280px, .7fr);

    gap: 20px;

    margin-bottom: 20px;
}


.current-weather {
    min-height: 260px;

    padding: clamp(25px, 4vw, 50px);

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 40px;
}


.location-label {
    color: var(--muted);

    font-size: 18px;
}


.temperature-row {
    display: flex;
    align-items: center;

    margin-top: 8px;
}


.main-icon {
    font-size: clamp(45px, 6vw, 80px);

    margin-right: 20px;
}


.temperature {
    font-size: clamp(80px, 12vw, 150px);

    line-height: .9;
    font-weight: 200;

    letter-spacing: -.08em;
}


.degree {
    font-size: clamp(40px, 5vw, 60px);

    align-self: flex-start;
}


.weather-description {
    margin-top: 18px;

    font-size: clamp(20px, 2vw, 29px);

    text-transform: capitalize;
}


.weather-info {
    min-width: 230px;

    display: grid;
    gap: 13px;
}


.info-item {
    display: flex;
    justify-content: space-between;
    gap: 35px;

    padding-bottom: 10px;

    border-bottom:
        1px solid
        rgba(255,255,255,.1);
}


.info-item span {
    color: var(--muted);
}


.status {
    padding: 30px;

    display: flex;
    flex-direction: column;
}


.status-title {
    color: var(--muted);

    font-size: 13px;

    text-transform: uppercase;
    letter-spacing: .12em;
}


.phenomenon {
    margin-top: 20px;

    font-size: 27px;
    font-weight: 500;
}


.updated {
    color: var(--muted);

    margin-top: 10px;

    font-size: 13px;
}


.refresh-button {
    margin-top: auto;

    padding: 13px 20px;

    color: white;

    background:
        rgba(255,255,255,.14);

    border:
        1px solid
        rgba(255,255,255,.2);

    border-radius: 14px;

    cursor: pointer;

    font: inherit;

    transition:
        background .2s,
        transform .2s;
}


.refresh-button:hover {
    background:
        rgba(255,255,255,.22);

    transform: translateY(-1px);
}


.refresh-button:disabled {
    opacity: .5;

    cursor: default;
}


/* ==============================
   MAP
   ============================== */

.map-section {
    padding: 25px;

    overflow: hidden;
}


.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 30px;

    margin-bottom: 20px;
}


.section-header h2 {
    margin: 0;

    font-size: 23px;
}


.section-header p {
    margin:
        6px
        0
        0;

    color: var(--muted);
}


.legend {
    display: flex;
    flex-wrap: wrap;

    justify-content: flex-end;

    gap: 10px;

    font-size: 12px;
}


.legend span {
    background:
        rgba(255,255,255,.1);

    padding:
        7px
        10px;

    border-radius: 20px;
}


#map {
    width: 100%;
    height: min(62vh, 650px);

    min-height: 420px;

    border-radius: 20px;

    overflow: hidden;
}


/* leaflet marker */

.weather-marker {
    width: 58px;
    height: 58px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-direction: column;

    border-radius: 18px;

    background:
        rgba(18, 34, 58, .84);

    border:
        1px solid
        rgba(255,255,255,.3);

    box-shadow:
        0 7px 20px
        rgba(0,0,0,.28);

    color: white;

    backdrop-filter: blur(10px);

    transition:
        transform .2s;
}


.weather-marker:hover {
    transform: scale(1.12);
}


.marker-icon {
    font-size: 21px;

    line-height: 1;
}


.marker-temp {
    font-size: 13px;
    font-weight: 700;

    margin-top: 2px;
}


/* popup */

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: #152338;

    color: white;
}

.popup-title {
    font-size: 16px;
    font-weight: 700;

    margin-bottom: 7px;
}

.popup-condition {
    opacity: .8;

    margin-bottom: 5px;
}


/* ==============================
   DISTRICTS
   ============================== */

.district-title {
    margin-top: 35px;
}


.district-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;
}


.district-card {
    padding: 20px;

    border-radius: 22px;

    background:
        rgba(255,255,255,.12);

    border:
        1px solid
        rgba(255,255,255,.15);

    backdrop-filter: blur(16px);

    transition:
        transform .2s,
        background .2s;

    cursor: pointer;
}


.district-card:hover {
    transform: translateY(-3px);

    background:
        rgba(255,255,255,.18);
}


.district-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 10px;
}


.district-name {
    font-weight: 600;
}


.district-icon {
    font-size: 25px;
}


.district-temp {
    margin-top: 17px;

    font-size: 40px;
    font-weight: 300;
}


.district-condition {
    margin-top: 6px;

    color: var(--muted);

    font-size: 13px;
}


/* ==============================
   FOOTER
   ============================== */

footer {
    text-align: center;

    margin-top: 35px;

    color:
        rgba(255,255,255,.5);

    font-size: 12px;
}


/* ==============================
   TABLET
   ============================== */

@media (max-width: 1000px) {

    .hero {
        grid-template-columns: 1fr;
    }

    .status {
        min-height: 180px;
    }

    .district-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }

}


/* ==============================
   PHONE
   ============================== */

@media (max-width: 650px) {

    .app {
        padding:
            20px
            12px
            30px;
    }

    .topbar {
        margin-bottom: 25px;
    }

    .date {
        max-width: 190px;

        font-size: 12px;
    }

    .current-weather {
        flex-direction: column;

        align-items: stretch;

        padding: 24px;
    }

    .weather-info {
        min-width: 0;
    }

    .main-icon {
        margin-right: 12px;
    }

    .section-header {
        flex-direction: column;
    }

    .legend {
        justify-content: flex-start;
    }

    .district-grid {
        grid-template-columns: 1fr 1fr;

        gap: 8px;
    }

    .district-card {
        padding: 16px;
    }

    #map {
        height: 55vh;

        min-height: 370px;
    }

    .map-section {
        padding: 12px;
    }

}


@media (max-width: 400px) {

    .district-grid {
        grid-template-columns: 1fr;
    }

}
