/* =================================================
   ベーススタイル (共通 & モバイル初期設定)
   ================================================= */
body {
    margin: 0;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ヘッダー */
.header {
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 1060;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    margin: 0 auto;
    padding: 15px 0;
}

.header-logo a {
    display: block;
}

.header-logo img {
    height: 50px;
    width: auto;
}

/* =================================================
   SP用 ハンバーガーボタン (デフォルト表示)
   ================================================= */
.hamburger-button {
    display: block;
    /* モバイルファーストなのでデフォルトで表示 */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    position: relative;
    z-index: 1100;
}

.hamburger-button span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #333;
    margin: 5px auto;
    transition: transform 0.4s, opacity 0.4s;
}

/* ハンバーガーメニューが開いた時の「×」印アニメーション */
.hamburger-button.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger-button.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-button.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* =================================================
   SP用 スライドメニュー本体 (デフォルト設定)
   ================================================= */
.mobile-menu {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    width: 80%;
    max-width: 300px;
    height: 100%;
    background-color: #fff;
    z-index: 1050;
    padding-top: 80px;
    overflow-y: auto;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.4s ease-in-out;
    visibility: hidden;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

/* activeクラスが付いた時に画面内にスライドイン */
.mobile-menu.active {
    transform: translateX(0);
    visibility: visible;
}

/* メニュー表示時の背景オーバーレイ */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.4s;
}

.menu-overlay.active {
    display: block;
    opacity: 1;
}

/* SPメニュー内のリストスタイル */
.mobile-menu-list {
    text-align: left;
}

.mobile-menu-list .nav-item>a {
    display: block;
    padding: 15px 20px;
    font-size: 1.0rem;
    font-weight: bold;
    border-bottom: 1px solid #eee;
}

/* SP用アコーディオンメニュー */
.mobile-menu .dropdown-menu {
    position: static;
    box-shadow: none;
    min-width: 100%;
    background-color: #f4f4f4;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.mobile-menu .dropdown-menu li a {
    font-size: 1.0rem;
    font-weight: normal;
    height: 50px;
    line-height: 2.5rem;
    border-bottom: 1px solid #e0e0e0;
    width: 100%;
    display: block;
    padding: 12px 0 0px 40px;
}

.mobile-menu .dropdown-menu li:last-child a {
    border-bottom: none;
}

/* =================================================
   PC用ナビゲーション (デフォルトでは非表示)
   ================================================= */
.header-nav {
    display: none;
    /* スマホでは非表示 */
}

/* =================================================
   PC以上 (768px以上) の設定
   ================================================= */
@media (min-width: 830px) {

    /* --- スマホ要素の非表示 --- */
    .hamburger-button {
        display: none;
    }

    .mobile-menu,
    .menu-overlay {
        display: none !important;
        /* 強制的に非表示 */
    }

    /* --- PCナビゲーションの表示とスタイル --- */
    .header-nav {
        display: block;
        margin-left: auto;
    }

    .header-nav .nav-list {
        display: flex;
        gap: 40px;
    }

    .header-nav .nav-item {
        position: relative;
    }

    .header-nav a {
        text-decoration: none;
        color: #333;
        padding: 20px 0;
    }

    .header-nav .nav-item:hover>a {
        color: #007bff;
    }

    /* PC用ドロップダウンメニュー */
    .header-nav .dropdown-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: #fff;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
        min-width: 200px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: opacity 0.3s, transform 0.3s;

        /* SP用スタイルのリセット */
        max-height: none;
        background-color: #fff;
        padding: 0;
    }

    .header-nav .nav-item:hover .dropdown-menu {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .header-nav .dropdown-menu li a {
        display: block;
        padding: 12px 20px;
        white-space: nowrap;
        font-weight: normal;
        border-bottom: none;
        height: auto;
        line-height: normal;
        width: auto;
    }

    .header-nav .dropdown-menu li a:hover {
        background-color: #f2f2f2;
    }
}