:root {
  /* Colors */

  --Green-900: hsl(183, 100%, 15%);
  --Green-750: hsl(183, 79%, 24%);
  --Green-400: hsl(172, 67%, 45%);
  --Green-200: hsl(173, 61%, 77%);
  --Grey-600: hsl(180, 25%, 32%);
  --Grey-500: hsl(186, 14%, 43%);
  --Grey-400: hsl(184, 14%, 56%);
  --Grey-300: hsl(184, 19%, 68%);
  --Grey-200: hsl(185, 41%, 84%);
  --Grey-50: hsl(189, 47%, 97%);
  --Orange: hsl(13, 70%, 60%);
  --White: hsl(0, 100%, 100%);

  /* Typography */

  --ff-primary: "Space Mono", monospace;
  --text-preset-1: 500 2rem / 2.96 var(--ff-primary);
  --text-preset-1-letter-spacing: -1px;
  --text-preset-2: 700 1.5rem / 1.96 var(--ff-primary);
  --text-preset-2-letter-spacing: 0.67px;
  --text-preset-3: 700 1rem / 1.5 var(--ff-primary);
  --text-preset-4: 500 0.8rem / 1.25 var(--ff-primary);
  --text-preset-5: 700 0.7rem / 1 var(--ff-primary);
  --text-preset-6: 700 0.5rem / 0.8 var(--ff-primary);
}

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

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

html {
  font-family: var(--ff-primary);
  font-size: 24px;
}

body {
  min-height: 100vh;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--Grey-200);
}

#logo {
  margin: 2rem auto;
  display: block;
}

.main-container {
  background-color: white;
  border-radius: 20px 20px 0 0;
  min-height: 100%;
  padding-block: 1.5rem;
  padding-inline: 1rem;
}

section > label,
legend,
h2,
.error {
  font: var(--text-preset-5);
  color: var(--Grey-500);
}

h2 {
  color: var(--Grey-50);
}

#section-bill {
  display: flex;
  flex-direction: column;
}

.input-container {
  position: relative;
}

.input-container > input,
.people-container > input {
  width: 100%;
  min-height: 50px;
  padding-inline: 0.6rem;
  display: flex;
  border: none;
  border-radius: 5px;
  background-color: var(--Grey-50);
  text-align: right;
  font-size: 1rem;
  font-weight: 700;
  color: var(--Green-900);
}

/* Remove spinner for Chrome, Safari, Edge, and Opera */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.people-container {
  position: relative;
}

#bill::placeholder,
#people::placeholder {
  font: var(--text-preset-3);
  color: var(--Grey-300);

  position: absolute;
  right: 1rem;
  bottom: 50%;
  transform: translateY(50%);
}

#bill,
#people {
  margin-top: 0.4rem;
}

.input-container > img,
.people-container > img {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.input-container > img {
  padding-top: 12px;
}

.person {
  font: var(--text-preset-6);
  color: var(--Grey-400);
}

fieldset {
  border: none;
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

#section-tip {
  padding-inline: 0;
}

legend {
  margin-bottom: 0.4rem;
}

fieldset > label {
  background-color: var(--Green-900);
  border-radius: 5px;
  height: 48px;

  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

#custom-tip {
  background-color: white;
  height: 48px;
  width: 100%;
  border: none;
  padding-top: 1px;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--Green-900);
}

#custom-tip::placeholder {
  font: var(--text-preset-3);
  text-align: center;
}

input[type="radio"] {
  display: none;
}

#section-people {
  position: relative;
}

.error {
  color: var(--Orange);
  padding-left: 0.5rem;
  position: absolute;
  right: 0;
  top: 5%;
  display: none;
}

#section-total {
  background-color: var(--Green-900);
  border-radius: 15px;
  padding: 1rem;
  margin-block: 1.5rem;
}

#total-amount,
#tip-amount {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  font: var(--text-preset-5);
}

#total-amount {
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

span {
  font: var(--text-preset-6);
  color: var(--Grey-400);
  margin-top: 0.3rem;
}

.tip-dollar-amount,
.total-dollar-amount {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--Green-400);
}

#reset {
  width: 100%;
  height: 48px;
  background-color: var(--Green-750);
  border: none;
  border-radius: 5px;
  color: var(--Green-900);
  text-transform: uppercase;
  font: var(--text-preset-4);
  cursor: not-allowed;
}

/* Active states */

#reset.reset-active {
  background-color: var(--Green-400);
  color: var(--Green-900);
  cursor: pointer;
}

.input-container > input:hover,
.people-container > input:hover,
.input-container > input:focus,
.people-container > input:focus {
  cursor: pointer;
  border: 2px solid var(--Green-400);
  outline: none;
}

#custom-tip:hover,
#custom-tip:focus {
  cursor: pointer;
  border: 2px solid var(--Green-400);
  outline: none;
  border-radius: 5px;
}

fieldset > label:hover,
fieldset > label:focus {
  cursor: pointer;
  background-color: var(--Green-400);
  color: var(--Green-900);
}

@media screen and (min-width: 768px) and (max-width: 1024px) {
  .main-container {
    padding-inline: 3.15rem;
    padding-block: 2.25rem;
    max-width: 610px;
    max-height: 800px;
    border-radius: 20px;
  }

  fieldset {
    grid-template-columns: repeat(3, 1fr);
  }

  #section-total {
    padding-block: 1.8rem;
    padding-inline: 2rem;
  }
}

@media screen and (min-width: 1025px) {
  .main-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    max-width: 920px;
    height: 481px;
    padding: 1.5rem;
    border-radius: 20px;
    gap: 2rem;
  }

  #section-total {
    width: 415px;
    height: 100%;
    padding: 2rem;
    border-radius: 15px;
    margin-block: 0;
    display: flex;
    flex-direction: column;
  }

  .keyboard {
    max-width: 380px;
  }

  #section-bill,
  #section-tip,
  #section-people {
    width: 100%;
  }

  fieldset {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
  }

  button {
    margin-top: auto;
  }

  .tip-dollar-amount,
  .total-dollar-amount {
    font: var(--text-preset-1);
  }

  #total-amount {
    margin-bottom: 0;
    margin-top: -2rem;
  }

  #tip-amount {
    margin-top: -1.5rem;
  }
}
