@import '../tools/mixins/transition';
@import '../tools/mixins/position';
@import '../settings/variables';
@import '../utilities/utils';
@import '../tools/mixins/breakpoints';

.c-modal {
  @include absolute(2em, 0, auto, auto);
  display: none;
  min-width: 26em;
  padding: $margin-big $margin-enormous;
  z-index: $layer-modal;
  position: relative;

  background-color: $color-background;
  border-radius: 2px;
  box-shadow: 0 0.125em 1.25em rgba(0, 0, 0, 0.2);

  &--with-mobile {
    @include media-breakpoint-down(md) {
      min-width: 0;
      width: 100vw;
    }
  }

  @media print {
    @include absolute(0, 0, 0, 0);
    background-color: $color-background;
    border-radius: 0 !important;
    box-shadow: none !important;
    min-width: auto;
    transform: initial;
    width: 100%;
    margin: 0;
    padding: 0;
    min-width: 99%;
  }

  &__close {
    @include absolute(3em, 3em, auto, auto);
    cursor: pointer;
    height: 1em;
    width: 1em;
    z-index: $layer-fixed;

    @media print {
      display: none;
    }

    &:before,
    &:after {
      @include absolute(auto, 0, 50%, auto);
      content: '';
      width: 100%;
      height: $hairline;
      background-color: $color-secondary-dark;
    }

    &:before {
      transform: rotate(-45deg);
    }

    &:after {
      transform: rotate(45deg);
    }
  }

  &__footer {
    padding-top: $margin-big;
    border-top: $hairline solid $color-neutral;

    &--gradient {
      border: none;
      padding-top: $margin-normal;
    }
  }

  &__overlay {
    display: none;

    &--opened {
      @include fixed(0, 0, 0, 0);
      display: block;
      z-index: $layer-blocker;
    }
  }

  &__content {
    max-height: 70vh;
    overflow: auto;

    @media print {
      max-height: initial;
    }

    &--maintenance {
      @include media-breakpoint-up(md) {
        border-radius: 2px;
        min-width: 40em;
      }
    }
  }

  &__text {
    color: $color-secondary-dark;
    font-size: 1em;
    &--link {
      color: $color-primary;
    }

    &--headline {
      font-family: $font-maersk-headline;
      font-size: 1.625em;
      line-height: 2.187em;
    }
  }

  &--opened {
    display: block;
  }

  &--centered {
    @include fixed(50%, auto, auto, 50%);
    transform: translate(-50%, -50%);

    @media print {
      @include absolute(0, 0, auto, 0);
      transform: initial;
    }

    &.c-modal--with-mobile {
      @include fixed(0, 0, 0, 0);
      transform: initial;

      @include media-breakpoint-up(md) {
        @include fixed(50%, auto, auto, 50%);
        transform: translate(-50%, -50%);
      }
    }
  }

  &__gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: $modal-gradient-height-mobile;
    background: linear-gradient(179.37deg, rgba(255, 255, 255, 0) 0.54%, #FFFFFF 99.46%);

    @include media-breakpoint-up(md) {
      width: calc(100% - 1em);
      height: $modal-gradient-height;
    }
  }

  &--lines-background {
    background: $color-background url('/assets/images/lines-background.svg') no-repeat;
  }
}
