@use 'global/common' as global;

/* ------------------------------
 オフキャンバス
------------------------------- */
.js-acms-offcanvas-active {
  position: fixed;
  inset: 0;
  z-index: global.zIndex(js-acms-offcanvas-active);
  display: none;
  width: 100%;
  height: 100%;
  background: rgb(0 0 0 / 30%);
}

.js-acms-offcanvas-open {
  display: block;
}

.js-acms-offcanvas-body {
  left: 0;
  width: 100%;
  transition: left 0.3s ease-in-out;
}

.js-acms-offcanvas-body-moving {
  position: fixed;
}

.js-acms-offcanvas-body-right {
  position: fixed;
  left: -70%;
  overflow-y: hidden;
}

.js-acms-offcanvas-body-left {
  position: fixed;
  left: 70%;
  overflow-y: hidden;
}

.js-acms-offcanvas-body-moving {
  position: fixed;
  left: 0;
}

.js-acms-offcanvas-active {
  & .js-acms-offcanvas-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: global.zIndex(js-acms-offcanvas-sidebar);
    box-sizing: border-box;
    display: block;
    width: 70%;
    max-width: 100%;
    overflow-y: scroll;
    background-color: global.$acms-color-white;
    -webkit-overflow-scrolling: touch;
  }

  & .js-acms-offcanvas-sidebar-right {
    right: 0;
    left: auto;
    margin-right: -70%;
    transition: margin-right 0.3s ease-in-out;
  }

  & .js-acms-offcanvas-sidebar-left {
    right: auto;
    left: 0;
    margin-left: -70%;
    transition: margin-left 0.3s ease-in-out;
  }

  & .js-acms-offcanvas-sidebar-right.active {
    margin-right: 0;
    transition: margin-right 0.3s ease-in-out;
  }

  & .js-acms-offcanvas-sidebar-left.active {
    margin-left: 0;
    transition: margin-left 0.3s ease-in-out;
  }
}

.js-acms-header-fixed {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  transition: margin-left 0.3s ease-in-out;
}

.js-acms-offcanvas-body-right,
.js-acms-offcanvas-body-left {
  overflow: hidden;
}

.js-acms-offcanvas-body-right .js-acms-header-fixed {
  margin-left: -70%;
}

.js-acms-offcanvas-body-left .js-acms-header-fixed {
  margin-left: 70%;
}
