// ============================================================================
// :: Preview
// ============================================================================
/**
 * Component used in combination with bp-presentation to display the component
 * with its information and representing code.
 */

// ============================================================================
// :: Root
// ============================================================================
.bp-preview {
  position: relative;

  + .bp-preview {
    margin-top: 8rem;
  }
}

// ============================================================================
// :: Elements
// ============================================================================
.bp-preview__info {
  padding: 2rem 2rem 0;

  border-top: 1px solid $bp-border-color-base;
  border-left: 1px solid $bp-border-color-base;
  border-right: 1px solid $bp-border-color-base;

  @include respond-at($bp-breakpoint-tablet-base) {
    padding: 3rem 3rem 0;
  }
}

.bp-preview__component {
  padding: 8rem 3rem;

  border-bottom: 1px solid $bp-border-color-base;
  border-left: 1px solid $bp-border-color-base;
  border-right: 1px solid $bp-border-color-base;
}

.bp-preview__nav,
.bp-preview__text {
  margin-bottom: 2.5rem;

  &:last-child {
    margin-bottom: 0;
    padding-bottom: 2.5rem;

    border-bottom: 1px solid $bp-border-color-base;
  }
}

.bp-preview__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bp-preview__title {
  font-weight: $bp-font-weight-bold;
  font-size: $bp-font-size-1x-large;
  letter-spacing: 0.05rem;
  text-decoration: none;
}

.bp-preview__action {
  margin-left: 3.5rem;
  padding: 0;

  font-size: 2.4rem;
  text-decoration: none;

  color: $bp-text-color-medium;
  border: none;
  background: transparent;

  cursor: pointer;

  transition: color 0.2s ease-in-out;

  &:hover {
    color: $bp-primary-color;
  }
}

.bp-preview__code {
  display: none;
}

// ============================================================================
// :: Modifiers
// ============================================================================
.bp-preview--full-width {

  /**
   * if this modifier is on the root, apply the styling, but if the code is
   * enabled this styling is not applied.
   */
  &:not([class*="has-code-enabled"]) {

    .bp-preview__nav,
    .bp-preview__text {
      border-bottom: none;
    }

    .bp-preview__component {
      max-width: 100%;

      border-top: 1px solid $bp-border-color-base;
    }
  }
}

.bp-preview--solo {

  .bp-preview__text {
    display: none;
  }

  .bp-preview__info {
    padding-top: 1.5rem;
  }

  .bp-preview__nav {
    margin-bottom: 0;
    padding-bottom: 1.5rem;

    border-bottom: 1px solid $bp-border-color-base;
  }
}

// ============================================================================
// :: States
// ============================================================================
.bp-preview {

  &.has-code-enabled {

    .bp-preview__component {
      max-height: 35rem;
      overflow: auto;
    }

    .bp-preview__content {
      display: none;
    }

    .bp-preview__code {
      display: block;
    }
  }
}
