@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap");

:root {
  --blue-light: #bde8fa;
  --blue-dark: #164a68;
  --yellow-light: #f7e9b9;
  --yellow-dark: #2a5510;
  --brown-light: #f1eaea;
  --brown-dark: #534a4a;
  --gray-light: #eeeeee;
  --gray-dark: #464646;
}

*,
:after,
:before {
  box-sizing: border-box;
}

body {
  font-family: "Montserrat", sans-serif;
  padding: 0;
  margin: 0;

  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100svh;
}

body.is-rainy,
body.is-snowy,
body.is-drizzly {
  color: var(--blue-dark);
  background-color: var(--blue-light);

  &.is-nighttime {
    color: var(--blue-light);
    background-color: var(--blue-dark);
  }
}

body.is-clear,
body.is-thunderstorm {
  color: var(--yellow-dark);
  background-color: var(--yellow-light);

  &.is-nighttime {
    color: var(--yellow-light);
    background-color: var(--blue-dark);
  }
}

body.is-cloudy,
body.is-atmosphere,
body.is-misty {
  color: var(--brown-dark);
  background-color: var(--brown-light);

  &.is-nighttime {
    color: var(--brown-light);
    background-color: var(--brown-dark);
  }
}

body.is-default {
  color: var(--gray-dark);
  background-color: var(--gray-light);

  &.is-nighttime {
    color: var(--gray-light);
    background-color: var(--gray-dark);
  }
}

main {
  padding: 1.5rem;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  align-items: stretch;
  justify-content: space-between;

  @media (min-width: 375px) {
    padding: 2.25rem;
  }

  @media (min-width: 668px) {
    min-height: fit-content;
  }
}

h1 {
  font-size: 1.875rem;
  margin-top: 0;
  margin-bottom: 2rem;
  text-wrap: balance;

  @media (min-width: 375px) {
    font-size: 2.25rem;
  }

  @media (min-width: 668px) {
    margin-top: 1rem;
  }
}

.weather-today__meta {
  display: flex;
  flex-flow: column;
  gap: 0.25rem;
  margin-bottom: 0;

  @media (min-width: 668px) {
    margin-bottom: 1rem;
  }

  p {
    font-size: 1rem;
    margin: 0;

    @media (min-width: 375px) {
      font-size: 1.25rem;
    }
  }

  span {
    margin: 0 0.25rem;
  }
}

.weather-today__greeting {
  img {
    max-width: 12rem;
    position: relative;
    left: -1.5rem;
  }
}

.weather-forecast__list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;

  li {
    display: flex;
    justify-content: space-between;
    position: relative;

    .list-section {
      display: flex;
      gap: 0.5rem;

      * {
        font-weight: 400;
        font-size: 1rem;
        margin: 0;

        @media (min-width: 375px) {
          font-size: 1.25rem;
        }
      }
    }

    &:after {
      position: absolute;
      content: "";
      width: 100%;
      bottom: -10px;
      border-bottom: 1px dashed;
    }

    &:last-of-type:after {
      border-bottom: none;
    }
  }
}

.error-message {
  &::first-letter {
    text-transform: capitalize;
  }
}

#city-input {
  background: transparent;
  border: none;
  border-radius: 0;
  border-bottom: 2px dashed;
  font-family: "Montserrat";
  font-size: 2.25rem;
  font-weight: 700;
  color: currentColor;
  padding: 0 0.25rem;
  cursor: pointer;

  &::selection {
    background-color: #fff;
  }

  .is-nighttime & {
    &:focus {
      background-color: #000;
    }
    &::selection {
      background-color: #000;
    }
  }

  &:focus {
    outline: none;
    background-color: #fff;
    border-color: transparent;
    border-radius: 0.5rem;
  }
}
