/* ヘッダー全体 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background-color: var(--body_color);
    width: 100%;
    border-bottom: solid 0.5px var(--main_color);
    font-size: 1.2vw;
}

.header a {
    color: var(--text_color);
    text-decoration: none;
}

/* インナー */
.header_inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: auto;
    padding: 1rem 1.5rem;
    flex-direction: column;
    gap: 8px;
}
.header_inner_item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.font_size_switcher,
.companylogo {
    opacity: 1;
    transform: translateY(0);
    max-height: 300px;
    overflow: hidden;
    transition:
        opacity 0.3s ease,
        transform 0.3s ease,
        max-height 0.3s ease;
}

.font_size_switcher.close,
.companylogo.close {
    opacity: 0;
    transform: translateY(-20px);
    max-height: 0;
    pointer-events: none;
}
.header_inner.close {
    gap: 0;
}

.companylogo {
    max-width: 280px;
}

/* ===== メインメニュー ===== */

/* 親 ul */
.h_main-menu {
    display: flex;
    align-items: center;
    /* gap: 2vw; */
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 親 li */
.h_main-menu > li {
    position: relative; /* サブメニューの基準になる */
}

/* 親 li 内の a */
.h_main-menu > li > a {
    color: var(--main_color);
    position: relative;
    display: inline-block;
    padding: 0 1.5vw;
    border-left: solid 1px var(--main_color);
}

.h_main-menu li:last-child > a {
    border-right: solid 1px var(--main_color);
}

.h_main-menu > li.is-open > .sub-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ===== サブメニュー（子 ul） ===== */
.header .sub-menu {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    text-align: center;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    margin-top: 1rem;
    background-color: #fff;
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
    padding-left: calc(100vw / 10);
    padding-right: calc(100vw / 10);
    box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.1);
    border-top: 0.5px solid var(--main_color);

    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 1rem;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;
}

/* 親 li にホバー / キーボードフォーカスで表示 */
.h_main-menu > li:hover > .sub-menu,
.header .sub-menu:hover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* サブメニュー内 li */
.header .sub-menu > li > a {
    padding: 1rem;
    font-size: 1.7vw;
    border-left: solid 2px var(--main_color);
    display: block;
    /* position: relative; */
}

/* サブメニュー矢印 */
.h_arrow {
    padding-right: 0.5rem;
}
.h_arrow img {
    width: 1.2vw;
    height: 1.2vw;
}

.header .sub-menu > li > a:hover {
    background-color: var(--sub_color);
    color: var(--main_color);
}
.header .sub-menu > li:last-child > a {
    border-right: solid 2px var(--main_color);
}
.header .sub-menu > li:nth-child(3) > a {
    border-right: solid 2px var(--main_color);
}

/* ナビのラッパー */
.header_nav {
    display: flex;
    align-items: center;
}

/* ハンバーガーメニュー */
.hamburger_menu {
    display: none !important;
    cursor: pointer;
}

.hamburger_menu span {
    display: block;
    width: 30px;
    height: 4px;
    margin: 6px 0px 4px 0px;
    margin-left: auto;
    background-color: var(--main_color);
    border-radius: 2px;
    transition: 0.5s;
}

/* ハンバーガーメニューが「開」状態のときのスタイル */
.hamburger_menu.open .Firstline {
    transform: rotate(45deg) translate(8px, 6px);
}

.hamburger_menu.open .Centerline {
    opacity: 0;
}

.hamburger_menu.open .Lastline {
    transform: rotate(-45deg) translate(8px, -6px);
    width: 30px !important;
}

/* スマホ */
@media screen and (max-width: 900px) {
    .header {
        position: fixed;
        top: 0px;
        left: 0;
        width: 100%;
    }

    .header_inner {
        background-color: var(--body_color);
        z-index: 999;
        position: relative;
    }
    .header_inner_item {
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
    }

    .font_size_switcher {
        display: block;
    }
    .header_inner {
        align-items: stretch;
        padding: 0 0.5rem;
    }

    .hamburger_menu {
        margin-bottom: 0.5rem;
    }

    .header_nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 0;
        left: 0;
        background-color: var(--body_color);
        width: 100% !important;
        padding: 1rem;
        height: calc(100vh - 80px);
        border-top: solid 0.5px var(--text_color);
    }

    .header_nav.is-open {
        display: block;
    }

    .h_main-menu {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem !important;
        /* スクロール有効 */
        overflow-y: scroll;
        max-height: calc(100vh - 115px);
        /* スクロールマーク */
        scrollbar-width: thin;
        scrollbar-color: var(--main_color) var(--body_color);
    }
    .h_main-menu li {
        border-bottom: solid 0.5px var(--text_color);
        width: 100%;
        padding-left: 0;
        padding-bottom: 0;
        text-align: start;
    }

    .h_main-menu li:last-child {
        border-bottom: none;
    }

    .h_main-menu > li > a {
        padding: 0;
        border-left: none;
        font-size: 1.1rem;
    }
    .h_main-menu li:last-child > a {
        border-right: none;
    }

    .h_arrow img {
        width: 1rem !important;
        height: 1rem !important;
    }

    /* ===== サブメニュー（子 ul）をずっと開いた状態にする ===== */
    .header .sub-menu {
        position: static;
        transform: translateX(0%);
        opacity: 1;
        background: var(--body_color);
        min-width: auto;
        width: 100%;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        box-shadow: none;
        grid-template-columns: 1fr;
        padding-top: 0rem;
        padding-bottom: 0rem;
        padding-left: 0;
        padding-right: 0;
        row-gap: 0;
    }

    .header .sub-menu > li > a {
        font-size: 1rem;
    }

    .hamburger_menu {
        display: block !important;
    }
    /* ハンバーガーメニューが「開」状態のときのスタイル */
    .hamburger_menu.open {
        position: absolute;
        top: 0;
        right: 0;
        z-index: 9999;
        background-color: #fff;
        padding: 1rem;
        outline: solid 0.5px var(--main_color);
    }

    .drawer-overlay {
        display: none;
        width: 100%;
        height: 100%;
        display: none;
        background: #000000d4;
        opacity: 0.7;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 998;
    }
    .header .sub-menu > li > a {
        border-left: none;
    }
    .header .sub-menu > li:last-child > a {
        border-right: none;
    }
    .header .sub-menu > li:nth-child(3) > a {
        border-right: none;
    }

    .h_main-menu li::before {
        content: "";
        margin-right: 0.5rem;
        margin-top: 1.5rem;
        background-image: url("../img/arrow_bl.svg");
        width: 1rem;
        height: 1rem;
        display: inline-block;
        background-repeat: no-repeat;
        background-size: contain;
    }
    .h_main-menu .sub-menu li::before {
        display: none;
    }
    /* フォントサイズボタン */
    .font_size_switcher {
        top: 60px !important;
        font-size: 1rem;
    }
    .font_size_switcher p {
        background-color: #fff;
    }

    .companylogo {
        opacity: 1 !important;
        transform: translateY(0) !important;
        max-height: none !important;
        pointer-events: auto !important;
    }
}
/* スマホ終了 */

@media (min-width: 901px) {
    .header_nav {
        display: flex !important;
        position: static;
        height: auto !important;
        padding: 0;
        background: transparent;
        border: 0;
    }
    .h_main-menu {
        flex-direction: row;
        align-items: center;
    }
}

/* フォントサイズボタン */
.font_size_switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 999;
}

.font_size_switcher button {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--text_color);
    background: #fff;
    cursor: pointer;
}

.font_size_switcher button:hover {
    background: var(--main_color);
    color: #fff;
}
.font_size_switcher_default {
    background: var(--main_color) !important;
    color: #fff;
}

@media (max-width: 900px) {
    header:has(.hamburger_menu.open) .font_size_switcher {
        opacity: 0;
        pointer-events: none;
    }
}
