@import "../config";
@import "./btn";

#{$class-prefix}-gallery {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;

  &-failed-image {
    width: 100%;
    height: 100%;
    background: #000;
    position: relative;
    display: table;

    &-caption {
      display: table-cell;
      vertical-align: middle;
      font-size: 16px;
      white-space: normal;
      padding: 10px;
    }

  }

  ul {
    position: relative;
    width: 100%;
    height: 100%;
    white-space: nowrap;
    display: block;
    margin: 0;
    padding: 0;
    @include transform(scale(0.8));
    @include transition(margin-left $gallery-animation-speed $transition-type);

    li {
      display: inline-block;
      vertical-align: middle;
      cursor: pointer;
      width: 100%;
      height: 100%;
      text-align: center;

      img,
      iframe,
      #{$class-prefix}-gallery-failed-image {
        vertical-align: middle;
        opacity: 0.7;
        @include transform(scale(0.9));
        @include transition(transform $gallery-animation-speed $transition-type,
                opacity $gallery-animation-speed $transition-type);
      }

      img {
        max-width: 100%;
        max-height: 100%;
        vertical-align: middle;
      }

      &.hover,
      &:hover {
        img,
        iframe,
        #{$class-prefix}-gallery-failed-image {
          opacity: 0.85;
          @include transform(scale(0.92));
        }

        #{$class-prefix}-gallery-failed-image {
          opacity: 0.7;
        }
      }

      &.selected {
        cursor: default;
        img,
        iframe,
        #{$class-prefix}-gallery-failed-image {
          opacity: 1;
          @include transform(scale(1));
        }
      }

      &.selected {
        #{$class-prefix}-gallery-failed-image {
          opacity: 0.7;
        }
      }

    }
  }

  &.expanded {
    ul {
      li {
        img,
        iframe {
          @include transform(scale(1.25));
        }
      }
    }
  }

  &-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    text-align: center;
    width: 100%;
    display: none;
    @include transition(opacity $transition-duration $transition-type);

    &.visible {
      display: block;
    }

    &-background {
      width: 100%;
      height: 100%;
      position: absolute;
      top: 0;
      left: 0;
      background: $corner-background;
      opacity: 0.4;
    }

    &-text {
      position: relative;
      height: 100%;
      width: 100%;
      font-variant: small-caps;
    }

  }

  &-close {
    display: none;
    top: 0;
    right: 0;
    position: absolute;

    &.visible {
      display: inline-block;
    }

  }

}

a#{$class-prefix}-gallery {

  &-controls {
    height: 100%;
    width: 35px;
    position: absolute;
    top: 0;
    z-index: 1;
    display: block;
    cursor: pointer;
    color: $btn-color;
    @include hover-opacity(.5, .8);

    &.transparent {
      opacity: 0;
    }

    i {
      $height: 70px;
      $width: 25px;
      position: absolute;
      top: 50%;
      left: 0;
      margin-top: -$height/2;
      font-size: $height;

    }

  }

  &-prev {
    left: 0;
  }

  &-next {
    right: 0;
  }

}