code: private void bubbling( String[] mediaSelector, String[] blockSelector, CssFormatter formatter ) {
          if( properties.size() > 0 ) {
              String media = mediaSelector[0];
              if( media.startsWith( "@media" ) || media.startsWith( "@supports" ) || media.startsWith( "@document" ) ) {
                  // conditional directives
                  int size0 = formatter.getOutputSize();
                  CssFormatter block = formatter.startBlock( mediaSelector );
                  if( block != formatter ) {
                      size0 = block.getOutputSize();
                  }
                  CssFormatter block2 = block.startBlock( blockSelector );
                  int size1 = block2.getOutputSize();
                  appendPropertiesTo( block2 );
                  int size2 = block2.getOutputSize();
                  block2.endBlock();
                  int size3 = block.getOutputSize();
                  for( Formattable prop : properties ) {
                      if( prop instanceof Mixin ) {
                          ((Mixin)prop).appendSubRules( blockSelector, block );
                      }
                  }
                  int size4 = block.getOutputSize();
                  block.endBlock();
                  if( size1 == size2 && size3 == size4 ) {
                      block.setOutputSize( size0 );
                  }
              } else {
                  // non-conditional directives for example @font-face or @keyframes
                  CssFormatter block = formatter.startBlock( mediaSelector );
                  appendPropertiesTo( block );
                  for( Rule rule : subrules ) {
                      rule.appendTo( null, block );
                  }
                  block.endBlock();
                  return;
              }
          }
  
          for( Rule rule : subrules ) {
              final String[] ruleSelector = rule.getSelectors();
              String name = ruleSelector[0];
              name = SelectorUtils.replacePlaceHolder( formatter, name, this );
              if( name.startsWith( "@media" ) ) {
                  rule.bubbling( new String[]{mediaSelector[0] + " and " + name.substring( 6 ).trim()}, blockSelector, formatter );
              } else {
                  rule.bubbling( mediaSelector, SelectorUtils.merge( blockSelector, ruleSelector ), formatter );
              }
          }
      }
docs: Nested Directives are bubbling.
  
  @param mediaSelector
  the selector of the media, must start with an @
  @param blockSelector
  current block selector
  @param formatter
  current formatter