@import "./menu.vars";

// Menu
// --------------------------------------------------

:host {
  --width: #{$menu-width};
  --width-small: #{$menu-small-width};

  @include position(0, 0, 0, 0);

  display: none;
  position: absolute;

  contain: strict;
}

:host(.show-menu) {
  display: block;
}


.menu-inner {
  @include position(0, auto, 0, 0);
  @include transform(translate3d(-9999px, 0, 0));

  display: flex;
  position: absolute;

  flex-direction: column;
  justify-content: space-between;

  width: var(--width);
  height: 100%;

  contain: strict;
}

:host(.menu-side-start) .menu-inner {
  @include multi-dir() {
    /* stylelint-disable property-blacklist */
    right: auto;
    left: 0;
  }
}

:host(.menu-side-end) .menu-inner {
  @include multi-dir() {
    right: 0;
    left: auto;
    /* stylelint-enable property-blacklist */
  }
}

ion-backdrop {
  display: none;

  opacity: .01;
  z-index: -1;
}

.menu-content {
  @include transform(translate3d(0, 0, 0));
}

.menu-content-open {
  cursor: pointer;
  touch-action: manipulation;

  // the containing element itself should be clickable but
  // everything inside of it should not clickable when menu is open
  pointer-events: none;
}

@media (max-width: 340px) {

  .menu-inner {
    width: var(--width-small);
  }

}


// Menu Reveal
// --------------------------------------------------
// The content slides over to reveal the menu underneath.
// The menu itself, which is under the content, does not move.

:host(.menu-type-reveal) {
  z-index: 0;
}

:host(.menu-type-reveal.show-menu) .menu-inner {
  @include transform(translate3d(0, 0, 0));
}


// Menu Overlay
// --------------------------------------------------
// The menu slides over the content. The content
// itself, which is under the menu, does not move.

:host(.menu-type-overlay) {
  z-index: $z-index-menu-overlay;
}

:host(.menu-type-overlay) .show-backdrop {
  display: block;

  cursor: pointer;
}


// Menu Split Pane
// --------------------------------------------------

:host(.menu-pane-visible) .menu-inner {
  @include position-horizontal(0, 0);

  width: auto;

  /* stylelint-disable declaration-no-important */
  transform: none !important;

  box-shadow: none !important;
}

:host(.menu-pane-visible) ion-backdrop {
  display: hidden !important;
  /* stylelint-enable declaration-no-important */
}
