@use "sass:map";
@use "global/acms-common" as acms;
@use "global/common" as global;

/* ------------------------------
  モバイルメニュー
------------------------------ */
@media (min-width: acms.$breakpoint-lg-min) {
  .global-nav-mobile-menu {
    display: none;
  }
}

.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;
  text-decoration: none;
  background: global.$color-primary;

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

.global-nav-mobile-menu-text {
  margin: 0.5rem 0 0;
  color: global.$color-text-inverse;
  font-size: map.get(global.$font-scales, body-s);
  line-height: global.$line-height-ss;
}

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

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

  &::before {
    top: -0.4rem;
  }

  &::after {
    bottom: -0.4rem;
  }

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

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

  [aria-expanded="true"] &::after {
    width: 1.25rem;
    transform: translate(0, -0.4rem) 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 + 0.5rem;
  overflow-y: scroll;
  background-color: global.$color-white;
  opacity: 0;
  transition-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transition-duration: 0.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 1.25rem;
}

.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 {
  font-weight: bold;
  font-size: map.get(global.$font-scales, body-m);

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

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

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

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

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

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

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

  .global-nav-mobile-item {
    font-size: map.get(global.$font-scales, body-s);

    .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: 1rem 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;
  }

  &.is-cta {
    margin: 1rem 0 0;
    padding: 1rem 2rem;
    color: var(--color-text-inverse);
    text-align: center;
    background: var(--color-primary);
    border-radius: global.$border-radius-lg;

    .icon-expand {
      right: 2rem;

      &::before {
        border-color: var(--color-text-inverse);
      }
    }
  }

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

.global-nav-mobile {
  .icon-expand {
    position: absolute;
    top: 50%;
    right: 1.25rem;
    margin-top: -0.25rem;

    &::before {
      position: absolute;
      display: block;
      width: 0.5rem;
      height: 0.5rem;
      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: 0.5rem 0 0;
  padding: 0;
  font-weight: bold;
  list-style: none;

  .global-nav-mobile-side-group {
    margin: 0 0 1.25rem;
  }
}

.global-nav-mobile-side-item {
  font-size: map.get(global.$font-scales, body-s);
}

.global-nav-mobile-side-link {
  position: relative;
  display: block;
  padding: 0.75rem 0;
  color: currentcolor;
  text-decoration: none;

  &:hover {
    color: inherit;
  }
}

.global-nav-mobile-navbar-footer {
  margin-top: 0.5rem;
}
