$font-core: 'Open Sans', sans-serif;
$font-alt: 'Source Code Pro', monospace;

$color-black: rgba(0, 0, 0, 0.84);
$color-gray: rgba(0, 0, 0, 0.54);
$color-gray-light: rgba(0, 0, 0, 0.20);
$color-gray-muted: rgba(0, 0, 0, 0.10);
$color-link: hsl(210, 70%, 40%);
$color-link-visited: hsl(280, 70%, 40%);

$color-task: hsl(150, 50%, 80%);
$color-task-bg: hsl(150, 50%, 90%);
$color-task-font: hsl(150, 50%, 20%);

$color-draft-warning: hsl(60, 80%, 60%);
$color-draft-warning-bg: hsl(60, 80%, 90%);
$color-draft-warning-font: hsl(60, 80%, 20%);

* {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  box-sizing: border-box;
}

body {
  font-size: 16px;
  font-family: $font-core;
  line-height: 1.4;
  width: 100%;
}

p {
  margin-bottom: 0.8em
}

ul {
  margin-bottom: 1em;
  margin-left: 1.5em;

  ul {
    margin-bottom: 0;
  }

  a {
    text-decoration: none;
  }
}

hr {
  margin: 1em 0;
  background-color: $color-gray-light;
  height: 1px;
}

small {
  font-size: 0.85em;
}

h1 {
  font-size: 3.0rem;
  margin: 1.5rem 0 1.8rem 0;
}

h2 {
  font-size: 2.0rem;
  margin: 1.0rem 0 1.3rem 0;
}

h3 {
  font-size: 1.5rem;
  margin: 0.5rem 0 0.8rem 0;
}

h4 {
  font-size: 1.2rem;
  margin: 0.2rem 0 0.5rem 0;
}

h1,
h2,
h3,
h4 {
  a {
    text-decoration: none
  }
}

section {
  margin-bottom: 2rem;
}

pre {
  padding: 0.4rem;
  font-size: 0.65rem;
  margin-bottom: 1rem;
  overflow-x: scroll;
}

p>code {
  color: #e74c3c;
  border: 1px solid #ecf0f1;
  padding: 5px;
  border-radius: 5px;
  background: rgba(236, 240, 241, 0.19);
}

table {
  tr:nth-child(even) {
    background-color: $color-gray-muted;
  }

  th {
    padding: 0.4em 0.6em;
    background-color: $color-gray-light;
  }

  td {
    padding: 0.2em 0.4em;
  }
}

a {
  &:link {
    color: $color-link;
  }

  &:visited {
    color: $color-link-visited;
  }
}

blockquote {
  border-left: 4px solid $color-task;
  background-color: $color-task-bg;
  padding: 0.4em 0.8em;
  margin-bottom: 1em;
  width: 80%;

  &>p {
    margin-bottom: 0;
  }
}

img {
  max-width: 100%;
}

video {
  max-width: 100%;
}


.tags {
  margin-bottom: 1rem;
}

.tag {
  font-size: 0.7em;
  border: 1px solid $color-gray-light;
  padding: 0.15em 0.4em;
  text-decoration: none;
  color: inherit;
  border-radius: 4px;
  position: relative;
  bottom: 0.2em;
  white-space: nowrap;

  &:hover {
    text-decoration: underline;
  }
}

.wrapper {
  display: grid;
  grid-template-areas:
    'header'
    'aside'
    'main'
    'footer';
  grid-gap: 2rem;
}


header {
  border-bottom: 1px solid $color-gray-light;
  background: white;
  grid-area: header;
  padding: 0 1rem;

  nav {
    display: flex;
    flex-wrap: wrap;
    padding: 1rem 0;
  }

  .title {
    display: block;
    flex-grow: 1;
    text-decoration: none;
    margin-right: 2em;
    line-height: 0;

    h1 {
      display: inline-block;
      font-family: $font-alt;
      color: $color-black;
      font-size: 2rem;
      margin: 0 0 1em 0;
      vertical-align: text-top;
    }

    img {
      display: inline;
      height: 1.8em;
      margin-right: 0.5em;
      vertical-align: -10%;
    }
  }

  .links {
    list-style: none;
    line-height: 2rem;
    margin-bottom: 0;
    margin-left: 0;

    li {
      display: inline-block;
      margin: 0 2em 0 0;

      &:last-of-type {
        margin-right: 0;
      }
    }

    a {
      text-decoration: none;
      color: inherit;

      &:hover {
        text-decoration: underline;
      }
    }
  }
}

main {
  grid-area: main;
  word-break: break-word;
  overflow: auto;

  #introduction {
    margin-bottom: 2em;
  }
}


// Paddings to enable full width pre tag

article {
  >div {
    margin-left: 1rem;
    margin-right: 1rem;
  }
}

article {

  >p,
  >ul,
  >ol,
  >h1,
  >h2,
  >h3,
  >h4,
  >h5,
  >h6 {
    padding-right: 0;
    padding-left: 0;
  }
}

#landing-page-content,
#section-drafts,
#section-language,
#section-languages,
#section-tag,
#section-tags,
#section-tasks {
  padding-right: 1rem;
  padding-left: 1rem;
}


#section-tag {
  .tag {
    text-decoration: none;
    font-size: inherit;
  }
}


.task-listing-container {
  margin-bottom: 2em;

  ul {
    column-count: 2;
    column-gap: 2em;
    margin-left: 2em;
  }

  li {
    a {
      text-decoration: none;

      &:hover {
        text-decoration: underline;
      }
    }
  }
}

aside {
  grid-area: aside;
  padding: 0 1rem;

  h3 {
    font-size: 1.2rem;
    color: $color-black;
    border-bottom: 1px solid $color-gray-light;
  }

  ul {
    list-style-type: none;
    margin-left: 1em;
  }
}

.section-container {
  ul {
    column-count: 1;
    column-gap: 2em;
    margin-left: 2em;
    font-size: 1.1rem;
  }
}

#languages-content {
  column-count: 2;
  column-gap: 2em;
}

.taxonomy ul {
  column-count: 2;
  column-gap: 5em;
  line-height: 1.4;

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

.page-title {
  margin: 0 0 30px;
  font-size: 26px;
}

.page-heading {
  word-break: break-word;
}

.page-navigator {
  margin-bottom: 15px;
  text-align: center;

  &>span,
  &>a {
    color: $color-gray-light;
    font-size: 12px;
  }

  &>.pages {
    color: $color-gray;
    font-size: 15px;
    margin: 0 10px;
  }

  &>a {
    color: $color-link;
    text-decoration: none;
  }
}

footer {
  border-top: 1px solid lightgray;
  color: gray;
  grid-area: footer;
  padding: 1em 1em;
  text-align: center;
}

@import "post.scss";


@media only screen and (min-width: 640px) {
  .wrapper {
    display: grid;
    grid-template-areas:
      '. header .'
      '. aside .'
      '. main .'
      '. footer .';
    grid-template-columns:
      auto 640px auto;
    grid-column-gap: 0;
  }

  .section-container {
    ul {
      column-count: 2;
    }
  }


  // Reset margins & paddings

  article {
    >div {
      margin-left: 0;
      margin-right: 0;
    }
  }

  article {

    >p,
    >ul,
    >ol,
    >h1,
    >h2,
    >h3,
    >h4,
    >h5,
    >h6 {
      padding-right: 0;
      padding-left: 0;
    }
  }

  #landing-page-content,
  #section-drafts,
  #section-language,
  #section-languages,
  #section-tag,
  #section-tags,
  #section-tasks {
    padding-right: 0;
    padding-left: 0;
  }

  #languages-content {
    column-count: 1;
  }

  #languages-content ul {
    column-count: 3;
  }

  .task-listing-container {
    ul {
      column-count: 3;
    }
  }
}


@media only screen and (min-width: 900px) {

  header {
    padding: 0;
  }

  aside {
    padding: 0;
  }

  pre {
    border-radius: 5px;
    padding: 1rem;
    font-size: 0.85rem;
  }

  .wrapper {
    display: grid;
    grid-template-areas:
      '. header  header  header header .'
      '. aside   main    main   main   .'
      '. footer  footer  footer footer .';
    grid-template-columns:
      auto 200px 200px 200px 200px auto;
    grid-gap: 2rem 20px;
  }
}
