/* ハンバーガーアイコンのCSS */
.openbtn {
    position: fixed;
    z-index: 9999;
    top: 10px;
    left: 10px;
    cursor: pointer;
    width: 50px;
    height: 50px;
}
    
.openbtn span {
    display: inline-block;
    transition: all .4s;
    position: absolute;
    left: 14px;
    height: 3px;
    border-radius: 2px;
    background-color: #999;
    width: 45%;
}

.openbtn span:nth-of-type(1) {
    top: 15px; 
}

.openbtn span:nth-of-type(2) {
    top: 23px;
}

.openbtn span:nth-of-type(3) {
    top: 31px;
}

.openbtn.active span:nth-of-type(1) {
    top: 18px;
    left: 18px;
    transform: translateY(6px) rotate(-45deg);
    width: 30%;
}

.openbtn.active span:nth-of-type(2) {
    opacity: 0;
}

.openbtn.active span:nth-of-type(3){
    top: 30px;
    left: 18px;
    transform: translateY(-6px) rotate(45deg);
    width: 30%;
}

/* スマートフォン向けの追加CSS */
@media screen and (max-width: 767px) {
    /* ヘッダーとメイン記事を表示 */
    header,
    main {
        display: block;
    }

    /* ハンバーガーアイコン以外を非表示 */
    .openbtn {
        display: block;
    }

    /* ナビゲーションを表示 */
    #g-nav {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 100%;
        background: #1F286F;
        z-index: 999;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }

    /* ナビゲーションリンクのスタイル */
    #g-nav a {
        color: #FFF;
        text-decoration: none;
        padding: 10px;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        font-weight: bold;
    }
}
/* PC向けの追加CSS */
@media screen and (min-width: 768px) {
    .openbtn {
        display: none; /* PC表示時にハンバーガーアイコンを非表示にする */
    }
}


/* 追加したCSS */
.nav-links ul {
    display: flex;
    justify-content: flex-start; /* 親リンクを左に詰める */
    gap: 20px; /* 親リンク間の間隔を追加 */
}

.nav-links ul li {
    position: relative;
}

.nav-links ul ul {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    width: 200px;
    top: 100%;
    font-size: 0.8em;
}

.nav-links ul li:hover > ul {
    display: block;
    left: 0;
}

.nav-links ul ul li {
    width: 100%;
    text-align: left;
}

.nav-links ul ul a {
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    display: block;
}

.nav-links ul ul a:hover {
    background-color: #ddd;
}

.nav-links ul li a {
    position: relative;
}

.nav-links ul li a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: transparent;
    transition: background-color 0.3s ease;
}

.nav-links ul li a:hover::after {
    background-color: #ccc; /* ホバー時に下線の色を変更 */
}

/* スマートフォン向けの追加CSS */
@media screen and (max-width: 767px) {
    /* ナビゲーションを画面全体に広げる */
    #g-nav {
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        background-color: #1F286F;
        height: 100%;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }

    /* ナビゲーションが表示されたときのアニメーション */
    #g-nav.active {
        transform: translateX(0);
    }

    /* ナビゲーションリンクのスタイル */
    #g-nav a {
        color: #FFF;
        text-decoration: none;
        padding: 15px 20px; /* リンクのパディングを調整 */
        text-transform: uppercase;
        letter-spacing: 0.1em;
        font-weight: bold;
        display: flex;
        justify-content: space-between; /* 子要素を水平方向に均等配置 */
        align-items: center; /* 子要素を垂直方向に中央揃え */
    }

    /* ナビゲーションリンクのスタイル *//* 親リンクがアクティブ（クリックされた状態）の場合、アコーディオンパネルを表示 */
    #g-nav ul ul {
        display: none;
        position: absolute;
        top: 100%; /* 親要素の下に配置 */
        left: 0;
        width: 135%;
        background-color: #1F286F;
        padding: 20px;
        box-sizing: border-box;
        z-index: 999;
        font-size: 0.8em;
    }

    /* 親リンクのスタイル */
    #g-nav ul li.has-child > a {
        display: block;
        width: 100%;
        padding: 20px; /* パディングを追加 */
        box-sizing: border-box; /* ボックスモデルを設定 */
        text-align: left; /* リンクを左揃えにする */
    }

    /* アローのスタイル */
    #g-nav ul li.has-child .arrow {
        float: right; /* アイコンを右寄せにする */
    }

    /* アクティブなアコーディオンパネル */
    #g-nav ul ul.active {
        display: block;
    }

    /* アコーディオンパネル内のリンク */
    #g-nav ul ul a {
        color: #FFF;
        text-decoration: none;
        display: block;
        margin-bottom: 5px;
    }

    /* ナビゲーションリンクを縦並びにする */
    #g-nav ul {
        display: flex;
        flex-direction: column;
        padding-left: 0;
    }
        /* 矢印アイコンのスタイル */
        .arrow {
        font-size: 20px; /* アイコンのサイズを調整 */
    }
    /* アコーディオンパネル内のリンクに下線を追加 */
#g-nav ul ul li {
    border-bottom: 1px solid #ccc;
}
}
