@import "../../../sass/webpack_deps";

$image-card-hover-movement: .5rem;

.ttd {
  position: relative;

  @media (max-width: $max-480) {
    overflow: hidden;
  }

  &__heading {
    @include h1();
    z-index: z("middle") + 5;
  }

  &__container {
    margin-bottom: $gutter;
    position: relative;

    @media (max-width: $max-840) {
      margin-left: auto;
      margin-right: auto;
      max-width: 61.5rem;
    }

    @media (min-width: $min-840) {
      margin-bottom: 2rem;
    }
  }

  &__list-container {
    overflow: hidden; // hide transitioning slides, which is a completely new ul element

    @media (min-width: $min-840) {
      margin-top: -#{$image-card-hover-movement}; // reset the position and offset the padding-top
      padding-top: $image-card-hover-movement; // becuase of overflow: hidden, this gives the .image-card room to move for hover transition
    }
  }

  &__list {
    counter-reset: image-card;
    display: flex; // Controls the speed of the more and less
    list-style: none;
    opacity: 1;
    position: relative;
    transition: 500ms transform ease-in-out;

    @media (max-width: $max-840) {
      flex-wrap: wrap;
    }

    .no-flexbox & {
      @include clearfix;
      float: left;
      width: 100%;
    }

    &--next {
      opacity: 0;
    }
  }

  &__item {
    width: span(6);

    @media (min-width: $min-840) {
      width: span(3);
    }

    .no-flexbox & {
      float: left;
    }

    &:not(:first-child) {
      margin-left: gutter();
    }

    &:nth-child(3) {
      @media (max-width: $max-840) {
        margin-left: 0;
      }
    }

    &:nth-child(3),
    &:nth-child(4) {
      @media (max-width: $max-840) {
        margin-top: gutter();
      }
    }
  }

  &__more,
  &__less {
    @include slider-button;
  }

  &__more {
    right: -2.5rem;

    @media (min-width: $min-480) {
      right: -3rem;
    }

    @media (min-width: $min-840) {
      right: -2rem;
    }
  }

  &__less {
    left: -2.5rem;

    @media (min-width: $min-480) {
      left: -3rem;
    }

    @media (min-width: $min-840) {
      left: -2rem;
    }
  }

  &__more-icon,
  &__less-icon {
    @include slider-button-icon;
  }

  &__more-icon {
    @include slider-button-icon-next;
  }

  &__less-icon {
    @include slider-button-icon-prev;
  }
}

.image-card {
  background-color: darken($color-white, 20); // #ccc
  display: block;
  position: relative;
  transition: transform $animation-speed;
  width: 100%;

  &:hover,
  &:active,
  &:focus {
    @media (min-width: $min-840) {
      transform: translateY(-#{$image-card-hover-movement});
    }
  }

  &__image {
    background-size: cover;
    opacity: 1;
    padding-top: 150%;
    transition: opacity $animation-speed-ui;
    width: 100%;

    &.is-visible {
      opacity: 1;
    }
  }

  &__content {
    background: linear-gradient(to top, rgba($color-black, .5) 0%, rgba($color-black, 0) 100%);
    bottom: 0;
    color: $color-white;
    font-size: $font-size;
    left: 0;
    padding: 0 ($gutter / 3) ($gutter / 2);
    position: absolute;
    right: 0;
    text-align: center;

    @media (min-width: $min-480) {
      padding: 0 ($gutter / 2) ($gutter - 1);
    }

    @media (min-width: $min-720) {
      min-height: 14.5rem;
    }
  }

  &__marker {
    @include marker;
    @include marker-small;
    margin-bottom: (($spacing / 2) + .5);

    @media (min-width: $min-480) {
      @include marker-large;
      margin-bottom: 2.1rem;
    }
  }

  &__title {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: (18 / 12);
    margin-top: .6rem;
    overflow: hidden;
    text-transform: uppercase;

    @media (min-width: $min-480) {
      font-size: 1.4rem;
      letter-spacing: .06rem;
      line-height: (19 / 14);
      margin-top: 1.2rem;
    }
  }

  &__subtitle {
    font-family: $miller-daily;
    font-size: 1.2rem;
    font-style: italic;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;

    @media (min-width: $min-480) {
      font-size: 1.4rem;
    }
  }
}
