/* Magnific Popup CSS */

@import "vars";

////////////////////////
//
// Contents:
//
// 1. General styles
//    - Transluscent overlay
//    - Containers, wrappers
//    - Cursors
//    - Helper classes
// 2. Appearance
//    - Preloader & text that displays error messages
//    - CSS reset for buttons
//    - Close icon
//    - "1 of X" counter
//    - Navigation (left/right) arrows
//    - Iframe content type styles
//    - Image content type styles
//    - Media query where size of arrows is reduced
//    - IE7 support
//
////////////////////////

////////////////////////
//      Settings      //
////////////////////////

// overlay
$mfp-overlay-color: #0b0b0b;                    // Color of overlay screen
$mfp-overlay-opacity: .8;                        // Opacity of overlay screen
$mfp-shadow: 0 0 8px rgba(0, 0, 0, .6); // Shadow on image or iframe

// spacing
$mfp-popup-padding-left: 8px;                        // Padding from left and from right side
$mfp-popup-padding-left-mobile: 6px;                        // Same as above, but is applied when width of window is less than 800px
$mfp-z-index-base: $zindex-popover;                       // Base z-index of popup

// controls
$mfp-include-arrows: true;                       // Include styles for nav arrows
$mfp-controls-opacity: .65;                       // Opacity of controls
$mfp-controls-color: #fff;                       // Color of controls
$mfp-controls-border-color: #3f3f3f;                    // Border color of controls
$mfp-inner-close-icon-color: #333;                       // Color of close button when inside
$mfp-controls-text-color: #ccc;                       // Color of preloader and "1 of X" indicator
$mfp-controls-text-color-hover: #fff;                       // Hover color of preloader and "1 of X" indicator
$mfp-IE7support: false;                       // Very basic IE7 support

// Iframe-type options
$mfp-include-iframe-type: true;                       // Enable Iframe-type popups
$mfp-iframe-padding-top: 40px;                       // Iframe padding top
$mfp-iframe-background: #000;                       // Background color of iframes
$mfp-iframe-max-width: 900px;                      // Maximum width of iframes
$mfp-iframe-ratio: 9/16;                       // Ratio of iframe (9/16 = widescreen, 3/4 = standard, etc.)

// Image-type options
$mfp-include-image-type: true;                       // Enable Image-type popups
$mfp-image-background: #444;
$mfp-image-padding-top: 40px;                       // Image padding top
$mfp-image-padding-bottom: 40px;                       // Image padding bottom
$mfp-include-mobile-layout-for-image: true;                       // Removes paddings from top and bottom

// Image caption options
$mfp-caption-title-color: #f3f3f3;                    // Caption title color
$mfp-caption-subtitle-color: #bdbdbd;                    // Caption subtitle color

// A11y
$mfp-use-visuallyhidden: false;

////////////////////////
// 1. General styles
////////////////////////

// Transluscent overlay
.mfp-bg {
  position: fixed;
  top: 0;
  left: 0;
  z-index: $mfp-z-index-base + 2;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: $mfp-overlay-color;
  opacity: $mfp-overlay-opacity;
}

// Wrapper for popup
.mfp-wrap {
  position: fixed;
  top: 0;
  left: 0;
  z-index: $mfp-z-index-base + 3;
  width: 100%;
  height: 100%;
  outline: none !important;
  -webkit-backface-visibility: hidden; // fixes webkit bug that can cause "false" scrollbar
}

// Root container
.mfp-container {
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 0 $mfp-popup-padding-left;
  text-align: center;
}

// Vertical centerer helper
.mfp-container {
  &:before {
    display: inline-block;
    height: 100%;
    vertical-align: middle;
    content: "";
  }
}

// Remove vertical centering when popup has class `mfp-align-top`
.mfp-align-top {
  .mfp-container {
    &:before {
      display: none;
    }
  }
}

// Popup content holder
.mfp-content {
  position: relative;
  z-index: $mfp-z-index-base + 5;
  display: inline-block;
  margin: 0 auto;
  text-align: left;
  vertical-align: middle;
}

.mfp-inline-holder, .mfp-ajax-holder {
  .mfp-content {
    width: 100%;
    cursor: auto;
  }
}

// Cursors
.mfp-ajax-cur {
  cursor: progress;
}

.mfp-zoom-out-cur {
  &, .mfp-image-holder .mfp-close {
    cursor: -moz-zoom-out;
    cursor: -webkit-zoom-out;
    cursor: zoom-out;
  }
}

.mfp-zoom {
  cursor: pointer;
  cursor: -webkit-zoom-in;
  cursor: -moz-zoom-in;
  cursor: zoom-in;
}

.mfp-auto-cursor {
  .mfp-content {
    cursor: auto;
  }
}

.mfp-close, .mfp-arrow, .mfp-preloader, .mfp-counter {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

// Hide the image during the loading
.mfp-loading {
  &.mfp-figure {
    display: none;
  }
}

// Helper class that hides stuff
@if $mfp-use-visuallyhidden {
  // From HTML5 Boilerplate https://github.com/h5bp/html5-boilerplate/blob/v4.2.0/doc/css.md#visuallyhidden
  .mfp-hide {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    border: 0 !important;
  }
} @else {
  .mfp-hide {
    display: none !important;
  }
}

////////////////////////
// 2. Appearance
////////////////////////

// Preloader and text that displays error messages
.mfp-preloader {
  position: absolute;
  top: 50%;
  right: 8px;
  left: 8px;
  z-index: $mfp-z-index-base + 4;
  width: auto;
  margin-top: -0.8em;
  color: $mfp-controls-text-color;
  text-align: center;

  a {
    color: $mfp-controls-text-color;

    &:hover {
      color: $mfp-controls-text-color-hover;
    }
  }
}

// Hide preloader when content successfully loaded
.mfp-s-ready {
  .mfp-preloader {
    display: none;
  }
}

// Hide content when it was not loaded
.mfp-s-error {
  .mfp-content {
    display: none;
  }
}

// CSS-reset for buttons
button {
  &.mfp-close, &.mfp-arrow {
    z-index: $mfp-z-index-base + 6;
    display: block;
    padding: 0;
    overflow: visible;
    touch-action: manipulation;
    cursor: pointer;
    background: transparent;
    border: 0;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
  }

  &::-moz-focus-inner {
    padding: 0;
    border: 0;
  }
}

// Close icon
.mfp-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  padding: 0 0 18px 10px;
  font-family: Arial, Baskerville, monospace;
  font-size: 28px;
  font-style: normal;
  line-height: 44px;
  color: $mfp-controls-color;
  text-align: center;
  text-decoration: none;
  opacity: $mfp-controls-opacity;

  &:hover, &:focus {
    opacity: 1;
  }

  &:active {
    top: 1px;
  }
}

.mfp-close-btn-in {
  .mfp-close {
    color: $mfp-inner-close-icon-color;
  }
}

.mfp-image-holder, .mfp-iframe-holder {
  .mfp-close {
    right: -6px;
    width: 100%;
    padding-right: 6px;
    color: $mfp-controls-color;
    text-align: right;
  }
}

// "1 of X" counter
.mfp-counter {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 12px;
  line-height: 18px;
  color: $mfp-controls-text-color;
  white-space: nowrap;
}

// Navigation arrows
@if $mfp-include-arrows {
  .mfp-arrow {
    position: absolute;
    top: 50%;
    width: 90px;
    height: 110px;
    padding: 0;
    margin: 0;
    margin-top: -55px;
    opacity: $mfp-controls-opacity;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);

    &:active {
      margin-top: -54px;
    }

    &:hover, &:focus {
      opacity: 1;
    }

    &:before, &:after {
      position: absolute;
      top: 0;
      left: 0;
      display: block;
      width: 0;
      height: 0;
      margin-top: 35px;
      margin-left: 35px;
      content: "";
      border: medium inset transparent;
    }

    &:after {
      top: 8px;
      border-top-width: 13px;
      border-bottom-width: 13px;
    }

    &:before {
      border-top-width: 21px;
      border-bottom-width: 21px;
      opacity: .7;
    }
  }

  .mfp-arrow-left {
    left: 0;

    &:after {
      margin-left: 31px;
      border-right: 17px solid $mfp-controls-color;
    }

    &:before {
      margin-left: 25px;
      border-right: 27px solid $mfp-controls-border-color;
    }
  }

  .mfp-arrow-right {
    right: 0;

    &:after {
      margin-left: 39px;
      border-left: 17px solid $mfp-controls-color;
    }

    &:before {
      border-left: 27px solid $mfp-controls-border-color;
    }
  }
}

// Iframe content type
@if $mfp-include-iframe-type {
  .mfp-iframe-holder {
    padding-top: $mfp-iframe-padding-top;
    padding-bottom: $mfp-iframe-padding-top;

    .mfp-content {
      width: 100%;
      max-width: $mfp-iframe-max-width;
      line-height: 0;
    }

    .mfp-close {
      top: -40px;
    }
  }

  .mfp-iframe-scaler {
    width: 100%;
    height: 0;
    padding-top: $mfp-iframe-ratio * 100%;
    overflow: hidden;

    iframe {
      position: absolute;
      top: 0;
      left: 0;
      display: block;
      width: 100%;
      height: 100%;
      background: $mfp-iframe-background;
      box-shadow: $mfp-shadow;
    }
  }
}

// Image content type
@if $mfp-include-image-type {

  @if $mfp-include-mobile-layout-for-image {
    @media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) {
      /**
       * Remove all paddings around the image on small screen
       */
      .mfp-img-mobile {
        .mfp-image-holder {
          padding-right: 0;
          padding-left: 0;
        }

        img {
          &.mfp-img {
            padding: 0;
          }
        }

        .mfp-figure {
          // The shadow behind the image
          &:after {
            top: 0;
            bottom: 0;
          }

          small {
            display: inline;
            margin-left: 5px;
          }
        }

        .mfp-bottom-bar {
          position: fixed;
          top: auto;
          bottom: 0;
          box-sizing: border-box;
          padding: 3px 5px;
          margin: 0;
          background: rgba(0, 0, 0, .6);

          &:empty {
            padding: 0;
          }
        }

        .mfp-counter {
          top: 3px;
          right: 5px;
        }

        .mfp-close {
          position: fixed;
          top: 0;
          right: 0;
          width: 35px;
          height: 35px;
          padding: 0;
          line-height: 35px;
          text-align: center;
          background: rgba(0, 0, 0, .6);
        }
      }
    }
  }

  /* Main image in popup */
  img {
    &.mfp-img {
      box-sizing: border-box;
      display: block;
      width: auto;
      max-width: 100%;
      height: auto;
      padding: $mfp-image-padding-top 0 $mfp-image-padding-bottom;
      margin: 0 auto;
      line-height: 0;
    }
  }

  /* The shadow behind the image */
  .mfp-figure {
    line-height: 0;

    &:after {
      position: absolute;
      top: $mfp-image-padding-top;
      right: 0;
      bottom: $mfp-image-padding-bottom;
      left: 0;
      z-index: -1;
      display: block;
      width: auto;
      height: auto;
      content: "";
      background: $mfp-image-background;
      box-shadow: $mfp-shadow;
    }

    small {
      display: block;
      font-size: 12px;
      line-height: 14px;
      color: $mfp-caption-subtitle-color;
    }

    figure {
      margin: 0;
    }
  }

  .mfp-bottom-bar {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    margin-top: -$mfp-image-padding-bottom + 4;
    cursor: auto;
  }

  .mfp-title {
    padding-right: 36px; // leave some space for counter at right side
    line-height: 18px;
    color: $mfp-caption-title-color;
    text-align: left;
    word-wrap: break-word;
  }

  .mfp-image-holder {
    .mfp-content {
      max-width: 100%;
    }
  }

  .mfp-gallery {
    .mfp-image-holder {
      .mfp-figure {
        cursor: pointer;
      }
    }
  }
}

/*
====== Zoom effect ======
*/
.mfp-zoom-in {

  // start state
  .mfp-with-anim {
    opacity: 0;
    transition: all .2s ease-in-out;
    transform: scale(.8);
  }

  &.mfp-bg {
    opacity: 0;
    transition: all .3s ease-out;
  }

  // animate in
  &.mfp-ready {
    .mfp-with-anim {
      opacity: 1;
      transform: scale(1);
    }

    &.mfp-bg {
      opacity: .8;
    }
  }

  // animate out
  &.mfp-removing {
    .mfp-with-anim {
      opacity: 0;
      transform: scale(.8);
    }

    &.mfp-bg {
      opacity: 0;
    }
  }
}

/*
====== Newspaper effect ======
*/
.mfp-newspaper {

  // start state
  .mfp-with-anim {
    opacity: 0;
    -webkit-transition: all .2s ease-in-out;
    transition: all .5s;
    transform: scale(0) rotate(500deg);
  }

  &.mfp-bg {
    opacity: 0;
    transition: all .5s;
  }

  // animate in
  &.mfp-ready {
    .mfp-with-anim {
      opacity: 1;
      transform: scale(1) rotate(0deg);
    }

    &.mfp-bg {
      opacity: .8;
    }
  }

  // animate out
  &.mfp-removing {
    .mfp-with-anim {
      opacity: 0;
      transform: scale(0) rotate(500deg);
    }

    &.mfp-bg {
      opacity: 0;
    }
  }
}

/*
====== Move-horizontal effect ======
*/
.mfp-move-horizontal {

  // start state
  .mfp-with-anim {
    opacity: 0;
    transition: all .3s;
    transform: translateX(-50px);
  }

  &.mfp-bg {
    opacity: 0;
    transition: all .3s;
  }

  // animate in
  &.mfp-ready {
    .mfp-with-anim {
      opacity: 1;
      transform: translateX(0);
    }

    &.mfp-bg {
      opacity: .8;
    }
  }

  // animate out
  &.mfp-removing {
    .mfp-with-anim {
      opacity: 0;
      transform: translateX(50px);
    }

    &.mfp-bg {
      opacity: 0;
    }
  }
}

/*
====== Move-from-top effect ======
*/
.mfp-move-from-top {
  .mfp-content {
    vertical-align: top;
  }

  // start state
  .mfp-with-anim {
    opacity: 0;
    transition: all .2s;
    transform: translateY(-100px);
  }

  &.mfp-bg {
    opacity: 0;
    transition: all .2s;
  }

  // animate in
  &.mfp-ready {
    .mfp-with-anim {
      opacity: 1;
      transform: translateY(0);
    }

    &.mfp-bg {
      opacity: .8;
    }
  }

  // animate out
  &.mfp-removing {
    .mfp-with-anim {
      opacity: 0;
      transform: translateY(-50px);
    }

    &.mfp-bg {
      opacity: 0;
    }
  }
}

/*
====== 3d unfold ======
*/
.mfp-3d-unfold {
  .mfp-content {
    perspective: 2000px;
  }

  // start state
  .mfp-with-anim {
    opacity: 0;
    transition: all .3s ease-in-out;
    transform: rotateY(-60deg);
    transform-style: preserve-3d;
  }

  &.mfp-bg {
    opacity: 0;
    transition: all .5s;
  }

  // animate in
  &.mfp-ready {
    .mfp-with-anim {
      opacity: 1;
      transform: rotateY(0deg);
    }

    &.mfp-bg {
      opacity: .8;
    }
  }

  // animate out
  &.mfp-removing {
    .mfp-with-anim {
      opacity: 0;
      transform: rotateY(60deg);
    }

    &.mfp-bg {
      opacity: 0;
    }
  }
}

/*
====== Zoom-out effect ======
*/
.mfp-zoom-out {

  // start state
  .mfp-with-anim {
    opacity: 0;
    transition: all .3s ease-in-out;
    transform: scale(1.3);
  }

  &.mfp-bg {
    opacity: 0;
    transition: all .3s ease-out;
  }

  // animate in
  &.mfp-ready {
    .mfp-with-anim {
      opacity: 1;
      transform: scale(1);
    }

    &.mfp-bg {
      opacity: .8;
    }
  }

  // animate out
  &.mfp-removing {
    .mfp-with-anim {
      opacity: 0;
      transform: scale(1.3);
    }

    &.mfp-bg {
      opacity: 0;
    }
  }
}

// Scale navigation arrows and reduce padding from sides
@media all and (max-width: 900px) {
  .mfp-arrow {
    -webkit-transform: scale(.75);
    transform: scale(.75);
  }

  .mfp-arrow-left {
    -webkit-transform-origin: 0;
    transform-origin: 0;
  }

  .mfp-arrow-right {
    -webkit-transform-origin: 100%;
    transform-origin: 100%;
  }

  .mfp-container {
    padding-right: $mfp-popup-padding-left-mobile;
    padding-left: $mfp-popup-padding-left-mobile;
  }
}

// IE7 support
// Styles that make popup look nicier in old IE
@if $mfp-IE7support {
  .mfp-ie7 {
    .mfp-img {
      padding: 0;
    }

    .mfp-bottom-bar {
      left: 50%;
      width: 600px;
      padding-bottom: 5px;
      margin-top: 5px;
      margin-left: -300px;
    }

    .mfp-container {
      padding: 0;
    }

    .mfp-content {
      padding-top: 44px;
    }

    .mfp-close {
      top: 0;
      right: 0;
      padding-top: 0;
    }
  }
}
