// ===========================================
// offcanvas
// ===========================================
.com-offcanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  visibility: hidden;
  transition: visibility 0.3s;
  &.is-open {
    visibility: visible;
  }
}

.com-offcanvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s;
  .is-open & {
    opacity: 1;
  }
}

.com-offcanvas-bar {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 400px;
  height: 100%;
  overflow-y: auto;
  background-color: map-get($colors, black);
  padding: 0;
  color: map-get($colors, white);
  transform: translateX(100%);
  transition: transform 0.3s;
  .is-open & {
    transform: translateX(0);
  }
}

.com-offcanvas-close {
  position: relative;
  top: 0;
  right: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  &::before,
  &::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: map-get($colors, white);
  }
  &::before {
    transform: rotate(45deg);
  }
  &::after {
    transform: rotate(-45deg);
  }
}

// body スクロール抑制
body.is-offcanvas-open {
  overflow: hidden;
}

.offcanvas-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  .title {
    @include font(16);
    font-weight: bold;
    color: map-get($colors, white);
  }
}

.offcanvas-btn-01 {
  position: relative;
  @include font(15);
  color: map-get($colors, white);
  display: block;
  padding: 1em;
  padding-right: 3em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  // 矢印アイコン（単一リンク用）
  &.arrow::after {
    content: '';
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='11' viewBox='0 0 7 11'%3E%3Cpath d='M1,1L5.5,5.5L1,10' fill='none' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    width: 7px;
    height: 11px;
    position: absolute;
    top: 0;
    bottom: 0;
    margin-block: auto;
    right: 2em;
  }
  // プラスアイコン（アコーディオン用）
  &.accordion::before,
  &.accordion::after {
    content: '';
    background-color: map-get($colors, white);
    width: 12px;
    height: 2px;
    position: absolute;
    top: 50%;
    right: 2em;
    transform: translateY(-50%);
    transition: 0.3s ease;
  }
  &.accordion::after {
    transform: translateY(-50%) rotate(90deg);
  }
}

// アコーディオン開閉
.has-children {
  .nav-sub {
    background-color: rgba(255, 255, 255, 0.1);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    a {
      padding-left: 2em;
    }
  }
  &.is-open {
    .offcanvas-btn-01.accordion::after {
      transform: translateY(-50%);
    }
    .nav-sub {
      max-height: 500px;
    }
  }
}
