/* ====================================
   Compact Header Styles
   - 2段構成（ロゴ+言語切替 / ナビゲーション）
   - 大画面：横並び
   - タブレット（769px）：縦2段
   - モバイル（768px以下）：ハンバーガーメニュー
==================================== */

:root {
  --header-bg: #0b1628;
  --nav-bg: #0b0b0b;
  --text-on-dark: #fff;
  --accent: #f3dd6b;
}

/* ==================================================
   ヘッダーコンテナ
================================================== */
.site-header {
  color: var(--text-on-dark);
  background-color: var(--header-bg);
  background-image: url('/assets/images/common/header_bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 100;
  transition: transform 0.3s ease;
  transform: translateY(0);
}

/* 背景に黒いフィルター */
.site-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: -1;
}

/* スクロールで自動非表示 */
.site-header.header-hidden {
  transform: translateY(-100%) !important;
}

/* ==================================================
   ヘッダー内部レイアウト
================================================== */
.site-header__inner {
  margin: 0 auto;
  padding: 24px 12px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end; /* center→flex-endに変更 */
  gap: 24px;
  position: relative;
}

/* ==================================================
   ロゴエリア
================================================== */
.header-top {
  flex: 0 0 auto;
}

/* ロゴ */
.site-title {
  flex: 0 0 auto;
  padding-bottom: 20px;
}

.site-logo {
  display: block;
  text-decoration: none;
  line-height: 0;
  width: 340px;
}

.site-logo:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.site-logo img {
  display: block;
  max-width: 376px;
  width: 100%;
  height: auto;
}

/* 言語切替（常に右上固定） */
.lang-switch {
  position: absolute;
  top: 12px;
  right: 24px;
  display: flex;
  gap: 4px;
  align-items: center;
  z-index: 10;
}

.lang-link {
  color: var(--text-on-dark);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.25s ease;
}

.lang-link:hover,
.lang-link:focus-visible {
  background: rgba(255, 255, 255, 0.25);
}

.lang-link[aria-current="true"],
.lang-link.active {
  background: var(--main-color);
  font-weight: 600;
}

/* ==================================================
   2行目:グローバルナビゲーション
================================================== */
.global-nav {
  position: relative;
  flex: 1 1 auto;
  margin-bottom: 12px; /* ヘッダー下端からの余白 */
}

/* ハンバーガーボタン（モバイルのみ表示） */
.nav-toggle {
  display: none;
}

/* ナビゲーションリスト */
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: transparent;
  padding: 0;
}

.nav-item {
  margin: 0;
}

.nav-item a {
  color: var(--text-on-dark);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.05em;
  padding: 8px 4px;
  position: relative;
  display: inline-block;
  transition: color 0.25s ease;
}

/* ホバー時の下線アニメーション */
.nav-item a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  height: 2px;
  width: 80%;
  background: var(--accent);
  transition: transform 0.3s ease;
}

.nav-item a:hover::after,
.nav-item a:focus-visible::after {
  transform: translateX(-50%) scaleX(1);
}

/* アクティブページ */
.nav-item.active a::after,
.nav-item a[aria-current="page"]::after {
  transform: translateX(-50%) scaleX(1);
}

/* ==================================================
   タブレット（769px付近）: 2段レイアウト
================================================== */
@media (max-width: 969px) {
  .site-header__inner {
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 12px 12px 0;
  }
  .site-title{
    padding-bottom: 0;
    padding-top: 12px;
  }
  .header-top {
    justify-content: space-between;
  }

  .site-logo {
    width: auto; /* 固定幅を解除 */
  }

  .site-logo img {
    max-width: 280px;
  }
  .global-nav{
    margin-bottom: 0;
  }
  .nav-list {
    justify-content: center;
    padding: 10px 16px;
    border-radius: 4px;
    gap: 16px;
  }

  .nav-item a {
    font-size: 13px;
  }
}

@media (max-width: 769px) {
  .site-header__inner{
    padding: 0 !important;
  }
  .site-logo{
    padding: 4px 0 0;
  }
  .site-logo img {
    max-width: 230px;
  }
  .global-nav{
    width: 100%;
  } 
  .nav-list {
    gap: 12px;
    padding: 8px 12px;
  }

  .nav-item a {
    font-size: 12px;
    padding: 6px 2px;
  }

  .lang-link {
    font-size: 13px;
    padding: 5px 10px;
  }
}

/* ==================================================
   モバイル（768px以下）: ハンバーガーメニュー
================================================== */
@media (max-width: 768px) {
  .site-header__inner {
    padding: 12px 16px;
  }

  .header-top {
    margin-bottom: 12px;
    align-self: flex-start;
    padding-left: 2rem;
  }

  .site-logo img {
    max-width: 240px;
  }

  /* ハンバーガー用Menu表示 */
  .nav-toggle {
    display: block;
    width: 100%;
    background: var(--nav-bg);
    color: var(--text-on-dark);
    border: none;
    padding: 10px 0;
    text-align: left;
    cursor: pointer;
    position: relative;
    text-align: center;
    font-size: 90%;
  }

  .nav-toggle__icon::before {
    top: -7px;
  }

  .nav-toggle__icon::after {
    bottom: -7px;
  }

  /* メニュー開いた時のアイコン */
  .nav-toggle[aria-expanded="true"] .nav-toggle__icon {
    background: transparent;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle__icon::before {
    transform: rotate(45deg);
    top: 0;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle__icon::after {
    transform: rotate(-45deg);
    bottom: 0;
  }

  /* ナビゲーションリスト */
  .nav-list {
    display: block;
    max-height: 0;
    overflow: hidden;
    background: var(--nav-bg);
    padding: 0;
    border-radius: 0;
    transition: max-height 0.35s ease, padding 0.35s ease;
  }

  .global-nav.open .nav-list {
    max-height: 500px;
    padding: 8px 0;
  }

  .nav-item {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-item:first-child {
    border-top: none;
  }

  .nav-item a {
    display: block;
    padding: 12px 16px;
    font-size: 14px;
  }

  .nav-item a::after {
    width: 80%;
    height: 2px;
  }

  .lang-link {
    font-size: 12px;
    padding: 4px 8px;
  }
}

/* ==================================================
   スキップリンク（アクセシビリティ）
================================================== */
.skip-link {
  position: absolute;
  left: 8px;
  top: -40px;
  background: #000;
  color: #fff;
  padding: 8px 12px;
  z-index: 1000;
  text-decoration: none;
  border-radius: 4px;
  transition: top 0.25s ease;
}

.skip-link:focus {
  top: 8px;
}

/* ==================================================
   ユーティリティ
================================================== */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ==================================================
   アニメーション無効化
================================================== */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}