/// Apply vertical margins that are multiples of the base line height.
///
/// A top and a bottom margin can be defined, as numbers without any unit.
/// When not specified, each margin will be set to zero.
///
/// @group typography
///
/// @parameter {Map} $margins    - a map with a top and/or bottom attributes
///
/// @example scss - Usage
///   $k-typography: (
///     line-height: 1.5rem,
///     ...
///   );
///
///   $margins: (
///     top:    1,
///     bottom: 2
///   );
///
///   @include k-typographyVerticalMargin($margins);
///
/// @example css - CSS output
///   margin-top:    1.5rem;
///   margin-bottom: 3rem;
@mixin k-typographyVerticalMargin($margins) {
  $valid:
    k-all(
      k-validate(
        $margins, $k-vertical-margin-schema,
        'k-typographyVerticalMargin', '$margin'
      )
    );

  // The base line height.
  $base-line-height: k-map-fetch($k-typography, 'line-height');

  // Get top margin or set to 0.
  $top-margin: k-default(map-get($margins, 'top'), 0);

  // Get bottom margin or set to 0.
  $bottom-margin: k-default(map-get($margins, 'bottom'), 0);

  margin-top: $top-margin * $base-line-height;
  margin-bottom: $bottom-margin * $base-line-height;
}
