$font-path: 'https://unpkg.com/carbon-components@latest/src/globals/fonts' !default;

@import 'import-once';
@import 'css--plex-core';

@mixin helvetica-font-face {
  // Default font directory, `!default` flag allows user override.
  // (font files are configured to be served as static assets from server.js)

  @font-face {
    font-family: 'IBM Helvetica';
    font-style: normal;
    font-weight: 300;
    src: url('#{$font-path}/helvetica-neue-light.woff2') format('woff2'),
      url('#{$font-path}/helvetica-neue-light.woff') format('woff');
  }

  @font-face {
    font-family: 'IBM Helvetica';
    font-style: italic;
    font-weight: 300;
    src: url('#{$font-path}/helvetica-neue-light-italic.woff2') format('woff2'),
      url('#{$font-path}/helvetica-neue-light-italic.woff') format('woff');
  }

  @font-face {
    font-family: 'IBM Helvetica';
    font-style: normal;
    font-weight: 400;
    src: url('#{$font-path}/helvetica-neue-roman.woff2') format('woff2'),
      url('#{$font-path}/helvetica-neue-roman.woff') format('woff');
  }

  @font-face {
    font-family: 'IBM Helvetica';
    font-style: italic;
    font-weight: 400;
    src: url('#{$font-path}/helvetica-neue-roman-italic.woff2') format('woff2'),
      url('#{$font-path}/helvetica-neue-roman-italic.woff') format('woff');
  }

  @font-face {
    font-family: 'IBM Helvetica';
    font-style: normal;
    font-weight: 700;
    src: url('#{$font-path}/helvetica-neue-bold.woff2') format('woff2'),
      url('#{$font-path}/helvetica-neue-bold.woff') format('woff');
  }

  @font-face {
    font-family: 'IBM Helvetica';
    font-style: italic;
    font-weight: 700;
    src: url('#{$font-path}/helvetica-neue-bold-italic.woff2') format('woff2'),
      url('#{$font-path}/helvetica-neue-bold-italic.woff') format('woff');
  }
}

@include exports('css--font-face') {
  @if global-variable-exists('css--plex') and $css--plex == true {
    @include plex-font-face;
  } @else {
    @include helvetica-font-face;
  }
}
