@import "settings.breakpoints";
@import "settings.colors";
@import "settings.fonts";

@import "mixins/settings.fonts";
@import "mixins/tools.mixins";

///////////////////////////
// Card Wrapper Styles
///////////////////////////

.c-card {
  border: 1px solid $color-stone-200;
  padding: rem(10);
  background-color: $color-white;
  width: 100%;
}

.c-card--adv {
  background-color: $color-blue-steel;
  position: relative;
}

///////////////////////////
// Card content styles
///////////////////////////

.c-card__grid {
  @include display-grid;
  @include grid-template-columns(rem(10), 1fr max-content);
  @include grid-template-rows(0, auto);

  // The first card in each of the top package types
  .c-card--topstory-no-img &,
  .c-card--hero-story &,
  .c-card--2package-imgleft-story &,
  .c-card--3package-imgmiddle-story &,
  .c-card--3package-imgleft-story & {
    @include grid-template-columns(0, auto);
    @include grid-template-rows(rem(10), grid-repeat(2, auto));

    .c-card__content {
      @include grid-column(1, 2);
      @include grid-row(2, 3, true);
    }
    .c-card__media {
      @include grid-column(1, 2);
      @include grid-row(1, 2, true);
      width: 100%;
    }
  }
}

.c-card__content {
  @include grid-column(1, 2, true);
}

.c-card__media {
  @include grid-column(2, 3, true);
  width: rem(70);

  > .c-image {
    display: none;
  }

  .c-image-container {
    display: block;
  }
}

.c-card--opinion .c-card__media {
  > .c-image {
    display: block;
  }
  .c-image-container {
    display: none;
  }
}

///////////////////////////
// Card Link
///////////////////////////

.c-card__link {
  text-decoration: none;

  &:visited {
    .c-card__hed-text {
      color: $color-grey-660;
      text-decoration: underline;
    }
    .c-video-time {
      text-decoration: none;
    }
  }
  &:hover,
  &:focus {
    // Prevent underline from appearing below icon
    text-decoration: none;
    .c-card__hed-text {
      text-decoration: underline;
    }
    .c-video-time {
      text-decoration: none;
    }
  }
  &:active {
    .c-card__hed-text {
      color: $color-grey-500;
      text-decoration: underline;
    }
    .c-video-time {
      text-decoration: none;
    }
  }
}

///////////////////////////
// Card Labels
///////////////////////////

.c-card__label {
  @include font-gm-sans-bold;
  text-transform: uppercase;
  font-size: rem(12);
  letter-spacing: rem(1);
  line-height: line-height(12, 12);
  background-color: $color-red-700;
  color: $color-white;
  padding: rem(4) rem(7);
  display: inline-block;
  margin-bottom: rem(10);
}

// Label colours
.c-card__label--gold900 {
  background-color: $color-gold-900;
}
.c-card__label--red500 {
  background-color: $color-red-500;
}
.c-card__label--red700 {
  background-color: $color-red-700;
}
.c-card__label--rust900 {
  background-color: $color-rust-900;
}
.c-card__label--stone999 {
  background-color: $color-stone-999;
}

.c-card__label--muted {
  @include font-gm-sans;
  background-color: transparent;
  color: $color-grey-660;
  padding: 0;

  .c-card--adv & {
    font-family: $font-sans-stack;
    font-weight: bold;
  }
}

///////////////////////////
// Card Hed (Title)
///////////////////////////

.c-card__hed {
  @include font-hed(17, 20);
  letter-spacing: 0;
  color: $color-grey-900;
  margin: 0;
  .c-card--topstory-no-img &,
  .c-card--hero-story &,
  .c-card--2package-imgleft-story &,
  .c-card--3package-imgmiddle-story &,
  .c-card--3package-imgleft-story & {
    @include font-hed(19, 22);
  }
}

.c-card__hed-text {
  display: inline;
}

.c-card__video-time {
  white-space: nowrap;
  display: inline-block;
}
.c-card__video-duration {
  @include font-gm-sans;
  text-transform: uppercase;
  font-size: rem(12);
  letter-spacing: rem(1);
  line-height: line-height(12, 13);
  color: $color-grey-600;
}

///////////////////////////
// Card Dek (Description)
///////////////////////////

.c-card__dek {
  @include font-pratt;
  font-size: rem(17);
  line-height: line-height(17, 20);
  letter-spacing: 0;
  color: $color-grey-900;
  display: none;
  padding-top: rem(10);
  margin: 0;
  .c-card--topstory-no-img &,
  .c-card--hero-story &,
  .c-card--2package-imgleft-story &,
  .c-card--3package-imgmiddle-story &,
  .c-card--3package-imgleft-story & {
    font-size: rem(15);
    line-height: line-height(15, 18);
    display: block;
  }
  .c-card--adv & {
    font-family: $font-sans-stack;
    font-weight: normal;
  }
}

///////////////////////////
// Card Meta (authors, timestamp, video duration, etc)
///////////////////////////

.c-card__meta {
  margin-top: rem(10);
  .c-timestamp,
  .c-card__meta__authors {
    display: inline-block;
    margin-right: rem(15);
  }
}

.c-card__author {
  @include font-gm-sans;
  text-transform: uppercase;
  font-size: rem(12);
  letter-spacing: rem(1);
  line-height: line-height(12, 15);
  color: $color-grey-600;
}

///////////////////////////
// Inverted cards
///////////////////////////

.c-card--inverted {
  border-color: $color-stone-500;
  background-color: transparent;

  // Label colours
  .c-card__label {
    background-color: $color-white;
    color: $color-grey-660;
  }
  .c-card__label--muted {
    background-color: transparent;
    color: $color-white;
  }

  // Text colours
  .c-card__hed,
  .c-card__dek,
  .c-card__video-duration,
  .c-card__author,
  .c-timestamp {
    color: $color-white;
  }
  .c-card__link {
    &:visited {
      .c-card__hed-text {
        color: $color-stone-200;
      }
    }
    &:active {
      .c-card__hed-text {
        color: $color-stone-500;
      }
    }
  }

  // Icon colours
  .c-indicator-icon__art {
    fill: $color-white;
  }
  .c-indicator-icon__art--canpro {
    fill: $color-canpro-300;
  }
}

// Key icon changes opacity when unlimited user
// is logged in and key is on a dark background
.u-user-role--unlimited {
  .c-card--inverted {
    .c-indicator-icon__art--key {
      fill: $color-white;
      opacity: 0.5;
    }
  }
}
.u-user-entitlement--cannabis-pro {
  .c-card--inverted {
    .c-indicator-icon__art--canpro {
      fill: $color-canpro-300;
      opacity: 0.6;
    }
  }
}
