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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center; /* center horizontally */
  align-items: center;     /* center vertically */
  background-image: linear-gradient(
    to bottom,
    #dcdcdc 50%,
    #e9e9e9 50%
  );
  font-family: Sans-Serif;
  padding: 20px; /* space on small screens */
}

/* MAIN CARD */
main {
  width: 90%;           /* fills most of the screen */
  max-width: 500px;     /* prevents being too wide on large screens */
  min-width: 300px;     /* ensures minimum size on very small screens */
  min-height: 300px;
  background-color: #f7f7f7;
  border-radius: 30px;
  box-shadow: 0 30px 50px #5553;
  padding: 30px;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

/* FORM STYLING */
main form {
  border: 1px solid #5553;
  display: flex;
  justify-content: space-between;
  border-radius: 30px;
}

main form input,
main form button {
  border: none;
  background-color: transparent;
  outline: none;
  padding: 10px;
}

main form i {
  opacity: 0.7;
}

/* RESULT SECTION */
main .result {
  padding-top: 20px;
  text-align: center;
}

main .result .name {
  font-weight: bold;
  font-size: large;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

/* TEMPERATURE */
main .temperature {
  margin-top: 10px;
}

main .temperature img {
  width: 100%;
  max-width: 150px; /* scales down for small screens */
  filter: drop-shadow(0 10px 50px #000);
}

main .temperature figcaption {
  font-size: 3em;
  word-break: break-word;
}

main .description {
  padding: 10px 0 30px;
}

/* STATS LIST */
main ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

main li {
  background-color: #f78a55;
  color: #fff;
  border-radius: 10px;
  padding: 20px 10px;
  background-image: linear-gradient(
    to bottom,
    transparent 50%,
    #0003 50%
  );
  font-weight: bold;
  font-size: small;
  text-align: center;
}

main li i {
  font-size: 2em;
  display: block !important;
  margin: 20px 0;
}

main li:nth-child(2) {
  background-color: #b56291;
}

main li:nth-child(3) {
  background-color: #48567b;
}

/* ERROR EFFECT */
main.error {
  animation: errorEffect 0.3s linear 1;
}

@keyframes errorEffect {
  0% {
    transform: translate(10px, 5px);
  }
  25% {
    transform: translate(-5px, 0);
  }
  50% {
    transform: translate(8px, 2px);
  }
  75% {
    transform: translate(-2px, 5px);
  }
  100% {
    transform: translate(0, 0);
  }
}

/* RESPONSIVE FOR SMALL SCREENS */
@media (max-width: 500px) {
  main ul {
    grid-template-columns: 1fr; /* stack stats vertically */
  }

  main .temperature figcaption {
    font-size: 2.5em;
  }

  main li {
    padding: 15px 10px;
  }
}

/* RESPONSIVE IMAGE FOR EXTRA SMALL SCREENS */
@media (max-width: 350px) {
  main .temperature img {
    max-width: 120px;
  }

  main {
    padding: 20px;
  }
}