/* ### CUSTOM PROPERTIES ### */

:root {
  /* # PRIMARY # */
  --green-400: hsl(172, 67%, 45%);
  /* # NEUTRAL # */
  --green-900: hsl(183, 100%, 15%);
  --grey-500: hsl(186, 14%, 43%);
  --grey-400: hsl(184, 15%, 56%);
  --grey-200: hsl(185, 41%, 84%);
  --grey-50: hsl(189, 47%, 97%);
  --white: hsl(0, 100%, 100%);
  /* # TYPOGRAPHY # */
  --ff-space-mon: "Space Mono", monospace;
  --fw-700: 700;
}

/* ### CSS RESET ### */

/* 1. Use a more-intuitive box-sizing model */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 2. Remove default margin */
* {
  margin: 0;
  padding: 0;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* ### UTILITY CLASSES ### */

.sr-only:not(:focus):not(:active) {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

button.tip.checked {
  background-color: #26c2ad;
  color: var(--green-900);
}

button.reset-btn.disabled {
  background-color: #0d686d;
  color: #045b62;
}

button.reset-btn.disabled:hover {
  background-color: #0d686d;
  color: #045b62;
  cursor: not-allowed;
}

/* ### GENERAL STYLING ### */

body {
  font-family: var(--ff-space-mon);
  font-weight: var(--fw-700);
  background-color: var(--grey-200);
}

/* ### TIP CALCULATOR COMPONENT ### */

.logo-container {
  margin-top: 3rem;
  margin-inline: auto;
  width: fit-content;
}

.tip-calculator-component {
  margin-top: 2.5rem;
  background-color: var(--white);
  padding: 1.6rem 1.5rem;
  border-radius: 1rem;
  max-width: 900px;
  margin-inline: auto;
  display: grid;
  gap: 1.5rem;
}

.tip-calculator-component button {
  border: none;
}

.tip-calculator__content {
  display: grid;
  gap: 1.2rem;
  padding-inline: 0.5rem;
}

.tip-calculator__content .calc-title {
  color: var(--grey-500);
  font-size: 0.975rem;
  margin-bottom: 0.5rem;
}

.tip-calculator__content input {
  width: 100%;
  border: none;
  background-color: var(--grey-50);
  padding: 0.3rem 0.5rem;
  font-size: 1.4rem;
  text-align: end;
  color: var(--green-900);
  position: relative;
  z-index: 0;
}

.tip-calculator__content input::placeholder {
  color: #9eb5b5;
}

.input-container {
  position: relative;
}

.input-container::before {
  content: "";
  display: block;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 0.8rem;
  background-repeat: no-repeat;
  background-position: center;
  z-index: 2;
}

.bill-container::before {
  width: 11px;
  height: 17px;
  background-image: url(./images/icon-dollar.svg);
}

.num-of-people-container::before {
  width: 13px;
  height: 16px;
  background-image: url(./images/icon-person.svg);
}

.invalid-msg {
  color: #b87f74;
  display: none;
  position: absolute;
  top: -32px;
  right: 0;
}

.tip-calculator__content input,
.tip-calculator__content button {
  border-radius: 0.3rem;
}

.tip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.tip {
  padding: 0.3rem 0.5rem;
  font-size: 1.4rem;
  background-color: var(--green-900);
  color: var(--white);
}

.tip-calculator__display {
  background-color: var(--green-900);
  display: grid;
  gap: 1rem;
  padding: 2rem 1.5rem 1.2rem;
  border-radius: 0.8rem;
}

.tip-amount-container,
.total-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

.tip-amount__text,
.total__text {
  color: var(--grey-200);
  font-size: 0.975rem;
}

.tip-calculator__display .subtitle {
  color: var(--grey-400);
  font-size: 0.9rem;
}

.tip-calculator__display .number-displayed {
  color: var(--green-400);
  font-size: 2.1rem;
}

.tip-calculator__display .reset-btn {
  background-color: var(--green-400);
  color: var(--green-900);
  padding: 0.5rem 1rem;
  text-transform: uppercase;
  border: none;
  border-radius: 0.3rem;
  font-size: 1.185rem;
  letter-spacing: 1px;
}

/* ### ACTIVE STATES ### */

.tip-calculator-component button:hover {
  background-color: #9ee7df;
  cursor: pointer;
  color: var(--green-900);
}

.tip-calculator-component input:hover,
.tip-calculator-component input:active,
.tip-calculator-component input:focus {
  outline: 2px solid #a0dbd7;
  caret-color: #aedfdc;
  cursor: pointer;
}

/* ### MEDIA QUERIES ### */

@media (min-width: 40em) {
  body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .tip-calculator-component {
    padding: 1.8rem 1.8rem 1.8rem 2.2rem;
    margin-top: 3.5rem;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    box-shadow: 0px 10px 18px rgba(28, 56, 40, 0.25);
  }

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

  .tip-calculator__content {
    gap: 2.5rem;
  }

  .tip-calculator__display {
    align-items: start;
    grid-template-rows: auto auto 1fr;
    padding: 1.8rem;
  }

  .tip-calculator__display .number-displayed {
    font-size: 2.6rem;
  }

  .total-container {
    margin-top: 1.5rem;
  }

  .reset-btn {
    align-self: end;
  }
}
