////
/// @group components
////

/// Tabbed navigational structure
///
/// BEM elements:
///   - `__list`    The containing list of tabs
///   - `__tab`     An individual tab
///   - `__tab-btn` A button within a tab
///   - `__content` The tabs content - container for the
///   - `__pane`    An individual tab pane
///
/// @todo Tabs on mobile devices
///
/// @example html
///   <div class="tabs" data-tabs>
///     <ul class="tabs__list" role="tablist">
///       <li class="tabs__tab" role="presentation">
///         <button class="tabs__tab-btn" type="button" role="tab">
///           Tab 1
///         </button>
///       </li>
///       <li class="tabs__tab" role="presentation">
///         <button class="tabs__tab-btn" type="button" role="tab">
///           Tab 2
///         </button>
///       </li>
///     </ul>
///     <div class="tabs__content">
///       <div class="tabs__pane" role="tabpanel">
///         Tab content 1
///       </div>
///       <div class="tabs__pane" role="tabpanel">
///         Tab content 2
///       </div>
///     </div>
///   </div>
/// @since 0.1.0
.tabs {
  margin: em($spacing-medium 0 $spacing-large);

  // The list of tabs
  &__list {
    list-style: none;
    margin: 0;
    overflow: hidden;
    padding: 0;
    position: relative;
    top: 1px; // To cover the border around the tabs content
  }

  // Individual tab
  &__tab {
    float: left;

    &--active .tabs__tab-btn { // sass-lint:disable-line no-combinators
      background: $colour-panel-default;
      border-left: 1px solid $colour-border;
      border-right: 1px solid $colour-border;
      border-top: 1px solid $colour-border;
      box-shadow: inset 0 em($spacing-x-small) 0 0 $colour-nice-teal;
      color: $colour-text;
      text-decoration: none;
    }
  }

  // The button/link for the tab itself
  &__tab-btn {
    @extend %link;
    background: 0;
    border: 0;
    border-left: 1px solid transparent;
    border-right: 1px solid transparent;
    border-top: 1px solid transparent;
    cursor: pointer;
    display: block;
    margin: 0;
    padding: em($spacing-medium $spacing-medium);
  }

  // The tab content containing the tab panels
  &__content {
    background: $colour-panel-default;
    border: 1px solid $colour-border;
    padding: em($spacing-medium);
  }

  // An individual tab content pane
  &__pane {

    // Assume tabs will stack if no JS is available
    .js & {
      display: none;

      &--active {
        display: block;
      }
    }

    :first-child {
      margin-top: 0;
    }

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