/* --- ヘッダー全体 --- */
:root {
    --lf-header-offset: 106px;
}

.l-header {
    width: 100%;
    background-color: var(--wp--preset--color--white);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.l-header .l-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 90px;
    gap: 20px;
}

/* --- ロゴ --- */
.l-header__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.l-header__logo img {
    height: 50px;
    width: auto;
    display: block;
}

/* --- ナビゲーション全体の配置 --- */
.l-header__nav {
    display: flex;
    align-items: center;
    gap: 40px;
    flex-shrink: 0;
}

/* --- メインメニュー (Gnav) --- */
.l-header__menu {
    display: flex;
    list-style: none !important;
    margin: 0;
    padding: 0;
    gap: 25px;
}

.l-header__menu li {
    white-space: nowrap;
    list-style: none !important;
}

.l-header__menu a {
    text-decoration: none;
    color: var(--wp--preset--color--text-black);
    font-weight: bold;
    font-size: 15px;
    transition: color 0.3s;
}

.l-header__menu a:hover {
    color: var(--wp--preset--color--main-color);
}

/* ★デスクトップ用：ナビホバー背景オーバーレイ */
.p-gnav-overlay {
    position: fixed;
    top: 90px;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 900;
    pointer-events: none;
}

.l-header:has(.p-gnav__item:hover) .p-gnav-overlay {
    opacity: 1;
    visibility: visible;
}

/* --- ドロップダウンメニュー (Sub Menu) --- */
.p-gnav__item {
    position: relative;
}

.p-gnav__sub {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    background: #fff;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
    list-style: none !important;
    margin: 0;
}

.p-gnav__item:hover .p-gnav__sub {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    top: calc(100% + 40px);
}

.p-gnav__item::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 50px;
}

.p-gnav__sub li {
    list-style: none !important;
    margin-bottom: 10px;
}

.p-gnav__sub li:last-child {
    margin-bottom: 0;
}

.p-gnav__sub-row {
    display: flex !important;
    gap: 10px;
    margin-bottom: 10px;
    list-style: none !important;
}

.p-gnav__sub-row li {
    flex: 1;
    margin-bottom: 0;
}

/* --- 右側CTAボタンエリア --- */
.l-header__cta {
    display: flex;
    gap: 12px;
}

.l-header__cta .c-button {
    padding: 10px 22px;
    font-size: 14px;
    white-space: nowrap;
    text-align: center;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.l-header .c-button:hover {
    background-color: var(--wp--preset--color--sub-color-1);
    color: var(--wp--preset--color--white);
    border-color: var(--wp--preset--color--sub-color-1) !important;
    opacity: 1;
}

/* --- 表示切り替え用ユーティリティ --- */
.u-mobile-only { display: none; }
.p-hamburger, .p-drawer, .p-drawer-overlay { display: none; } /* 初期は全消し */

@media (max-width: 1024px) {
    :root {
        --lf-header-offset: 86px;
    }

    .u-desktop-only { display: none !important; }
    .u-mobile-only { display: flex !important; }

    .l-header__logo img {
        height: 32px;
    }

    .l-header .l-inner {
        height: 70px;
        padding: 0 20px;
    }

    .l-header__mobile-controls {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .l-header__mobile-controls .c-button {
        padding: 8px 12px;
        font-size: 13px;
        border-radius: 6px;
        white-space: nowrap;
        letter-spacing: -0.02em;
    }

    /* --- ハンバーガーボタン --- */
    .p-hamburger {
        display: block;
        position: relative;
        width: 26px;
        height: 20px;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 2000;
        padding: 0;
    }
    .p-hamburger span {
        position: absolute;
        left: 0;
        width: 100%;
        height: 2px;
        background-color: #333;
        transition: all 0.3s;
    }
    .p-hamburger span:nth-child(1) { top: 0; }
    .p-hamburger span:nth-child(2) { top: 9px; }
    .p-hamburger span:nth-child(3) { top: 18px; }

    .p-hamburger.is-active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
    .p-hamburger.is-active span:nth-child(2) { opacity: 0; }
    .p-hamburger.is-active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

    /* --- ドロワーメニュー --- */
    .p-drawer {
        display: block; /* メディアクエリ内でblockにする */
        position: fixed;
        top: 65px;
        width: 100%;
        height: calc(100vh - 65px);;
        background: #fff;
        z-index: 1500;
        overflow-y: auto;
        padding: 30px 20px;

        /* アニメーション初期状態 */
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s ease;
        pointer-events: none;
    }

    .p-drawer.is-active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    .p-drawer__menu { list-style: none; padding: 0; margin: 0; }
    .p-drawer__menu li {
        border-bottom: 1px solid #eee;
        padding: 15px 0;
    }

    /* 1. 「サービス」などの見出しの太さを統一 */
    .p-drawer__menu li > a,
    .p-drawer__menu li > span { /* リンクでない場合も考慮 */
        font-weight: 600;
        font-size: 18px; /* 他の項目とサイズを合わせる */
        color: #333;
    }

    /* 2. サービスボタン（サブメニュー）のコンテナ */
    .p-drawer__sub-content {
        margin-top: 15px;
        display: flex;
        flex-direction: column;
        gap: 12px; /* ★ボタン同士の間隔をあける */
    }

    /* 3. ボタン自体の調整（改行許可と高さ自動） */
    .p-drawer__sub-content .c-arrow-button {
        width: 100%;
        height: auto !important; /* 高さを固定せず中身に合わせる */
        padding: 12px 15px !important;
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
    }

    /* ボタン内のテキストを改行させる */
    .p-drawer__sub-content .c-arrow-button__text {
        white-space: normal !important; /* ★折り返しを許可 */
        line-height: 1.4;
        font-size: 14px;
        flex: 1; /* テキスト領域を広げる */
        padding-right: 10px; /* アイコンとの距離 */
    }

    /* アイコンが潰れないように固定 */
    .p-drawer__sub-content .c-arrow-button__icon {
        flex-shrink: 0;
    }

    .p-drawer__menu li:first-child { padding-top: 0; }
    .p-drawer__menu a {
        text-decoration: none;
        color: #333;
        font-weight: bold;
        display: block;
        font-size: 16px;
    }

    .p-drawer__cta {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 30px;
    }

    .p-drawer__cta .c-button {
        font-size: 18px;
        height: 56px;
        letter-spacing: -0.05em;
        font-weight: bold;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        white-space: nowrap;
    }

    .p-drawer__cta .c-button.--hole {
        border: 2px solid var(--wp--preset--color--main-color);
        color: var(--wp--preset--color--main-color);
        background: #fff;
    }
}
