@use "sass:string";
@use "sass:math";
@use "sass:list";

@use "../variables" as *;
@use "../utils" as *;

.mie {
  @each $side in ("horizontal", "vertical") {
    $side-short-key: string.slice($side, 1, 1);

    @each $name, $size in $indent-size {
      $size-postfix: if($name != "medium", "-" + $name, "");

      $start: "margin-" + if($side == "horizontal", "left", "top");
      $end: "margin-" + if($side == "horizontal", "right", "bottom");
      $class-name: "sb" + $side-short-key + $size-postfix;

      &.#{$class-name} {
        > * {
          #{$start}: #{math.div($size, 2)} !important;
          #{$end}: #{math.div($size, 2)} !important;

          &:first-child {
            #{$start}: 0 !important;
          }

          &:last-child {
            #{$end}: 0 !important;
          }
        }
      }
    }
  }
}
