:root {
  --purple: hsl(259, 100%, 65%);
  --light-red: hsl(0, 100%, 67%);
  --off-white: hsl(0, 0%, 94%);
  --light-grey: hsl(0, 0%, 86%);
  --smokey-grey: hsl(0, 1%, 44%);
  --off-black: hsl(0, 0%, 8%);
}

html {
  height: 100%;
  margin: 0;
}

body {
  height: 100%;
  margin: 0;
  background-color: var(--off-white);
  font-family: 'Poppins', sans-serif;
}

img {
  max-width: 100%;
  max-height: 100%;
  user-select: none;
}

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

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

main {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

input {
  display: block;
  padding: 10px 20px;
  max-width: 160px;
  width: 100%;
  color: var(--grey);
  border: 1px solid var(--light-grey);
  border-radius: 8px;
  font-size: 32px;
  font-weight: 700;
  box-sizing: border-box;

  &:hover, &:focus {
    border: 1px solid var(--purple);
  }
}

.wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
  z-index: 1;
  padding: 20px;
}

.panel {
  display: flex;
  flex-direction: column;
  background-color: white;
  max-width: 780px;
  width: 100%;
  box-sizing: border-box;
  border-radius: 20px 20px 160px;
  padding: 50px;
}

#my-form {
  display: flex;
  flex-direction: column;
  justify-content: stretch;
}

.form-fields {
  display: flex;
  gap: 30px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 10px;

  & label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--smokey-grey);
  }
}

.form-border {
  position: relative;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;

  &::before {
    content: '';
    position: absolute;
    right: 0;
    left: 0;
    height: 1px;
    width: 100%;
    background-color: var(--light-grey);
    top: 50%;
  }

  & button {
    position: relative;
    background-color: var(--purple);
    border-radius: 50%;
    padding: 16px;
    cursor: pointer;
    border: none;
    transition: background-color 200ms;

    &:hover {
      background-color: var(--off-black);
    }
  }
}

.form-error {
  font-size: 14px;
  font-style: italic;
  color: var(--light-red);
}

.invalid-state {
  & input {
    border: 1px solid var(--light-red);
  }

  & label {
    color: var(--light-red) !important;
  }
}

.result {
  display: flex;
  flex-direction: column;
  font-size: 80px;
  font-weight: 800;
  font-style: italic;
  line-height: 1.2;
}

.output {
  color: var(--purple);
}

.attribution {
  position: fixed;
  bottom: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;

  & span {
    color: var(--grey);
    font-size: 12px;
    font-weight: 400;
  }

  & a {
    color: var(--off-black);
    font-size: 12px;
    font-weight: 400;
  }
}

@media screen and (width < 600px) {
  input {
    font-size: 16px;
    padding: 16px 20px;
  }

  .panel {
    padding: 50px 20px;
  }

  .form-fields {
    gap: 12px;
    justify-content: space-between;
  }

  .form-field {
    flex: 1;
  }

  .form-border {
    justify-content: center;
    margin: 20px 0;

    & button {
      padding: 10px;
    }
  }

  .result {
    font-size: 50px;
  }

  .attribution {
    display: none;
  }
}
