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


html {
    min-height: 100%;
}


body {
    min-height: 100vh;
    font-family: "DM Sans", sans-serif;
    color: #20242b;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    transition: background-image 0.5s ease;
    overflow-x: hidden;
}

h1, h2 {
    font-family: "Playfair Display", serif;
}

button, input {
    font: inherit;
}



/* BACKGROUND IMAGES*/
.weather-page.weather--sunny {
    background-image: url("../images/sunny.webp");
}

.weather-page.weather--cloudy {
    background-image: url("../images/cloudy.webp");
}

.weather-page.weather--rainy {
    background-image: url("../images/rainy.webp");
}

.weather-page.weather--snow {
    background-image: url("../images/snow.webp");
}

.weather-page.weather--storm {
    background-image: url("../images/storm.webp");
}

.weather-page.weather--sunrise {
    background-image: url("../images/sunrise.webp");
}

.weather-page.weather--sunset {
    background-image: url("../images/sunset.webp");
}

.weather-page.weather--clear-night {
    background-image: url("../images/clear-night.webp");
}

.weather-page.weather--cloudy-night {
    background-image: url("../images/cloudy-night.webp");
}


/* ACCESSIBILITY */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* LOADER */
.weather-page .weather {
    opacity: 0;
    visibility: hidden;
}

.weather-page.weather-page--indlaest .weather {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease 0.1s;
}

.loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: #20242b;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

.loader--skjult {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader__kompas {
    display: block;
    width: 9.375em;
    height: 9.375em;
}

.loader__pil,
.loader__ring-rotation,
.loader__ring-streg,
.loader__tick {
    animation-duration: 2s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.loader__pil {
    animation-name: loader-pil;
    transform: rotate(45deg);
    transform-origin: 16px 52px;
}

.loader__ring-rotation,
.loader__ring-streg {
    transform-origin: 80px 80px;
}

.loader__ring-rotation {
    animation-name: loader-ring-rotation;
}

.loader__ring-streg {
    animation-name: loader-ring-streg;
    transform: rotate(-45deg);
}

.loader__tick {
    animation-name: loader-tick;
}

.loader__tick:nth-child(2) {
    animation-delay: -1.75s;
}

.loader__tick:nth-child(3) {
    animation-delay: -1.5s;
}

.loader__tick:nth-child(4) {
    animation-delay: -1.25s;
}

.loader__tick:nth-child(5) {
    animation-delay: -1s;
}

.loader__tick:nth-child(6) {
    animation-delay: -0.75s;
}

.loader__tick:nth-child(7) {
    animation-delay: -0.5s;
}

.loader__tick:nth-child(8) {
    animation-delay: -0.25s;
}

.loader__tekst {
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.25em;
    font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
}

@keyframes loader-pil {
    from {
        transform: rotate(45deg);
    }

    to {
        transform: rotate(405deg);
    }
}

@keyframes loader-ring-rotation {
    from {
        transform: rotate(0);
    }

    to {
        transform: rotate(720deg);
    }
}

@keyframes loader-ring-streg {
    from,
    to {
        stroke-dashoffset: 452;
        transform: rotate(-45deg);
    }

    50% {
        stroke-dashoffset: 169.5;
        transform: rotate(-180deg);
    }
}

@keyframes loader-tick {
    from,
    3%,
    47%,
    to {
        stroke-dashoffset: -12;
    }

    14%,
    36% {
        stroke-dashoffset: 0;
    }
}


/* MAIN */
.weather {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}


/* WEATHER CARD */
.weather__card {
    width: 100%;
    max-width: 380px;
    padding: 22px;
    padding-top: 2rem;
    background:rgb(255 255 255 / 30%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(20, 30, 50, 0.18);
    backdrop-filter: blur(12px);
}


/* HEADER */
.weather__header {
    margin-bottom: 28px;
}


.weather__eyebrow {
    margin-bottom: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: #1f1f1f;
}


.weather__title {
    line-height: 1.1;
}


/* SEARCH */
.weather__search {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}


.weather__input {
    width: 100%;
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid #d8dce4;
    border-radius: 14px;
    outline: none;
    background: rgb(246, 244, 244);
    color: #20242b;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}


.weather__input::placeholder {
    color: #9aa1ae;
}


.weather__input:focus {
    border-color: #7c8cff;
    box-shadow: 0 0 0 3px rgba(124, 140, 255, 0.12);
}


.weather__button {
    padding: 14px 20px;
    border: none;
    border-radius: 14px;
    background: #20242b;
    color: rgb(232, 223, 223);
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}


.weather__button:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}


/* ERROR */
.weather__error {
    min-height: 20px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #c0392b;
}


/* LOCATION */
.weather__location {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
}


.weather__location h2 {
    font-size: 1.6rem;
    line-height: 1.2;
}


.weather__location p {
    margin-top: 4px;
    color: #1f1f1f;
}


/* MAIN WEATHER */
.weather__main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: fit-content;
    margin: 2rem;
}


.weather__icon {
    font-size: 4rem;
    line-height: 1;
}


.weather__temperature {
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1;
}


.weather__description {
    margin-top: 8px;
    color: #1f1f1f;
}


/* DETAILS */
.weather__details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}


.weather__detail {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 18px;
    background:rgba(245, 246, 249, 0.9);
}


.weather__detail-icon {
    font-size: 1.5rem;
    line-height: 1;
}


.weather__detail p {
    margin-bottom: 4px;
    font-size: 0.75rem;
    color: #737b8c;
}


.weather__detail strong {
    font-size: 1rem;
}


/* FORECAST */
.forecast {
    margin-top: 32px;
}

.forecast__title {
    margin-bottom: 14px;
    font-size: 1.1rem;
}

.forecast__list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.forecast__day {
    padding: 16px 8px;
    text-align: center;
    border-radius: 18px;
    background:rgba(245, 246, 249, 0.9);
}


.forecast__day-name {
    margin-bottom: 10px;
    font-size: 0.8rem;
    text-transform: capitalize;
    color: #737b8c;
}


.forecast__icon {
    margin-bottom: 8px;
    font-size: 1.8rem;
}


.forecast__temperature {
    font-weight: 700;
}

.search__wrapper {
    position: relative;
    width: 100%;
}


.search__suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(20, 30, 50, 0.15);
    overflow: hidden;
    z-index: 10;
}


.search__suggestion {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
}


.search__suggestion:hover {
    background: #f4f5f7;
}


.search__suggestion strong {
    display: block;
    font-size: 0.95rem;
}


.search__suggestion span {
    font-size: 0.75rem;
    color: #737b8c;
}

/* FOOTER */

.footer {
    bottom: -10%;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    pointer-events: none;
}


/* MOBILE */
@media (max-width: 500px) {

    .weather {
        padding: 16px;
    }


    .weather__card {
        padding: 24px;
        border-radius: 24px;
    }


    .weather__main {
        gap: 14px;
        margin: 2.5rem;
    }


    .weather__icon {
        font-size: 3.2rem;
    }


    .weather__temperature {
        font-size: 3.2rem;
    }


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

}
