@import "variables";

html {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: Hack, Monaco, Consolas, 'Ubuntu Mono', PingHei, 'PingFang SC', 'Microsoft YaHei', monospace;
  font-size: 1rem;
  line-height: 1.54;
  background-color: var(--background);
  color: var(--foreground);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -webkit-overflow-scrolling: touch;
  -webkit-text-size-adjust: 100%;

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

  &.pixel_style {
    font-family: Pixel, Monaco, Consolas, 'Ubuntu Mono', PingHei, 'PingFang SC', 'Microsoft YaHei', monospace;
  }
}

h1, h2, h3, h4, h5, h6 {
  font-weight: bold;
  line-height: 1.3;
}

h1 {
  font-size: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: .75rem;
}

h2 {
  font-size: 1.3rem;
  margin-top: 1.5rem;
  margin-bottom: .75rem;
}

h3 {
  font-size: 1.2rem;
  margin-top: 1rem;
  margin-bottom: .5rem;
}

h4, h5, h6 {
  font-size: 1.15rem;
  margin-top: .5rem;
  margin-bottom: .25rem;
}


a {
  color: var(--blue);
}

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

  &.left {
    margin-right: auto;
  }

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

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

p {
  margin-top: .75rem;
  margin-bottom: .75rem;
}

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(--foreground);
    color: var(--background);

    &.left {
      text-align: left;
    }

    &.center {
      text-align: center;
    }

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

code {
  font-family: Hack, Monaco, Consolas, 'Ubuntu Mono', PingHei, 'PingFang SC', 'Microsoft YaHei', monospace;
  font-feature-settings: normal;
  background: var(--selectionBackground);
  padding: 1px 4px;
  margin: 0 4px;
  font-size: .95rem;
}

pre {
  font-family: Hack, Monaco, Consolas, 'Ubuntu Mono', PingHei, 'PingFang SC', 'Microsoft YaHei', monospace;
  font-size: .95rem;
  overflow: auto;
  border-top: 1px solid rgba(255, 255, 255, .1);
  border-bottom: 1px solid rgba(255, 255, 255, .1);

  @media (max-width: $phone-max-width) {
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  code {
    padding: 0;
    margin: 0;
    background: none;
  }
}

blockquote {
  border-top: 1px solid var(--foreground);
  border-bottom: 1px solid var(--foreground);
  border-left: .5rem solid var(--foreground);
  margin: 2rem 0;
  padding: 1rem;

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

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

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

  p {
    position: relative;
  }

}

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

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

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

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

  li {
    position: relative;

    p {
      margin-top: .125rem;
      margin-bottom: .125rem;
    }

  }

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

ol {
  list-style-type: decimal;
}

.container {
  display: flex;
  flex-direction: column;
  padding: 40px;
  max-width: 864px;
  min-height: 100vh;
  margin: 0 auto;

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

.content {
  display: flex;
  flex-direction: column;
}

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