/**
 * Site header
 */
.site-header {
  display: grid;
  grid-template-columns: repeat(3, 1fr);

  width: 100%;
  // border-top: 5px solid $grey-color-dark;
  // border-bottom: 1px solid $grey-color-dark;
  min-height: $spacing-unit * 1.865;

  // Positioning context for the mobile navigation icon
  position: relative;

  .wrapper {
    display: flex;
    flex: 1;
    justify-self: center;
    align-self: center;
    flex-direction: column;

    width: auto;
    min-width: 740px;

    @include media-query($on-half) {
      width: 100%;
      margin: 0;
      min-width: 0;
    }

    @include media-query($on-palm) {
      width: 100%;
      margin: 0;
      min-width: 0;
    }
  }

  .header-left-space {
    width: 100%;
    min-width: 5vw;
  }
  .header-right-space {
    min-width: 5vw;
  }
}

.title-wrapper {
  flex: 1;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  padding-top: $spacing-unit / 2;
}

.header-utils-wrapper {
  margin-top: $spacing-unit / 4;
  margin-bottom: $spacing-unit / 4;
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;

  .header-icons-on-half {
    display: none;

    @include media-query($on-half) {
      display: flex;
      flex: 1;
      margin-left: $spacing-unit / 2;

      a img {
        height: 1.5rem;
      }

      a {
        margin-right: $spacing-unit / 2;
      }
    }
  }
}

// BMC Custom
.bmc-btn-container {
  display: flex !important;
  align-items: center !important;
  justify-content: right !important;
  margin-left: $spacing-unit / 2;

  @include media-query($on-palm) {
    margin-right: $spacing-unit / 1.5;
  }
}

.bmc-btn {
  flex: 1 !important;
  height: 36px !important;
  padding: 0px !important;
  min-width: none !important;
}

.bmc-btn-text {
  font-size: 18px;
  font-weight: 100 !important;

  @include media-query($on-palm) {
    display: none !important;
  }
}
////////////////

.site-hits {
  height: fit-content;
  margin-left: $spacing-unit / 2;
}

.site-title {
  @include relative-font-size(1.625);
  font-weight: 300;
  letter-spacing: -1px;
  margin-bottom: 0;
  float: left;
  height: fit-content;
  line-height: normal;

  &,
  &:visited {
    color: $site-title-color;
  }
}

.site-nav {
  float: right;
  // line-height: $base-line-height * $base-font-size * 2.25;

  .nav-trigger {
    display: none;
  }

  .menu-icon {
    display: none;
  }

  .page-link {
    color: $text-color;
    line-height: $base-line-height;

    margin-left: 0.5rem;
    // Gaps between nav items, but not on the last one
    &:not(:last-child) {
      margin-right: 0.75rem;
    }
  }

  @include media-query($on-palm) {
    position: absolute;
    top: 9px;
    right: $spacing-unit / 2;
    background-color: $background-color;
    // border: 1px solid $grey-color-light;
    border-radius: 5px;
    text-align: right;

    z-index: 5000;

    label[for="nav-trigger"] {
      display: block;
      float: right;
      width: 36px;
      height: 36px;
      z-index: 2;
      cursor: pointer;
    }

    .menu-icon {
      display: block;
      float: right;
      width: 36px;
      height: 26px;
      line-height: 0;
      padding-top: 10px;
      text-align: center;

      > svg {
        fill: $grey-color-dark;
      }
    }

    .category-link-split {
      display: none;
    }

    input ~ .trigger {
      clear: both;
      display: none;
    }

    input:checked ~ .trigger {
      display: block;
      padding-bottom: 5px;
    }

    .page-link {
      display: block;
      padding: 5px 10px;

      &:not(:last-child) {
        margin-right: 0;
      }
      margin-left: 20px;
    }
  }
}

/**
 * Site footer
 */
.site-footer {
  display: flex;
  width: 100%;
  justify-content: center;

  border-top: 1px solid $grey-color-dark;
  padding: $spacing-unit 0;

  .wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
}

.footer-heading {
  @include relative-font-size(1.125);
  margin-bottom: $spacing-unit / 2;
}

.contact-list,
.feed-subscribe,
.social-media-list {
  list-style: none;
  margin-left: 0;
  margin-bottom: 0;
}

.footer-col-wrapper {
  @include relative-font-size(0.9375);
  color: $grey-color;
  margin-left: -$spacing-unit / 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  // @extend %clearfix;
}

.footer-col {
  float: left;
  margin-bottom: $spacing-unit / 2;
  padding-left: $spacing-unit / 2;
}

.footer-col-1 {
  width: -webkit-calc(35% - (#{$spacing-unit} / 2));
  width: calc(35% - (#{$spacing-unit} / 2));
}

.footer-col-2 {
  width: -webkit-calc(20% - (#{$spacing-unit} / 2));
  width: calc(20% - (#{$spacing-unit} / 2));
}

.footer-col-3 {
  width: -webkit-calc(45% - (#{$spacing-unit} / 2));
  width: calc(45% - (#{$spacing-unit} / 2));
}

/**
 * Page content
 */
.page-content {
  width: 100%;
  padding: $spacing-unit 0;
  flex: 1;

  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.page-content > .content-middle {
  max-width: 100vh;

  display: flex;
  justify-content: center;

  min-width: 740px;

  margin: 0 $spacing-unit;

  @include media-query($on-half) {
    margin: 0 auto;
  }

  @include media-query($on-palm) {
    margin: 0;
    min-width: 0;
  }
}

.page-content > .content-side {
  display: flex;
  min-width: 5vw;
}

.page-content > .content-left {
  width: 100%;
  justify-content: flex-end;

  > .global-left-top {
    display: flex;
    flex-direction: column;

    @include on-small-height() {
      display: none !important;
    }

    > .profile-container {
      padding-right: $spacing-unit;
      margin-right: $spacing-unit / 4;

      border-right: 2px solid $grey-color-dark;

      > .profile-upper {
        display: flex;
        justify-content: flex-end;

        > .profile-picture {
          width: 100px;
          min-width: 100px;
        }
      }

      > .profile-bottom {
        display: flex;
        flex-direction: column;

        align-items: flex-end;

        padding-left: $spacing-unit / 8;

        > .profile-name {
          font-size: 1.5rem;
          height: 1.5rem;
        }
        > .profile-nick {
          margin-top: 4px;
          height: 1rem;
          color: $grey-color;
        }
        > .profile-desc {
          white-space: nowrap;
        }
        > .profile-link {
          margin-top: $spacing-unit / 2;
          a img {
            height: 1.5rem;
          }
        }
        > .profile-link a {
          margin-left: $spacing-unit / 4;
        }
      }
    }
  }
}

// hover, opacity
.profile-link a img:hover,
.header-icons-on-half a img:hover,
.trigger .page-link:hover,
.up-btn:hover,
.site-footer a:hover {
  opacity: 25%;
}

.page-content > .content-right {
  > .global-right-top {
    display: flex;
    flex-direction: column;

    @include on-small-height() {
      display: none !important;
    }

    > .global-right-top-content {
      position: sticky;
      top: $spacing-unit / 2;
      padding-left: $spacing-unit / 8;

      display: flex;
      flex-direction: column;

      margin-left: -2.5em;
    }
  }

  > .global-right-bottom {
    display: flex;
    flex-direction: column-reverse;

    > .global-right-bottom-content {
      position: sticky;
      bottom: $spacing-unit / 4;
      padding-left: $spacing-unit / 4;

      display: flex;
      flex-direction: column;
    }
  }
}

.page-content > .hover-on-half {
  display: none;

  position: sticky;
  bottom: $spacing-unit/4;
  right: $spacing-unit/4;
}

@include media-query($on-half) {
  .site-header,
  .page-content {
    grid-template-columns: 1fr;
  }

  .site-header > .header-side-space,
  .page-content > .content-side {
    display: none;
  }

  .page-content > .hover-on-half {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-right: $spacing-unit;

    @include media-query($on-laptop) {
      margin-right: $spacing-unit / 2;
    }
  }
}

.page-heading {
  @include relative-font-size(2);
}

.post-list-heading {
  @include relative-font-size(1.75);
}

.post-list {
  margin-left: 0;
  list-style: none;

  > li {
    padding-bottom: $spacing-unit / 4;
    margin-bottom: $spacing-unit;

    border-bottom: 2px solid $grey-color-dark;
  }
}

.post-meta {
  font-size: $small-font-size;
  color: $grey-color;

  a {
    color: $grey-color;
  }
}

.post-link {
  display: block;
  @include relative-font-size(1.5);
  color: $brand-color;

  line-height: 1;

  & p {
    margin-top: 0.5rem;
  }

  @include media-query($on-palm) {
    @include relative-font-size(1);
  }
}

/**
 * Posts
 */
.post-header {
  margin-bottom: $spacing-unit;
}

.post-title {
  @include relative-font-size(2.625);
  letter-spacing: -1px;
  line-height: 1;

  @include media-query($on-palm) {
    @include relative-font-size(1.75);
  }
}

.post-subtitle {
  @include relative-font-size(0.75);
  line-height: 1;
  color: $grey-color;
}

.post-content {
  margin-bottom: $spacing-unit;

  word-break: break-all;

  @include media-query($on-palm) {
    @include relative-font-size(0.8);
  }

  p {
    text-align: start;
  }

  h2,
  h2 > code {
    @include relative-font-size(2);

    @include media-query($on-palm) {
      @include relative-font-size(1.5);
    }
  }

  h3,
  h3 > code {
    @include relative-font-size(1.625);

    @include media-query($on-palm) {
      @include relative-font-size(1.2);
    }
  }

  h4,
  h4 > code {
    @include relative-font-size(1.25);

    @include media-query($on-palm) {
      @include relative-font-size(1);
    }
  }
}
