@import url("https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap");

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

.visually-hidden {
  position: absolute;
  width: 0;
  height: 0;
  padding: 0;
  margin: 0;
  border: none;
  overflow: hidden;
  white-space: nowrap;
}

:root {
  --clr-green-200: hsl(173, 61%, 77%);
  --clr-green-400: hsl(172, 67%, 45%);
  --clr-green-750: hsl(183, 79%, 24%);
  --clr-green-900: hsl(183, 100%, 15%);
  --clr-grey-500: hsl(186, 14%, 43%);
  --clr-grey-400: hsl(184, 14%, 56%);
  --clr-grey-300: hsl(184, 19%, 68%);
  --clr-grey-200: hsl(185, 41%, 84%);
  --clr-grey-50: hsl(189, 47%, 97%);
  --clr-white: hsl(0, 100%, 100%);
  --clr-orange-400: hsl(13, 70%, 60%);

  --ff-space-mono: "Space Mono", monospace;

  --fs-48: 3rem;
  --fs-32: 2rem;
  --fs-24: 1.5rem;
  --fs-20: 1.25rem;
  --fs-16: 1rem;
  --fs-13: 0.8125rem;

  --pd-80: 5rem;
  --pd-48: 3rem;
  --pd-32: 2rem;
  --pd-24: 1.5rem;
  --pd-16: 1rem;
  --pd-8: 0.5rem;

  --gap-80: 5rem;
  --gap-40: 2.5rem;
  --gap-32: 2rem;
  --gap-24: 1.5rem;
  --gap-16: 1rem;
  --gap-8: 0.5rem;
}

header {
  display: flex;
  padding: var(--pd-32);
  justify-content: center;
}

body {
  background-color: var(--clr-grey-200);
  font-family: var(--ff-space-mono);
  min-width: 15.625rem;
}

.main {
  background-color: var(--clr-white);
  padding: var(--pd-32) var(--pd-24);
  border-radius: 15px 15px 0 0;
  margin: 2rem 0;
}

.form {
  display: flex;
  flex-direction: column;
  gap: var(--gap-32);
}

.form__bills {
  display: flex;
  flex-direction: column;
  gap: var(--gap-32);
}

.bills__bill {
  display: flex;
  flex-direction: column;
  gap: var(--gap-8);
}

h2 {
  color: var(--clr-grey-500);
  font-size: var(--fs-16);
  font-weight: 600;
}

.bill__amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--pd-8) var(--pd-16);
  background-color: var(--clr-grey-50);
  border-radius: 10px;
  cursor: pointer;
}

.bill__amount:hover {
  border: 2px solid var(--clr-green-400);
}

.amount__input {
  width: 100%;
  border: transparent;
  text-align: right;
  background-color: var(--clr-grey-50);
  font-family: var(--ff-space-mono);
  font-size: var(--fs-24);
  color: var(--clr-green-900);
  font-weight: 700;
  outline: transparent;
}

.amount__input::placeholder {
  color: var(--clr-grey-300);
  font-weight: 700;
}

.bill__amount:has(.amount__input:invalid:not(:placeholder-shown)) {
  border: 2px solid var(--clr-orange-400);
}

.bills__select-tip {
  display: flex;
  flex-direction: column;
  gap: var(--gap-8);
}

.select-tip__options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.25rem, 1fr));
  gap: var(--gap-16);
}

.options__btn {
  height: 3rem;
  font-size: var(--fs-24);
  font-weight: 700;
  color: var(--clr-white);
  background-color: var(--clr-green-900);
  border: none;
  border-radius: 10px;
  padding: var(--pd-8);
  cursor: pointer;
}

.options__btn:hover,
.active {
  background: var(--clr-green-200);
  color: var(--clr-green-900);
}

.options__custom {
  width: 100%;
  border: none;
  outline: none;
  background: var(--clr-grey-50);
  font-size: var(--fs-24);
  font-weight: 700;
  color: var(--clr-green-900);
  padding: var(--pd-8) var(--pd-16);
  border-radius: 10px;
}

.options__custom:hover {
  border: 2px solid var(--clr-green-400);
}

.options__custom::placeholder {
  color: var(--clr-grey-500);
}

.options__custom:invalid:not(:placeholder-shown) {
  border: 2px solid var(--clr-orange-400);
}

.bills__number-people {
  display: flex;
  flex-direction: column;
  gap: var(--gap-8);
}

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

.block__error {
  font-size: var(--fs-16);
  font-weight: 700;
  color: var(--clr-orange-400);
}

.hide-error {
  display: none;
}

.people__number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--clr-grey-50);
  padding: var(--pd-8) var(--pd-16);
  background-color: var(--clr-grey-50);
  border-radius: 10px;
  cursor: pointer;
}

.people__number:hover {
  border: 2px solid var(--clr-green-400);
}

.number__input-people {
  width: 100%;
  background-color: var(--clr-grey-50);
  border: transparent;
  text-align: right;
  font-family: var(--ff-space-mono);
  font-size: var(--fs-24);
  font-weight: 700;
  outline: transparent;
  color: var(--clr-green-900);
}

.number__input-people::placeholder {
  color: var(--clr-grey-300);
  font-weight: 700;
}

.people__number:has(.number__input-people:invalid:not(:placeholder-shown)) {
  border: 2px solid var(--clr-orange-400);
}

.form__result {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--gap-32);
  background-color: var(--clr-green-900);
  padding: var(--pd-24);
  color: var(--clr-white);
  border-radius: 15px;
}

.amount-container {
  display: flex;
  flex-direction: column;
  gap: var(--gap-24);
}

.result__tip-amount,
.result__total-amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.label__title {
  font-size: var(--fs-16);
  font-weight: bold;
}

.label__amount {
  font-size: var(--fs-13);
  font-weight: bold;
  color: var(--clr-grey-400);
}

.dollars {
  font-size: var(--fs-32);
  font-weight: bold;
  color: var(--clr-green-400);
}

.reset-btn {
  padding: var(--pd-8) var(--pd-32);
  cursor: pointer;
  font-family: var(--ff-space-mono);
  font-size: var(--fs-20);
  font-weight: bold;
  text-transform: uppercase;
  background-color: var(--clr-green-400);
  border: transparent;
  border-radius: 10px;
}

.reset-btn:hover {
  background: var(--clr-green-200);
}

.reset-disabled {
  cursor: not-allowed;
  background-color: var(--clr-green-750);
}

.reset-disabled:hover {
  background-color: var(--clr-green-750);
}

.attribution {
  font-size: 11px;
  text-align: center;
  margin-bottom: 1rem;
}
.attribution a {
  color: hsl(228, 45%, 44%);
}

@media (min-width: 42.5rem) {
  body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .main {
    display: flex;
    justify-content: center;
    gap: var(--gap-80);
    min-width: 38rem;
    border-radius: 15px;
    padding: var(--pd-48);
  }

  .form {
    width: 100%;
    gap: var(--gap-40);
  }
}

@media (min-width: 77.5rem) {
  .main {
    min-width: 57.5rem;
    padding: var(--pd-48) var(--pd-32);
  }
  .form {
    flex-direction: row;
  }
  .form__bills {
    width: 60%;
  }

  .form__result {
    width: 40%;
  }
}
