@import "variables";

html {
  box-sizing: border-box;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Fira Code', Menlo, DejaVu Sans Mono, Monaco, Consolas, Ubuntu Mono, monospace;
  font-size: 1rem;
  line-height: 1.54;
  background-color: var(--background);
  color: var(--color);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -webkit-overflow-scrolling: touch;
  -webkit-text-size-adjust: 100%;
  font-feature-settings: "liga";

  @media (max-width: $phone-max-width) {
    font-size: 1rem;
  }
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;

  &:not(first-child) {
    margin-top: 40px;
  }

  .zola-anchor {
    font-size: 1.5rem;
    visibility: hidden;
    margin-left: 0.5rem;
    vertical-align: 1%;
    text-decoration: none;
    border-bottom-color: transparent;
    cursor: pointer;

    @media(max-width: $phone-max-width){
        visibility: visible;
    }
  }

  &:hover {
    .zola-anchor {
      visibility: visible;
    }
  }
}

// Actually keeping Pawroman's stylings here for font-size over h1-h6.
// I prefer differentiated header height.

// OLD
// ---------------------
// h1, h2, h3 {
//   font-size: 1.4rem;
// }

// h4, h5, h6 {
//   font-size: 1.2rem;
// }

// Pawroman's
// ---------------------
h1 {
  font-size: 1.4rem;
}

h2 {
  font-size: 1.3rem;
}

h3 {
  font-size: 1.2rem;
}

h4, h5, h6 {
  font-size: 1.15rem;
}


a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;

  &.left {
    margin-right: auto;
  }

  &.center {
    margin-left: auto;
    margin-right: auto;
  }

  &.right {
    margin-left: auto;
  }
}

p {
  margin-bottom: 20px;
}

figure {
  display: table;
  max-width: 100%;
  margin: 25px 0;

  &.left {
    // img {
      margin-right: auto;
    // }
  }

  &.center {
    // img {
      margin-left: auto;
      margin-right: auto;
    // }
  }

  &.right {
    // img {
      margin-left: auto;
    // }
  }

  figcaption {
    font-size: 14px;
    padding: 5px 10px;
    margin-top: 5px;
    background: var(--accent);
    color: var(--background);

    &.left {
      text-align: left;
    }

    &.center {
      text-align: center;
    }

    &.right {
      text-align: right;
    }
  }
}

code {
  font-family: 'Fira Code', Menlo, DejaVu Sans Mono, Monaco, Consolas, Ubuntu Mono, monospace;
  font-feature-settings: normal;
  background: var(--accent-alpha-20);
  color: var(--accent);
  padding: 1px 6px;
  margin: 0 2px;
  font-size: .95rem;
}

pre {
  font-family: 'Fira Code', Menlo, DejaVu Sans Mono, Monaco, Consolas, Ubuntu Mono, monospace;
  font-feature-settings: "liga";  
  padding: 20px 10px;
  font-size: .95rem;
  overflow: auto;
  border-top: 1px solid rgba(255, 255, 255, .1);
  border-bottom: 1px solid rgba(255, 255, 255, .1);

  + pre {
    border-top: 0;
    margin-top: -40px;
  }
  
  @media (max-width: $phone-max-width) {
    white-space: pre-wrap;
    word-wrap: break-word;
  }

    code {
      background: none !important;
      margin: 0;
      padding: 0;
      font-size: inherit;
      border: none;

      table {
        table-layout: auto;
        border-collapse: collapse;
        box-sizing: border-box;
        width: 100%;
        margin: 00px 0;
      }

      table, th, td {
        border: none;
        padding: 0px;
      }

      table tr td:first-child {
        padding-right: 10px;
      }

  }
}

blockquote {
  border-top: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  margin: 40px 0;
  padding: 25px;

  @media (max-width: $phone-max-width) {
    padding-right: 0;
  }

  &:before {
    content: '”';
    font-family: Georgia, serif;
    font-size: 3.875rem;
    position: absolute;
    left: -40px;
    top: -20px;
  }

  p:first-of-type {
    margin-top: 0;
  }

  p:last-of-type {
    margin-bottom: 0;
  }

  p {
    position: relative;
  }

  p:before {
    content: '>';
    display: block;
    position: absolute;
    left: -25px;
    color: var(--accent);
  }
}

table {
  table-layout: fixed;
  border-collapse: collapse;
  width: 100%;
  margin: 40px 0;
}

table, th, td {
  border: 1px dashed var(--accent);
  padding: 10px;
}

th {
  color: var(--accent);
}

ul, ol {
  margin-left: 30px;
  padding: 0;

  li {
      position: relative;
      margin-top: 5px;
      margin-bottom: 5px;
  }

  @media (max-width: $phone-max-width) {
    margin-left: 20px;
  }

  ul, ol {
      margin-top: 10px;
      margin-bottom: 10px;
  }
}

ol ol {
  list-style-type: lower-alpha;
}

.container {
  display: flex;
  flex-direction: column;
  padding: 40px;
  max-width: 864px;
  min-height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.1);

  &.full,
  &.center {
    border: none;
    margin: 0 auto;
  }

  &.full {
    max-width: 100%;
  }

  @media (max-width: $phone-max-width) {
    padding: 20px;
  }
}

.content {
  display: flex;
}

hr {
  width: 100%;
  border: none;
  background: var(--border-color);
  height: 1px;
}

.hidden {
  display: none;
}
