/* Picture theme
 */

/* Mixin
 */

@mixin picture($name: full, $dark: false, $picture: '', $repeat: false, $format: 'jpg') {

  .theme-picture--#{$picture}-#{$name} {

    background: #fff;

    &:before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      display: block;
      width: 100%;
      height: 100%;

      background-image: url(../images/themes/#{$picture}.#{$format});
      background-position: bottom left;
      background-size: cover;
      background-repeat: no-repeat;
    }

    @if $repeat == true {
      &:before {
        background-size: 300px;
        background-repeat: repeat;
      }
    }

    /* if half
     */
    @if str-index($name, half) {
      &:before {
        width: 50%;
      }
    }

    .card-content {

      .card-picture {
        position: absolute;
        top: 20%;
        left: 4%;

        label {
          color: #fff !important;
        }

        .drag-handle {
          border-color: #fff !important;
        }
      }

      .card-item,
      .card-item p {
        position: relative;
      }

      .card-item {
        position: absolute;
        left: 58%;
      }


      .person,
      .details,
      .email,
      .url {
        position: absolute;

        width: auto;
      }

      .person {
        top: 8%;

        font-size: emCalc(24);
        letter-spacing: -1px;

        p {
          line-height: 1.2em;

          &:last-child {
            font-size: .8em;
          }
        }
      }

      .details {
        top: 52%;

        font-size: emCalc(14);

        p {
          line-height: 1.2em;
        }
      }

      .email {
        top: 80%;
      }

      .url {
        top: 88%;
      }

      .email,
      .url {
        font-size: emCalc(14);

        p {
          line-height: 1em;
        }
      }

    }


    @if $dark == true {
      @include theme(dark);

      background: #000;
    } @else {
      @include theme(light);
    }

    /* if top
     */
    @if str-index($name, top) {

      &:before {
        width: 100%;
        height: 44%;

        background-position: 0% 68%;
        background-size: cover;
      }

      .card-content {

        .card-picture {
          top: 4%;
          left: 32%;

          label {
            padding: emCalc(4);
          }
        }

        .person {
          left: 6%;
          top: 52%;
        }

      }

    }

  }

  .theme-picture--#{$picture}-#{$name}-thumb {

    @include theme-new();

    .theme-preview {
      position: relative;
      background-color: #fff;
      padding: 0 !important;
    }

    .theme-preview:after {
      position: absolute;
      z-index: 1;
      top: 0;
      left: 0;
      content: '';
      display: block;
      width: 100%;
      height: 100%;

      background: url(../images/themes/#{$picture}.#{$format}) no-repeat left top;
      background-size: cover;
    }

    /* if half
     */
    @if str-index($name, half) {
      .theme-preview:after {
        width: 50%;
      }
    }

    @if $dark == true {
      .theme-preview {
        background: #000;
      }
    }

    @if str-index($name, top) {
      .theme-preview:after {
        width: 100%;
        height: 50%;

        background-size: cover;
      }
    }
  }

  /* for repeating patterns
   * double them when enlarging the card
   */
  @if $repeat == true {
    .card-big .theme-picture--#{$picture}-#{$name} {
      &:before {
        background-size: 600px;
      }
    }
  }

}

/* generate themes
 */

/* old winter themes
 * TODO delete once nobody wants them
 */
@include picture('half', false, 'winter');
@include picture('half-black', true, 'winter');
@include picture('top', false, 'winter');
@include picture('top-black', true, 'winter');

@include picture('half', false, 'winter2');
@include picture('half-black', true, 'winter2');
@include picture('top', false, 'winter2');
@include picture('top-black', true, 'winter2');

@include picture('half', false, 'winter3');
@include picture('half-black', true, 'winter3');
@include picture('top', false, 'winter3');
@include picture('top-black', true, 'winter3');

/* space theme
 */

@include picture('full', true, 'space');
@include picture('half', false, 'space');
@include picture('half-black', true, 'space');
@include picture('top', false, 'space');
@include picture('top-black', true, 'space');

/* city theme
 */

@include picture('half', false, 'city');
@include picture('half-black', true, 'city');
@include picture('top', false, 'city');
@include picture('top-black', true, 'city');

/* stardust
 * http://subtlepatterns.com/stardust/
 */

@include picture('full', true, 'stardust', true, 'png');

/* food
 * http://subtlepatterns.com/food/
 */

@include picture('full', false, 'food', true, 'png');

/* school
 * http://subtlepatterns.com/school/
 */

@include picture('full', false, 'school', true, 'png');

/* restaurant
 * http://subtlepatterns.com/restaurant-2/
 */

@include picture('full', true, 'restaurant', true, 'png');
