////
///Placeholder for Copyright ///
////

// ----------------------------------------------------------------------------
// Rules
// ----------------------------------------------------------------------------

// Navigation tabs
.md-tabs {
  width: 100%;
  overflow: auto;
  color: var(--md-primary-bg-color);
  background-color: var(--md-primary-fg-color);

  // [print]: Hide tabs
  @media print {
    display: none;
  }

  // [tablet -]: Hide tabs
  @include break-to-device(tablet) {
    display: none;
  }

  // Tabs in hidden state, i.e. when scrolling down
  &[data-md-state="hidden"] {
    pointer-events: none;
  }

  // Navigation tabs list
  &__list {
    margin: 0;
    margin-left: px2rem(4px);
    padding: 0;
    white-space: nowrap;
    list-style: none;
    contain: content;

    // Adjust for right-to-left languages
    [dir="rtl"] & {
      margin-right: px2rem(4px);
      margin-left: initial;
    }
  }

  // Navigation tabs item
  &__item {
    display: inline-block;
    height: px2rem(48px);
    padding-right: px2rem(12px);
    padding-left: px2rem(12px);
  }

  // Navigation tabs link - could be defined as block elements and aligned via
  // line height, but this would imply more repaints when scrolling
  &__link {
    display: block;
    margin-top: px2rem(16px);
    font-size: px2rem(14px);
    outline-color: var(--md-accent-fg-color);
    outline-offset: px2rem(4px);
    // Hack: save a repaint when tabs are appearing on scrolling up
    backface-visibility: hidden;
    opacity: 0.7;
    transition:
      transform 400ms cubic-bezier(0.1, 0.7, 0.1, 1),
      opacity   250ms;

    // Active link and link on focus/hover
    &--active,
    &:focus,
    &:hover {
      color: inherit;
      opacity: 1;
    }

    // Delay transitions by a small amount
    @for $i from 2 through 16 {
      .md-tabs__item:nth-child(#{$i}) & {
        transition-delay: 20ms * ($i - 1);
      }
    }

    // Hide tabs upon scrolling - disable transition to minimizes repaints
    // while scrolling down, while scrolling up seems to be okay
    .md-tabs[data-md-state="hidden"] & {
      transform: translateY(50%);
      opacity: 0;
      transition:
        transform 0ms 100ms,
        opacity 100ms;
    }
  }
}
