header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #fff;
    position: fixed;
    width: 100%;
    /* 高さを固定したい場合に明示 */
    height: 70px;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid #eee;
}

.logo {
    height: 100%;
}

.logo img {
    padding-left: 2%;
    height: 100%;
    width: auto;
    display: block;
    /* 念のため上限 */
}

.menu-button {
    display: none;
}

#nav-menu {
    display: flex;
    gap: 1.5rem;
}

#nav-menu ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    flex-wrap: wrap;
}

#nav-menu ul li a {
    font-family: "Noto Serif JP", serif;
    font-optical-sizing: auto;
    font-weight: 500;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 20px;
    line-height: 70px;
    z-index: 1;
    position: relative;
    padding: 0 10px;
    /* 見た目調整用の余白 */
    color: #000;
}

#nav-menu ul li a::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12%;
    bottom: 10%;
    width: 2px;
    height: 80%;
    /* 線の太さ */
    background-color: #d4967d;
    /* 線の色 */
    transition: background-color 0.3s;
    transition: width 0.3s ease;
    z-index: -1;
}

#nav-menu ul li a:hover::before {
    width: 100%;
    background-color: #d4967d;
    transition: 0.3s;

}

nav ul {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

nav a {
    text-decoration: none;
    font-weight: 500;
}

/* ドロップダウンのベース */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    font-family: "Noto Serif JP", serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-size: 20px;
    color: #000;
    cursor: default;
    padding: 0 10px;
    position: relative;
}

/* hover時の背景アニメも同様に */
.dropdown-toggle::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 60%;
    background-color: #d4967d;
    transition: width 0.3s ease;
    z-index: -1;
}

.dropdown:hover .dropdown-toggle::before {
    width: 100%;
}

/* サブメニュー */
.dropdown-menu {
    position: absolute;
    top: 100%;
    /* 下にずらす */
    left: 0;
    background-color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    list-style: none;
    padding: 10px 0;
    margin: 0;
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    min-width: 100px;
    z-index: 999;
    flex-direction: column;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    padding: 0;
}

.dropdown-menu li a {
    display: block;
    white-space: nowrap;
    /* ← これで折り返さず横に流れる！ */
    padding: 10px 16px;
    color: #333;
    font-size: 16px;
    text-decoration: none;
    transition: background 0.2s;
}

#nav-menu ul li a::before {
    height: 100%;
    align-items: center;
}

/* ドロップダウンのベース */

@media screen and (max-width: 768px) {

    /* ヘッダー */
    header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* ヘッダー基本スタイル */
    #main-header {
        position: fixed;
        padding: 1rem 1.5rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* 右上の "menu" ボタン */
    .menu-button {
        font-family: "Noto Serif JP", serif;
        font-optical-sizing: auto;
        font-weight: 400;
        display: block;
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 1000;
        background: none;
        border: none;
        font-size: 1.2rem;
        color: #333;
        cursor: pointer;
    }

    .menu-button:hover {
        opacity: 1;
    }


    /* ナビメニューのスタイル */
    #nav-menu {
        display: flex;
        gap: 1.5rem;

    }

    /* 初期状態 */
    #nav-menu {
        position: absolute;
        top: 3.5rem;
        right: 1.5rem;
        left: auto;
        /* ← 右端からの距離 */
        width: 50%;
        /* ← 必要な分だけの幅にする */
        /* 内容に合わせて幅が決まる */
        background-color: #fff;
        padding: 1.2rem 1.5rem;
        border-radius: 0;
        /* ← スマホでは角丸なしも自然 */
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
        z-index: 1000;

        opacity: 0;
        visibility: hidden;
        transform: translateY(20px);
        transition: all 0.4s ease;
        pointer-events: none;
    }

    #nav-menu.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(10%);
        pointer-events: auto;
    }


    #nav-menu ul {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 0;
        margin: 0;
        align-items: flex-start;
    }

    #nav-menu ul li {
        list-style: none;
        text-align: right;
    }

    #nav-menu ul li a {
        color: #333;
        text-decoration: none;
        padding: 0 0 10px 10px;
        font-size: 18px;
    }

    nav ul {
        flex-direction: column;
        gap: 1rem;
    }

    nav ul li {
        text-align: right;
    }

    nav ul {
        flex-direction: column;
        gap: 0.8rem;
        margin-top: 1rem;
    }
}