:root {
  --blue-light: #bfecff;
  --blue-dark: #123e57;
  --yellow-light: #fef3cf;
  --yellow-dark: #174b4d;
  --brown-light: #f1eaea;
  --brown-dark: #383a4a;
  --gray-light: #eeeeee;
  --gray-dark: #464646;
}

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

body {
  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);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap; /* Added to prevent text from wrapping */
}

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

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

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

h1 {
  font-size: 1.75rem;
  margin-top: 0;
  margin-bottom: 1.5rem;
  text-wrap: balance;

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

  @media (min-width: 668px) {
    font-size: 2.25rem;
    margin-top: 1.25rem;
  }
}

h2 {
  font-size: 1.25rem;
}

p {
  font-size: 1.125rem;
  margin-top: 0.5rem;
}

.text-large {
  font-size: 1.375rem;
  margin-bottom: 1.5em;

  @media (min-width: 668px) {
    font-size: 1.5rem;
  }
}

.weather-today__meta {
  display: flex;
  flex-flow: row;
  gap: 0.75rem;
  margin-bottom: 2.5rem;

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

  .badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;

    font-size: 0.875rem;
    font-weight: 600;

    border: 1px solid currentColor;
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem 0.375rem 0.6rem;
    margin: 0;

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

  span {
    margin: 0 0.25rem;
  }

  .icon path {
    fill: currentColor;
  }
}

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

.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;
  }
}

[id^="city-input"] {
  background: transparent;
  border: none;
  border-radius: 0;
  border-bottom: 2px dashed;
  font-size: 1.75rem;
  font-weight: 700;
  color: currentColor;
  padding: 0;
  cursor: pointer;

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

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

  &:hover {
    border-bottom-style: solid;
  }

  &::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;
  }
}
