:root {

    /* Neutral */
    --neutral-900: hsl(243, 96%, 9%);
    --neutral-800: hsl(243, 27%, 20%);
    --neutral-700: hsl(243, 23%, 24%);
    --neutral-600: hsl(243, 23%, 30%);
    --neutral-300: hsl(240, 6%, 70%);
    --neutral-200: hsl(250, 6%, 84%);
    --neutral-0: hsl(0, 0%, 100%);

    /* Orange */
    --orange-500: hsl(28, 100%, 52%);

    /* Blue */
    --blue-500: hsl(233, 67%, 56%);
    --blue-700: hsl(248, 70%, 36%);

    /* Typography */
    --font-sans: "DM Sans", sans-serif;
    --font-grotesque: "Bricolage Grotesque", sans-serif;

    --body-font-size: 18px;

    /* Sizing + radius */
    --radius-lg: 1.5rem;
    --radius-md: 1rem;
    --radius-sm: 0.5rem;

    --spacing: 1rem;
}

* {
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: var(--font-sans);
    font-size: var(--body-font-size);
    background-color: var(--neutral-900);
    color: var(--neutral-0);
}


.weather-app {
    width: 100%;
    max-width: 1100px;
    padding: 0 1rem;
}

.weather-app-header {
    width: 100%;
    height: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}


.container {
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.logo {
    align-self: flex-start;
}

#logo {
    width: 150px;
}

.unit {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    background-color: var(--neutral-700);
    padding: 8px;
    border-radius: var(--radius-sm);
}

#unit-svg {}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}


#unit {
    background-color: var(--neutral-700);
    border: var(--neutral-700);
    color: var(--neutral-200);
}

h1 {
    display: flex;
    font-family: var(--font-grotesque);
    white-space: nowrap;
    justify-content: center;
    align-items: center;
    font-size: clamp(20px, 5vw, 48px);
}

#search-section {
    height: auto;
    display: flex;
    flex: 2;
    margin-top: 1rem;
    width: 100%;
    max-width: 76%;
    justify-content: center;
    align-self: center;
    gap: 1.5rem;
}

#search-bar {
    display: flex;
    flex-grow: 1;
    background: var(--neutral-800);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    align-items: center;
}

#search-bar.active-glow {
    outline: 2px solid rgba(0, 150, 255, 0.8);
    outline-offset: 3px;
}

#search-bar:focus-within {
    box-shadow: 0 0 0 3px var(--clr-button-bg);
}

#search-svg {
    width: 1.2rem;
    height: auto;
    color: var(--neutral-300);
    margin-right: 0.5rem;
    padding: 0;
}

#search-input {
    flex-grow: 1;
    background: none;
    font-size: 15px;
    font-weight: var(--fw-medium);
    color: var(--neutral-300);
    border: none;
    padding: 0;
}

#search-input:focus-visible {
    outline: none;
}

#search-button {
    width: 120px;
    flex-shrink: 0;
    color: var(--neutral-0);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    background-color: var(--blue-500);
    border: none;
    box-shadow: 0 4px 6px -1px var(--neutral-900);
    transition: opacity 0.3s ease, transform 0.2s ease;
}


#search-button:hover {
    opacity: 0.9;
}

#search-button.active-glow {
    transform: translateY(1px);
    outline: 2px solid rgba(0, 150, 255, 0.8);
    outline-offset: 3px;
}

#error-message {
    position: relative;
    height: 35px;
    top: 30%;
    right: 8rem;
    width: 300px;
    background: #ff4d4d;
    color: white;
    padding: 5px 0 10px 80px;
    border-radius: 8px;
    font-size: 15px;
    display: none;
    white-space: nowrap;
    z-index: 10;
}


#error-message.show {
    display: block;
}


.weather-container {
    width: 100%;
    display: grid;
    position: relative;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-top: 2rem;
}

/* weather banner */

.left-forecast-column {
    width: 95%;
}

.forecast-banner {
    height: 250px;
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem;
    border-radius: var(--radius-lg);
}

#large-svg {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: var(--radius-lg);
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: -1;
    box-shadow: 0 10px 20px -5px var(--clr-shadow-dark);
}

.location,
.date,
.weather-description,
#sunny-icon,
.span-degree {
    position: relative;
}

.location {
    font-size: 30px;
    align-self: flex-start;
    white-space: nowrap;
    top: 2rem;
    padding-left: 0.5rem;
}

/* Styling for the weather description text */
.weather-description {
    font-size: 20px;
    font-weight: 300;
    left: 22rem;
    top: 50px;
}

.date {
    font-size: 18px;
    font-weight: 200;
    white-space: nowrap;
    top: 15px;
}

#sunny-icon {
    width: 100px;
    bottom: 80px;
    left: 23rem;
}

.span-degree {
    font-size: 80px;
    bottom: 185px;
    font-style: normal;
    left: 29rem;

}

/* weather metrics */

#weather-metrics {
    width: 100%;
    height: 120px;
    margin-top: 2rem;
    display: flex;
    font-size: 1.2rem;
    font-weight: 500;
    gap: 1rem;
    /* overflow-x: auto; */
    overflow: hidden;

}

.weather-metric {
    min-width: 0;
    flex: 1 1 0;
    background-color: var(--neutral-800);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 3px hsl(243, 23%, 24%);
    aspect-ratio: 1 / 1;
}

.feels-like {
    display: flex;
    align-items: center;
    margin-top: 25px;
    font-weight: 300;
    font-size: 18px;
    padding-left: 15px;
    color: var(--neutral-300);
}

.degree {
    display: flex;
    align-items: center;
    margin-top: 10px;
    font-weight: 100;
    font-size: 25px;
    padding-left: 15px;
    color: var(--neutral-0);
}

/* Daily Forecast section */

h3 {
    width: 100%;
    color: var(--neutral-0);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
    font-size: 1.1rem;
}

.daily-forecast {
    width: 100%;
    height: auto;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    justify-content: flex-start;
}

.daily-forecast::-webkit-scrollbar {
    height: 6px;
}

.daily-forecast::-webkit-scrollbar-thumb {
    background: var(--neutral-600);
    border-radius: 3px;
}


#daily-forecast {
    min-width: 90px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--neutral-700);
    border-radius: var(--radius-sm);
    padding: 10px;
    box-shadow: 0 2px 3px hsl(243, 23%, 24%);
    justify-content: space-between;
}

.day {
    font-size: 1rem;
    font-weight: 300;
    margin: 0;
}

.daily-forecast img {
    width: 40px;
    margin: 0.5rem 0;
}

.degree-box {
    display: flex;
    gap: 25px;
    color: var(--neutral-0);
    font-size: 18px;
    font-weight: 300;

}

/* Hourly forecast section */

.hourly-forecast-section {
    width: clamp(260px, 30vw, 420px);
    display: flex;
    position: relative;
    background-color: var(--neutral-700);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    flex-direction: column;
    grid-column: 2 / 3;
    transform: translateX(-30px);
}

.hourly-forecast-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

#hourly-forecast {
    position: absolute;
    right: 10%;
    top: 6%;
    transform: translateY(-50%);
    width: 100px;
    color: var(--neutral-0);
    background-color: var(--neutral-600);
    border: none;
    padding: 3px 5px;
    border-radius: var(--radius-sm);
}

.hourly-forecast-sections {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
    margin-top: 0.5rem;
    overflow-y: auto;
    max-height: 480px;
}

.hourly-forecast-sections::-webkit-scrollbar {
    width: 8px;
}

.hourly-forecast-sections::-webkit-scrollbar-track {
    background: var(--neutral-700);
}

.hourly-forecast-sections::-webkit-scrollbar-thumb {
    background: var(--neutral-600);
    border-radius: 10px;
}


.hourly-forecast {
    width: 100%;
    height: 50px;
    border-radius: var(--radius-sm);
    background-color: var(--neutral-600);
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0;
}

.icon-overcast {
    width: 30px;
    flex-shrink: 0;
}

.time {
    flex-grow: 1;
    margin-left: 1rem;
    font-size: 1rem;
    font-weight: 300;
}

.deg {
    font-size: 1rem;
    font-weight: 200;
    flex-shrink: 0;
}

.attribution {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 2rem;
    font-size: 0.8rem;
    color: var(--neutral-300);
}


@media (max-width: 768px) {

    .container {
        overflow-x: hidden;
        padding: 0;
    }

    .weather-app {
        padding: 0 0.5rem;
    }

    #search-section {
        flex-direction: column;
        align-items: center;
        max-width: 100%;
        gap: 1rem;
    }

    #search-bar {
        order: 1;
        width: 100%;
        max-width: 550px;
    }

    #search-button {
        order: 2;
        width: 100%;
        max-width: 550px;
        align-self: center;
    }

    #error-message {
        position: relative;
        left: 4px;
        height: 35px;
        transform: translateY(-8rem);
        width: 100%;
        max-width: 550px;
        background: #ff4d4d;
    }

    .weather-container {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 2rem;
    }

    .left-forecast-column {
        width: 100%;
        display: grid;
    }

    .location {
        top: 1.5rem;
    }

    .weather-description {
        right: auto;
    }

    #sunny-icon {
        bottom: 80px;
        right: auto;
    }

    .span-degree {
        right: auto;
    }

    #weather-metrics {
        width: 100%;
        margin-top: 1rem;
        gap: 0.8rem;
    }


    .feels-like {
        font-size: 12px;
    }

    .degree {
        font-size: 20px;
    }

    #daily-forecast {
        min-width: 0;
    }

    .hourly-forecast-section {
        width: 100%;
        padding: 1rem;
        grid-column: 1 /1;
        transform: none;
    }

}

@media (max-width: 375px) {

    .weather-app {
        padding: 0 0.2rem;
    }

    #large-svg {
        height: 50px object-fit: contain;
    }

    .weather-description {
        left: 5rem;
        top: 80px;
    }

    .date {
        font-size: 15px;
        white-space: wrap;
        top: 10px;
    }

    #sunny-icon {
        width: 80px;
        bottom: 1rem;
        left: 7rem;
    }

    .span-degree {
        font-size: 70px;
        bottom: 6.5rem;
        left: 11rem;

    }

}