/// Emits arbitrary themed CSS.
///
/// @param {String} $theme - The theme to target
@mixin anthology-with-theme($theme)
{
  $full-selector: '';

  @each $selector in selector-parse(&)
  {
    $theme-attr: $_anthology-config-theme-attr;
    $nested-element-theme-selector: '[#{$theme-attr}~="#{$theme}"] #{$selector}';
    $same-element-theme-selector: selector-unify($selector, '[#{$theme-attr}~="#{$theme}"]');
    $selector: '#{$nested-element-theme-selector}, #{$same-element-theme-selector}';

    @if $full-selector == ''
    {
      $full-selector: $selector;
    }
    @else
    {
      $full-selector: '#{$full-selector}, #{$selector}';
    }
  }

  @at-root #{$full-selector} { @content; }
}

/// Emits themed CSS for a single property.
///
/// @param {String} $property - The CSS property to change.
/// @param {Map} $themed-values - A map of corresponding themes/values.
@mixin anthology-themeify($property, $themed-values)
{
  @each $theme, $value in $themed-values
  {

    @if $theme == 'default'
    {
      #{$property}: $value;
    }

    @else
    {
      @include A(with-theme, $theme) { #{$property}: $value; }
    }

  }
}
