/* 全ページ共通: ヘッダー・ハンバーガー・メニュー overlay
 * ページ別 CSS の重複定義より後に読み込み、幅・位置の崩れを上書きする */

body > header,
#header {
  max-width: 100%;
  overflow-x: clip;
  box-sizing: border-box;
  width: 100%;
  justify-content: space-between;
}

body > header nav > div:nth-of-type(1) ul.mnav_pc,
#header nav > div:nth-of-type(1) ul.mnav_pc {
  min-width: 0 !important;
  margin-right: 0 !important;
  max-width: 100%;
}

body > header nav > div#main_toggle,
#header nav > div#main_toggle {
  display: none;
}

/* PC: ハンバーガーを flex 内に置き、ボタンと重ならないようにする */
@media (min-width: 769px) {
  body > header nav,
  #header nav {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
  }

  body > header nav > div:nth-of-type(1) ul.mnav_pc,
  #header nav > div:nth-of-type(1) ul.mnav_pc {
    gap: 0.75em;
    flex-shrink: 1;
  }

  body > header nav > div:nth-of-type(1) ul.mnav_pc li a,
  #header nav > div:nth-of-type(1) ul.mnav_pc li a {
    width: auto !important;
    white-space: nowrap;
  }

  .menu-toggle,
  #menu-toggle {
    position: relative !important;
    right: auto !important;
    top: -10px !important;
    flex-shrink: 0;
    margin: 0;
  }
}

@media (max-width: 768px) {
  html,
  body {
    overflow-x: clip;
    max-width: 100%;
  }

  body > header,
  #header {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  body > header nav,
  #header nav {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 99997;
  }

  body > header nav > div:nth-of-type(1),
  #header nav > div:nth-of-type(1) {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body > header nav > div:nth-of-type(1) ul.mnav_pc,
  #header nav > div:nth-of-type(1) ul.mnav_pc {
    display: none !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  body > header h1,
  #header h1 {
    width: min(14rem, calc(100% - 72px));
    max-width: none;
  }

  #menu-toggle,
  .menu-toggle {
    position: fixed !important;
    right: max(16px, env(safe-area-inset-right, 0px)) !important;
    top: 10px !important;
    pointer-events: auto;
  }
}

.menu {
  position: fixed;
  inset: 0;
  width: auto;
  max-width: 100%;
  overflow-x: hidden;
  animation: none !important;
  visibility: hidden;
  pointer-events: none;
}

.menu.active {
  visibility: visible;
  pointer-events: auto;
  animation: none !important;
}

.menu div.inner_wrap {
  max-width: 95%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .menu div.inner_wrap {
    background-attachment: scroll;
    background-position: right bottom;
  }

  /* アコーディオン h4 の +/- 擬似要素（約半分サイズ） */
  .menu div.inner_wrap > div.nav_pc_upper div.nav_pc_right > ul.nav_pc_right_ul li h4:before,
  .menu div.inner_wrap > div.nav_pc_upper div.nav_pc_right > ul.nav_pc_right_ul li h4:after,
  footer > div.nav_pc_upper div.nav_pc_right > ul.nav_pc_right_ul li h4:before,
  footer > div.nav_pc_upper div.nav_pc_right > ul.nav_pc_right_ul li h4:after {
    border-radius: 1px;
    width: 12px;
    height: 2px;
    top: 30px;
    right: 22px;
  }

  .menu div.inner_wrap > div.nav_pc_upper div.nav_pc_right > ul.nav_pc_right_ul li h4:before,
  footer > div.nav_pc_upper div.nav_pc_right > ul.nav_pc_right_ul li h4:before {
    width: 2px;
    height: 12px;
    top: 25px;
    right: 27px;
  }
}
