@import "../vars";

.clearfix:after {
  content: ".";
  display: block;
  clear: both;
  visibility: hidden;
  line-height: 0;
  height: 0;
}

html {
  scroll-behavior: smooth;
}
html, body {
  padding: 0;
  margin: 0;
  border: 0;
  background-color: $bg;
  color: $fg;
  height: 100%;
  min-height: 100%;
}
body {
  font-family: $ff;
  font-size: $fs;
}

.no-select {
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
  user-select: none; /* Non-prefixed version, currently
                                  supported by Chrome, Edge, Opera and Firefox */
}
.no-drag {
  -webkit-user-drag: none;
}

span.normal {
  font-weight: normal;
}

.base-width {
  max-width: $base-width;
  margin: 0 auto;
  position: relative;
}

body.full-width .base-width {
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

@media screen and (min-width: $wide_width) {
  body.wide .base-width {
    max-width: $wide_width;
    margin-left: auto;
    margin-right: auto;
  }
}

.matched {
  background: $hl_matched_bg;
  color: $hl_matched_fg;
  padding: 0 1px;
  border-radius: 3px;
}

input[type="text"],
input[type="password"],
textarea {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  box-sizing: border-box;
  border: 1px $input-border solid;
  background-color: $input-bg;
  color: $fg;
  font-family: $ff;
  font-size: $fs;
  padding: 6px;
  outline: none;
  @include radius(3px);

  &:focus {
    border-color: $input-border-focused;
  }
}
textarea {
  resize: vertical;
}

button {
  @include radius(3px);
  background-color: $light-bg;
  color: $fg;
  padding: 6px 12px;
  border: 1px $input-border solid;
  font-family: $ff;
  font-size: $fs;
  outline: none;
  cursor: pointer;
  position: relative;
}
button:hover {
  background-color: $input-border;
}
button:active {
  border-color: $input-border-focused;
  background-color: $input-border-focused;
}


a {
  text-decoration: none;
  color: $link-color;
  outline: none;
  border-bottom: 1px $link-color-underline solid;
}
a:hover {
  border-bottom-color: $link-color-underline-hover;
}
@mixin no-underline($underline-on-hover: false) {
  &, &:hover {
    border-bottom: none !important;
  }

  @if $underline-on-hover {
    &:hover {
      border-bottom: 1px solid $link-color-underline-hover !important;
    }
  }
}

p, p code, li {
  line-height: 140%;
}

.unicode { font-family: sans-serif; }

.ff_ms   { font-family: $ffMono }
.fl_r    { float: right }
.fl_l    { float: left }
.pos_rel { position: relative }
.pos_abs { position: absolute }
.pos_fxd { position: fixed }

.page-content {
  padding: 0 $side-padding;
}
.page-content-inner {
  padding: 0 0 $base-padding 0;
}


table.contacts {
  border: 0;
  border-collapse: collapse;
  margin: 8px auto 0;
}
table.contacts td {
  padding-bottom: 15px;
  vertical-align: top;
}
table.contacts td.label {
  text-align: right;
  width: 30%;
  color: $dark-grey;
}
table.contacts td.value {
  text-align: left;
  padding-left: 8px;
}
table.contacts td.value span {
  background: $inline-code-block-bg;
  padding: 3px 7px 4px;
  border-radius: 3px;
  color: $fg;
  font-family: $ffMono;
  font-size: $fs - 1px;
}
table.contacts td b {
  font-weight: 600;
}
table.contacts td pre {
  padding: 0;
  margin: 0;
  font-size: 12px;
}

table.contacts div.note {
  font-size: $fs - 3px;
  padding-top: 2px;
  color: $dark-grey;
  > a {
    color: $dark-grey;
    border-bottom: 1px $border-color solid;
    &:hover {
      text-decoration: none;
      color: $link-color;
      border-bottom-color: $link-color;
    }
  }
}

.pt {
  margin: 5px 0 20px;
  color: $dark-fg;
  padding-bottom: 7px;
  border-bottom: 2px rgba(255, 255, 255, 0.12) solid;
}
.pt h3 {
  margin: 0;
  display: inline-block;
  font-weight: bold;
  font-size: $fs;
  color: $fg;
}
.pt h3:not(:first-child) {
  margin-left: 5px;
}
.pt a {
  margin-right: 5px;
}
.pt a:not(:first-child) {
  margin-left: 5px;
}
.pt a, .pt h3 {
  position: relative;
  top: 1px;
}
.pt_r { margin-top: 5px }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: $grey;
  @include radius(3px);
  background-color: $light-bg;
}

.md-file-attach {
  padding: 3px 0;
}
.md-file-attach-icon {
  width: 14px;
  height: 14px;
  background: transparent url(/img/attachment.svg) no-repeat center center;
  background-size: 14px 14px;
  display: inline-block;
  margin-right: 5px;
  position: relative;
  top: 1px;
}
.md-file-attach > a {
  //font-weight: bold;
}
.md-file-attach-size {
  color: $grey;
  margin-left: 2px;
}
.md-file-attach-note {
  color: $fg;
  margin-left: 2px;
}

.md-image {
  padding: 3px 0;
  line-height: 0;
  max-width: 100%;
}
.md-images {
  margin-bottom: -8px;
  padding: 3px 0;
  max-width: 100%;
}
.md-images .md-image {
  padding-top: 0;
  padding-bottom: 0;
}
.md-images > span {
  display: block;
  float: left;
  margin: 0 8px 8px 0;
  max-width: 100%;
}
.md-image.align-center { text-align: center; }
.md-image.align-left   { text-align: left; }
.md-image.align-right  { text-align: right; }
.md-image-wrap {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
}
.md-image-wrap > a {
  display: block;
  max-width: 100%;
  @include no-underline();
}
.md-image-note {
  line-height: 130%;
  color: $dark-grey;
  padding: 8px 0 4px;
  font-style: italic;
}

.md-video video {
  max-width: 100%;
}

.language-ascii {
  line-height: 125% !important;
}


.index-book {
  //margin-top: -10px;
  //padding-top: 5px;
  &-image-wrap {
    float: left;
    width: 300px;
    height: 463px;
    > a {
      @include no-underline();
    }
  }
  &-image {
    background: url(/img/cover.jpg?1) no-repeat 0 0;
    background-size: 600px 463px;
    display: block;
    text-decoration: none;
    width: 300px;
    height: 463px;
    outline: none;
  }
  &-updates {
    float: right;
    text-align: right;
    line-height: 140%;
    &-link-wrap {
      border-top: 1px $border-color solid;
      margin-top: 13px;
      padding-top: 10px;
      display: inline-block;
      padding-left: 3px;
    }
  }
}
.index-dl-line {
  margin-left: 315px;
  margin-bottom: 15px;
  display: block;
  background: $hover-hl;
  padding: 30px 20px;
  border-radius: 4px;
  text-align: center;
  text-decoration: none;

  &:last-child { margin-bottom: 0 }

  &:hover {
    background-color: $hover-hl-darker;
  }

  > b {
    color: $link-color;
    position: relative;
  }

  &-info {
    color: $grey;
    padding-top: 5px;

    > span.bullet {
      margin: 0 3px;
      opacity: 0.65;
      font-size: $fs - 2px;
      position: relative;
      top: -1px;
      color: $grey !important;
    }
  }
}
a.index-dl-line {
  @include no-underline();
  text-decoration: none;
  //&:hover {
  //  > b:after {
  //    display: block;
  //    content: '';
  //    position: absolute;
  //    bottom: 0;
  //    left: 0;
  //    right: 0;
  //    height: 1px;
  //    background-color: $link-color-underline;
  //  }
  //}
}

.bc {
  &.mt {
    margin-top: $base-padding;
  }

  > a.bc-item, > span.bc-item {
    font-size: $fs + 2px;
    line-height: $fs + 6px;
    display: inline-block;
    padding: 4px 9px;
    vertical-align: middle;

    margin-bottom: 8px;
    &:not(:last-child) {
      margin-right: 8px;
    }
  }

  > a.bc-item {
    @include no-underline();
    background-color: $hover-hl;
    border-radius: 4px;
  }
  > span.bc-item {
    padding: 4px;
    &:first-child {
      padding-left: 0;
    }
  }

  > a.bc-item:hover {
    text-decoration: none;
    border-bottom-color: $link-color-underline;
    background-color: $hover-hl-darker;
  }

  // arrow
  span.bc-arrow {
    color: $light-grey;
    vertical-align: middle;
    opacity: .7;
    > svg {
      position: relative;
      top: 3px;
      margin-left: -6px;
      margin-right: -4px;
      margin-top: -1px;
    }
  }
}
