/* General styles */

html {
  scroll-behavior: smooth;
  font-size: 20px;

  @media (max-width: 768px) {
    font-size: 18px;
  }
}

main {
  margin-bottom: $spacing-06;
}

h2, h3, h4, h5, h6 {
  margin: $spacing-04 0 $spacing-03 0;
  line-height: 1.05;
  font-weight: 400;
  scroll-margin-top: 60px;

  &:first-child {
    margin-top: 0;
  }
}

h1 {
  margin: $spacing-04 0;
  font-weight: 700;
  line-height: 1.05;
  scroll-margin-top: 600px;
  @include typescale-01;
  @include font-serif;
}

h2 {
  @include typescale-02;
}

h3 {
  @include typescale-03;
}

h4 {
  @include typescale-04;
}

h5 {
  @include typescale-05;
}

h6 {
  @include typescale-06;
}

ul, ol {
  padding-left: $spacing-04;

  ul, ol {
    margin-left: $spacing-03;
  }

  li {
    line-height: 1.5;
  }
}

dl {
  margin: 0 0 $spacing-03 0;

  dt {
    color: $dark-grey;
    @include typescale-06;

    &:not(:first-child) {
      margin-top: $spacing-03;
    }
  }

  dd {
    margin: 0;
  }
}

p, blockquote, ul, ol {
  margin: 0 0 $spacing-04 0;

  &:last-child {
    margin-bottom: 0;
  }
}

pre, code {
  @include font-monospace;
  @include typescale-06;
  background: $light-grey;
}

pre {
  padding: $spacing-02;
}

strong, b {
  font-weight: 600;
}

a {
  text-decoration: underline;
  color: $warm-black;
  overflow-wrap: break-word;
  word-wrap: break-word;

  &:hover,
  &:focus,
  &:active {
    color: $grapefruit;
    text-decoration: none;
  }
}

section {
  padding: $spacing-04 0;
}

blockquote {
  padding-left: 1.5em;
  border-left: 1px solid $sanguine;
  font-style: italic;

  em, i {
    font-style: normal;
  }
}

hr {
  margin: $spacing-05 0;
  border: 0;
  height: 1px;
  background-color: rgba($dark-grey, 0.5);
}

img {
  height: auto;
  max-width: 100%;
}

iframe {
  padding: $spacing-02;
  width: 100%;
  border: 0;
  border-radius: $spacing-02;
  @include box-shadow;
}

table {
  margin-bottom: $spacing-04;
  width: 100%;

  thead {
    text-align: left;
    color: $dark-grey;
    @include typescale-06;
  }

  tr {
    border-bottom: 1px solid rgba($dark-grey, 0.25);

    &:last-child {
      border: 0;
    }
  }

  th, td {
    vertical-align: top;
    padding: $spacing-03;

    &:first-child {
      padding-left: 0;
    }

    &.long_content {
      word-wrap: break-word;
    }
  }

  th {
    text-align: left;
    font-weight: 400;
    color: $dark-grey;
  }

  td:last-child {
    width: 50%;
  }
}

::placeholder {
  font-style: italic;
  color: rgba($dark-grey, 0.5);
}
/* Aside */

aside {
  h2 {
    @include typescale-03;
  }

  h2 {
    @include typescale-04;
  }

  form {
    margin-bottom: 0;
  }
}

/* Forms */

form {
  margin-bottom: $spacing-04;

  label, p {
    display: block;
    margin: 0 0 $spacing-03 0;

    small, a {
      color: $dark-grey;
    }
  }
}

input, select, button, textarea {
  -webkit-appearance: none;
  -moz-appearance: none;
  border-radius: 0;

  display: inline-block;
  padding: 0.5em;
  background-color: $white;
  border: 1px solid $warm-black;
  font-size: smaller;
  @include font-sans;
}

textarea {
  resize: vertical;
}

select {
  padding-right: 30px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  -webkit-border-radius: 0;
  border-radius: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-chevron-down'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: 1em;
  background-position: calc(100% - 0.5em) center;
  background-repeat: no-repeat;
}

/* Custom radio buttons & checkboxes */

input[type="checkbox"],
input[type="radio"] {
  position: absolute;

  opacity: 0;
  width: 0.8em;
  height: 0.8em;
  pointer-events: none;
  //margin-left: -0.8rem;

  &:focus  + label {
    outline: solid 2px $warm-black;
    outline-offset: 1px;
  }

  &:focus:not(:focus-visible){
    outline: none;
  }


  + label {
    margin: 0 0 $spacing-03 0;
    line-height: 1;
    color: $dark-grey;
    font-size: 1rem;
  }

  + label::before {
    content: '\a0';
    display: inline-block;
    margin: 0 $spacing-02 0 0;
    width: 0.8em;
    height: 0.8em;
    line-height: 0.75em;
    transition: all 0.35s;
    border: 1px solid $warm-black;
  }

  &:checked + label {
    color: $sanguine;

    &::before {
      content: '\a0';
      background: $sanguine;
      border: 1px solid $white;
      box-shadow: inset 0 0 0 1px $white, 0 0 0 1px $sanguine;
    }
  }
}

input[type="radio"] + label {
  display: inline-block;
  margin: 0 $spacing-04 $spacing-03 0;

  &::before {
    border-radius: 50%;
  }
}

fieldset {
  padding: 0;
  margin: 0 0 $spacing-04 0;
  border: 0;
  min-width: 0;
}

/* Feather icons */

.feather {
  height: 1em;
  width: auto;
}
