/* --- 2. 固定ヘッダー (Top) --- */
.fixed-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 99999;
}

/* ロゴエリアコンテナ */
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 99999;
}

/* --- ハンバーガーメニューの基本設定（PCでは隠す） --- */
.hamburger {
  display: none; /* デフォルトは非表示 */
}

.logo-area {
  background: #fff;
  padding: 0 20px;
  border-radius: 0 0 50px 0;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 15px;
  z-index: 99999;
  height: 120px;
}

.logo-mark {
  /* width: 70px; */
  height: 80px;
  display: block;
}

.logo-text-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.logo-line-1 {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--jilaf);
  line-height: 1.2;
}

.logo-line-2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--jilaf);
  line-height: 1.1;
  letter-spacing: 0.05em;
}

.logo-line-3 {
  font-size: 0.6rem;
  font-family: var(--font-en);
  font-weight: 500;
  color: #3b9065; /* common.cssの変数を使用 */
  line-height: 1.2;
  margin-top: 2px;
}

.menu-area {
  height: 120px;
}
/* 右上ユーティリティ */
.top-utility {
  display: flex;
  align-items: center;
  gap: 15px;
  justify-content: flex-end;
  height: 60px;
  padding-right: 20px;
}

/* ==========================================================================
   Scroll Animation for Utility Bar
   ========================================================================== */

/* ==========================================================================
   Utility Bar Scroll Animation (Vertical Shrink)
   ========================================================================== */

.top-utility.pc-only {
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  opacity: 1;
  transform: translateY(0);

  /* ★ポイント1：高さをアニメーション対象にする */
  max-height: 100px; /* 十分な高さを指定 */
  margin-bottom: 15px; /* メニューとの間の余白 */
  overflow: hidden;
}

/* 隠れる時のクラス */
.top-utility.pc-only.is-hidden {
  opacity: 0;
  transform: translateY(-20px);

  /* ★ポイント2：高さと余白を完全にゼロにする */
  max-height: 0;
  margin-bottom: 0;

  pointer-events: none;
  visibility: hidden;
}

/* --- ヘッダー全体の余白も調整が必要な場合 --- */
.header-top {
  /* もし .header-top に大きな padding が設定されているなら、
       そこも transition をかけておくとスムーズです 
    */
  transition: padding 0.4s ease;
}

/* ユーティリティが消えたときにヘッダーを細くするなら、JSで親にもクラスをつけると完璧です */
.fixed-header.is-shrunk .main-nav {
  margin-top: 10px;
  /* padding-bottom: 10px; */
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  padding: 8px 35px 8px 15px;
  border-radius: 20px;
  border: 1px solid #ddd;
  font-size: 0.8rem;
  width: 200px;
  outline: none;
  box-shadow: var(--shadow-sm);
}

.search-box i {
  position: absolute;
  right: 12px;
  color: var(--navy);
}

.btn-action {
  padding: 10px 25px;
  border-radius: 50px;
  min-width: 150px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: bold;
  transition: 0.5s;
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.btn-action:hover {
  transform: translateY(-3px); /* 少し上に浮き上がる */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); /* 影を強くして立体感を出す */
  filter: brightness(1.1); /* 全体的に少し明るくする */
  opacity: 0.9; /* ほんの少し透かして「押せる感」を強調 */
}

/* クリックした瞬間（アクティブ状態） */
.btn-action:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.btn-contact {
  background: #455564;
}
.btn-support {
  background: var(--accent-red);
}

/* グラデーションメニューバー */
/* ==========================================================================
   NAVIGATION & DROPDOWN (修正版)
   ========================================================================== */

/* --- 社長の元のCSS (ベース) --- */
.main-nav {
  background: var(--navy-gradient);
  backdrop-filter: blur(8px);
  border-radius: 40px 0 0 40px;
  padding: 0 30px; /* 上下のパディングは高さ60pxで制御するため0にしてFlexで中央揃えにします */
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 40px;
  box-shadow: var(--shadow-sm);
  width: fit-content;
  margin-left: auto;
  height: 60px; /* 高さ固定 */
  position: relative;
  z-index: 1000; /* メニューを最前面に */
}

/* PC ではトグルボタンは不要 */
.sub-menu-toggle {
  display: none;
}

.nav-links {
  display: flex;
  gap: 30px;
  margin-right: 20px;
  align-items: center;
  list-style: none; /* リストの点などを消す */
  margin-top: 0;
  margin-bottom: 0;
  padding-left: 0;
  height: 100%; /* ナビの高さ一杯に使う */
}

/* --- ここからドロップダウン用の追加記述 --- */

/* リストアイテム（親） */
.nav-links > li {
  position: relative; /* 子メニューの基準点 */
  height: 100%; /* ナビの高さに合わせる */
  display: flex;
  align-items: center; /* リンクを垂直中央に */
}

/* リンクのデザイン */
.nav-links a {
  color: #fff; /* 変数が効かない場合のために白を指定 */
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px; /* テキストと矢印の間隔 */
  transition: opacity 0.3s;
}

.nav-links a:hover {
  opacity: 0.7;
}

/* 矢印アイコンの動き */
.nav-links li i {
  font-size: 0.7em;
  transition: transform 0.3s;
}
/* 親liにホバーしたら矢印が回転 */
.nav-links > li:hover > a i {
  transform: rotate(180deg);
}

/* --- 子メニュー（ドロップダウン本体） --- */
/* --- 子メニュー（ドロップダウン本体） --- */
.sub-menu {
  position: absolute;
  top: 60px; /* 親ナビの高さ分下げる */
  left: 50%;
  transform: translateX(-50%) translateY(10px); /* 中央揃え & 少し下に配置(初期) */

  width: max-content;
  min-width: 220px; /* 少し幅を広げました */

  /* 背景色を var(--jilaf) に変更 */
  background: var(--jilaf);

  padding: 0; /* 区切り線を端まで引くためにパディングを0に */
  border-radius: 0 0 8px 8px; /* 下側だけ角丸 */
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);

  /* アニメーション */
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 999;
  list-style: none;
  overflow: hidden; /* 角丸からはみ出さないように */
}

/* ホバー時に表示 */
.nav-links > li:hover .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* --- 子メニューのリスト項目（区切り線を追加） --- */
.sub-menu li {
  display: block;
  width: 100%;

  /* 白い区切り線（少し透明度を持たせて上品に） */
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}

/* 最後の項目だけ線はいらないので消す */
.sub-menu li:last-child {
  border-bottom: none;
}

/* 子メニュー内のリンク */
.sub-menu li a {
  display: block;
  padding: 15px 20px; /* パディングを調整して押しやすく */
  color: #fff;
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
  text-align: left;
  font-weight: normal;
  transition:
    background 0.3s,
    color 0.3s;
}

/* ホバー時の挙動 */
.sub-menu li a:hover {
  background: rgba(255, 255, 255, 0.2); /* 白く光らせる */
  color: #fff;
  opacity: 1;
}

/* 言語切り替え */
.lang-switch {
  display: flex;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.lang-switch span {
  padding: 5px 15px;
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  color: var(--text-white);
  border-radius: 18px;
}

.lang-switch .active {
  background: var(--emerald);
}

/* ==========================================================================
   RESPONSIVE HEADER
   ========================================================================== */

/* --- Step 1: PC幅が狭い時 (1250px以下) --- */
@media (max-width: 1350px) {
  /* 1. ロゴエリアを縦並びにする */
  .logo-area {
    flex-direction: column; /* 縦積みに変更 */
    align-items: center; /* 左揃え */
    justify-content: center;
    gap: 5px; /* アイコンと文字の間隔 */
    width: 150px;
  }

  /* 2. ロゴマーク（画像）のサイズ調整 */
  .logo-mark {
    height: 45px; /* 少し小さくしてバランスを取る */
    width: auto;
  }

  /* 3. ロゴテキストグループの余白調整 */
  .logo-text-group {
    margin-left: 0; /* 横並び用の余白をリセット */
    margin-top: 0;
  }

  /* 4. テキストサイズの微調整（縦積みでも邪魔にならないように） */
  .logo-line-1 {
    font-size: 0.7rem; /* 小さく */
    display: inline-block; /* 念のため表示（消さない） */
  }
  .logo-line-2 {
    font-size: 0.9rem; /* 小さく */
    display: inline-block; /* 念のため表示（消さない） */
  }

  /* もし「公益財団法人」「国際労働財団」を1行にまとめたい場合 */
  .logo-text-group {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
  }

  .logo-line-3 {
    display: none;
  }

  /* 5. ヘッダー全体の高さ調整（縦積みした分、高くなるのを防ぐ） */
  .header-top {
    align-items: center;
  }

  /* 4. メニューの余白を詰める */
  .main-nav {
    padding: 0 15px;
    gap: 15px;
  }

  .nav-links {
    gap: 15px; /* リンク間の隙間を減らす */
  }

  .nav-links a {
    font-size: 0.8rem; /* 文字を少し小さく */
  }
}

/* --- Step 2: タブレット (900px以下) --- */
@media (max-width: 900px) {
  .logo-area {
    gap: 5px; /* アイコンと文字の間隔 */
    width: 150px;
    padding: 0 5px;
    height: 120px;
  }

  .menu-area {
    height: 100px;
  }

  /* 2. ロゴマーク（画像）のサイズ調整 */
  .logo-mark {
    height: 45px; /* 少し小さくしてバランスを取る */
    width: auto;
  }

  /* 3. ロゴテキストグループの余白調整 */
  .logo-text-group {
    margin-left: 0; /* 横並び用の余白をリセット */
    margin-top: 0;
  }

  /* 4. テキストサイズの微調整（縦積みでも邪魔にならないように） */
  .logo-line-1 {
    font-size: 0.65rem; /* 小さく */
    display: inline-block; /* 念のため表示（消さない） */
  }
  .logo-line-2 {
    font-size: 0.85rem; /* 小さく */
    display: inline-block; /* 念のため表示（消さない） */
  }
  /* --- ヘッダーレイアウトの変更 --- */
  .header-top {
    justify-content: space-between;
  }

  /* ユーティリティ（検索・ボタン）をスマホでは隠す、あるいは調整 */
  /* ここでは一旦、メニュー内に含めるため隠します（または配置調整） */
  .top-utility {
    display: none; /* シンプルにするため一旦非表示 */
  }

  /* 1. ハンバーガーボタン本体のデザイン */
  .hamburger {
    display: block; /* 表示 */
    position: relative;

    /* 丸いボタンにする設定 */
    width: 48px;
    height: 48px;
    background-color: var(--jilaf); /* 背景色：ネイビー */
    border-radius: 50%; /* まん丸にする */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); /* 少し浮かせる影 */

    cursor: pointer;
    z-index: 2000;
    margin-left: auto; /* 右端に寄せる */
    border: none; /* 枠線なし */
  }

  /* 2. 線の設定（白線） */
  .hamburger span {
    position: absolute;
    left: 11px; /* (48px - 26px) / 2 = 11px */
    width: 26px; /* 線の長さ */
    height: 2px; /* 線の太さ */
    background-color: #fff; /* ★線は白！ */
    transition: 0.4s; /* アニメーション速度 */
    border-radius: 2px;
  }

  /* 3本の線の位置 */
  .hamburger span:nth-child(1) {
    top: 14px;
  } /* 上 */
  .hamburger span:nth-child(2) {
    top: 23px;
  } /* 中央 */
  .hamburger span:nth-child(3) {
    bottom: 14px;
  } /* 下 */

  /* 3. 開いた時のアニメーション（バツ印） */
  .hamburger.active {
    background-color: var(--orange);
  }

  .hamburger.active span:nth-child(1) {
    top: 23px; /* 中央に移動 */
    transform: rotate(45deg);
  }

  .hamburger.active span:nth-child(2) {
    opacity: 0; /* 消す */
  }

  .hamburger.active span:nth-child(3) {
    bottom: 23px; /* 中央に移動 */
    transform: rotate(-45deg);
  }

  /* --- ナビゲーション（ドロワーメニュー化） --- */
  .main-nav {
    position: fixed;
    top: 0;
    right: -100%; /* 最初は画面外（右）に隠す */
    width: 80%; /* 画面の8割くらいの幅 */
    max-width: 300px;
    height: 100vh;
    background: var(--navy-gradient); /* 背景色 */

    flex-direction: column; /* 縦並び */
    justify-content: flex-start;
    align-items: flex-start;
    padding: 80px 30px 40px;

    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0; /* 角丸解除 */
    overflow-y: auto; /* 縦スクロール許可 */
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
  }

  /* クラスがついたら出てくる */
  .main-nav.nav-open {
    right: 0;
  }

  /* --- スマホメニュー内のリンク --- */
  .nav-links {
    flex-direction: column; /* 縦並び */
    width: 100%;
    height: auto;
    gap: 0;
    align-items: flex-start;
  }

  .nav-links > li {
    width: 100%;
    height: auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-direction: column; /* ドロップダウンを下に積むため */
    align-items: flex-start;
  }

  .nav-links > li > a {
    padding: 15px 0;
    width: 100%;
    justify-content: space-between; /* 矢印を右端に */
    font-size: 1rem;
  }

  /* --- スマホ版ドロップダウン（常に表示 or アコーディオン） --- */
  /* ここではシンプルに「常に展開」または「インデントして表示」させます */
  .sub-menu {
    position: static; /* 絶対配置をやめる */
    transform: none;
    opacity: 1;
    visibility: visible;
    width: 100%;
    box-shadow: none;
    background: rgba(0, 0, 0, 0.2); /* 少し暗くする */
    border-radius: 4px;
    padding: 0;
    margin-bottom: 15px;
    display: none; /* 最初は閉じておく（JSで開閉させるのがベスト） */
  }

  /* 親メニューに open クラスがついたら開く（後述のJSが必要） */
  .nav-links > li.active .sub-menu {
    display: block;
  }

  .nav-links > li:hover .sub-menu {
    transform: none;
  }

  /* 矢印の向き制御（PC用・モバイルでは .sub-menu-toggle i が担当） */
  .nav-links > li.active > a i {
    transform: rotate(180deg);
  }

  /* 親リンク + トグルボタンを横並びに */
  .nav-links > li.has-child {
    flex-direction: row !important;
    flex-wrap: wrap;
    align-items: stretch;
  }

  .nav-links > li.has-child > a {
    width: auto !important;
    flex: 1;
  }

  /* モバイルでは a 内の chevron を隠す（トグルボタン側に移譲） */
  .nav-links > li.has-child > a > i {
    display: none;
  }

  /* サブメニューは全幅で折り返す */
  .nav-links > li.has-child > .sub-menu {
    width: 100%;
    flex-basis: 100%;
  }

  /* トグルボタン */
  .sub-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    padding: 15px 0;
    flex-shrink: 0;
  }

  .sub-menu-toggle i {
    font-size: 0.75em;
    transition: transform 0.3s;
  }

  .nav-links > li.has-child.active .sub-menu-toggle i {
    transform: rotate(180deg);
  }

  /* 言語スイッチの位置調整 */
  .lang-switch {
    margin-top: 30px;
    margin-left: 0;
  }
  .top-utility.sp-only {
    display: flex !important; /* 強制表示 */
    flex-direction: column; /* 縦並び */
    width: 100%;
    padding: 0 20px; /* 横の余白 */
    box-sizing: border-box; /* パディングを含めた幅計算 */

    margin-top: 0; /* nav-linksのmargin-bottomで距離をとるので0でOK */
    margin-bottom: 30px; /* 言語スイッチとの距離 */
    flex-shrink: 0; /* 縮まないようにする */

    /* 重なり防止：配置リセット */
    position: static;
    order: 0; /* 並び順をHTML通りにする */
    height: auto;
  }

  /* 検索ボックス（スマホ用） */
  .sp-only .search-box {
    position: relative;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 10px;
    display: flex;
    align-items: center;
  }

  .sp-only .search-box input {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    outline: none;
  }

  .sp-only .search-box button {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
  }

  /* ボタンエリア（スマホ用） */
  .sp-only .utility-btns {
    display: flex;
    flex-direction: column; /* ボタンも縦に積む */
    width: 100%;
    gap: 10px;
  }

  /* ボタン共通デザイン */
  .btn-action {
    display: block;
    text-align: center;
    padding: 12px;
    border-radius: 50px;
    font-weight: bold;
    text-decoration: none;
    font-size: 0.9rem;
  }

  /* 個別の色設定（PCと同じ変数を使用） */
  .btn-contact {
    border: 1px solid #fff;
    color: #fff;
  }

  .btn-support {
    background: var(--orange);
    color: #fff;
    border: 1px solid var(--orange);
  }
}

/* スマホ対応 */
@media (max-width: 768px) {
  .logo-area {
    gap: 5px;
    width: 90px;
    padding: 0 5px;
    height: 52px;
  }

  .logo-mark {
    height: 36px;
  }

  .logo-line-1 {
    display: none;
  }
  .logo-line-2 {
    display: none;
  }

  .menu-area {
    height: 52px;
  }
}
