$purple: #424969;
$orange: #ffac5f;
$blonde: #f5ddbc;
$light-purple: #faf0fa;
$yugo: #ea8472;

$header: $orange;
$header-height: 50px;

$max-width: 95ch;

.mathpar, .math-paragraph {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: center;
}

a#mastodon {
  display: none;
}

html, body {
  min-height: 100%;
  height: 100%;
  margin: 0;

  background-color: white;

  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
}

body {
  display: flex;
  flex-direction: column;

  counter-reset: theorem figure;
}

div#header {
  background-color: $header;
  height: $header-height;

  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: space-between;

  flex-wrap: nowrap;
  overflow-x: auto;

  div#logo {
    margin-left: .5em;
    line-height: $header-height;

    padding-left: .5em;
    padding-right: .5em;
    font-size: 18pt;

    a {
      color: $purple;
      text-decoration: none;
    }

    transition: background-color .2s ease-in-out;
  }

  div#logo:hover {
    background-color: darken($header, 10%);
  }

  div#navigation {
    margin-right: .5em;

    display: flex;
    flex-direction: row;
    align-items: stretch;
    align-self: flex-end;
    justify-content: flex-end;

    line-height: $header-height;

    a {
      color: $purple;
      text-decoration: none;

      margin-left: .5em;
      margin-right: .5em;
    }

    div.nav-button {
      height: 100%;
      transition: background-color .2s ease-in-out;
    }

    div.nav-button:hover {
      background-color: darken($header, 10%);
    }
  }

}

div#content {
  max-width: $max-width;
  margin: 0px auto 0px auto;
  flex: 1 0 auto;

  span.katex, span.together {
    display: inline-block;
  }

  p {
    text-align: justify;
    letter-spacing: 1.75;

    code {
      display: inline-block;
    }

    span.qed {
      float: right;
    }

    span.theorem ::after {
      counter-increment: theorem;
      content: " " counter(theorem);
    }

    span.theorem, span.paragraph-marker {
      font-style: italic;
    }
  }

  p.image {
    text-align: center !important;
  }

  h1 {
    font-variant: small-caps;
    max-width: 120ch;
  }

  blockquote {
    background-color: $light-purple;

    border-radius: 10px;
    border: 1px solid $purple;

    padding: 0em 1em;
  }

  > article > blockquote {
    width: 80%;
    margin: auto;
  }

  > article > div.code-container {
    width: 80%;
    margin: auto;

    pre {
      padding: 0px 1em;
    }

    > span {
      display: inline;
    }
  }

  div.code-container {
    background-color: $light-purple;

    border-radius: 10px;
    border: 1px solid darken($light-purple, 10%);

    overflow-x: auto;

    > span {
      padding: 0.5em 1em 0.25em 1em;
      background-color: darken($light-purple, 10%);

      border-top-left-radius: 10px;

      box-shadow: 1px 1px darken($light-purple, 20%);
      display: none;
    }

    > span::after {
      content: " code";
    }

    div.sourceCode {
      padding: 0px .5em;
    }
  }

  div.code-container.custom-tag {
    > span::after {
      display: none;
    }
  }

  div.code-container.continues {
    > span {
      display: none;
    }
  }

  * {
    max-width: 100%;
  }

  details {
    summary {
      margin-left: 1em;
      font-size: 14pt;
      padding: .2em 1em;
    }

    border-radius: 5px;
    border: 1px solid $purple;

    padding: .2em 1em;

    background-color: white;
    font-size: 0pt;

    margin-top: 0.5em;
    margin-bottom: 0.5em;

    transition: font-size 0.3s ease-in-out, background-color 0.3s ease-in-out;
    transform: rotate3d(0, 0, 0, 0);
  }

  details[open] {
    background-color: $light-purple;
    font-size: 14pt;
  }

  .special-thanks {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;

    p {
      font-size: 21pt;
      margin-top: .5em;
      margin-bottom: 0px;
    }

    ul {
      list-style: none;
      li {
        margin: .5em 0px;
        border-radius: 10px;
        border: 1px solid $purple;
        background-color: $light-purple;
        
        padding: 1em;

        a {
          text-decoration: underline;
        }

        transition: all 0.2s ease-in-out;
      }

      li:hover {
        border-radius: 5px;
        transform: scale(1.01);
        background-color: lighten($light-purple, 5%);
      }
    }
  }

  .eqn-list {
    list-style: none;
    direction: rtl;
    counter-reset: equation;

    li {
      counter-increment: equation;

      span.katex-display {
        margin: 2px; 
      }

      * {
        direction: ltr;
      }
    }

    li::marker {
      content: "(" counter(equation) ")";
      font-family: KaTeX_Main, Times New Roman, serif;
    }
  }

  font-size: 14pt;
  line-height: 1.6;
}

div.info, span#reading-length {
  padding-left: 1em;
  font-style: italic;
}

span#reading-length::before {
  content: "Word count: "
}

div#footer {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding-left: 1em;
  padding-right: 1em;

  background-color: $light-purple;
}

.definition {
  text-decoration: dotted underline;
}

.post-list {
  list-style: none;
  padding: 0px;

  div.post-list-item {
    margin-top: .2em;
    margin-bottom: .2em;

    padding: 1em;

    border-radius: 10px;
    background-color: $light-purple;

    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: flex-end;

    font-size: 11pt;

    a {
      font-size: 14pt;
      padding-right: 2em;
    }
  }
}

table {
  margin: auto;
  border-collapse: collapse;

  td, th {
    border: 1px solid $purple;
    text-align: center;
    padding: 0px 1em 0px 1em;

    > * {
      vertical-align: middle;
    }
  }

  td.image {
    padding: 0px;
    img {
      margin-top: auto;
    }
  }
}

figure {
  width: 100%;
  margin: auto;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;

  div {
    width: 100%;
    overflow-x: auto;
  }

  figcaption {
    font-size: 14pt;
  }

  figcaption::before {
    counter-increment: figure;
    content: "Figure " counter(figure) ". ";
  }
}


@media only screen and (max-width: $max-width) {
  div#content {
    margin-left: 1em;
    margin-right: 1em;
  }

  .mathpar {
    overflow-x: auto;
    justify-content: space-evenly;

    > * {
      margin-left: .2em;
      margin-right: .2em;
      flex-shrink: 0;
      flex-grow: 0;
    }
  }
}

// Contact page

.contact-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: center;

  .contact-card {
    margin: 0px .5em;

    border: 1px solid $purple;
    border-radius: 10px;
    background-color: $blonde;

    padding: 0px 1em;

    .username, .username * {
      font-size: 21pt;
      color: $purple;
    }

    p {
      display: flex;
      align-items: center;
      justify-content: space-evenly;

      max-width: 40ch !important;
    }

    transition: all 0.2s ease-in-out;
  }

  .contact-card:hover {
    margin: 0px .55em;
    background-color: darken($blonde, 10%);
    border-radius: 5px;
    transform: scale(1.01);
  }
}

@font-face {
  font-family: 'Fantasque Sans Mono';
  src: url('fonts/FantasqueSansMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
}
