@import "tools.mixins";
@import "objects.homepage-cards";

// ------------------------------------
// Shared
// ------------------------------------

@mixin o-package-story-list-2-column($display: flex, $wrap: wrap, $flow: "") {
  @include flex-display($display, $wrap, $flow);
  justify-content: space-between;
  width: 100%; // Fix for IE11, when package is nested inside of a grid column
  .u-wrapper {
    flex-basis: calc(50% - #{rem(30)});
    margin-right: rem(20);
    &:nth-of-type(even) {
      margin-right: 0;
    }
  }
}

@mixin o-package-story-list-4-column {
  .u-wrapper {
    flex-basis: calc(25% - #{rem(40)});
    &:nth-of-type(even) {
      margin-right: rem(20);
    }
    &:last-of-type,
    &:nth-of-type(4n) {
      margin-right: 0;
    }
  }
}

// ------------------------------------
// Basic
// ------------------------------------

@mixin o-package-story-list-basic-sm {
  .o-package--story-list--basic {
    @include o-package-story-list-2-column;
  }
}

@mixin o-package-story-list-basic-md {
  .o-package--story-list--basic {
    @include o-package-story-list-4-column;
  }
}

// ------------------------------------
// Numbered
// ------------------------------------

@mixin o-package-story-list-numbered-sm {
  .o-package--story-list--numbered {
    @include o-package-story-list-2-column;
  }
}

@mixin o-package-story-list-numbered-md {
  .o-package--story-list--numbered {
    @include o-package-story-list-4-column;
  }
}

// ------------------------------------
// Cards
// ------------------------------------

@mixin o-package-story-list-cards-sm {
  .o-package--story-list--cards {
    @include o-package-story-list-2-column($flow: row wrap, $wrap: "");
  }
}

@mixin o-package-story-list-cards-lg {
  .o-package--story-list--cards {
    @include o-package-story-list-4-column;
  }
}

// ------------------------------------
// A-Stack
// ------------------------------------

@mixin o-package-story-list-a-stack-sm-to-md {
  .o-package--story-list--a-stack {
    @include o-package-story-list-2-column;
    .u-wrapper:nth-of-type(2) {
      .o-card {
        padding-top: 0;
      }
    }
  }
}

@mixin o-package-story-list-a-stack-md {
  .o-package--story-list--a-stack {
    .u-wrapper {
      &:nth-of-type(2) {
        .o-card {
          padding-top: rem(10);
        }
      }
    }
    .o-card__content .o-card__col:first-of-type {
      flex: 100%;
      margin-right: 0;
    }
    .o-card__hed {
      font-size: rem(19);
    }
    .c-image {
      display: none;
    }
  }
}

@mixin o-package-story-list-a-stack-lg {
  .o-package--story-list--a-stack {
    .o-card__content .o-card__col:first-of-type {
      flex: 3;
      margin-right: rem(10);
    }
    .c-image {
      display: block;
    }
  }
}
