// REM Font Adjustments
@mixin font-size($sizeValue) {
  font-size: ($sizeValue) + px;
  font-size: ($sizeValue / 10) + rem;
}

@mixin letter-spacing($spacingValue) {
  letter-spacing: ($spacingValue) + px;
  letter-spacing: ($spacingValue / 10) + rem;
}

@mixin line-height($heightValue) {
  line-height: ($heightValue) + px;
  line-height: ($heightValue / 10) + rem;
}

// PLACEHOLDER
// NOTE: Vendor-prefixed selectors must be on separate blocks, because one invalid/unknown
//       selector will invalidate the whole block.
@mixin placeholder {
  &:-ms-input-placeholder      { @content; }  // IE
  &::-ms-input-placeholder     { @content; }  // Edge
  &::-webkit-input-placeholder { @content; }  // QQ Browser
  &::placeholder               { @content; }  // Chrome/Firefox/Safari
}

@mixin rotate($degrees) {
  -moz-transform: rotate($degrees);
  -webkit-transform: rotate($degrees);
  -o-transform: rotate($degrees);
  -ms-transform: rotate($degrees);
  transform: rotate($degrees);
  transition: transform 150ms;
  transition-timing-function: ease-in-out;
}

@mixin codeblock($bgcolor) {
    background-color: $bgcolor;
    border-radius: 5px;
    padding: 20px;
    margin: 0 auto; // was 24
    border: 0.5px solid $lightgray;
}

// INFO CARD SKELETON
@mixin card($height, $width) {
  height: $height;
  width: $width;
  background-color: $white;
  border-radius: 4px;
  box-shadow: 0 2px 2px rgba($black, 0.24), 0 0 2px rgba($black, 0.12);
  box-sizing: border-box;
  transition: box-shadow .5s;

  &:hover {
    box-shadow: 0 8px 8px rgba($black, 0.24), 0 0 8px rgba($black, 0.12);
    text-decoration: none;
  }
}

@mixin deploy-theme($mainColor, $gradientTargetColor) {
  .mat-toolbar.mat-primary, footer {
    background: linear-gradient(145deg, $mainColor, $gradientTargetColor);
  }

  .vertical-menu-item {
    &.selected, &:hover {
      color: $mainColor;
    }
  }

  .toc-inner ul.toc-list li {
    &.active a {
      color: $mainColor;

      &:before {
        background-color: $mainColor;
      }
    }

    &:hover a {
      color: $mainColor;
    }
  }
}

/// Define some styles for docs (i.e. non-marketing) pages.
///
/// @example scss - Example SCSS:
///   .foo {
///     @include docs-pages {
///       .bar {
///         color: orange;
///       }
///     }
///   }
///
///   .baz {
///     @include docs-pages($nestParentSelector: true) {
///       .qux {
///         color: orange;
///       }
///     }
///   }
///
/// @example css - Output CSS:
///   .foo .folder-api .bar, .foo .folder-cli .bar, ... {
///     color: orange;
///   }
///
///   .folder-api .baz .qux, .folder-cli .baz .qux, ... {
///     color: orange;
///   }
///
/// @param {boolean} $nestParentSelector
///   If true, the parent selector (`&`) is nested inside the docs pages selectors.
@mixin docs-pages($nestParentSelector: false) {
  $selectors: (
    '.folder-api',
    '.folder-cli',
    '.folder-docs',
    '.folder-errors',
    '.folder-guide',
    '.folder-start',
    '.folder-tutorial',
  );

  @if $nestParentSelector and & {
    @at-root #{selector-nest(#{$selectors}, &)} {
      @content;
    }
  } @else {
    #{$selectors} {
      @content;
    }
  }
}

/// Define some styles for marketing (i.e. non-docs) pages.
///
/// @example scss - Example SCSS:
///   .foo {
///     @include marketing-pages {
///       .bar {
///         color: orange;
///       }
///     }
///   }
///
///   .baz {
///     @include marketing-pages($extraSelectors: ('.other-page'), $nestParentSelector: true) {
///       .qux {
///         color: orange;
///       }
///     }
///   }
///
/// @example css - Output CSS:
///   .foo .page-about .bar, .foo .page-contribute .bar, ... {
///     color: orange;
///   }
///
///   .page-about .baz .qux, .page-contribute .baz .qux, ..., .other-page .baz .qux {
///     color: orange;
///   }
///
/// @param {string[]} $extraSelectors
///   A list of additional page selectors to apply the styles to.
/// @param {boolean} $nestParentSelector
///   If true, the parent selector (`&`) is nested inside the marketing pages selectors.
@mixin marketing-pages($extraSelectors: (), $nestParentSelector: false) {
  $marketingPagesSelectors: (
    '.page-about',
    '.page-contribute',
    '.page-events',
    '.page-features',
    '.page-home',
    '.page-presskit',
    '.page-resources',
  );
  $selectors: join($marketingPagesSelectors, $extraSelectors, $separator: comma);

  @if $nestParentSelector and & {
    @at-root #{selector-nest(#{$selectors}, &)} {
      @content;
    }
  } @else {
    #{$selectors} {
      @content;
    }
  }
}
