/* hide the reply border above the time gap notices */
.time-gap + .topic-post article {
  border-top: none;
}

.time-gap {
  .topic-avatar {
    display: none;
  }
}

.topic-post article {
  border-top: 1px solid $primary-low;
  padding: 15px 0 8px 0;
}

.post-stream {
  padding-bottom: 30px;
}

span.badge-posts {
  margin-right: 5px;
}

.show-replies {
  display: none;
}

.topic-post {
  nav.post-controls {
    color: dark-light-choose($primary-low-mid, $secondary-high);
    .actions {
      display: flex;
    }
    // Handles the like and flag buttons in the post menu.
    .double-button {
      display: flex;
      flex: 0 1 auto;
      button {
        &.like,
        &.read-indicator,
        &.create-flag {
          flex: 1 1 auto;
        }
        &.button-count {
          padding: s(2 1 2 2);
          + .toggle-like,
          + .create-flag {
            padding: s(2 2 2 1);
          }
          &.my-likes,
          &.regular-likes {
            display: flex;
            max-width: unset;
            padding: s(2);
            .d-icon {
              padding-left: s(2);
            }
          }
        }
      }
    }
    .d-icon {
      opacity: 1;
    }
    button {
      border: none;
      font-size: $font-up-1;
      padding: 10px 8px;
      background: transparent;
      flex: 1 1 auto;
      max-width: 45px;
      &.hidden {
        display: none;
      }
      &.admin {
        position: relative;
      }
      &.expand-post {
        margin: 10px 0 10px 0;
      }
      &.reply {
        .d-icon {
          color: $primary-high;
        }
        margin-left: auto;
      }
      &.has-like {
        .d-icon {
          color: $love;
        }
      }
      &.bookmarked {
        .d-icon {
          color: $tertiary;
        }
      }
    }
  }
}

.post-admin-menu {
  display: inline-flex;
  flex-direction: column;
  box-sizing: border-box;
  background-color: $secondary;
  width: auto;
  max-width: 320px;
  padding: 10px;
  border: 1px solid $primary-low;
  position: absolute;
  text-align: left;
  bottom: -50px;
  left: 135px;
  @media screen and (max-width: 374px) {
    left: 50px;
  }
  z-index: z("dropdown");
  h3 {
    margin-top: 0;
    color: $primary;
    font-size: $font-0;
  }
  ul {
    list-style: none;
    margin: 10px 0 0 0;
  }
  li {
    margin-bottom: 5px;
    .d-icon {
      width: 14px;
      margin-right: 10px;
    }
  }
}

.embedded-posts {
  .topic-meta-data h5 a {
    margin-left: 10px;
  }
}

.post-actions {
  /* overriding display: here was causing hidden element to take up space */
}

.post-action {
  float: right;
  margin-right: 10px;
  clear: right;
}

.post-action .relative-date {
  margin-left: 5px;
}

a.reply-to-tab {
  z-index: z("base") + 1;
  color: dark-light-choose($primary-medium, $secondary-medium);
  margin-right: 0.5em;
}

.topic-post .boxed .contents {
  clear: both;
}

.topic-map {
  margin: 10px 0;
  h4 {
    line-height: $line-height-medium;
  }
  .user {
    float: left;
    margin-right: 10px;
  }
  .map-collapsed {
    .secondary {
      display: none;
    }
  }
  .map {
    li {
      float: left;
      padding: 7px 8px;
      &:last-of-type {
        border-right: 0;
      }
    }
    .number {
      line-height: $line-height-medium;
    }
    .number,
    .d-icon {
      color: dark-light-choose($primary-high, $secondary-low);
      font-size: $font-up-1;
    }
    .avatar + a {
      float: left;
    }
  }
  li.avatars {
    display: none;
  }
  .links,
  .information,
  .avatars {
    padding: 10px;
    color: $primary;
    overflow: auto;
  }
  .information {
    p {
      margin: 0 0 10px 0;
    }
  }
  .buttons {
    .btn {
      border: 0;
      padding: 0 15px;
      color: dark-light-choose($primary-medium, $secondary-high);
      background: blend-primary-secondary(5%);
      border-left: 1px solid $primary-low;
      .fa {
        margin: 0;
        font-size: $font-up-2;
        line-height: 52px;
      }
    }
  }
  .link-summary .btn {
    color: dark-light-choose($primary-medium, $secondary-high);
    background: blend-primary-secondary(5%);
    width: 100%;
  }
}

#topic-footer-buttons {
  @include clearfix;
  padding: 20px 0 0 0;
  .d-icon-bookmark.bookmarked {
    color: $tertiary;
  }
  .combobox {
    margin-right: 0.5em;
    width: 160px;
    margin-bottom: 0.5em;
  }
}

#topic-footer-buttons {
  .topic-notifications-button,
  .pinned-button {
    display: flex;
    align-items: center;
    @include breakpoint(mobile-medium) {
      display: inline-block;
      .reason {
        display: block;
        margin: 0.5em 0 0 0;
      }
    }
  }
}

#topic-footer-button {
  width: 100px;
  margin: 0 auto;
}

.suggested-topics {
  clear: left;
  padding: 20px 0 15px 0;
  th.views,
  td.views,
  td.activity,
  th.activity,
  th.likes,
  td.likes {
    display: none;
  }
  a.badge-category,
  a.badge-category-parent {
    font-size: $font-down-1;
    vertical-align: top;
  }
}

span.post-count {
  background: $primary;
  color: $secondary;
  opacity: 0.8;
}

#topic-footer-buttons {
  .btn {
    margin-bottom: 0.5em;
    margin-right: 0.5em;
  }
}

#topic-title {
  z-index: z("base") + 1;
  margin: 0 0 0 0 !important;
  padding: 15px 0;
}

// mobile has no fixed width on topic-body so overflow: hidden causes problems
.topic-body {
  overflow: visible;
  .cooked {
    overflow: visible;
  }
}

// instead, for mobile we set overflow hidden on the post's #main-outlet
// this prevents image overflow on deeply nested blockquotes, lists, etc
[class*="archetype-"] #main-outlet {
  overflow: hidden;
}

.quote-button.visible {
  display: block;
  z-index: z("tooltip");
}

iframe {
  max-width: 100%;
}

.open > .dropdown-menu {
  display: block;
}

.dropdown-menu li {
  margin: 5px 0;
  .fa {
    float: left;
    margin-right: 5px;
    padding-top: 1px;
  }
  span {
    color: dark-light-choose($primary-medium, $secondary-medium);
  }
  span.title {
    color: $primary;
  }
}

.btn-group {
  margin-top: 25px;
  position: relative;
}

.dropdown-toggle {
  float: left;
  position: relative;
}

.selected-posts {
  padding: 0.1em 0.7em;
}

// hide the full set of selection buttons on mobile
.select-posts button {
  display: none;
}

// unhide the simple "select just this post" button
button.select-post {
  display: inline-block;
}

.deleted {
  .topic-body {
    background-color: dark-light-diff(
      rgba($danger, 0.7),
      $secondary,
      50%,
      -60%
    );
  }
}

.deleted-user-avatar {
  font-size: $font-up-5;
}

span.btn-text {
  display: none;
}

blockquote {
  clear: both;
  /* leave browser defaults for top and bottom here */
  margin-left: 0;
  margin-right: 0;
}

.gap {
  padding: 0.25em 0;
}

.posts-wrapper {
  position: relative;
}

span.highlighted {
  background-color: $highlight-low;
}

.topic-avatar {
  float: left;
  margin-right: 10px;
  z-index: z("base") + 1;
  /* must render on top of topic-body + topic-meta-data, otherwise not tappable */
}

.topic-meta-data {
  margin-left: 50px;
  font-size: $font-down-1;
  .names {
    line-height: $line-height-medium;
    display: flex;
    flex-wrap: wrap;

    .full-name {
      font-weight: bold;
    }

    .first {
      order: 1;
    }

    .poster-icon {
      order: 2;
    }

    .second {
      order: 3;
      flex-basis: 100%;
    }

    .user-title {
      order: 4;
      flex-basis: 100%;
    }
    span {
      margin-right: 4px;
    }
  }
}

.username.new-user a {
  color: $primary-low-mid;
}

.user-title {
  color: $primary-medium;
  overflow: hidden;
  margin-right: 50px;
}

.read-state {
  display: none;
}

.signup-cta {
  margin-left: auto;
  margin-right: auto;
  width: calc(100% - 50px);
  a {
    margin-top: 7px;
  }
  button {
    margin-right: 7px;
  }
}

.popup-menu {
  h3 {
    margin-bottom: 0;
  }
}

.post-notice {
  margin-bottom: 1em;
  &.old {
    border-top: none;
    padding-top: 0;
  }
}
