/* header.css - レスポンシブ対応版 (2025-10-08 修正)
   - スマホでのハンバーガーはみ出し/崩れ修正
   - spanのdisplay/配置/アニメーション見直し
*/

/* ========================================
   上に戻るボタン のレスポンシブ対応
   ======================================== */

.back-to-top {
  position: fixed;
  bottom: 5rem;
  right: 5rem;
  width: 7rem;
  height: 7rem;
  color: #fff;
  background-color: #3b82f6;
  opacity: 0.8;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
  display: none;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s, transform 0.3s, background-color 0.3s;
  z-index: 999;
}

.back-to-top:hover {
  transform: translateY(-4px);
  background-color: #2563eb;
}

.back-to-top svg {
  width: 3rem;
  height: 3rem;
}

/* 2xl: iPad Proや横向きタブレット (900px) */
@media (max-width: 900px) {
  .back-to-top {
    bottom: 3rem;
    right: 3rem;
    width: 6rem;
    height: 6rem;
  }

  .back-to-top svg {
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* x-large: 一般的タブレット (768px) */
@media (max-width: 768px) {
  .back-to-top {
    bottom: 2rem;
    right: 2rem;
    width: 5rem;
    height: 5rem;
  }

  .back-to-top svg {
    width: 2rem;
    height: 2rem;
  }
}

/* medium: スマホ横・大型スマホ (480px) */
@media (max-width: 480px) {
  .back-to-top {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 4rem;
    height: 4rem;
  }

  .back-to-top svg {
    width: 1.75rem;
    height: 1.75rem;
  }
}

/* ========================================
   ヘッダー のレスポンシブ対応
   ======================================== */

header {
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.5rem 1rem;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.header-logo {
  display: block;
  margin-bottom: 0.25rem;
}

.header-button {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.header-button a {
  display: flex;
  align-items: center;
  padding: 0.25rem 1rem;
  color: white;
  background-color: #1e40af;
  border-radius: 0.75rem;
  transition: background-color 0.3s;
  white-space: nowrap;
  font-size: 0.875rem;
}

.header-button a:hover {
  background-color: #1d4ed8;
}

.header-button a i {
  font-size: 1.25rem;
  margin-right: 0.5rem;
}

/* ========================================
   ナビゲーション のレスポンシブ対応
   ======================================== */

.nav-container {
  background: white;
}

.nav-wrapper {
  padding-bottom: 0.5rem;
}

.nav-menu {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-link {
  position: relative;
  overflow: hidden;
  padding: 0.5rem 0;
  padding-bottom: 0.5rem;
  width: 19.5%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  transition: color 0.3s;
}

.nav-link:hover {
  color: #1e40af;
}

.nav-link i {
  font-size: 1.25rem;
  margin-right: 0.5rem;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: #1e40af;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-link:hover::after {
  width: 80%;
}

.nav-divider {
  border-left: 1px solid #e5e7eb;
  height: 2rem;
  margin: 0 0.5rem;
}

/* ========================================
   モバイルメニュー のレスポンシブ対応
   ======================================== */

.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 998;
  overflow-y: auto;
}

.mobile-menu.active {
  display: block;
}

.mobile-menu-content {
  position: fixed;
  top: 0;
  right: 0;
  width: 80%;
  max-width: 20rem;
  height: 100vh;
  padding: 5rem 1rem 1rem;
  background: white;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
}

.mobile-menu.active .mobile-menu-content {
  transform: translateX(0);
}

.mobile-menu-content a {
  display: block;
  padding: 0.75rem;
  color: #4b5563;
  border-radius: 0.5rem;
  transition: all 0.3s;
  margin-bottom: 0.5rem;
}

.mobile-menu-content a:hover {
  color: #1e40af;
  background-color: #f9fafb;
}

.mobile-menu-content a i {
  font-size: 1.25rem;
  margin-right: 0.5rem;
}

.mobile-menu-content a.primary-btn {
  color: white;
  background-color: #1e40af;
}

.mobile-menu-content a.primary-btn:hover {
  background-color: #1d4ed8;
}

/* ========================================
   ハンバーガーメニューボタン
   ======================================== */

.hamburger-btn {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* ✅ 中央寄せ */
  width: auto;            /* ✅ はみ出し対策 */
  height: auto;           /* ✅ はみ出し対策 */
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;             /* 基本は余白なし（下で端末毎に付与） */
  z-index: 999;
  position: relative;
  line-height: 0;         /* ✅ 余分な行高を排除 */
  overflow: visible;      /* ✅ 変形時のはみ出しを許可 */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.hamburger-btn span {
  display: block;                     /* ✅ 明示 */
  width: 24px;
  height: 3px;
  margin: 4px 0;                      /* ✅ 3本の間隔 */
  background-color: #1e40af;
  border-radius: 9999px;
  transition: transform 0.3s ease, opacity 0.2s ease, background-color 0.2s ease;
  transform-origin: center;
}

/* 変形：Xにする際に上下を中央へ */
.hamburger-btn.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
}
.hamburger-btn.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ========================================
   レスポンシブ設定
   ======================================== */

/* 2xl: iPad Proや横向きタブレット (900px) */
@media (max-width: 900px) {
  /* ナビゲーションメニューを2行に折り返し */
  .nav-menu {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.5rem 0;
  }
  
  .nav-link {
    width: 29%;
    padding: 0.5rem 0.5rem;
    font-size: 0.875rem;
    justify-content: flex-start;
  }
  
  .nav-link i {
    font-size: 1.1rem;
    margin-right: 0.4rem;
  }
  
  .nav-wrapper {
    padding-bottom: 0.75rem;
  }
}

/* ✅ 修正済み: medium (スマホ横・大型スマホ 480px以下) */
@media (max-width: 480px) {
  .hide-on-mobile {
    display: none !important;
  }

  .header-button {
    display: none;
  }

  .header-logo {
    width: 60vw;
  }

  .header-top {
    padding: 0.5rem 0;
  }

  /* ✅ ハンバーガーボタンの安全な固定配置（ノッチ対応） */
  .hamburger-btn {
    display: flex;
    position: fixed;
    top: max(0.75rem, env(safe-area-inset-top) + 0.5rem);
    right: max(0.75rem, env(safe-area-inset-right) + 0.5rem);
    z-index: 1000;
    background: white;
    padding: 0.8rem 0.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    width: auto;
    height: auto;
  }

  .hamburger-btn span {
    width: 3rem;
    height: 2.5px;
    margin: 0.2rem 0;
  }

  .mobile-menu-content {
    padding: 5rem 1rem 1rem;
  }

  .mobile-menu-content a {
    padding: 0.875rem 0.75rem;
    font-size: 0.95rem;
  }
}

/* ✅ small: さらに小さい端末 (414px以下) */
@media (max-width: 414px) {
  .header-logo {
    width: 65vw;
  }

  .hamburger-btn {
    top: max(0.5rem, env(safe-area-inset-top) + 0.5rem);
    right: max(0.5rem, env(safe-area-inset-right) + 0.5rem);
    padding: 0.7rem 0.2rem;
  }


  .mobile-menu-content a {
    font-size: 0.9rem;
  }
}

/* x-small: 小型スマホ (360px以下) */
@media (max-width: 360px) {
  .header-logo {
    width: 70vw;
  }


  .mobile-menu-content a {
    padding: 0.75rem 0.625rem;
    font-size: 0.85rem;
  }
}




