$allThemes: join($themes, $greys);

@each $suffix, $size in $sizes {
  $i: index(($sizes), ($suffix $size));

  .m-bd-#{$suffix} {
    border: #{$i}px solid currentColor;

    &-l {
      border-left: #{$i}px solid currentColor;
    }

    &-r {
      border-right: #{$i}px solid currentColor;
    }

    &-t {
      border-top: #{$i}px solid currentColor;
    }

    &-b {
      border-bottom: #{$i}px solid currentColor;
    }

    @each $theme in $allThemes {
      $color: $theme;
      $color-light: $theme + '-light';
      $color-dark: $theme + '-dark';

      &-#{$theme} {
        border: #{$i}px solid color($color);

        &-l {
          border-left: #{$i}px solid color($color);
        }

        &-r {
          border-right: #{$i}px solid color($color);
        }

        &-t {
          border-top: #{$i}px solid color($color);
        }

        &-b {
          border-bottom: #{$i}px solid color($color);
        }
      }
    }
  }
}
