////
/// @group overrides
////

/// Directions for spacing
///
/// @type Map
/// @access private

$_spacing-directions: (
  "top",
  "right",
  "bottom",
  "left"
) !default;

/// Spacing override classes
///
/// Generate spacing override classes for the given property (e.g. margin)
/// for each point in the spacing scale.
///
/// @param {String} $property - Property to add spacing to (e.g. 'margin')
///
/// @example scss
///   .govuk-\!-margin-0 {
///      margin: 0;
///   }
///
///  .govuk-\!-margin-top-1 {
///     margin-top: [whatever spacing point 1 is...]
///   }
///
/// @access private

@mixin _govuk-generate-spacing-overrides($property) {
  // For each point in the spacing scale (defined in settings), create an
  // override that affects all directions...
  @each $scale-point, $scale-map in $govuk-spacing-responsive-scale {

    .govuk-\!-#{$property}-#{$scale-point} {

      @include _govuk-responsive-spacing($scale-point, $property, "all", true);
    }

    // ... and then an override for each individual direction
    @each $direction in $_spacing-directions {

      .govuk-\!-#{$property}-#{$direction}-#{$scale-point} {
        @include _govuk-responsive-spacing($scale-point, $property, $direction, true);
      }
    }
  }
}

@include govuk-exports("govuk/overrides/spacing") {
  @include _govuk-generate-spacing-overrides("margin");
  @include _govuk-generate-spacing-overrides("padding");
}