/* Variables */
:root {
  --primary-color: #0D76EC;
  --hover-color: #12437A;
  --light-bg: #fff;
  --light-bg-card: #f5f5f5;
  --primary-color-dark: #4da3ff;
  --hover-color-dark: #91c9ff;
  --dark-bg: #14161e;
  --dark-bg-card: #1c212d;
  --dark-font-color: #eee;
  --dark-nav-color: #ddd;
}

/* Main page with sticky footer */
html, body {
  height: 100%;
  background-color: var(--light-bg);
  font-family: 'Source Sans Pro', sans-serif;
  border-top: 3px solid var(--primary-color);
  font-size: 18px;
}

#wrap {
  padding-bottom: 50px;
  min-height: 100%;
  height: auto;
  margin: 0 auto -65px;

  // Avoid scrollbar jumps in centering
  margin-left: calc(100vw - 100%);
}

/* Content containers */
.container {
  width: auto;
  max-width: 800px;

  .text-muted {
    margin: 20px 0;
  }

  h1 {
    text-align: center;
  }

  a {
    color: var(--primary-color);

    &:hover {
      color: var(--hover-color);
    }

    &.label-rss {
      background-color: rgba(242, 101, 34, 0.8);
      color: #fff;

      &:hover {
        background-color: rgba(242, 101, 34, 1);
      }
    }
  }

  p {
    margin-bottom: 20px;
  }

  h1, h2, h3, h4, h5, h6 {
    span {
      cursor: default;
    }
  }

  h1 {
    font-weight: bold;
    color: var(--primary-color);
  }

  h2 {
    a {
      color: var(--primary-color);

      &:hover {
        color: var(--hover-color);
      }
    }
  }
}

/* Labels */
.label {
  &.label-success {
    background-color: rgba(92, 139, 184, 0.6);
    color: #fff;

    &.label-lg {
      font-size: 1em;
      padding: 0.5em 1em;
    }

    &:hover,
    &:focus,
    &.active {
      background-color: rgba(92, 139, 184, 0.9);
      color: #fff;
    }
  }
}

/* Images */
.container p img,
.img-responsive {
  display: block;
  height: auto;
  margin: 2rem auto;
  max-width: 100%;
}

/* Panels */
.panel {
  border-style: none;
  box-shadow: none;
  -webkit-box-shadow: none;

  &-body {
    padding-top: -10px;
    text-align: left;
  }

  &-default {
    h2, h3, h4, h5 {
      text-align: left;
    }

    h2 {
      font-size: 1.25rem;
      line-height: 24px;
    }

    h5 {
      line-height: 30px;
      font-size: 1rem;
    }

    h6 {
      font-size: 0.9rem;
    }
  }
}

/* Social */
.social-links {
  display: flex;
  justify-content: center;
  margin: 40px auto 0;
  padding: 0;
  width: 100%;
  text-align: center;
  animation: fade 1s ease 1s both;

  li {
    display: inline-block;
    padding: 0 5px;
    text-align: center;

    a {
      font-size: 26px;
      color: #000;
      padding: 10px 10px 4px;
      transition: all 0.4s ease;

      &:hover {
        color: #000;
      }

      i {
        transform: scale(0.8);
        transition: transform 0.3s;

        &:hover {
          transform: scale(1);
        }
      }
    }
  }
}

/* Layout tweaks */
.avatar {
  padding-top: 5%;

  img {
    max-height: 190px;
  }
}

.blog-post {
  padding-top: 15px;
}

.blog-title {
  padding-top: 2px;
}

.label {
  display: inline-block;
  margin-bottom: 5px;
}

.related-posts h4 {
  text-align: center;
}

.page-not-found {
  padding-top: 20%;
}

.disqus {
  padding-bottom: 15px;
}

/* Blog content */
.blogpost {
  text-align: left;
  line-height: 30px;
  font-size: 18px;

  .header-image {
    margin-bottom: 0.5em;

    img {
      width: 100%;
      height: auto;
    }

    p {
      opacity: 0.7;
      font-size: 0.8em;
      text-align: center;
      line-height: 1em;
      margin-top: .5em;
      margin-bottom: 0;
    }
  }

  .blog-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: .5em;
    justify-content: center;

    .label {
      margin-bottom: 0;
    }
  }
}

/* Metadata */
.metadata-page {
  font-size: 18px;
  text-align: left;
  margin: 3em 0 2em;

  .row {
    padding-bottom: 0;
  }
}

.metadata-summary {
  font-size: 0.8rem;
  opacity: 0.7;
}

.blog-summary {
  padding-bottom: 1em;

  p:last-of-type {
    display: inline;
  }
}

/* Learn more link */
a.learn-more {
  font-size: 1.8em;
  line-height: 0.8em;
  font-weight: 700;
  font-variant: small-caps;
  text-transform: lowercase;
  padding: 0 1em 0 0.3em;
  position: absolute;

  &::after {
    position: absolute;
    right: 0.3em;
    content: " » ";
    opacity: 0.8;
    transition: all 150ms linear;
  }

  &:hover::after {
    right: 0;
    opacity: 1;
  }
}

/* Pagination */
#pagination {
  display: flex;
  justify-content: center;

  .pagination {
    li.page-item:not(.active) {
      a {
        color: var(--primary-color);

        &:hover {
          color: var(--hover-color);
        }
      }
    }
  }
}

/* Footer */
footer {
  border-bottom: 5px solid var(--primary-color);
  text-align: center;
  text-decoration: none !important;

  .text-muted {
    color: #6b6b6b;
  }

  p {
    font-size: 0.8rem;
  }
}

/* Site specific */
div#index-content {
  text-align: center;
}

div.contact p {
  line-height: 1.5em;
  margin-bottom: 30px;
}

/* Recent posts */
#recent-posts {
  padding: 0 1rem;
  .card {
    // Box
    padding: 1rem;
    background-color: var(--light-bg-card);
    border-radius: 0 1rem;
    margin-bottom: .3rem;
    text-align: left;

    .card-title {
      font-size: 1.1rem;
      margin-top: 0;
    }
  }
  // First and last card in the list have different border radius
  .row:first-child .card {
    border-radius: 1rem 1rem 0 1rem;
  }
  .row:last-child .card {
    border-radius: 0 1rem 1rem 1rem;
  }
}

/* Helpers */
.vertical-align {
  display: flex;
  align-items: center;
}

pre code {
  white-space: pre;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  html, body {
    background-color: var(--dark-bg);
    color: var(--dark-font-color);
  }

  // Navbar
  .luxbar-menu a,
  .luxbar-item a {
    color: var(--dark-nav-color);
  }

  .luxbar-menu-light .luxbar-hamburger span {
    &, &::before, &::after {
      background-color: var(--dark-nav-color);
    }
  }

  // Links, headlines etc.
  .container {
    a {
      color: var(--primary-color-dark);

      &:hover {
        color: var(--hover-color-dark);
      }
    }

    h1,
    h2 a {
      color: var(--primary-color-dark);

      &:hover {
        color: var(--hover-color-dark);
      }
    }
  }

  .panel {
    background-color: var(--dark-bg);
    color: #ddd;
  }

  .social-links li a {
    color: #ddd;

    &:hover {
      color: #fff;
    }
  }

  #recent-posts .card {
    background-color: var(--dark-bg-card);
  }

  // Pagination
  .pagination {
    li.page-item {
      a {
        color: var(--primary-color-dark);
        background-color: #222;

        &:hover {
          color: var(--hover-color-dark);
          background-color: #000;
        }
      }
    }
  }

  footer {
    .text-muted {
      color: #a5a5a5 !important;
    }
  }
}
