//
// Copyright IBM Corp. 2016, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

//-----------------------------
// List
//-----------------------------

@import '../../globals/scss/vars';
@import '../../globals/scss/css--reset';
@import '../../globals/scss/typography';
@import '../../globals/scss/vendor/@carbon/elements/scss/import-once/import-once';

/// List styles
/// @access private
/// @group list
@mixin lists {
  .#{$prefix}--list--nested,
  .#{$prefix}--list--unordered,
  .#{$prefix}--list--ordered {
    @include reset;
    @include type-style('body-short-01');

    list-style: none;
  }

  .#{$prefix}--list__item {
    color: $text-01;
    margin-bottom: $carbon--spacing-02;
  }

  .#{$prefix}--list--nested {
    margin-top: $carbon--spacing-02;
    margin-left: $carbon--spacing-06;
  }

  .#{$prefix}--list--nested > .#{$prefix}--list__item {
    margin-top: 0;
    margin-bottom: 0;
  }

  .#{$prefix}--list--nested .#{$prefix}--list--nested {
    margin-top: 0;
  }

  .#{$prefix}--list--ordered:not(.#{$prefix}--list--nested) {
    counter-reset: item;
  }

  .#{$prefix}--list--ordered:not(.#{$prefix}--list--nested)
    > .#{$prefix}--list__item {
    position: relative;
  }

  .#{$prefix}--list--ordered:not(.#{$prefix}--list--nested)
    > .#{$prefix}--list__item::before {
    content: counter(item) '.';
    counter-increment: item;
    position: absolute;
    left: rem(-24px);
  }

  .#{$prefix}--list--ordered.#{$prefix}--list--nested {
    list-style-type: lower-latin;
  }

  .#{$prefix}--list--unordered > .#{$prefix}--list__item {
    position: relative;

    &::before {
      position: absolute;
      left: -$carbon--spacing-05;
      content: '\002013'; // – en dash
    }
  }

  .#{$prefix}--list--unordered.#{$prefix}--list--nested
    > .#{$prefix}--list__item::before {
    left: -$carbon--spacing-04; // offset to account for smaller ▪ vs –
    content: '\0025AA'; // ▪ square
  }
}

@include exports('lists') {
  @include lists;
}
