/**
 * @file
 * Styles for tabs.
 */

.reset-appearance {
  margin: 0;
  padding: 0;
  border: 0 none;
  background: transparent;
  line-height: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.position-container {
  position: relative;
}

.is-collapse-enabled .tabs,
.is-horizontal .tabs {
  position: relative;
}

.is-collapse-enabled .tabs::before,
.is-horizontal .tabs::before {
  position: absolute;
  z-index: 10;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  height: 1px;
  content: "";
  background-color: #a6a6a6;
}

/* Span the full width of the viewport. */
.content-header .is-horizontal .tabs::before,
.content-header .is-collapse-enabled .tabs::before {
  right: -2.5em;
  left: -2.5em;
}

/**
 * Tab styles.
 *
 * 1. They are required by some elements such as <button>.
 * 2. The fixed height is needed to ensure alignment with absolutely-positioned
 *    active tab.
 */
.tabs__tab {
  position: relative;
  display: block;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%; /* 1 */
  margin: -1px 0 0;
  padding: 9px 2em 7px 1em; /* LTR */
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #0074bd;
  border: 1px solid #bfbfbf;
  background-color: rgb(254, 253, 250, 0.7);
  [dir="rtl"] & {
    padding-right: 1em;
    padding-left: 2em;
  }
  &:hover,
  &:focus {
    color: #0179bc;
    background-color: #fafaf7;
  }
  li& {
    display: block;
    padding: 0;
    [dir="rtl"] & {
      /* This is required to win over the specificity of [dir="rtl"] .tabs__tab. */
      padding-right: 0;
      padding-left: 0;
    }
    & a {
      padding: 9px 2em 7px 1em; /* LTR */
      color: #007496;
      [dir="rtl"] & {
        padding-right: 1em;
        padding-left: 2em;
      }
    }
  }
}

.tabs a:hover,
.tabs a:focus {
  text-decoration: none;
}

/* Primary tabs. */
.tabs.primary {
  clear: both;
  margin: 16px 0 0;
  margin: 1rem 0 0;
  .region-header & {
    margin: 0;
  }
  & .tabs__tab.is-active {
    z-index: 15;
    color: #004f80;
    border-color: #a6a6a6;
    border-radius: 4px 0 0 0; /* LTR */
    background-color: #fff;
    [dir="rtl"] & {
      border-top-left-radius: 0;
      border-top-right-radius: 4px;
    }
  }
  & a {
    background: none;
    &:focus,
    &:hover {
      text-decoration: underline;
      color: #0179bc;
      background-color: #fafaf7;
    }
  }
  & .is-active a:focus {
    text-decoration: underline;
    background: none;
  }
}

/* Only add the arrow if there is space. */
@media screen and (min-width: 18.75em) {
  /* 300px */
  .tabs.primary a {
    background: url(../../images/icons/0074bd/chevron-right.svg) 99% center no-repeat;
    [dir="rtl"] & {
      background: url(../../images/icons/0074bd/chevron-left.svg) 1% center no-repeat;
    }
  }
  .tabs.primary .tabs__tab.is-active a {
    background-image: none;
  }
}

.tabs__trigger {
  display: none;
}

.is-collapse-enabled .tabs__trigger {
  /* JavaScript dependent styles. */
  position: absolute;
  z-index: 10;
  top: 2px;
  right: 0; /* LTR */
  left: auto; /* LTR */
  display: block;
  box-sizing: content-box;
  width: 25%;
  padding-right: 4px;
  padding-left: 4px;
  text-align: center;
  letter-spacing: 0.1em;
  border-bottom: 0;
  border-left: 0; /* LTR */
  border-radius: 0 4px 0 0; /* LTR */
  outline: 0;
  font-family: Arial, sans-serif;
  font-size: 1.25em;
  [dir="rtl"] & {
    right: auto;
    left: 0;
    border-right: 0;
    border-left: 1px solid #bfbfbf;
    border-radius: 4px 0 0 0;
  }
}

.is-collapse-enabled .tabs {
  overflow: hidden;
  max-height: 0;
  padding-top: 38px;
}

.tabs.is-open {
  max-height: 999em;
  padding-bottom: 16px;
  padding-bottom: 1rem;
}

.is-collapse-enabled .tabs__tab.is-active {
  position: absolute;
  top: 2px;
  left: 0; /* LTR */
  width: 75%;
  border-bottom: 0;
}

[dir="rtl"] .is-collapse-enabled .tabs__tab.is-active {
  right: 0;
  left: auto;
}

.is-collapse-enabled .tabs.primary a.is-active::before {
  content: none;
}

.is-open .tabs__tab.is-active {
  color: #004f80;
  border-color: #a6a6a6;
  border-bottom: 1px solid #a6a6a6;
  background-color: #fff;
}

/* Styles for the horizontal state always take the priority. */
.is-horizontal .tabs {
  display: flex;
  overflow: visible;
  flex-wrap: wrap;
  max-height: none !important;
  padding-top: 0 !important;
}

.is-horizontal .tabs__tab {
  float: left; /* LTR */
  width: auto;
  height: auto;
  margin: 0 0 -1px;
  text-align: center;
  border-bottom: none;
  [dir="rtl"] & {
    float: right;
    /* This is required to win over the specificity of [dir="rtl"] .tabs > li. */
    margin-left: 0;
  }
  & + .tabs__tab {
    margin-left: -1px; /* LTR */
    [dir="rtl"] & {
      margin-right: -1px;
      margin-left: 0;
    }
  }
}

.is-horizontal .tabs.primary .tabs__tab:first-child {
  border-radius: 4px 0 0 0; /* LTR */
  [dir="rtl"] & {
    border-radius: 0 4px 0 0;
  }
}

.is-horizontal .tabs.primary .tabs__tab:last-child {
  border-radius: 0 4px 0 0; /* LTR */
  [dir="rtl"] & {
    border-radius: 4px 0 0 0;
  }
}

/* Override the states above. */
.is-horizontal .tabs__tab.is-active,
.is-horizontal .tabs.primary .tabs__tab.is-active,
[dir="rtl"] .is-horizontal .tabs.primary .tabs__tab.is-active {
  position: relative;
  top: 0;
  width: auto;
  margin: 0 -4px;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

.is-horizontal .tabs.primary a {
  padding: 7px 2em 7px 2em;
  background-image: none;
}

.is-horizontal .tabs__trigger {
  display: none;
}

.tabs.secondary {
  display: block;
  margin-top: 16px;
  margin-top: 1rem;
  & .tabs__tab {
    display: block;
    margin-left: -1px; /* LTR */
    padding: 5px 15px 5px 16px; /* LTR */
    -webkit-transition:
      border-color 0.2s,
      background-color 0.2s;
    transition:
      border-color 0.2s,
      background-color 0.2s;
    color: #0074bd;
  }
  is-horizontal & {
    display: flex;
  }
  [dir="rtl"] & .tabs__tab {
    margin-right: -1px;
    margin-left: 0;
    padding-right: 16px;
    padding-left: 15px;
  }
  /**
   * This is required to win over the specificity of
   * [dir="rtl"] .tabs.secondary .tabs__tab.
   */
  [dir="rtl"] .views-displays & li,
  [dir="rtl"] .views-displays & li.is-active {
    padding-right: 0;
    padding-left: 0;
  }
  & .tabs__tab + .tabs__tab {
    border-top: 1px solid #d9d8d4;
  }
  & .tabs__tab.is-active {
    padding-left: 15px; /* LTR */
    color: #004f80;
    border-left: 2px solid #004f80; /* LTR */
  }
  [dir="rtl"] & .tabs__tab.is-active {
    padding-right: 15px;
    border-right: 2px solid #004f80;
    border-left: 1px solid #bfbfbf;
  }
  /**
   * This is required to win over the specificity of
   * [dir="rtl"] .tabs.secondary .tabs__tab.is-active.
   */
  [dir="rtl"] .views-displays & li.is-active {
    padding-right: 0;
    border: 0 none;
  }
  & .tabs__tab:hover,
  & .tabs__tab:focus {
    padding-left: 15px; /* LTR */
    color: #0179bc;
    border-left: 2px solid #008ee6; /* LTR */
  }
  [dir="rtl"] & .tabs__tab:hover,
  [dir="rtl"] & .tabs__tab:focus {
    padding-right: 15px;
    border-right: 2px solid #008ee6;
    border-left: 1px solid #bfbfbf;
  }
}

/**
 * This is required to win over the specificity of
 * [dir="rtl"] .tabs.secondary .tabs__tab:hover.
 */
[dir="rtl"] .views-displays .tabs li.tabs__tab:hover {
  padding-right: 0;
  border: 0 none;
}

.tabs.secondary a {
  padding: 7px 13px 5px;
  text-decoration: none;
  background-color: transparent;
  /**
   * This is required to win over the specificity of [dir="rtl"] li.tabs__tab a.
   */
  [dir="rtl"] & {
    padding-right: 13px;
    padding-left: 13px;
  }
  /**
   * This is required to win over the specificity of
   * [dir="rtl"] .tabs.secondary a.
   */
  [dir="rtl"] .views-displays & {
    padding-right: 7px;
    padding-left: 7px;
  }
}

.tabs.secondary .is-active a {
  color: #004f80;
}

.tabs.secondary a:focus {
  text-decoration: underline;
}

/* Styles for the horizontal state. */
.is-horizontal .tabs.secondary .tabs__tab {
  position: relative;
  z-index: 15;
  top: 0;
  float: left; /* LTR */
  margin-right: 1em;
  margin-left: 1em;
  padding: 0;
  border-top: 0;
  border-right-color: transparent; /* LTR */
  border-bottom: 2px solid transparent;
  border-left: 1px solid transparent; /* LTR */
  background: none;
  /**
   * This is required to win over the specificity of
   * [dir="rtl"] .tabs.secondary .tabs__tab:hover and
   * [dir="rtl"] .tabs.secondary .tabs__tab:focus.
   */
  [dir="rtl"] & {
    float: right;
    padding-right: 0; /* 1 */
    border-right: 1px solid transparent;
    border-left-color: transparent;
  }
  &.is-active {
    border-bottom-color: #004f80;
  }
  &:hover,
  &:focus {
    border-bottom-color: #008ee6;
  }
}
