/* ===== 新しい共通ナビゲーションスタイル ===== */
nav {
  background-color: #fafafa;
  padding: 18px clamp(20px, 4vw, 60px); /* 左右パディングを可変に */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: all 0.3s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: clamp(10px, 2vw, 20px); /* 要素間のスペースを可変に */
}

/* ロゴスタイル */
nav .logo {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 12px);
  text-decoration: none;
  flex-shrink: 0; /* ロゴが縮まないように */
}

nav .logo img {
  height: clamp(28px, 3vw, 36px); /* ロゴサイズを可変に */
  width: auto;
}

nav .logo-text {
  font-size: clamp(16px, 1.8vw, 22px); /* 画面幅に応じて16px〜22pxで調整 */
  font-weight: 700;
  color: #333;
  letter-spacing: 0.05em;
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic Medium', 'Meiryo', 'Helvetica Neue', sans-serif;
  white-space: nowrap; /* テキストが折り返さないように */
}

/* メニューリスト */
nav ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: flex-start; /* 左寄せに変更 */
  gap: clamp(12px, 2.5vw, 32px); /* 画面幅に応じて12px〜32pxで調整 */
  flex: 1; /* これは残す(言語ボタンを右端に押し出すため) */
  margin-left: clamp(20px, 3vw, 40px); /* ロゴとメニューの間を可変に */
  flex-wrap: wrap; /* メニューが収まらない時は2行に折り返す */
}

nav li {
  margin: 0;
}

nav a {
  color: #555;
  text-decoration: none;
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic Medium', 'Meiryo', 'Helvetica Neue', sans-serif;
  font-weight: 400;
  font-size: clamp(14px, 1.6vw, 20px); /* 画面幅に応じて14px〜20pxで調整 */
  padding: 0;
  transition: all 0.3s ease;
  letter-spacing: 0.03em;
  position: relative;
  white-space: nowrap; /* メニューテキストが折り返さないように */
}

nav a:hover {
  color: #333;
  background-color: transparent;
  border-radius: 0;
}

/* ホバー時の下線アニメーション */
nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: #4A9FBF;
  transition: width 0.3s ease;
}

nav a:hover::after {
  width: 100%;
}

/* アクティブページのスタイル */
nav a.active {
  color: #333;
  font-weight: 500;
  background-color: transparent;
  border-radius: 0;
}

nav a.active::after {
  width: 100%;
}

/* ===== 言語切り替えボタン ===== */
.language-switcher {
  display: flex;
  align-items: center;
  flex-shrink: 0; /* ボタンが縮まないように */
}

.language-switcher button {
  background-color: transparent;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: clamp(6px, 0.8vw, 8px) clamp(12px, 1.2vw, 16px); /* パディングを可変に */
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: clamp(12px, 1.2vw, 14px); /* フォントサイズを可変に */
  font-weight: 500;
  color: #555;
  transition: all 0.3s ease;
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic Medium', 'Meiryo', 'Helvetica Neue', sans-serif;
  white-space: nowrap; /* ボタンテキストが折り返さないように */
}

.language-switcher button:hover {
  background-color: #f5f5f5;
  border-color: #4A9FBF;
  color: #4A9FBF;
}

.language-switcher button:active {
  transform: scale(0.95);
}

#langIcon {
  font-size: clamp(14px, 1.4vw, 16px);
}

#langText {
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* ハンバーガーメニュー */
.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  padding: 20px 15px;
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 60px;
  min-width: 60px;
  justify-content: center;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.hamburger span {
  width: 25px;
  height: 4px;
  background-color: #333;
  margin: 4px 0;
  transition: 0.3s;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(45deg) translate(-5px, -6px);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  nav {
    padding: 0;
  }

  nav .logo {
    padding: 16px 20px;
  }

  nav .logo img {
    height: 32px;
  }

  nav .logo-text {
    font-size: 14px;
  }

  /* 言語切り替えボタン(スマホ) */
  .language-switcher {
    position: absolute;
    right: 70px; /* ハンバーガーメニューの左側 */
    top: 50%;
    transform: translateY(-50%);
  }

  .language-switcher button {
    padding: 6px 12px;
    font-size: 12px;
  }

  #langIcon {
    font-size: 14px;
  }

  .hamburger {
    display: flex;
  }

  nav ul {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #333;
    flex-direction: column;
    align-items: center;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    gap: 0;
  }

  nav ul.active {
    max-height: 500px;
  }

  nav li {
    margin: 0;
    width: 100%;
    text-align: center;
  }

  nav a {
    display: block;
    padding: 20px 20px;
    border-bottom: 1px solid #555;
    font-size: 16px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
  }

  nav a::after {
    display: none;
  }

  nav a:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
  }

  nav a.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.15);
  }
}