// Dependencies.
@import 'components/clearfix/clearfix';

// Tabs
//
// Markup:
// {{> "tabs"}}
// {{> "tabs--secondary"}}
//
// Style guide: components.navigation.tabs

// Tabs (primary)
//
// Markup: tabs.hbs
//
// Style guide: components.navigation.tabs.primary

.tabs,
%tabs {
  @extend %clearfix;
  @include margin(1 0);
  background-image: none;
  margin-bottom: 36px;
  border-left: 3px solid color(tabs-border);
  text-indent: 0;
  @if support-legacy-browser(ie, '9') {
    // IE 9 and earlier don't understand gradients.
    border-bottom: 1px solid color(tabs-border) \0/ie;
  }
  padding: 0;
  list-style: none;
  white-space: nowrap;

  @media print {
    display: none;
  }

  @include respond-to('small') {
    border-bottom: 3px solid color(tabs-border);
    border-left: 0;
  }
}

.tabs__tab,
%tabs__tab {
  margin: 0;
  float: left;
  width: 100%;

  @include respond-to('small') {
    width: auto;
  }

  @if support-legacy-browser(ie, '9') {
    // IE 9 and earlier don't understand gradients.
    border-bottom: 0 \0/ie;
  }

  @include rtl() {
    float: right;
  }
}

%tabs__tab-link-common {
  //@include adjust-leading-to(1);
  // Add a top-left bevel.
  border: 1px solid lighten(color(tab-bg), 5%);
  border-right: 0;
  border-bottom: 0;
  display: block;
  text-decoration: none;
}

.tabs__tab-link,
%tabs__tab-link {
  @include line-height(1);
  color: color(tab-secondary);
  background-color: none;
  width: 100%;
  padding: 18px 20px;
  text-decoration: none;
  text-transform: uppercase;
  display: inline-block;

  @include respond-to('small') {
    width: auto;
    padding: 20px 25px;
  }

  &:focus,
  &:hover {
    color: color(tab-hover);
    text-decoration: underline;
    outline: none;
    border: 0;
  }
}

.tabs__tab-link.is-active,
%tabs__tab-link-is-active {
  font-weight: weight(bold);
  position: relative;
  color: color(link);
  text-decoration: none;

  &:before {
    content: '';
    width: 3px;
    height: 100%;
    border-left: 3px solid color(link);
    border-bottom: 0;
    bottom: 0;
    left: -3px;
    position: absolute;

    @include respond-to('small') {
      border-bottom: 3px solid color(link);
      border-left: 0;
      width: 100%;
      height: 3px;
      bottom: -3px;
      left: 0;
    }
  }
}

// Secondary tabs
//
// Markup: tabs--secondary.hbs
//
// Style guide: components.navigation.tabs.secondary

.tabs--secondary,
%tabs--secondary {
  @extend %tabs;
  @include font-size(11px);
  background-image: none;
  border: 0;
}

.tabs +,
%tabs + {
  .tabs--secondary,
  %tabs--secondary {
    @include background-image(linear-gradient(bottom, color(tabs-border) 1px, transparent 1px));
    // Collapse bottom margin of .tabs.
    @include margin-top (- 1);
  }
}

.tabs--secondary__tab,
%tabs--secondary__tab {
  //@include output-rhythm(margin, rhythm(1)/2 3px);
  float: left;

  @include rtl() {
    float: right;
  }
}

.tabs--secondary__tab-link,
%tabs--secondary__tab-link {
  @extend %tabs__tab-link-common;
  @include border-radius(.75em);
  @include transition(background-color .3s);
  @include single-text-shadow(color(tab-text-shadow), 1px, 1px, 0);
  @include padding(0 .5);
  color: color(tab-secondary);
  background-color: lighten(color(tab-bg), 8%);

  &:focus,
  &:hover {
    color: darken(color(tab-secondary), 20%);
    background-color: color(tab-bg);
    border-color: darken(color(tab-bg), 26.5%);
  }

  &:active {
    @extend %tabs--secondary__tab-link-is-active;
  }
}

.tabs--secondary__tab-link.is-active,
%tabs--secondary__tab-link-is-active {
  @include single-text-shadow(darken(color(tab-secondary), 20%), 1px, 1px, 0);
  color: lighten(color(tab-bg), 15%);
  background-color: color(tab-secondary);
  border-color: darken(color(tab-secondary), 40%);
}
