/* header CSS */
#trigger {
  position: absolute;
  top: 0;
  width: 100%;
  height: 1px;  /* 目に見えないけど、スクロールの判定用 */
  pointer-events: none;  /* クリックできないように */
}

header {
  display: flex;
  z-index: 300;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 80px;
  border-bottom: 1px solid #ddd;
  background: none;  /* 背景を透明に設定 */
  transition: transform 0.5s ease, opacity 0.7s ease 0.1s;
}

header {
  position: fixed;
  background: none;  /* 背景を透明に設定 */
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

#header {
  z-index: 300;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 80px;
  transition: transform 0.5s ease, opacity 0.7s ease 0.1s;
  transition: background-color 0.3s ease;
  top: 0;
  z-index: 1000; /* 他の要素より前に表示されるように */
  transition: background-color 0.3s ease, box-shadow 0.3s ease; /* 変化にアニメーションを追加 */
}

#header.scrolled {
  color: #000;
  background: #fff;
  border-bottom: 1px solid #ddd;
  transition: transform 0.5s ease, opacity 0.7s ease 0.1s;
  background-color: white;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* スクロール時に影を追加 */
}

#header:not(.scrolled) a {
  color: #fff;
}

#header.scrolled a {
  color: #000;
}

#headerLogo {
  height: 100%;
  position: absolute;
  left: 40px;
  top: 0;
  z-index: 3;
}

#headerLogo a {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all 0.25s ease;
  color: #fff;
}

#header.scrolled a {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all 0.25s ease;
}

#headerLogo img {
  display: block;
  transition: all 0.25s ease;
  max-height: calc(100% - 20px);
  width: auto;
}

/* メインナビゲーション */
#headerGlobalMenuContainer {
  height: 80px;
  z-index: 2;
  position: absolute;
  top: 0;
  right: 80px;
}

#headerGlobalMenu > ul {
  position: relative;
  text-align: center;
  font-size: 0;
  display: flex;
}

#headerGlobalMenu > ul > li {
  display: inline-block;
  position: relative;
  line-height: 1;
  text-align: center;
}

#headerGlobalMenu > ul > li > a {
  text-decoration: none;
  height: 80px;
  line-height: 80px;
  padding: 0 20px;
  display: block;
  position: relative;
  overflow: hidden;
}

#headerGlobalMenu {
  display: flex;
}

#headerGlobalMenuContainer > ul > li > a {
  color: #000;
  text-decoration: none;
  height: 80px;
  line-height: 80px;
  padding: 0 20px;
  display: block;
  position: relative;
  overflow: hidden;
}

a,
a:before,
a:after,
input {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

main {
  width: 100%;
  margin: -80px 0 0 0;
}

/* ハンバーガーメニュー */
#drawer_menu_button {
  width: 60px;
  height: 60px;
  display: block;
  position: absolute;
  right: 0;
  top: 0;
  background-color: transparent;  /* ハンバーガーメニューのボタン背景を透明に */
  z-index: 1001;  /* メニューより前に表示 */
}

#drawer_menu_button {
  position: absolute;
  left: 0;
  top: 0;
  width: 60px;
  height: 60px;
  background-color: transparent;  /* 背景を透明に */
  z-index: 1001;  /* メニューより前に表示 */
}

.bar {
  display: block;
  height: 40px;
  width: 40px;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

#drawer_menu_button .bar_1 {
  display: block;
  width: 100%;
  height: 8px;
  background-color: #fff;  /* 初期状態は白 */
  margin: 6px 0;
  transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.3s ease;
}

/* モバイルメニュー */
#mobile_menu {
  display: none;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 80px;  /* ヘッダー下に表示 */
  right: 0;
  width: 250px;  /* メニューの幅 */
  background-color: rgba(0, 0, 0, 0.9);  /* メニュー背景色 */
  color: #fff;
  padding: 20px;
  z-index: 1000;
  transition: transform 0.3s ease;
  display: flex; /* 親要素にflexを追加 */
  flex-direction: column; /* 縦並びにする */
  justify-content: flex-start; /* アイテムを上に寄せる */
}

#drawer_menu_button span:nth-child(1) {
  top: 20px;
}

#drawer_menu_button span:nth-child(2) {
  top: 26px;
}

#drawer_menu_button span:nth-child(3) {
  top: 32px;
}

/* モバイルメニューが開いているとき */
#mobile_menu.open {
  display: block;
  transform: translateX(0);  /* メニューが右からスライドイン */
}

/* メニュー項目 */
#mobile_menu ul {
  padding: 0;
  margin: 0;
  list-style: none;
  width: 100%; /* 幅を100%にして全体の幅を使う */
}

#mobile_menu ul li {
  width: 100%; /* 各メニュー項目が親の幅を使う */
}

#mobile_menu ul li a {
  display: block;
  margin: 0;
  padding: 0 50px 0 20px;
  height: 50px;
  line-height: 50px;
  overflow: hidden;
  text-decoration: none;
  color: #fff !important;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  transition: none;
  white-space: nowrap;
  text-overflow: ellipsis;
  visibility: visible;
  width: 100%;                  /* ブロック全体をクリック可能に */
  box-sizing: border-box;       /* padding込みでも幅が崩れないように */
  
}

/* ハンバーガーメニューの色変更 */
#header.scrolled #drawer_menu_button .bar_1 {
  background-color: #000;  /* スクロール時にバーを黒に変更 */
}

@media screen and (min-width: 1201px) {

  #drawer_menu_button {
    display: none;
  }

  #drawer_menu_button .bar_1 {
    display: none;
  }

  #headerGlobalMenuContainer {
    display: block;
  }

}

/* メディアクエリ (1200px以下) */
@media screen and (max-width: 1200px) {

  /* ヘッダーのスタイルを変更 */
    #header {
      position: fixed;
      width: 100%;
      height: 60px;
      top: 0;
      left: 0;
      z-index: 1000;
      display: flex;
      justify-content: flex-start; /* ロゴやメニューを左寄せ */
      align-items: center;
      transition: background-color 0.3s ease, box-shadow 0.3s ease;
    }


    
  /* ロゴの配置 */
  #headerLogo {
    position: absolute;
    left: 20px;  /* ロゴの位置を少し左寄りに */
    top: 0;
  }

  #headerLogo img {
    max-height: calc(100% - 20px);
    width: auto;
  }

  #header.scrolled a {
    align-items: flex-start;

  }

  /* グローバルメニューを非表示 */
  #headerGlobalMenuContainer {
    display: none;
  }

  /* ハンバーガーメニュー */
  .menu_button {
    width: 60px;
    height: 60px;
    display: block;
    position: absolute;
    right: 0;
    top: 0;
  }

  #drawer_menu_button {
    width: 60px;
    height: 60px;
    display: block;
    position: absolute;
    right: 0;
    top: 0;
  }

  #drawer_menu_button .bar_1 {
    width: 22px;
    height: 2px;
    background: #ffffff;
    display: block;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.4s ease;
  }




  /* モバイルメニュー */
  #mobile_menu {
    display: none;
    position: fixed;         /* absolute → fixed に変更 */
    top: 0;                  /* ヘッダー下 → 全画面表示なので0に */
    left: 0;
    width: 100%;            /* 全幅 */
    height: 100vh;           /* 全高 */
    background-color: rgba(0, 0, 0, 0.95); /* 背景をやや暗めに */
    color: #fff;
    padding: 60px 20px 20px; /* 上に余白（メニューの開き始め位置） */
    z-index: 9999;           /* 最前面に表示 */
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;    /* 非表示状態ではクリック不可 */
  }

  /* モバイルメニューが開いたとき */
  #mobile_menu.open {
    display: block;
    opacity: 1;
    pointer-events: auto;   /* 表示状態ではクリック可 */
  }

  

  /* メニュー項目 */
  #mobile_menu ul li a {
    text-align: left;
    text-decoration: none;
    color: #fff;
    font-size: 16px;
    display: block;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2); /* ボーダーを全幅に */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: flex-start;  /* 左寄せにするため、アイテムを左に配置 */
    justify-content: center;  /* 垂直方向にセンタリング */
  }

  /* スクロール時のハンバーガーメニューの色変更 */
  #header.scrolled #drawer_menu_button .bar_1 {
    background-color: #000;  /* スクロール時にハンバーガーメニューのバーを黒に変更 */
  }

  main {
    width: 100%;
    margin: -60px 0 0 0;
  }
}
