@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@700&display=swap");
*,
*::before,
::after {
  box-sizing: border-box;
  list-style: none;
  padding: 0;
  margin: 0;
  transition: 0.1s ease-in-out;
}
body {
  font-family: "Space Mono", monospace;
  background-color: hsl(185, 42%, 84%);
  display: flex;
  align-items: center;
  flex-direction: column;
  max-height: 100vh;
}
#title {
  display: inline-block;
  text-align: center;
  white-space: nowrap;
  margin-top: 150px;
  margin-bottom: 50px;
  text-transform: uppercase;
  color: hsl(183, 85%, 22%);
  font-size: 1.5rem;
  letter-spacing: 0.5rem;
  word-wrap: break-word;
}
.calc-container > h2,
.people-legend > h2 {
  font-size: 0.9rem;
  color: hsl(184, 14%, 56%);
  margin-bottom: -25px;
}
.container {
  background-color: white;
  border-radius: 20px;
  width: 918px;
  height: 480px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.calc-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;

  margin: 32px 16px 32px 32px;
  padding: 16px;
  border-radius: 20px;
}

form {
  display: flex;
  justify-content: space-between;
  height: 47px;
  align-items: center;
  border-radius: 5px;
  padding-left: 15px;
  background-color: hsl(189, 41%, 97%);
  color: hsl(183, 94%, 20%);
}
form:hover {
  cursor: pointer;
  border: 2px solid hsl(172, 67%, 45%);
}
input {
  border: none;
  outline: none;
  font-size: 1.5rem;
  width: 90px;
  font-weight: 700;
  background-color: hsl(189, 41%, 97%);
  color: hsl(183, 94%, 20%);
  font-family: "Space Mono", monospace;
}
.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
button {
  width: 117px;
  height: 48px;
  margin: 8px 0 8px 0;
  background-color: hsl(183, 100%, 15%);
  border-style: none;
  border-radius: 5px;
  color: white;
  font-size: 1.5rem;
  font-family: "Space Mono", monospace;
}
button:hover:not(.active) {
  color: hsl(183, 100%, 15%);
  background-color: hsl(185, 41%, 84%);
  transition: O.2s;
  cursor: pointer;
}
button:active {
  border: 2px solid hsl(183, 100%, 15%);
  transition: O.2s;
  background-color: hsl(172, 67%, 45%);
}
.active {
  background-color: hsl(172, 67%, 45%);
  color: hsl(183, 100%, 15%);
  transition: O.2s;
  border: 2px solid hsl(172, 67%, 45%);
}
#custom {
  background-color: hsl(189, 41%, 97%);
}
#custom > input {
  color: hsl(184, 14%, 56%);
}
#custom:hover {
  border: 2px solid hsl(172, 67%, 45%);
  cursor: pointer;
}
.cantbezero {
  border: 2px solid hsl(22, 67%, 45%);
}
.cantbezero:hover {
  cursor: pointer;
  border: 2px solid hsl(22, 67%, 45%);
}
.zero {
  color: hsl(22, 67%, 45%);
  visibility: hidden;
  margin-bottom: -25px;
  font-size: 0.9rem;
}

.people-legend {
  display: flex;
  justify-content: space-between;
}

/* Right Side */

.result-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr 1.5fr;
  background-color: hsl(183, 100%, 15%);
  margin: 32px 32px 32px 16px;
  border-radius: 20px;
  padding: 57px 40px 40px 40px;
  row-gap: 10px;
}
h2 {
  color: white;
  font-size: 0.9rem;
}
p {
  color: hsl(185, 41%, 84%);
  font-size: 0.75rem;
}
.reset {
  width: 100%;
  height: 48px;
  margin: 0;
  grid-column: 1/3;
  background-color: hsl(172, 67%, 45%);
  border-style: none;
  border-radius: 5px;
  color: hsl(183, 100%, 15%);
  text-transform: uppercase;
  font-size: 1.3rem;
  font-family: "Space Mono", monospace;
  align-self: end;
}
#tipAmount {
  font-size: 3rem;
  color: hsl(172, 67%, 45%);
  align-self: start;
  justify-self: end;
  line-height: 3rem;
}
#total {
  font-size: 3rem;
  color: hsl(172, 67%, 45%);
  justify-self: end;
  line-height: 3rem;
}

/* Pour écran dont la largeur est supérieure ou égale à 930px */
@media screen and (min-width: 930px) {
  .container {
    width: 918px;
    height: 480px;
    margin: 0 auto;
    transform: scale(1);
    transition: transform 0.2s ease-in-out;
  }
}

/* Pour écran dont la largeur est inférieure à 930px */
@media screen and (max-width: 929px) {
  .container {
    width: 100vw;
    height: 100vh;
    margin: 0;
    transform: scale(0.8);
    transition: transform 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
  }
  .calc-container > h2,
  .people-legend > h2 {
    margin-bottom: 5px;
  }
  .calc-container {
    margin: 32px;
    padding: 16px;

    flex: 1;
    flex-wrap: nowrap;
  }

  .result-container {
    margin: 0 32px 32px 32px;
    padding: 16px;

    flex: 1;
  }
}
/* Pour écran dont la largeur est inférieure à 830px */
@media screen and (max-width: 829px) {
  .calc-container {
    padding: 0;
  }
}
/* Pour écran dont la largeur est inférieure à 780px */
@media screen and (max-width: 779px) {
  #title {
    margin: 40px 0 40px 0;
  }
  body {
    align-items: center;
  }
  .container {
    width: 100%;
    transform: scale(1);
    transition: transform 0.2s ease-in-out;
  }
}
/* Pour écran dont la largeur est inférieure à 420px */
@media screen and (max-width: 419px) {
  .result-container {
    flex: 0;
  }
  .calc-container {
    justify-content: space-evenly;
    margin-top: 0;
    margin-bottom: 0;
  }
  button {
    width: 47%;
  }
}
@media screen and (max-height: 679px) {
  .calc-container {
    margin-top: 10px;
  }
}
