/// Шрифт из системы типографики
/// @group Typography
///
/// @param {Number} $typography-size - Размер шрифта
/// @param {Number} $margins [true] - Флаг, добавлять отступы или нет
///
/// @output Подставляет значения `font-size`, `line-height` и `margin`
///
/// @example scss
///   .block {
///     @include t(56, $margins: false);
///   }
///

@mixin t($typography-size, $margins: true) {
  $typography-settings: map-get($typography-sizes, $typography-size);
  $line-height-xxs: map-get($typography-settings, line-height-xxs);
  
  font-size: map-get($typography-settings, font-size);
  line-height: map-get($typography-settings, line-height);
  
  @if ($line-height-xxs) {
    @media screen and (max-width: $screen-xxs-max) {
      line-height: $line-height-xxs;
    }
  }

  @if ($margins == true) {
      $margin-top: map-get($typography-settings, margin-top);
      $margin-bottom: map-get($typography-settings, margin-bottom);

      @if ($margin-top) {
        margin-top: $margin-top;

        &:first-child {
            margin-top: 0;
        }
      }

      @if ($margin-bottom) {
        margin-bottom: $margin-bottom;
        
        &:last-child {
            margin-bottom: 0;
        }
      }
  }
}
