@import '../Pisces/_layout';
@import '../Pisces/_brand';
@import '../Pisces/_menu';
@import '../Pisces/_sub-menu';
@import '../Pisces/_sidebar';

// ==================================================
// Rewrite _layout.styl
// ==================================================
// Sidebar padding used as main desktop content padding for sidebar padding and post blocks padding too.

// In `source/css/_variables/Pisces.styl` there are variable for main offset:
// $sidebar-offset                   = 12px;
// This value alse can be changed in main NexT config as `sidebar: offset: 12` option.

// In `source/css/_variables/base.styl` there are variables for other resolutions:
// $content-tablet-padding           = 10px;
// $content-mobile-padding           = 8px;
// P.S. If u want to change this paddings u may set this variables into `custom_file_path.variable` (in theme _config.yml).

// So, it will 12px in Desktop, 10px in Tablets and 8px in Mobiles for all possible paddings.
// ==================================================
// Read values from NexT config and set they as local variables to use as string variables (in any CSS section).
$use-seo = hexo-config('seo');

// ==================================================
// Desktop layout styles.
// ==================================================
// Post blocks.
.content-wrap {
  background: initial;
  box-shadow: initial;
  padding: initial;
}

// Post & Comments blocks.
.post-block {
  background: white;
  border-radius: $border-radius-inner;
  box-shadow: $box-shadow-inner;
  padding: $content-desktop-padding;
}

// When blocks are siblings (homepage).
#posts > article + article {
  .post-block {
    border-radius: $border-radius;
    // Rewrite shadows & borders because all blocks have offsets.
    box-shadow: $box-shadow;
    margin-top: $sidebar-offset;
  }
}

// Comments blocks.
.comments {
  background: white;
  border-radius: $border-radius;
  box-shadow: $box-shadow;
  margin: auto;
  margin-top: $sidebar-offset;
  padding: $content-desktop-padding;
}

.tabs-comment {
  margin-top: 1em;
}

// Top main padding from header to posts (default 40px).
.posts-expand {
  padding-top: initial;
}

// Post navigation items.
.post-nav-divider {
  width: 4%;
}

.post-nav-item {
  width: 48%;
}

// Post delimiters.
.post-eof {
  display: none;
}

// Pagination.
.pagination {
  .prev, .next, .page-number {
    margin-bottom: initial;
    top: initial;
  }

  background: white;
  border-radius: $border-radius;
  border-top: initial;
  box-shadow: $box-shadow;
  margin: $sidebar-offset 0 0;
  padding: 10px 0 10px;
}

// Footer alignment.
.main {
  padding-bottom: initial;
}

.footer {
  bottom: auto;
}

// Sub-menu(s).
.sub-menu {
  border-bottom: initial;
  box-shadow: $box-shadow-inner;

  // Adapt submenu(s) with post-blocks.
  + #content > #posts {
    .post-block {
      box-shadow: $box-shadow;
      margin-top: $sidebar-offset;

      +tablet() {
        margin-top: $content-tablet-padding;
      }

      +mobile() {
        margin-top: $content-mobile-padding;
      }
    }
  }
}

// ==================================================
// Headers.
// ==================================================
.post-body {
  h1, h2 {
    border-bottom: 1px solid $body-bg-color;
  }

  h3 {
    if ($use-seo) {
      border-bottom: 1px solid $body-bg-color;
    } else {
      border-bottom: 1px dotted $body-bg-color;
    }
  }

  h4 {
    if ($use-seo) {
      border-bottom: 1px dotted $body-bg-color;
    }
  }
}

// ==================================================
// > 768px & < 991px
// ==================================================
+tablet() {
  // Posts in blocks.
  .content-wrap {
    padding: $content-tablet-padding;
  }

  .posts-expand {
    margin: initial;

    // Components inside Posts.
    .post-button {
      margin-top: ($content-tablet-padding * 2);
    }
  }

  .post-block {
    border-radius: $border-radius;
    // Rewrite shadows & borders because all blocks have offsets.
    box-shadow: $box-shadow;
    // Inside posts blocks content padding (default 40px).
    padding: ($content-tablet-padding * 2);
  }

  // Only if blocks are siblings need bottom margin (homepage).
  #posts > article + article {
    .post-block {
      margin-top: $content-tablet-padding;
    }
  }

  .comments {
    margin-top: $content-tablet-padding;
    padding: $content-tablet-padding ($content-tablet-padding * 2);
    // padding: initial;
    // padding-top: $content-tablet-padding;
  }

  .pagination {
    margin: $content-tablet-padding 0 0;
  }
}

// ==================================================
// < 767px
// ==================================================
+mobile() {
  // Posts in blocks.
  .content-wrap {
    padding: $content-mobile-padding;
  }

  .posts-expand {
    margin: initial;

    // Components inside Posts.
    .post-button {
      margin: $sidebar-offset 0;
    }
  }

  .post-block {
    border-radius: $border-radius;
    // Rewrite shadows & borders because all blocks have offsets.
    box-shadow: $box-shadow;
    min-height: auto;
    // Inside posts blocks content padding (default 40px).
    padding: $sidebar-offset;
  }

  // Only if blocks are siblings need bottom margin (homepage).
  #posts > article + article {
    .post-block {
      margin-top: $content-mobile-padding;
    }
  }

  .comments {
    margin-top: $content-mobile-padding;
    padding: 10px $sidebar-offset;
  }

  .pagination {
    margin: $content-mobile-padding 0 0;
  }
}
