/*
 * This file contains base styles that are overridden by custom stylesheets. These stylesheets need
 * to be placed in this directory, and they are imported at the bottom of the file.
 *
 * Define rules that are not supposed to be overridden after the @imports at the bottom of the file.
 */

@import "dimensions";
@import "global";

// Because FA is a SPECIAL SNOWFLAKE.
$fa-font-path: '@fortawesome/fontawesome-free/webfonts';

@import "@fortawesome/fontawesome-free/scss/fontawesome.scss";
@import "@fortawesome/fontawesome-free/scss/solid.scss";
@import "@fortawesome/fontawesome-free/scss/regular.scss";
@import "@fortawesome/fontawesome-free/scss/brands.scss";
@import "normalize-scss/sass/normalize/import-now";

body {
  background-color: $background_color;
  color: $foreground_color;
  font-family: $font_family_base;
  font-size: 13px;
  margin: 0;
  padding: 0;
  line-height: 1.15;
}

/* normalize.css breakage */
sup, sub {
  line-height: 1.15em;
}

sub {
  bottom: -0.15em;
}

h1, h2, h3, h4, h5 {
  font-weight: normal;
  text-rendering: optimizeLegibility;
  margin-bottom: 0.62em;
  line-height: 1.15em;
}

h1 { font-size: 24px; }

h2 { font-size: 22px; }

h3 { font-size: 19px; }

h4 {
  font-size: 17px;
  margin-top: 1em;
  margin-bottom: 0.5em;
}

// Slightly dirty, no clean way to strip top margins off headers though
.remove-top-margin {
  margin-top: 0;
}

h5 {
  margin-top: 0.5em;
  margin-bottom: 0.3em;
  font-size: 15px;
}

h6 {
  font-size: 10px;
  margin: 2px;
  margin-bottom: 0;
}

.paragraph {
  hyphens: none;
  margin-bottom: var(--padding-small);
  margin-top: var(--padding-small);
  margin-left: 2px;
  line-height: 1.35em;
}

.communication__body__text .paragraph {
  margin-bottom: var(--padding-normal);
}

.paragraph img, .communication__body__text img, .block__content img {
  max-width: 100%;
}

p {
  @extend .paragraph;
}

pre {
  background-color: $meta_color;
  padding: 10px;
  font-size: 11px;
  font-family: $font_family_monospace;
  border: 1px solid $meta_border_color;
  max-width: 100%;
  overflow-y: hidden;
  overflow-x: auto;

  code {
    border: 0;
    background: 0;
    padding: 0;
  }
}

a, a:active, a:visited {
  color: $link_color;
  text-decoration: none;
}

a:hover {
  color: $link_hover_color;
}

img {
  margin: 0;
  border: 0;
  vertical-align: bottom;
}

.clearfix {
  clear: both;
  height: 0;
}

/* Child selectors, as opposed to flat BEM classes, are justified in this case.
 * HTML tables are bulky to begin with; adding .table__row and .table__cell to every
 * item will hinder the development speed and decrease readability. */
.table {
  padding-left: 10px;
  width: 100%;
  border-collapse: collapse;
  border: $border;

  th {
    font-weight: bold;
    text-align: left;
    padding: 5px;
    &.center {
      text-align: center;
    }
  }

  > thead > tr {
    background: $background_color;
  }

  > tbody {
    border: $border;
    > tr {
      @include even-odd;
    }
  }

  td {
    padding: 5px;
  }
}

.table__tiny-column {
  width: 50px;
}

.border-vertical {
  border-top: 2px solid $border_color;
}

.background-success {
  background-color: $success_light_color;
}

.background-warning {
  background-color: $warning_light_color;
}

.background-danger {
  background-color: $danger_light_color;
}

hr {
  border: 0;
  height: 1px;
  background: $border_color;
  margin: var(--padding-small);
}

#error_explanation {
  margin: 1em 0;
  background: $warning_light_color;
  border: 1px solid $warning_color;
  padding: 0.62em;
  li {
    margin: 3px;
    margin-left: 15px;
  }
  h2 {
    font-size: 19px;
  }
}

//rules page. API page also borrows stuff from here
.rule {
  padding: 5px;
  h2 {
    background: $background_odd_color;
    border: $border;
    padding: 5px;
    padding-bottom: 7px;
  }
  h2.important {
    background: $danger_light_color;
    border-color: $danger_color;
  }
  // Make HTML lists with multi-line text readable
  ul {
    margin: 0;
    padding: 5px 20px;
  }
  li {
    padding: 5px 0;
  }
}

.walloftext {
  font-size: 14px;

  @media (max-width: 900px) {
    width: 95%;
  }
}

// Text Editor
blockquote {
  margin: 1em 2em;
  border: 1px dotted $foreground_color;
  padding: var(--padding-small);
  background-color: inherit;
}

blockquote .paragraph {
  &:first-child {
    margin-top: 0;
  }

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

// Prevent blockquote from gaining far too much indentation and breaking.
blockquote blockquote blockquote blockquote blockquote blockquote {
  margin: 1em 0;
  padding: 1em 2px;
}

// Horizontal space is at a high premium on mobile.
@media (max-width: $min_px_width_for_desktop_layout) {
  blockquote {
    margin: 1em 4px;
    padding: var(--padding-small) 4px;
  }
}

.spoiler, .spoiler-revealed {
  display: inline-block;
  position: relative;
}

.spoiler::before, .spoiler-revealed::before {
  content: ' ';
  display: block;
  position: absolute;
  pointer-events: none;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: $admin_links_hover_color;
}

.spoiler:hover::before, .spoiler-revealed::before {
  display: none;
}

.spoiler {
  background-color: $admin_links_hover_color;
  color: $admin_links_hover_color;

  a {
    color: $admin_links_hover_color;
  }

  code {
    background: 0;
    border: 0;
  }

  &:not(:hover) > .image-show-container {
    background: $admin_links_hover_color;

    > * {
      visibility: hidden;
    }
  }
}

.spoiler:hover, .spoiler-revealed {
  background-color: $admin_links_color;
  color: $foreground_color;
  a {
    color: $link_color;
  }
  a:hover {
    color: $link_dark_color;
  }
  code {
    @extend code;
  }
}

.literal {
  white-space: pre-wrap;
}

.editor-syntax-reference {
  margin-bottom: 6px;
}

@mixin image-alt-size($name, $size) {
  @media (min-width: $size) {
    img[alt=#{$name}] {
      max-height: $size !important;
      max-width: $size !important;
    }
  }
}

@include image-alt-size(tiny, $image_tiny_size);
@include image-alt-size(small, $image_small_size);
@include image-alt-size(medium, $image_medium_size);
@include image-alt-size(large, $image_large_size);

table {
  @extend .table;
}

code {
  background-color: $meta_color;
  border: 1px solid $meta_border_color;
  padding: 0 4px;
}

//donations
.donate-button {
  background: 0;
  border: 0;
  margin-left: 170px;
}

.button_to {
  display: inline;
}

/* User titles (admin/mod/assistant) and channel states (live/off air) */
.label {
  padding: 6px;
  overflow-y: hidden;
}

.label--small {
  font-size: 9px;
  overflow: hidden;
}

.label--block {
  display: inline-block;
  margin: 2px 6px 6px 0;
}

.label--narrow {
  padding: 0 2px;
}

.label--success {
  background: $success_light_color;
  border: 1px solid $success_color;
}

.label--danger {
  background: $danger_light_color;
  border: 1px solid $danger_color;
}

.label--warning {
  background: $warning_light_color;
  border: 1px solid $warning_color;
}

.label--purple {
  background: $assistant_color;
  border: 1px solid $assistant_border_color;
}

.label--primary {
  background: $primary_light_color;
  border: 1px solid $primary_color;
}

.large-text {
  font-size: 15px;
}

.small-text {
  font-size: 10px;
}

.page-current {
  padding: 0 $header_spacing;
}

i.favicon-home {
  background-image: url("/favicon.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  min-width: 1em;
  height: 1em;
  display: inline-block;
}

// changelog
.commit-sha {
  @extend .label--purple;
  padding: 2px;
  font-size: 12px;
  font-family: $font_family_monospace;
  vertical-align: top;
}

.commit-message {
  display: block;
}

span.stat {
  font-size: 18px;
}

.seamless-frame {
  border: 0;
  overflow: hidden;
  padding: 0;
}

@import "barline";
@import "blocks";
@import "burger";
@import "buttons";
@import "dropdown";
@import "forms";
@import "header";
@import "layout";
@import "media";
@import "shame";
@import "text";

@import "views/adverts";
@import "views/approval";
@import "views/badges";
@import "views/channels";
@import "views/comments";
@import "views/commissions";
@import "views/communications";
@import "views/duplicate_reports";
@import "views/filters";
@import "views/galleries";
@import "views/images";
@import "views/notifications";
@import "views/pages";
@import "views/polls";
@import "views/posts";
@import "views/profiles";
@import "views/pagination";
@import "views/search";
@import "views/staff";
@import "views/stats";
@import "views/tags";

.no-overflow {
  overflow: hidden;
}

.no-overflow-x {
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}
