/* ============================================================================
   @OBJECTS -> LIST BLOCK
   ========================================================================= */


/**
 * Creates blocky list items out of a `ul` or `ol` which is usually for a
 * vertical list of links.
 *
 * The objects block class, its modifier class(s), and its element class(s)
 * (available as silent placeholder selectors also):
 *
   .o-list-block
   .o-list-block--tiny
   .o-list-block--small
   .o-list-block--large
   .o-list-block--huge
 *
 * @markup
   <ul class="o-list-block [modifier]">
     <li>
       <a href="#">Some link text</a>
     </li>
     <li>
       <a href="#">Some link text</a>
     </li>
   </ul>
 *
 * @credit
 * https://github.com/inuitcss/objects.list-block/blob/master/_objects.list-block.scss
 */


/**
 * Settings.
 */

/**
 * Apply at these breakpoints (turned off by default).
 */

$o-list-block-apply-at-breakpoints:              $default-breakpoints !default;

// From the above breakpoints choose what you wish to apply it too
$o-list-block-apply-at-breakpoints-for-default:  false !default;

$o-list-block-apply-at-breakpoints-for-tiny:     false !default;

$o-list-block-apply-at-breakpoints-for-small:    false !default;

$o-list-block-apply-at-breakpoints-for-large:    false !default;

$o-list-block-apply-at-breakpoints-for-huge:     false !default;

/**
 * Whitespace.
 */

$o-list-block-item-padding-base:                 $spacing-half !default;

$o-list-block-item-padding-tiny:                 $spacing-quarter !default;

$o-list-block-item-padding-small:                $spacing-third !default;

$o-list-block-item-padding-large:                $spacing-base !default;

$o-list-block-item-padding-huge:                 $spacing-double !default;


%o-list-block > li,
.o-list-block > li {

  &,
  > a {
    @include to-rem(padding, $o-list-block-item-padding-base);
  }

  > a {
    display: block;
    @include to-rem(margin, -$o-list-block-item-padding-base);
  }
}

@if $o-list-block-apply-at-breakpoints-for-default {
  @include generate-at-breakpoints('.o-list-block{bp} > li',
    $o-list-block-apply-at-breakpoints) {

      &,
      > a {
        @include to-rem(padding, $o-list-block-item-padding-base);
      }

      > a {
        display: block;
        @include to-rem(margin, -$o-list-block-item-padding-base);
      }
  }
}


/**
 * Modifier: tiny padding.
 */

%o-list-block--tiny > li,
.o-list-block--tiny > li {

  &,
  > a {
    @include to-rem(padding, $o-list-block-item-padding-tiny);
  }

  > a {
    @include to-rem(margin, -$o-list-block-item-padding-tiny);
  }
}

@if $o-list-block-apply-at-breakpoints-for-tiny {
  @include generate-at-breakpoints('.o-list-block--tiny{bp} > li',
    $o-list-block-apply-at-breakpoints) {

      &,
      > a {
        @include to-rem(padding, $o-list-block-item-padding-tiny);
      }

      > a {
        @include to-rem(margin, -$o-list-block-item-padding-tiny);
      }
  }
}


/**
 * Modifier: small padding.
 */

%o-list-block--small > li,
.o-list-block--small > li {
  &,
  > a {
    @include to-rem(padding, $o-list-block-item-padding-small);
  }

  > a {
    @include to-rem(margin, -$o-list-block-item-padding-small);
  }
}

@if $o-list-block-apply-at-breakpoints-for-small {
  @include generate-at-breakpoints('.o-list-block--small{bp} > li',
    $o-list-block-apply-at-breakpoints) {

    &,
    > a {
      @include to-rem(padding, $o-list-block-item-padding-small);
    }

    > a {
      @include to-rem(margin, -$o-list-block-item-padding-small);
    }
  }
}


/**
 * Modifier: large padding.
 */

%o-list-block--large > li,
.o-list-block--large > li {

  &,
  > a {
    @include to-rem(padding, $o-list-block-item-padding-large);
  }

  > a {
    @include to-rem(margin, -$o-list-block-item-padding-large);
  }
}

@if $o-list-block-apply-at-breakpoints-for-large {
  @include generate-at-breakpoints('.o-list-block--large{bp} > li',
    $o-list-block-apply-at-breakpoints) {

    &,
    > a {
      @include to-rem(padding, $o-list-block-item-padding-large);
    }

    > a {
      @include to-rem(margin, -$o-list-block-item-padding-large);
    }
  }
}


/**
 * Modifier: huge padding.
 */

%o-list-block--huge > li,
.o-list-block--huge > li {

  &,
  > a {
    @include to-rem(padding, $o-list-block-item-padding-huge);
  }

  > a {
    @include to-rem(margin, -$o-list-block-item-padding-huge);
  }
}

@if $o-list-block-apply-at-breakpoints-for-huge {
  @include generate-at-breakpoints('.o-list-block--huge{bp} > li',
    $o-list-block-apply-at-breakpoints) {

    &,
    > a {
      @include to-rem(padding, $o-list-block-item-padding-huge);
    }

    > a {
      @include to-rem(margin, -$o-list-block-item-padding-huge);
    }
  }
}