$purple-50:  #faf5ff;
$purple-100: #f3e8ff;
$purple-200: #e9d5ff;
$purple-300: #d8b4fe;
$purple-400: #c084fc;
$purple-500: #a855f7;
$purple-600: #9333ea;
$purple-700: #7e22ce;
$purple-800: #6b21a8;
$purple-900: #581c87;

$yellow-50:  #fefce8;
$yellow-100: #fef9c3;
$yellow-200: #fef08a;
$yellow-300: #fde047;
$yellow-400: #facc15;
$yellow-500: #eab308;
$yellow-600: #ca8a04;
$yellow-700: #a16207;
$yellow-800: #854d0e;
$yellow-900: #713f12;

$bluegray-50:  #f8fafc;
$bluegray-100: #f1f5f9;
$bluegray-200: #e2e8f0;
$bluegray-300: #cbd5e1;
$bluegray-400: #94a3b8;
$bluegray-500: #64748b;
$bluegray-600: #475569;
$bluegray-700: #334155;
$bluegray-800: #1e293b;
$bluegray-900: #0f172a;

$red-50:  #fef2f2;
$red-100: #fee2e2;
$red-200: #fecaca;
$red-300: #fca5a5;
$red-400: #f87171;
$red-500: #ef4444;
$red-600: #dc2626;
$red-700: #b91c1c;
$red-800: #991b1b;
$red-900: #7f1d1d;

$nav-height: 48px;

$font-size: 14pt;

@mixin center-that-bitch {
  display: flex;
  flex-direction: column;
  align-items: center;
}

html {
  min-height: 100%;
  height: 100%;
  max-width: 100%;
  margin: 0; 

  overflow-x: clip;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;

  width: 100%;

  @include center-that-bitch;

  margin: 0;

  color: $bluegray-900;
  font-size: $font-size;

  overflow-x: clip;
}

header {
  background-color: $purple-600;
  display: flex;
  height: $nav-height;
  width: 100%;
  z-index: 999;
  
  position: fixed;

  justify-content: space-between;

  align-items: center;

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

  border-bottom: 3px solid $purple-700;
  box-sizing: border-box;

  div, nav > a {
    height: $nav-height;
    
    padding-left: 0.3em;
    padding-right: 0.3em;

    display: flex;
    align-items: center;
  }

  div:hover, nav > a:hover {
    background-color: $purple-500;
    transition: background-color 0.3s ease-in-out;
  }

  a {
    color: white;
    font-size: $font-size * 1.2;
    text-decoration: none;
  }

  nav {
    display: flex;
    align-items: center;
    gap: 0.5em;
  }
}

@mixin left-bordered-block($color) {
  padding-left:   1em;
  padding-top:    0.2em;
  padding-bottom: 0.2em;

  border-left: 5px dashed $color;
}

@mixin material {
  padding-left:   1em;
  padding-top:    0.2em;
  padding-bottom: 0.2em;

  margin-top: 1em;
  margin-bottom: 1em;

  padding-right: 1em;
  box-shadow: 2px 2px 6px black;
}

main {
  max-width: 100ch;
  width: 100%;
  margin: 0px auto 0px auto;
  flex: 1 0 auto;

  padding: 2ch;
  padding-top: $nav-height;

  box-sizing: border-box;

  div#post-toc-container {
    aside#toc {
      display: none;
    }

    article {
      grid-column: 2;
      width: 100%;
      line-height: 1.5;
    }
  }

  div#post-info {
    font-style: italic;
    line-height: 1.2;

    @include left-bordered-block($bluegray-500);
  }
}

div.warning {
  @include material;
  background-color: $red-200;
}

figure.wraparound {
  float: right;
  width: auto;

  margin-left: 2em;
}

figure {
  overflow-x: auto;
  overflow-y: clip;
  width: 100%;
  margin: auto;

  @include center-that-bitch;
  
  figcaption {
    margin-top: 0.3em;
    display: inline-block;
    text-align: center;
  }

  p {
    margin: 0;
  }
}

.katex-display {
  > span.katex {
    white-space: normal;
  }
}

div.mathpar {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  align-items: center;
  

  gap: 1em;

  > figure {
    width: auto;
    max-width: 33%;
  }
}

.sourceCode {
  font-size: $font-size;
}

div.sourceCode {
  background-color: $yellow-50;

  @include material;

  flex-grow: 0;
  height: auto;
}

div.code-container {
  padding: 0;
  display: flex;
  flex-direction: column;

  box-shadow: 2px 2px 6px black;

  > div.sourceCode, > pre {
    background-color: $yellow-50;

    border: 0;
    box-shadow: none;
    padding: 2em;
    padding-bottom: 0.5em;
    padding-top: 0.5em;

    margin: 0;

    pre {
      margin-top: 5px;
      margin-bottom: 5px;
    }

    overflow-x: auto;
  }

  // this is fucking criminal lmao
  div.empty-code-tag {
    background-color: $yellow-50;
  }

  div.code-tag {
    display: flex;
    flex-direction: row-reverse;
    height: 1.4em;

    background-color: $yellow-300;
    padding: 0.2em;

    span {
      @include center-that-bitch;
      margin-right: 0.4em;
    }
  }
}

blockquote {
  @include left-bordered-block($bluegray-700);

  background-color: $bluegray-100;

  padding-left: 2.5em;
  margin-left: 0;
}

table {
  width: 70%;
  margin: auto;
  border-collapse: collapse;

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

ul#post-list {
  list-style-type: none;
  display: flex;
  flex-direction: column;
  gap: 2em;

  .post-list-item {
    @include left-bordered-block($yellow-500);

    background-color: $yellow-50;

    padding: 1em;

    .post-list-header {
      margin-top: 0.2em;

      display: flex;
      justify-content: space-between;
      line-height: 14pt;

      font-style: italic;
      font-size: 10pt;

      a {
        font-size: 14pt;
        font-style: normal;
        color: $bluegray-800;
      }
    }
  }
}

div.contact-list {
  display: flex;
  justify-content: space-evenly;
  align-items: stretch;
  gap: 3em;

  div.contact-card {
    background-color: $purple-200;
    @include material;

    width: 33%;
    max-width: 33%;
    flex-grow: 1;


    p {
      margin: 0;
    }

    div.contact-header {
      // I really hate Pandoc sometimes
      display: flex;
      align-items: center;
      gap: 1em;

      margin-bottom: 10px;

      img {
        height: 48px;
        clip-path: url(#squircle);
      }

      span.username {
        font-size: 16pt;
      }
    }
  }
}

@media only screen and (max-width: 450px) {
  header {
    div#logo {
      width: 100%;
      display: flex;
      flex-direction: row;
      justify-content: center;
    }
    nav {
      display: none;
    }
  }
}

@media only screen and (min-width: 1500px) {
  main {
    max-width: 100%;
    > h1 {
      font-size: 26pt;
      @include center-that-bitch;
    }

    div#post-toc-container {
      display: grid;
      grid-template-columns: 0.5fr 2fr 0.5fr;

      aside#toc {
        display: block !important;
        max-width: 200px;

        h3 { @include center-that-bitch; }

        ul {
          border-left: 2px solid $bluegray-400;
          list-style-type: none;
          padding-left: 1em;

          a {
            text-decoration: none;
          }
        }
      }

      article {
        max-width: 100ch;
        margin-top: -100px;
        margin: auto;
      }
    }
  }
}

details {
  margin-top: 1em;
  margin-bottom: 1em;
}