/*

###############################
### MOLECULE: format-visual ###
###############################

### INFO:

format-visual contains a code-snippet component along with two amp-img components. The component inside the the code-snippet should manipulate
the border and format around the images.

### MODIFIERS:
websites, stories, ads, email

This is the base of all formats.
There are specific files for each format, to keep css rendering low.

*/

@import '../../extends';
@import '../../functions';
@import '../../mixins';
@import '../../variables';

@import '../atoms/component-frame.scss';

.#{utility('stage')} {
  .#{molecule('format-visual')} {
    grid-column: 11 / -1;
    position: absolute;
    left: 50%;
    top: 0;
    margin-left: -30%;

    @media (min-width: 768px) {
      position: static;
      margin-top: -50%;
      margin-left: auto;
      margin-right: auto;
    }

    @media (min-width: 1024px) {
      margin-top: -40%;
    }
  }
}

.#{molecule('format-visual')} {
  width: 100%;
  max-width: 16em;
  padding: 1.5em 0;
  margin: 0 auto;
  transform: rotate3d(135, -90, 90, 50deg);
  display: grid;

  @media (min-width: 768px) {
    width: 50%;
    max-width: 100%;
    position: relative;
    padding: 0;
    margin-bottom: 5em;
  }

  &:after {
    content: '';
    width: 100%;
    height: auto;
    position: absolute;
    bottom: 0;
    left: 0;
    padding-top: 75%;
    border-radius: 1000% 0 0 0 / 1000% 0 0 0;
    opacity: 0.5;
    transform: rotate(-5deg) scale(1, 1.1) skew(-25deg);
    transform-origin: center;
    background: linear-gradient(-225deg, transparent 30%, color('black'));
    filter: blur(20px);
    z-index: -1;

    @media (min-width: 768px) {
      padding-top: 100%;
      transform-origin: right bottom;
    }
  }

  &-image {
    width: 100%;
    height: auto;
    margin: auto;
  }

  &-bottom-image {
    position: relative;
    grid-column: 2 / 3;
    grid-row: 1 / 4;
    max-width: 9em;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.15));

    @media (min-width: 768px) {
      max-width: 100%;
    }
  }

  &-top-image {
    position: relative;
    grid-column: 1 / 4;
    grid-row: 2 / 3;
    max-width: 11em;
    @include component-frame;
    box-shadow: 30px 90px 60px -40px rgba(0, 0, 0, 0.5);
    animation: 10s ease-in-out infinite bounce -4s;

    @media (min-width: 768px) {
      max-width: 100%;
    }
  }

  &-code-snippet {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    width: auto;
    margin: auto auto 0;
    font-size: 10px;
    transform: translate(75%, -4em);

    @media (min-width: 768px) {
      font-size: 1.25vw;
      transform: translate(50%, -75px);
    }

    .#{molecule('code-snippet')} {
      margin: 0;
      box-shadow: 15px 30px 45px -5px rgba(0, 0, 0, 0.25);
      animation: 10s ease-in-out infinite bounce;
    }
  }
}

@keyframes bounce {
  0% { transform: translate(-1.5%, -3%); }
  50% { transform: translate(1.5%, 3%); }
  100% { transform: translate(-1.5%, -3%); }
}
