/* --------------------------- */
/* Custom properties           */
/* --------------------------- */

:root {
  /* colors */
  --clr-dark-green: 183 100% 15%;
  --clr-light-green: 172 67% 45%;
  --clr-grey-500: 186 14% 43%;
  --clr-grey-400: 184 14% 56%;
  --clr-grey-200: 185 41% 84%;
  --clr-grey-50: 189 47% 97%;
  --clr-white: 0 100% 100%;

  /* font-sizes */
  --fs-large: 2.5rem;
  --fs-medium-l: 2rem;
  --fs-medium: 1.5rem;
  --fs-small: 1.25rem;
  --fs-xsmall: 1rem;
  --fs-body: 0.875rem;
  --fs-s-body: 0.75rem;

  /* font-families */
  --ff-spaceMono: "Space Mono", monospace;

  /* font-weight */
  --fw-400: 400;
  --fw-700: 700;
}

/* --------------------------- */
/* Font                        */
/* --------------------------- */

@font-face {
  font-display: swap;
  font-family: 'Space Mono';
  font-weight: 400;
  src: url('./fonts/SpaceMono-Regular.ttf') format('truetype');
}

@font-face {
  font-display: swap;
  font-family: 'Space Mono';
  font-weight: 700;
  src: url('./fonts/SpaceMono-Bold.ttf') format('truetype');
}

/* --------------------------- */
/* Reset                       */
/* --------------------------- */

/* https://piccalil.li/blog/a-modern-css-reset/ */

/* Box sizing */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Reset margins */
body,
h1,
h2,
h3,
h4,
h5,
p,
figure,
picture {
  margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
    font-weight: var(--fw-400);
}

/* set up the body */
body {
  display: flex;
  font-family: var(--ff-spaceMono);
  font-size: var(--fs-s-body);
  font-weight: var(--fw-700);
  color: hsl(var(--clr-grey-500));
  background-color: hsl(var(--clr-grey-200));
  line-height: 1.5;
  letter-spacing: 1px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* make images easier to work with */
img,
picture {
  max-width: 100%;
  display: block;
}

/* make form elements easier to work with */
input,
button,
textarea,
select {
  font: inherit;
}

/* remove animations for people who've turned them off */
@media (prefers-reduced-motion: reduce) {  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------- */
/* Utility classes              */
/* --------------------------- */

.flex {
  display: flex;
  gap: var(--gap, 1rem);
}

/* screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap; /* added line */
  border: 0;
}

.uppercase { text-transform: uppercase; }

/* --------------------------- */
/* Compontents                 */
/* --------------------------- */
.container {
  flex-direction: column;
  gap: 2.5rem;
}

.tip-calculator-logo {
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding-block-start: 2.5rem;
}

.form-container {
  flex-direction: column;
  flex: 1;
  gap: 1.5rem;
  background-color: hsl(var(--clr-white));
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 1.8rem;
}

.inputs-sections {
  flex-direction: column;
  gap: 1rem;
}

.labels {
  flex-direction: row;
  justify-content: space-between;
}

.error-msg {
  color: orange;
}

.error-border-bill,
.error-border-tip,
.error-border-people {
  outline: none;
  box-shadow: inset 0 0 0 2px orange;
}

.bill-section {
  flex-direction: column;
  gap: 0.25rem;
}

.bill-input,
.error-border-bill,
.tip-input,
.error-border-tip,
.number-of-people-input,
.error-border-people {
  background-color: hsl(var(--clr-grey-50));
  color: hsl(var(--clr-dark-green));
  font-size: var(--fs-small);
  text-align: end;
  border-radius: 5px;
  border: none;
  padding-block: .25rem;
  padding-inline: 1rem;
  cursor: pointer;
}

.bill-input,
.error-border-bill {
  background-image: url("./images/icon-dollar.svg");
  background-repeat: no-repeat;
  background-position: left 1rem center;
}
/* background-position: x y; */

.bill-input:hover,
.tip-input:hover,
.number-of-people-input:hover,
.bill-input:focus,
.tip-input:focus,
.number-of-people-input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px hsl(var(--clr-light-green));
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
} 
input[type="number"] {
  -moz-appearance: textfield;
}

.tip-section {
  flex-direction: column;
  gap: .25rem;
}

.tip-choice-section {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  border: none;
  padding: 0;
  margin: 0;
}

.tip-btn {
  background-color: hsl(var(--clr-dark-green));
  color: hsl(var(--clr-white));
  font-size: var(--fs-small);
  text-align: center;
  max-width: 100%;
  border-radius: 5px;
  border: none;
  padding-inline: 1rem;
  padding-block: .25rem;
  cursor: pointer;
  transition: background-color 200ms ease, color 300ms ease;
}

.tip-btn input {
  display: none;
}

.tip-btn[aria-checked="true"] {
  background-color: hsl(var(--clr-light-green));
  color: hsl(var(--clr-dark-green));
}

.tip-btn:hover,
.tip-btn:focus,
.tip-btn[aria-checked="true"]:focus,
.tip-btn[aria-checked="true"]:hover {
  outline: none;
  background-color: hsl(168 60% 80%);
  color: hsl(var(--clr-dark-green));
}

.tip-input,
.error-border-tip {
  display: block;
  width: 100%;
}

.number-of-people-section {
  flex-direction: column;
  gap: .25rem;
}

.number-of-people-input,
.error-border-people {
  background-image: url("./images/icon-person.svg");
  background-repeat: no-repeat;
  background-position: left 1rem center;
}

.results-section {
  background-color: hsl(var(--clr-dark-green));
  flex-direction: column;
  padding: 1rem;
  border: none;
  border-radius: 10px;
  gap: 1.5rem;
}

.results-list {
  flex-direction: column;
  margin: 0;
  gap: 1rem;
}

.results-tip-section,
.results-total-section {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.results-data {
  flex-direction: column;
  gap: .5rem;
}

.results-section dt {
  color: hsl(var(--clr-white));
}

.results-section dd {
  margin: 0;
}

.per-person-dd {
  font-size: var(--fs-s-body);
}

.tip-dd,
.total-dd {
  color: hsl(var(--clr-light-green));
  font-size: var(--fs-medium);
}

.reset-btn {
  background-color: hsl(var(--clr-light-green)/0.20);
  color: hsl(var(--clr-dark-green));
  font-size: var(--fs-small);
  border-radius: 5px;
  border: none;
  padding-block: .25rem;
  transition: background-color 200ms ease;
}

.reset-btn:not(:disabled) {
  outline: none;
  background-color: hsl(var(--clr-light-green));
  cursor: pointer;
}

.reset-btn:not(:disabled):hover,
.reset-btn:not(:disabled):focus {
  background-color: hsl(168 60% 70%);
}

@media (min-width: 32rem) {
  .form-container {
    margin-inline: auto;
    margin-bottom: 3rem;
    width: min(400px, 100%);
    border-radius: 20px;
  }
}

@media (min-width: 50rem) {
  body {
    justify-content: center;
    align-items: center;
  }

  .container {
    gap: 4rem;
  }

  .tip-calculator-logo {
    padding-block-start: 0;
  }

  .form-container {
    flex-direction: row;
    align-items: stretch;
    margin: auto;
    width: 750px;
    padding: 2rem;
  }

  .form-container > div {
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  .inputs-sections {
    flex: 1;
    gap: 2.5rem;
  }

  .results-section {
    flex: 1;
    justify-content: space-between;
    padding: 2rem;
    gap: 4rem;
  }

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

  .tip-input {
    padding-inline: .4rem;
  }

  .results-list {
    gap: 2.5rem
  }

  .tip-dd,
  .total-dd {
    font-size: var(--fs-medium-l);
  }
}