@use "global/acms-common" as acms;
@use "global/common" as global;

/* ------------------------------
  モバイルメニュー
------------------------------ */
.global-nav-mobile-menu-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: global.$header-height-fixed;
  height: global.$header-height-fixed;
  background: global.$color-primary;

  &:hover {
    text-decoration: none;
  }

  &:active,
  &:focus {
    outline: 0;
  }
}

.global-nav-mobile-menu-text {
  margin: 7px 0 0;
  color: global.$color-text-inverse;

  @include acms.font-size(12);

  line-height: 1;
}


/* トグルメニューアイコン */
.global-nav-mobile-icon-toggle-menu {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 2px;
  margin: 6px auto;
  vertical-align: middle;
  background-color: global.$color-text-inverse;
  border-radius: 1px;
  transition: .1s all;

  &::before,
  &::after {
    position: absolute;
    display: block;
    width: 22px;
    height: 2px;
    background-color: global.$color-text-inverse;
    border-radius: 1px;
    transition: .3s all;
    content: "";
  }

  &::before {
    top: -6px;
  }

  &::after {
    bottom: -6px;
  }

  [aria-expanded="true"] & {
    background: transparent;
  }

  [aria-expanded="true"] &::before {
    width: 22px;
    transform: translate(0, 6px) rotate(45deg);
  }

  [aria-expanded="true"] &::after {
    width: 22px;
    transform: translate(0, -6px) rotate(-45deg);
  }
}


@media (max-width : acms.$breakpoint-lg-max) {
  .is-locked {
    overflow: hidden;
  }

  .global-nav-mobile {
    position: fixed;
    top: 0;
    left: 0;
    z-index: global.$zindex-mobile-nav;
    display: none;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    padding-top: global.$header-height + 10px;
    overflow-y: scroll;
    background-color: global.$color-white;
    opacity: 0;
    transition-timing-function: cubic-bezier(.25, .46, .45, .94);
    transition-duration: .3s;
    transition-property: all;

    &.is-active {
      display: block;
    }

    &.is-opened {
      opacity: 1;
    }
  }
}


/* モバイルメニュー開いた時
------------------------------ */
.global-nav-mobile-inner {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: 0 20px;
}

.global-nav-mobile-menu-btn {
  position: fixed;
  top: 0;
  right: 0;
  z-index: global.$zindex-mobile-nav-btn;
}

.global-nav-mobile-navbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0 0 50px;
}

.global-nav-mobile-group {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;

  .global-nav-mobile-navbar > &  {
    border-top: global.$border-width-sm solid global.$color-gray30;
  }
}

.global-nav-mobile-item {
  @include acms.font-size(18);

  font-weight: bold;

  &.is-expand {
    .global-nav-mobile-link {
      position: relative;
    }

    .icon-expand {
      margin-top: 5px;

      &::before,
      &::after {
        position: absolute;
        display: block;
        width: 16px;
        height: 2px;
        background-color: global.$color-text;
        border: 0;
        border-radius: 1px;
        transition: .3s all;
        content: "";
      }

      &::before {
        transform: translate(-2px,-6px) rotate(90deg);
      }

      &::after {
        transform: translate(-2px,-6px);
      }
    }

    .icon-expand.is-close {
      &::before,
      &::after {
        width: 16px;
        transform: translate(-2px,-6px);
      }
    }

  }

  .global-nav-mobile-group {
    display: none;
  }

  .global-nav-mobile-item {
    @include acms.font-size(14);

    .icon-expand {
      &::before,
      &::after {
        content: none;
      }
    }

    .global-nav-mobile-link {
      &:link,
      &:visited,
      &:hover,
      &:active,
      &:focus {
        color: global.$color-text-side;
      }
    }

  }
}

.global-nav-mobile-link {
  position: relative;
  display: block;
  padding: 15px 0;
  color: global.$color-text;
  border-bottom: global.$border-width-sm solid global.$color-gray30;

  &:link,
  &:visited,
  &:hover,
  &:active,
  &:focus {
    color: global.$color-text;
    text-decoration: none;
  }

  .global-nav-mobile-item.is-expand .global-nav-mobile-item &::before {
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
    border: 3px solid transparent;
    border-left: 6px solid rgb(0 0 0 / 40%);
    content: "";
  }
}


.global-nav-mobile {
  .icon-expand {
    position: absolute;
    top: 50%;
    right: 20px;
    margin-top: -3px;

    &::before {
      position: absolute;
      display: block;
      width: 6px;
      height: 6px;
      border-top: 2px solid global.$color-gray100;
      border-right: 2px solid global.$color-gray100;
      transform:  rotate(45deg);
      content: "";
    }
  }
}


.global-nav-mobile-side-group {
  width: 100%;
  margin: 10px 0 0;
  padding: 0;
  font-weight: bold;
  list-style: none;

  .global-nav-mobile-side-group {
    margin: 0 0 20px;
  }

}

.global-nav-mobile-side-item {
  @include acms.font-size(14);
}

.global-nav-mobile-side-link {
  position: relative;
  display: block;
  padding: 13px 0;

  @include global.link-color(global.$color-text);
}


.global-nav-mobile-navbar-footer {
  margin-top: 10px;
}
