@import "./normalize";
@import "./icons.scss";

@font-face {
  font-family: IBMPlex;
  src: url(./assets/IBMPlexSans-Regular.ttf);
}

body {
  margin: 0;
  padding: 0;
  font-family: "IBMPlex", sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
}

h1,
h2 {
  font-family: "IBMPlex", sans-serif;
}

h1 {
  font-size: $heading-large;
  margin-bottom: $spacing-large;
  line-height: 1.6;
}

h2 {
  font-size: $heading-medium;
  margin-bottom: $spacing-medium;
  line-height: 1.6;
}

p {
  font-size: $font-medium;
  line-height: 1.6;
  &.small {
    font-size: $font-small;
  }
}

a {
  text-decoration: underline;
  color: $secondary;
  font-size: $font-medium;
}

label {
  font-size: $font-medium;
  line-height: 1.6;
  font-weight: bold;
  color: $primary;
}

input {
  font-size: $font-medium;
  background-color: $white;
  min-width: 0;

  text-align: center;

  &[type="number"] {
    -moz-appearance: textfield;
    letter-spacing: $spacing-x-small;
    border: none;
    border-bottom: solid $border-small $black;
    background: $white;
    &::-webkit-outer-spin-button {
      margin: 0;
      appearance: none;
    }
    &::-webkit-outer-spin-button {
      margin: 0;
      appearance: none;
    }
  }

  &[type="checkbox"] {
    // check https://css-tricks.com/custom-styling-form-inputs-with-modern-css-features/
    // to understand how this switch is created
    --active: #{$primary};
    --active-inner: #{$white};
    --focus: 2px rgba(#{primary}, 0.9);
    --border: #{$primary};
    --border-hover: #{$primary};
    --background: #{$white};
    -webkit-appearance: none;
    -moz-appearance: none;
    height: 1.8rem;
    width: 3rem;
    outline: none;
    display: inline-block;
    vertical-align: top;
    position: relative;
    margin: 0;
    cursor: pointer;
    border: 1px solid var(--bc, var(--border));
    background: var(--b, var(--background));
    transition: background 0.3s, border-color 0.3s, box-shadow 0.2s;

    &:after {
      content: "";
      display: block;
      left: 0;
      top: 0;
      position: absolute;
      transition: transform var(--d-t, 0.3s) var(--d-t-e, ease),
        opacity var(--d-o, 0.2s);
    }
    &:checked {
      --b: var(--active);
      --bc: var(--active);
      --d-o: 0.3s;
      --d-t: 0.6s;
      --d-t-e: cubic-bezier(0.2, 0.85, 0.32, 1.2);
    }
    &:disabled {
      --b: var(--disabled);
      cursor: not-allowed;
      opacity: 0.9;
      &:checked {
        --b: var(--disabled-inner);
        --bc: var(--border);
      }
      & + label {
        cursor: not-allowed;
      }
    }
    &:hover {
      &:not(:checked) {
        &:not(:disabled) {
          --bc: var(--border-hover);
        }
      }
    }
    &:focus {
      box-shadow: 0 0 0 var(--focus);
    }
    &:not(.switch) {
      width: 2rem;
      &:after {
        opacity: var(--o, 0);
      }
      &:checked {
        --o: 1;
      }
    }
    & + label {
      font-size: 14px;
      line-height: 21px;
      display: inline-block;
      vertical-align: top;
      cursor: pointer;
      margin-left: 4px;
    }
    &:not(.switch) {
      border-radius: 7px;
      &:after {
        width: 5px;
        height: 9px;
        border: 2px solid var(--active-inner);
        border-top: 0;
        border-left: 0;
        left: 11px;
        top: 6px;
        transform: rotate(43deg);
      }
    }
    &.switch {
      width: 38px;
      border-radius: 11px;
      &:after {
        left: 2px;
        top: 6px;
        border-radius: 50%;
        width: 15px;
        height: 15px;
        background: var(--ab, var(--border));
        transform: translateX(var(--x, 0));
      }
      &:checked {
        --ab: var(--active-inner);
        --x: 17px;
      }
      &:disabled {
        &:not(:checked) {
          &:after {
            opacity: 0.6;
          }
        }
      }
    }
  }
}

// MARKDOWN

section {
  margin-top: $spacing-large;
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  & ul {
    padding-left: $spacing-medium;
    padding-top: $spacing-medium;
    padding-bottom: $spacing-medium;

    & li {
      list-style-type: disc;
      line-height: 1.6;
    }
  }

  & code {
    background: $background;
    padding: 0 $spacing-small;
    border-radius: $spacing-x-small;
  }
}
