/* ============================================================
   header.css
   - 透過 → スクロールで白背景（.is-scrolled）
   - ハンバーガーメニュー（〜1023px）
   - アクティブリンク下線アニメーション
   ============================================================ */

/* ─── ヘッダー基本 ─── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 72px;
  background: transparent;
  transition:
    background var(--transition-base),
    box-shadow var(--transition-base);
}

/* トップページ以外は最初から白背景 */
body:not(.is-front-page) .site-header {
  background: var(--color-bg);
  box-shadow: 0 1px 0 var(--color-border);
}

/* スクロール後（JSで付与: .is-scrolled） */
.site-header.is-scrolled {
  background: var(--color-bg);
  box-shadow: 0 2px 16px rgba(27, 58, 107, 0.10);
}

/* ─── ヘッダーインナー ─── */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* ─── ロゴ ─── */
.site-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo img {
  height: 44px;
  width: auto;
}

.site-logo__text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-bg);
  letter-spacing: var(--letter-spacing-wide);
  transition: color var(--transition-base);
  line-height: 1.3;
}

/* スクロール後・非トップページはロゴテキストを濃色に */
.site-header.is-scrolled .site-logo__text,
body:not(.is-front-page) .site-logo__text {
  color: var(--color-primary);
}

/* ─── メインナビ ─── */
.nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-bg);
  text-decoration: none;
  position: relative;
  transition: color var(--transition-base);
  min-height: 44px;
  white-space: nowrap;
}

/* アクティブ・ホバーで下線アニメーション */
.nav-list a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
  border-radius: 1px;
}

.nav-list a:hover::after,
.nav-list .current-menu-item a::after {
  transform: scaleX(1);
}

/* スクロール後・非トップページはリンクを濃色に */
.site-header.is-scrolled .nav-list a,
body:not(.is-front-page) .nav-list a {
  color: var(--color-text);
}

.nav-list a:hover,
.site-header.is-scrolled .nav-list a:hover,
body:not(.is-front-page) .nav-list a:hover {
  color: var(--color-primary);
}

/* お問い合わせだけCTAボタン化 */
.nav-list .menu-item:last-child a {
  background: var(--color-primary);
  color: var(--color-bg) !important;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
}
.nav-list .menu-item:last-child a::after {
  display: none;
}
.nav-list .menu-item:last-child a:hover {
  background: var(--color-primary-mid);
  color: var(--color-bg) !important;
}

/* ─── ハンバーガーボタン ─── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-base);
}

.hamburger:hover {
  background: rgba(255, 255, 255, 0.1);
}

.site-header.is-scrolled .hamburger:hover,
body:not(.is-front-page) .hamburger:hover {
  background: rgba(27, 58, 107, 0.08);
}

.hamburger__line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-bg);
  border-radius: 1px;
  transition:
    background var(--transition-base),
    transform 0.3s ease,
    opacity 0.3s ease;
  transform-origin: center;
}

.site-header.is-scrolled .hamburger__line,
body:not(.is-front-page) .hamburger__line {
  background: var(--color-primary);
}

/* ハンバーガー → ✕ アニメーション */
.hamburger.is-active .hamburger__line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger.is-active .hamburger__line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger.is-active .hamburger__line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ─── オーバーレイ（モバイルメニュー用） ─── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--transition-base);
}
.nav-overlay.is-active {
  display: block;
  opacity: 1;
}

/* ─── タブレット以下（〜1023px）─── */
@media (max-width: 1023px) {
  .hamburger {
    display: flex;
  }

  .nav-primary {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;        /* 全幅 */
    height: 100vh;      /* 画面いっぱい */
    background: var(--color-bg);
    z-index: 1001;
    padding: 72px 16px 32px; /* 上：ヘッダー分 / 左右・下：コンパクト */
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow-y: auto;
    box-shadow: -4px 0 24px rgba(27, 58, 107, 0.12);
  }

  .nav-primary.is-open {
    transform: translateX(0);
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  .nav-list a {
    color: var(--color-text) !important;
    font-size: 0.95rem;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    min-height: 44px;
  }

  .nav-list a::after {
    display: none;
  }

  .nav-list a:hover {
    background: var(--color-bg-light);
    color: var(--color-primary) !important;
  }

  .nav-list .current-menu-item a {
    background: rgba(27, 58, 107, 0.06);
    color: var(--color-primary) !important;
    font-weight: 700;
  }

  .nav-list .menu-item:last-child a {
    margin-top: 8px;
    display: flex;
    justify-content: center;
  }
}

/* ─── モバイル（〜767px）─── */
@media (max-width: 767px) {
  .site-header {
    height: 60px;
  }

  .site-logo img {
    height: 36px;
  }

  .nav-primary {
    padding-top: 60px; /* モバイルはヘッダーが60pxなので調整 */
  }
}