// Foundation for Sites
// https://get.foundation
// Licensed under MIT Open Source

////
/// @group callout
////

/// Default background color.
/// @type Color
$callout-background: $white !default;

/// Default fade value for callout backgrounds.
/// @type Number
$callout-background-fade: 85% !default;

/// Default border style for callouts.
/// @type List
$callout-border: 1px solid rgba($black, 0.25) !default;

/// Default bottom margin for callouts.
/// @type Number
$callout-margin: 0 0 1rem 0 !default;

/// Sizes for Callout paddings.
/// @type Map
$callout-sizes: (
  small: 0.5rem,
  default: 1rem,
  large: 3rem,
) !default;

/// Default font color for callouts.
/// @type Color
$callout-font-color: $body-font-color !default;

/// Default font color for callouts, if the callout has a dark background.
/// @type Color
$callout-font-color-alt: $body-background !default;

/// Default border radius for callouts.
/// @type Color
$callout-radius: $global-radius !default;

/// Amount to tint links used within colored panels. Set to `false` to disable this feature.
/// @type Number | Boolean
$callout-link-tint: 30% !default;

/// Adds basic styles for a callout, including padding and margin.
@mixin callout-base() {
  position: relative;
  margin: $callout-margin;
  padding: map-get($callout-sizes, default);

  border: $callout-border;
  border-radius: $callout-radius;

  // Respect the padding, fool.
  > :first-child {
    margin-top: 0;
  }

  > :last-child {
    margin-bottom: 0;
  }
}

/// Generate quick styles for a callout using a single color as a baseline.
/// @param {Color} $color [$callout-background] - Color to use.
@mixin callout-style($color: $callout-background) {
  $background: scale-color($color, $lightness: $callout-background-fade);

  background-color: $background;
  color: color-pick-contrast($background, ($callout-font-color, $callout-font-color-alt));
}

@mixin callout-size($padding) {
  padding-top: $padding;
  padding-right: $padding;
  padding-bottom: $padding;
  padding-left: $padding;
}


/// Adds styles for a callout.
/// @param {Color} $color [$callout-background] - Color to use.
@mixin callout($color: $callout-background) {
  @include callout-style($color);
  @include callout-base;
}

@mixin foundation-callout {
  .callout {
    @include callout;

    @each $name, $color in $foundation-palette {
      &.#{"" + $name} {
        @include callout-style($color);
      }
    }

    @each $size, $padding in map-remove($callout-sizes, default) {
      &.#{$size} {
        @include callout-size($padding);
      }
    }
  }
}
