ehmorris/cardslap

View on GitHub
app/assets/stylesheets/_home.css.scss

Summary

Maintainability
Test Coverage
@mixin auth-box {
  min-width: 300px;
  padding: 2rem;
  width: 40%;

  @include media($smallandtouch) {
    padding: 1rem;
  }
}

body.home {
  background: $off-white;
  font-family: $sans;
  font-weight: 400;
  letter-spacing: 1px;
  line-height: 2rem;
  margin: 0;

  .notice {
    @include auth-box;
    background: none;
    color: #000;
    font: 800 1.5rem/1.4em $mono;
    margin: 10vh auto 0 auto;
    position: relative;
    text-align: left;
    z-index: 4;

    @include media($smallandtouch) {
      font-size: 1.2rem;
      margin-top: 5vh;
    }
  }

  .notice:before {
    content: 'error.';
    display: block;
  }

  .pitch {
    color: #000;
    font-family: $mono;
    height: $card-size * 2;
    margin-top: $card-size;
    padding: 1.5rem;
    position: fixed;
    top: 0;
    width: $card-size * 2;
    z-index: 6;

    p {
      margin-top: 0;
    }

    a {
      background: #fff;
      display: inline-block;
      margin-bottom: 1rem;
      padding: .25rem 1rem;
    }

    @include media($smallandtouch) {
      height: auto;
      position: relative;
      top: -3rem;
      width: auto;
    }
  }

  &.flash {
    .pitch {
      display: none;
    }
  }

  h1.logo {
    color: #fff;
    display: block;
    font: 800 24vw/1em $sans;
    left: 10%;
    letter-spacing: 0px;
    margin: 6vh auto 0;
    position: fixed;
    text-transform: uppercase;
    top: 0;
    @include user-select(none);
    width: 80%;
    z-index: 2;

    @include media($smallandtouch) {
      color: #fff !important;
    }

    span {
      display: block;

      &:last-child {
        margin-right: .75vw;
        text-align: right;
      }
    }
  }

  .cards {
    background: lighten($blue, 8%);
    @include position(fixed, 0px 0px 0px 0px);
    z-index: 1;

    .card {
      display: block;
      float: left;
      height: $card-size;
      @include perspective(1000px);
      position: relative;
      @include transition;
      width: $card-size;

      > div {
        @include backface-visibility(hidden);
        @include position(absolute, 0px 0px 0px 0px);
        @include transform-style(preserve-3d);
        @include transition(all .4s ease);
      }

      .front {
        background: lighten($blue, 2%);
        @include transform(rotate3d(45,45,0,0deg));
        z-index: 1;
      }

      .back {
        background: $melongreen;
        @include transform(rotate3d(45,45,0,-180deg));
        z-index: 0;
      }

      &:nth-child(3n) {
        .front {
          background: darken($blue, 3%);
        }

        .back {
          background: darken($melongreen, 6%);
        }
      }
      &:nth-child(5n) {
        .front {
          background: lighten($blue, 3%);
        }

        .back {
          background: lighten($melongreen, 6%);
        }
      }
      &:nth-child(7n) {
        .front {
          background: lighten($blue, 1%);
        }

        .back {
          background: lighten($melongreen, 2%);
        }
      }
      &:nth-child(8n) {
        .front {
          background: darken($blue, 1%);
        }

        .back {
          background: darken($melongreen, 2%);
        }
      }

      &.flip {
        .front {
          @include transform(rotate3d(45,45,0,180deg));
        }

        .back {
          z-index: 2;
          @include transform(rotate3d(45,45,0,0deg));
        }
      }
    }
  }

  .auth {
    margin-bottom: 10vh;
    margin-top: 80vh;
    position: relative;
    z-index: 3;

    @include media($smallandtouch) {
      margin-top: 5vh;
    }

    .form {
      @include auth-box;
      background: $off-white;
      margin: auto;

      @include media($smallandtouch) {
        background: none;
      }
    }

    h2 {
      margin: 0 0 1rem 0;
    }

    p {
      margin: 1rem 0 0 0;
    }

    input, .sign-in .reset {
      border: 0;
      border-radius: 2px;
      font-family: $mono;
      font-size: 1.1rem;
      font-weight: 100;
      letter-spacing: 1px;
      margin: 0 0 1rem 0;
      padding: .75rem 1rem;
      width: 100%;
    }

    input[type=email], input[type=password] {
      background: #eee;
    }

    input[type=submit] {
      margin-bottom: 0;
      text-align: left;
    }

    .sign-up {
      h2 {
        color: $pink;
      }

      input[type=submit] {
        background: $pink;
        border: 0;

        &:hover {
          background: lighten($pink, 5%);
        }

        &:focus, &:active {
          background: darken($pink, 10%);
        }
      }
    }

    .sign-in {
      form {
        position: relative;
      }

      .reset {
        color: #999;
        margin-top: -4.1rem;
        position: absolute;
        right: 0;
        width: auto;
      }
    }
  }
}