@use 'mixins';

/*
 * Modern CSS Reset
 * Based on Josh W. Comeau's reset with custom additions
 */

$input-placeholder-color: var(--input--placeholder--color, #c1c1c1);

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

*,
*::before,
*::after {
  box-sizing: inherit;
  border-width: 0;
  border-style: solid;
}

/* 2. Remove default margin */
*:not(dialog) {
  margin: 0;
}

/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

/* 4. Add accessible line-height and improve text rendering */
body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 5. Improve media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  vertical-align: middle;
  max-width: 100%;
}

img {
  border: none;
  height: auto;
}

video {
  outline: none;
}

/* 6. Inherit fonts for form controls */
input,
button,
textarea,
select {
  font: inherit;
}

/* 7. Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* 8. Improve line wrapping */
p {
  text-wrap: pretty;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

/* ========================================
 * Custom additions
 * ======================================== */

/* Lists */
ul,
ol {
  list-style: none;
  padding: 0;
}

li {
  list-style: inherit;
}

/* Input & Textarea */
input {
  vertical-align: middle;
  min-width: 0;

  &::placeholder {
    color: $input-placeholder-color;
  }

  &:-webkit-autofill,
  &:-webkit-autofill:hover,
  &:-webkit-autofill:focus {
    -webkit-background-clip: text;
  }

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

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

textarea {
  vertical-align: top;
  resize: vertical;
  @include mixins.scrollbar;

  &::placeholder {
    color: $input-placeholder-color;
  }
}

input:focus,
textarea:focus {
  outline: none;
}

/* Button */
button,
input[type='submit'] {
  cursor: pointer;
  -webkit-appearance: none;
  background-color: transparent;
  padding: 0;
  text-align: left;
  color: inherit;

  &:focus {
    outline: none;
  }

  &:disabled {
    cursor: default;
  }
}

/* Details/Summary */
details {
  summary {
    list-style: none;

    &::-webkit-details-marker {
      display: none;
    }
  }

  > * {
    box-sizing: border-box;
  }
}

/* Links */
a {
  color: inherit;
  text-decoration: none;
  transition: color linear 0.2s;
}

/* Table */
table {
  border-collapse: collapse;
}
