/* ============================================================================
   @CORE -> BASE -> HEADINGS
   ========================================================================= */


/**
 * Double stranded for greater reuse.
 */


/**
 * Settings.
 */

// Margins
$apply-heading-margins:                     true !default;

$apply-smaller-margin-for-lowest-headings:  true !default;


/**
 * Apply font family.
 */

@include headings(1, 6, true) {
  font-family: $font-family-headings;
}


/**
 * Set margins but make optional.
 */

@if $apply-heading-margins {
  // Base
  @include headings(1, 3, true) {
    @extend %bottom-spacing;
  }

  @if $apply-smaller-margin-for-lowest-headings {
    // Half
    @include headings(4, 6, true) {
      @extend %bottom-spacing-half;
    }
  }
  @else {
    // Base
    @include headings(4, 6, true) {
      @extend %bottom-spacing;
    }
  }
}


/**
 * H1.
 */

h1,
.h1 {
  @include font-size($font-size-heading-1);

  // N.B. this is needed to turn off the top margin set in normalize.css
  margin-top: 0;
}


/**
 * H2.
 */

h2,
.h2 {
  @include font-size($font-size-heading-2);
}


/**
 * H3.
 */

h3,
.h3 {
  @include font-size($font-size-heading-3);
}


/**
 * H4.
 */

h4,
.h4 {
  @include font-size($font-size-heading-4);
}


/**
 * H5.
 */

h5,
.h5 {
  @include font-size($font-size-heading-5);
}


/**
 * H6.
 */

h6,
.h6 {
  @include font-size($font-size-heading-6);
}