// Name:         Off-canvas
//
// Description:  Define style for off-canvas sidebar
//
// Component:    `.am-offcanvas`
//
// Sub-objects:  `.am-offcanvas-page`
//               `.am-offcanvas-bar`
//
// Modifiers:    `.am-offcanvas-bar-flip`
//
// States:       `.am-active`
//
// =============================================================================


// Variables
// =============================================================================
@offcanvas-dimmer-background:         rgba(0,0,0,0.15);
@offcanvas-bar-width:                 270px;
@offcanvas-bar-background:            #333;
@offcanvas-bar-border-color: darken(@offcanvas-bar-background, 5%);


/* ==========================================================================
   Component: OffCanvas Plugin
 ============================================================================ */

/* Off-canvas overlay and bar container */

.@{ns}offcanvas {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: @z-index-offcanvas;
  background: @offcanvas-dimmer-background;

  .hook-offcanvas;

  &.@{ns}active {
    display: block;
  }
}


/**
 * .@{ns}offcanvas-page
 *
 * Prepares the whole HTML page to slide-out
 * 1. Fix the main page and disallow scrolling
 * 2. Side-out transition
 */

.@{ns}offcanvas-page {
  position: fixed;   /* 1 */
  transition: margin-left .3s ease-in-out; /* 2 */
}


/* Sub-object .@{ns}offcanvas-bar */

.@{ns}offcanvas-bar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: @z-index-offcanvas + 1;
  width: @offcanvas-bar-width;
  max-width: 100%;
  background: @offcanvas-bar-background;

  overflow-y: auto;  /* scrollable */
  -webkit-overflow-scrolling: touch; /* scrollable */
  transition: transform .3s ease-in-out;
  transform: translateX(-100%);

  &:after {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 1px;
    background: @offcanvas-bar-border-color;
    // box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.6);
  }

  .hook-offcanvas-bar;
}

.@{ns}offcanvas.@{ns}active .@{ns}offcanvas-bar.@{ns}offcanvas-bar-active {
  transform: translateX(0);
}


/* .@{ns}offcanvas-bar-flip */
.@{ns}offcanvas-bar-flip {
  left: auto;
  right: 0;
  transform: translateX(100%);

  &:after {
    right: auto;
    left: 0;
  }
}

.@{ns}offcanvas-content {
  padding: 15px;
  color: #999;

  a {
    color: #ccc;
  }
}


// Hooks
// ========================================================================

.hook-offcanvas() {}
.hook-offcanvas-bar() {}
