/* ヘッダーのCSS */
header {
    background: #0a14a7;
    display: flex;
    justify-content: center; /* 中央揃えに変更 */
    align-items: center;
    padding: 15px 20px 15px; /* 上15px, 左右20px, 下15pxのパディング */
    position: relative; /* ハンバーガーメニューの絶対配置の基準点 */
    width: 100%;
    z-index: 10;
    min-height: 50px; /* ヘッダーの最低高さを確保（タイトルの高さに応じて調整） */
}

/* サイトタイトルのスタイル */
.site-title {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #f9f9fa;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.site-title:hover {
    transform: translateY(-1px);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* ページタイトルのスタイル */
h1 {
    font-size: 2rem;
    font-weight: bold;
    margin: 1.5rem 0;
}

/* トップページのタイトル */
body.top-page h1 {
    color: #d3f70b;
}

/* トップページ以外のページタイトル */
body:not(.top-page) h1 {
    color: #0c0675;
}

/* ロゴのスタイル (既存のものを流用) */
.site-title .logo {
    height: 2em; /* 文字の高さに合わせる */
    width: auto;
    margin-left: 8px;
    vertical-align: middle; /*念のため*/
    border-radius: 50%; /* 角を丸くする */
}

/* ハンバーガーメニューボタンのスタイル */
  .hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    cursor: pointer;
    z-index: 100;
    position: absolute; /* 絶対配置を追加 */
    left: 20px;
    top: 50%; /* 垂直中央揃え */
    transform: translateY(-50%); /* 垂直中央揃え */
  }

/* ハンバーガーメニューの線（span要素）のスタイル */
.hamburger span {
    display: block; /* ブロック要素として表示 */
    height: 3px; /* 線の高さ（太さ）を3pxに設定 */
    width: 100%; /* 線の幅を親要素いっぱいに設定 */
    background-color: #f7f7fa; /* 線の色を紺色に設定 */
    transition: all 0.3s ease; /* すべてのプロパティに0.3秒のトランジションを設定 */
}

/* ハンバーガーボタンがアクティブ時（メニュー表示時）のアニメーション */
/* 1本目の線（上）を45度回転させてXマークの一部にする */
.hamburger.active span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg); /* 下に8.5px移動して45度回転 */
}

/* 2本目の線（中央）を非表示にする */
.hamburger.active span:nth-child(2) {
    opacity: 0; /* 透明にして見えなくする */
}

/* 3本目の線（下）を-45度回転させてXマークの一部にする */
.hamburger.active span:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg); /* 上に8.5px移動して-45度回転 */
}

/* ナビゲーションメニュー全体のスタイル */
.nav-menu {
    position: fixed; /* 画面上に固定配置 */
    top: 0; /* 上端から0pxの位置に配置 */
    right: -100%; /* 初期状態では画面右外側に配置（非表示） */
    width: 70%; /* メニューの幅を画面の70%に設定 */
    height: 100vh; /* 高さを画面いっぱい（ビューポートハイト）に設定 */
    background-color: #1a1a1a; /* 背景色を暗めのグレーに設定 */
    padding-top: 60px; /* 上部に60pxの余白を設定（ヘッダーの下に表示されるように） */
    transition: all 0.5s ease; /* 0.5秒かけてアニメーション */
    z-index: 90; /* 重ね順を設定 - オーバーレイより上、ハンバーガーボタンより下 */
}

/* メニューがアクティブ時（表示時）のスタイル */
.nav-menu.active {
    right: 0; /* 右端を0に設定して画面内に表示 */
}

/* メニュー内のリスト要素のスタイル */
.nav-menu ul {
    list-style: none; /* リストマーカー（・など）を非表示 */
}

/* メニュー内の各項目のスタイル */
.nav-menu li {
    padding: 15px 20px; /* 上下15px、左右20pxの内側余白 */
    border-bottom: 1px solid #333; /* 下部に1pxの境界線を設定 */
}

/* メニュー内のリンクのスタイル */
.nav-menu a {
    color: #f7f7fa; /* 文字色を青に設定 */
    text-decoration: none; /* 下線を非表示 */
    font-size: 1.2rem; /* フォントサイズを1.2rem（19.2px相当）に設定 */
    display: block; /* ブロック要素として表示（クリック領域を広げる） */
}

.nav-menu a:hover {
    color: #0c0675; /* ホバー時の色を紺色に変更 */
}

/* 現在のページを示すスタイル */
.nav-menu a.current {
    color: #0c0675; /* 現在のページのリンクを紺色に変更 */
    font-weight: bold; /* 太字に設定 */
}

/* オーバーレイ（メニュー表示時の背景）のスタイル */
.overlay {
    position: fixed; /* 画面上に固定配置 */
    top: 0; /* 上端から0pxの位置に配置 */
    left: 0; /* 左端から0pxの位置に配置 */
    width: 100%; /* 幅を画面いっぱいに設定 */
    height: 100%; /* 高さを画面いっぱいに設定 */
    background-color: rgba(0, 0, 0, 0.5); /* 背景色を半透明の黒に設定 */
    z-index: 80; /* 重ね順を設定 - コンテンツより上、メニューより下 */
    display: none; /* 初期状態では非表示 */
}

/* オーバーレイがアクティブ時（表示時）のスタイル */
.overlay.active {
    display: block; /* 表示する */
}

/* デスクトップ表示用のスタイル（レスポンシブ対応） */
@media (min-width: 768px) {
    header { /* デスクトップ用にheaderの設定を追加 */
        justify-content: space-between; /* デスクトップでは左右配置に戻す */
        background: linear-gradient(135deg, #0a14a7 0%, #1e3a8a 50%, #0a14a7 100%);
        box-shadow: 0 2px 20px rgba(10, 20, 167, 0.3);
        padding: 20px 40px;
    }

    .hamburger {
        display: none; /* ハンバーガーメニューボタンを非表示 */
    }
    
    .overlay {
        display: none !important; /* オーバーレイを常に非表示 */
    }
    
    .nav-menu {
        position: static; /* 固定配置を解除 */
        width: auto; /* 幅を自動調整 */
        height: auto; /* 高さを自動調整 */
        padding-top: 0; /* 上部の余白をリセット */
        background-color: transparent; /* 背景色を設定 */
        right: 0; /* 右端をリセット */
        transition: none; /* アニメーション */
    }
    
    .nav-menu ul {
        display: flex; /* リストを横並びにする */
        align-items: center;
        gap: 5px;
        padding: 8px 20px;
    }
    
    .nav-menu li {
        border-bottom: none; /* 下線を非表示 */
        padding: 0;
        position: relative;
    }
    
    .nav-menu a {
        font-size: 0.95rem; /* フォントサイズを少し小さく */
        padding: 12px 18px; /* 上下の余白を設定 */
        color: #f7f7fa;
        text-decoration: none;
        font-weight: 500;
        letter-spacing: 0.5px;
        border-radius: 20px;
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
        display: block;
    }
    
    .nav-menu a::before {
        content: '';
        position: absolute;
        bottom: 0;
        left: 50%;
        width: 0;
        height: 2px;
        background: linear-gradient(90deg, #d3f70b, #fbbf24);
        transition: all 0.3s ease;
        transform: translateX(-50%);
    }
    
    .nav-menu a:hover {
        background: rgba(255, 255, 255, 0.15);
        color: #ffffff;
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(211, 247, 11, 0.3);
    }
    
    .nav-menu a:hover::before {
        width: 80%;
    }
    
    .nav-menu a.current {
        background: linear-gradient(135deg, rgba(211, 247, 11, 0.2), rgba(251, 191, 36, 0.2));
        color: #d3f70b;
        font-weight: 600;
        box-shadow: 0 4px 15px rgba(211, 247, 11, 0.4);
    }
    
    .nav-menu a.current::before {
        width: 80%;
        background: linear-gradient(90deg, #d3f70b, #fbbf24);
    }
}

/* より大きな画面用のスタイル */
@media (min-width: 1024px) {
    .site-title {
        font-size: 2rem; /* タイトルを大きくする */
    }
    
    .nav-menu ul {
        padding: 10px 25px;
        gap: 8px;
    }
    
    .nav-menu a {
        font-size: 1rem;
        padding: 14px 22px;
    }
}

@media (max-width: 767px) {
  header {
    justify-content: flex-start; /* 左詰めに */
  }
  .site-title {
    margin-left: 48px; /* ハンバーガー分だけ左に余白 */
  }
}