/* ============================================
   ハンバーガーメニュー
   PC(981px〜)  : 従来の縦メニューそのまま
   SP(〜980px)  : ハンバーガー＋スライドドロワー
   ============================================ */

/* PCではボタン・ドロワー・オーバーレイは非表示 */
#hamburger-btn,
#nav-drawer,
#nav-overlay { display: none; }

/* ===============================
   スマホ専用スタイル
   =============================== */
@media (max-width: 980px) {

  /* --- 横スクロール完全禁止 --- */
  html, body {
    overflow-x: hidden;
    width: 100%;
  }

  /* wrap・h1画像をレスポンシブに */
  div#wrap {
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden;
    box-sizing: border-box;
    border-left: none !important;
    border-right: none !important;
  }

  div#wrap > h1 {
    position: static !important;
    top: auto !important;
    left: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0;
  }

  div#wrap > h1 img {
    width: 100% !important;
    height: auto !important;
    display: block;
  }

  /* 既存メニューバーは非表示（ドロワーに移動するため） */
  div#menuBar {
    display: none !important;
  }

  /* --- ハンバーガーボタン --- */
  #hamburger-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 10px;
    right: 10px;
    width: 50px;
    height: 50px;
    background: #000;
    border: 2px solid #fff;
    border-radius: 6px;
    cursor: pointer;
    z-index: 9999;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  }

  #hamburger-btn .bar {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    position: absolute;
    transition: transform 0.3s, opacity 0.2s, top 0.3s;
  }
  #hamburger-btn .bar:nth-child(1) { top: 13px; }
  #hamburger-btn .bar:nth-child(2) { top: 22px; }
  #hamburger-btn .bar:nth-child(3) { top: 31px; }

  #hamburger-btn.open .bar:nth-child(1) { top: 22px; transform: rotate(45deg); }
  #hamburger-btn.open .bar:nth-child(2) { opacity: 0; }
  #hamburger-btn.open .bar:nth-child(3) { top: 22px; transform: rotate(-45deg); }

  /* --- オーバーレイ --- */
  #nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0);
    z-index: 8000;
    pointer-events: none;
    transition: background 0.3s;
  }
  #nav-overlay.active {
    background: rgba(0,0,0,0.5);
    pointer-events: auto;
  }

  /* --- スライドドロワー --- */
  #nav-drawer {
    display: block;
    position: fixed;
    top: 0;
    right: -280px;
    width: 270px;
    height: 100%;
    background: #111;
    z-index: 9000;
    overflow-y: auto;
    transition: right 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: 60px;
    box-sizing: border-box;
  }
  #nav-drawer.open {
    right: 0;
  }

  body.nav-open {
    overflow: hidden;
  }

  /* --- ドロワー内メニュー --- */
  #nav-drawer ul#navmenu {
    display: block !important;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
  }
  #nav-drawer ul#navmenu,
  #nav-drawer ul#navmenu li,
  #nav-drawer ul#navmenu ul {
    width: 100%;
    float: none;
    position: static;
  }

  /* 第1階層 */
  #nav-drawer ul#navmenu > li > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    background: #1a1a1a;
    color: #fff;
    font: bold 13px/1.4 Verdana, Arial, sans-serif;
    text-decoration: none;
    border-bottom: 1px solid #2a2a2a;
  }
  #nav-drawer ul#navmenu > li > a:active { background: #555; }

  /* サブ持ち項目に ▼ */
  #nav-drawer ul#navmenu > li.has-sub > a::after {
    content: "▼";
    font-size: 10px;
    opacity: 0.6;
    flex-shrink: 0;
    transition: transform 0.25s;
    display: inline-block;
  }
  #nav-drawer ul#navmenu > li.has-sub.sub-open > a::after {
    transform: rotate(180deg);
  }

  /* 第2階層 */
  #nav-drawer ul#navmenu ul {
    display: none;
    background: #0d0d0d;
    list-style: none;
    padding: 0;
  }
  #nav-drawer ul#navmenu li.sub-open > ul {
    display: block;
  }
  #nav-drawer ul#navmenu ul li a {
    display: block;
    padding: 11px 18px 11px 32px;
    color: #bbb;
    font: 12px/1.4 Verdana, Arial, sans-serif;
    text-decoration: none;
    border-bottom: 1px solid #1e1e1e;
    background: #0d0d0d;
  }
  #nav-drawer ul#navmenu ul li a:active { background: #2a2a2a; color: #fff; }

  /* コンテンツエリアのレスポンシブ */
  div#info {
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    box-sizing: border-box;
    padding: 12px 14px !important;
  }

  div#info img[align="right"],
  div#info img[style*="float:right"],
  div#info img[style*="float: right"] {
    float: none !important;
    display: block;
    margin: 8px auto;
    max-width: 100%;
    height: auto !important;
  }

  div#info iframe {
    width: 100% !important;
    height: auto;
    aspect-ratio: 16/9;
  }

  div#info div[style*="width:630px"],
  div#info div[style*="width: 630px"] {
    width: 100% !important;
    box-sizing: border-box;
  }

  div#footer {
    width: 90% !important;
  }
}
