/* Make the header a positioning context and set a minimum height */
.site-header {
    position: relative;
    color: #333;
    overflow: hidden;
    transition: height 0.3s ease-in-out;
}

/* Position the main visual slider as the full background */
.site-header .mainvisual {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
}

/* ▼ JSで高さを動的に変更するため、画像の高さをautoに設定 ▼ */
.site-header .mainvisual .swiper-slide {
    height: auto !important;
}

.site-header .mainvisual img {
    width: 100%;
    height: auto;
    display: block;
}

/* ▲ ここまでが高さ調整のための修正 ▲ */


/* Set up the grid container for the foreground content */
.header-content-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 180px 1fr 200px;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
        "logo util1 util2"
        "logo mega util2"
        "shortcut . ."
        ". emergency .";
    gap: 15px;
    z-index: 20;
}

/* --- Grid Area Assignments --- */
#logo {
    grid-area: logo;
    align-self: start;
    background-color: #FFF;
    text-align: center;
    border-radius: 0px 0px 6px 0px;
    padding: 18px 0px;
}

#logo h1 {
    margin: 0px;
}

#logo img {
    vertical-align: bottom;
}

.headerUtility1 {
    grid-area: util1;
    justify-self: center;
    align-self: start;
}

.headerUtility2 {
    position: fixed;
    top: 0px;
    right: 0px;
    z-index: 1950;
    /* transition: right 0.3s ease-in-out; */
}


.megaMenu {
    grid-area: mega;
    justify-self: center;
    align-self: start;
}

.shortcutMenu {
    grid-area: shortcut;
    align-self: center;
    justify-self: start;
    background-color: #EEF1F4;
    padding: 12px;
    border-radius: 0px 6px 6px 0px;
    text-align: center;
}

.emergencyMenu {
    grid-area: emergency;
    justify-self: center;
    align-self: end;
}

/* --- Styling Adjustments for Visibility --- */
.headerUtility1 ul,
.shortcutMenu a {
    color: #333;
}

.headerUtility1 a,
.headerUtility1 button {
    color: #333;
    padding: 5px 10px;
    border-radius: 4px;
}

.headerUtility1 a img {
    vertical-align: bottom;
}



.hu2Links {
    display: flex;
    padding: 10px 10px 0px 0px;
    column-gap: 12px;
}

.hu2Links a,
.hu2Links button#search-modal-trigger {
    /* ▼ Button-specific resets ▼ */
    border: none;
    padding: 0;
    background-color: transparent;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    /* ▲ End resets ▲ */

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 93px;
    height: 80px;
    background-image: url('/img/top/bg-kuma3.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    color: white;
    text-decoration: none;
}

.hu2Links a::before,
.hu2Links button#search-modal-trigger::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    margin-top: 4px;
}

.hu2Links a#contactInfo::before {
    background-image: url('/img/top/bg-kuma3-contact.png');
}

.hu2Links button#search-modal-trigger::before {
    background-image: url('/img/top/bg-kuma3-kensaku.png');
}



/* --- ShortcutMenu Modifications --- */
.shortcutMenu.is-fixed {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    border-radius: 0px 0px 6px 0px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.shortcutMenu.is-hidden {
    display: none;
}

#open-shortcut-menu {
    display: none;
    grid-area: shortcut;
    align-self: center;
    justify-self: start;
    z-index: 1001;
    background-color: #FFF;
    color: #333;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    width: auto;
    height: auto;
}

#open-shortcut-menu.is-fixed {
    position: fixed;
    top: 20px;
    left: 20px;
    grid-area: auto;
}

#open-shortcut-menu.is-visible {
    display: block;
}


.shortcutMenu strong {
    /* font-weight: 500; */
}

.shortcutLinks {
    display: flex;
    flex-direction: column;
    padding: 10px 0px;
}

.shortcutLinks a {
    display: block;
    background-color: #FFF;
    color: #333;
    text-decoration: none;
    text-align: center;
    padding: 6px 12px;
    margin-bottom: 8px;
    border-radius: 5px;
    transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
    border: 1px solid #ddd;
    box-shadow: 2px 2px 0px #C7CACC;
}

.shortcutLinks a:last-child {
    margin-bottom: 0;
}

.shortcutLinks a:hover {
    background-color: #0c446e;
    color: #fff;
    border-color: #0c446e;
}

/* ヘッダーコンテンツのクリック制御 */
.header-content-wrapper {
    pointer-events: none;
}

#logo,
.headerUtility1,
.headerUtility2,
.megaMenu,
.shortcutMenu,
.emergencyMenu,
#open-shortcut-menu {
    pointer-events: auto;
}

/* --- Main Visual Slider Controls --- */
.site-header .mainvisual .swiper-controls-wrapper {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 10;
    width: auto;
}



/* headerUtility1の要素 */
.headerUtility1 ul {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
    list-style: none;
    padding: 10px 0px;
    margin: 0;
    justify-content: center;
    border-radius: 6px;
}

#support_menu_box {
    display: flex;
    align-items: center;
    gap: 15px;
}

#moji_size,
#haikei_color {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

#moji_size dt,
#haikei_color dt {
    width: auto;
}

#moji_size dd,
#haikei_color dd {
    margin-inline-start: 0;
}

#moji_size dd {
    display: flex;
}

li.h_sns {
    display: flex;
    column-gap: 15px;
}

.headerUtility1 a,
.headerUtility1 button {
    background-color: #FFF;
    color: #333;
    text-shadow: none;
    text-decoration: none;
    transition: background-color 0.3s;
    border: solid 1px gray;
    display: flex;
    align-items: center;
}

a#haikei_black {
    background-color: #000;
    color: #FFF;
}

a#haikei_blue {
    background-color: #00F;
    color: #FF0;
}

.headerUtility1 a:hover,
.headerUtility1 button:hover {
    background-color: #e0e0e0;
}

li.h_sns a {
    padding: 0px;
    background-color: transparent;
    border: none;
}

li.h_sns a:hover {
    background-color: transparent;
}

li.h_lang a::before,
li.h_onseiFurigana a::before,
li.h_siteMap a::before,
li.h_guide a::before {
    display: inline-block;
    content: '';
    width: 18px;
    height: 18px;
    margin-right: 5px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    vertical-align: text-bottom;
}

li.h_guide a::before {
    background-image: url('/img/top/i-guide.png');
}

li.h_siteMap a::before {
    background-image: url('/img/top/i-sitemap.png');
}

li.h_onseiFurigana a::before {
    background-image: url('/img/top/i-onsei-furigana.png');
}

li.h_lang a::before {
    background-image: url('/img/top/i-lang.png');
}


/* --- Emergency Menu Button Styling --- */
.emergencyMenu {
    position: relative;
    transform: translateY(var(--container-transform, 0px));
    transition: transform 0.3s ease-in-out;
}

.emergencyMenu summary {
    width: 180px;
    height: 85px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5em;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    position: relative;
    z-index: 2;
    list-style: none;
    background-image: url('/img/top/bg-kuma2.png');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center top;
    flex-direction: column;
    color: #333;
}


.emergencyMenu summary::-webkit-details-marker {
    display: none;
}

.emergencyMenu summary::before {
    content: '';
    width: 9px;
    height: 9px;
    border-top: 3px solid #333;
    border-right: 3px solid #333;
    transform: rotate(-45deg);
    transition: transform 0.3s ease;
}

.emergencyMenu[open] summary::before {
    transform: rotate(135deg);
}

.emergencyMenu-links {
    position: absolute;
    top: 84px;
    z-index: 1;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
    box-sizing: border-box;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    display: flex;
    flex-wrap: nowrap;
    white-space: nowrap;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 6px 6px 0px 0px;
}

.emerMenuLinks {
    z-index: 1;
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    white-space: nowrap;
    justify-content: center;
    gap: 15px;
    padding: 14px;
}

.emerMenuLinks>* {
    width: calc((100% - 15px) / 2);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.emergencyMenu.sp strong {
    text-align: center;
    display: block;
}

.emergencyMenu[open] .emergencyMenu-links {
    opacity: 1;
    max-height: 500px;
}

.emerMenuLinks a,
.emergencyMenu-links a {
    position: relative;
    padding: 14px 10px;
    background: repeating-linear-gradient(-45deg,
            #fff,
            #fff 5px,
            #FFE100 5px,
            #FFE100 7px);
    border-radius: 8px;
    color: #333333;
    font-weight: bold;
    text-decoration: none;
    text-align: center;
    flex-grow: 1;
    transition: transform 0.2s ease-in-out;
    z-index: 1;
    box-sizing: border-box;
}

.emerMenuLinks a::before,
.emergencyMenu-links a::before {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    bottom: 6px;
    left: 6px;
    background-color: white;
    border-radius: 5px;
    z-index: -1;
    transition: background-color 0.3s;
}

.emergencyMenu-links a:hover {
    transform: translateY(-3px);
}



/* ▼▼▼ MOBILE STYLES ▼▼▼ */
@media (max-width: 1200px) {

    .header-content-wrapper {
        grid-template-columns: 70px 1fr;
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
            "logo ."
            "shortcut ."
            ". emergency";
    }

    .header-content-wrapper>.shortcutMenu,
    #open-shortcut-menu {
        display: none !important;
    }

    .header-content-wrapper>.emergencyMenu {
        display: none !important;
    }


    #logo {
        width: 80px;
        padding: 7px 5px;
        box-sizing: border-box;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    #logo img {
        width: 100%;
        height: auto;
    }

    .headerUtility1 {
        display: none;
    }

    .main-nav .headerUtility1 {
        display: block;
        order: -2;
        padding: 8px;
        width: 100%;
        box-sizing: border-box;
    }

    .main-nav .shortcutMenu {
        display: block;
        order: -1;
        padding: 15px;
        width: calc(100% - 30px);
        box-sizing: border-box;
        margin: 0 auto;
        border-radius: 6px;
        padding: 5px 0px 8px;
    }

    .main-nav .shortcutMenu strong br {
        display: none;
    }

    .main-nav .shortcutMenu .shortcutLinks {
        flex-direction: row;
        column-gap: 7px;
        justify-content: center;
        padding: 5px 0px 0px;
    }

    .main-nav .shortcutMenu .shortcutLinks a {
        margin-bottom: 0px;
    }

    .main-nav .shortcutMenu #close-shortcut {
        display: none;
    }

    .main-nav .headerUtility1 ul {
        align-items: flex-start;
        gap: 10px;
        padding: 76px 0px 0px;
    }

    .main-nav .headerUtility1 ul li {
        display: flex;
    }

    .main-nav .headerUtility1 ul li.h_sns {
        margin-top: 15px;
    }

    .main-nav .headerUtility1 ul a {
        display: block;
    }

    .headerUtility2 {
        top: 14px;
        right: 85px;
    }

    body.is-scroll-locked .headerUtility2 {
        right: calc(85px + var(--scrollbar-compensation, 0px));
    }

    .headerUtility2 .hu2Links {
        padding: 0px;
    }

    .headerUtility2 button#search-modal-trigger,
    .headerUtility2 .hu2Links a {
        display: flex;
        width: 65px;
        height: 55px;
    }

    .headerUtility2 button#search-modal-trigger::before,
    .headerUtility2 .hu2Links a::before {
        width: 16px;
        height: 16px;
        margin: 3px 0 1px;
    }

    .site-header .emergencyMenu:not(.sp) {
        display: none;
    }

    #moji_size,
    #haikei_color {
        flex-wrap: wrap;
        text-align: center;
        justify-content: center;
    }

    #moji_size dt,
    #haikei_color dt {
        width: 100%;
        margin-bottom: 5px;
    }

}


/* ▼▼▼ 下層ページヘッダー (.site-header-lower) 用のスタイル ▼▼▼ */
.site-header-lower {
    position: relative;
    color: #333;
    background-color: #FFF;
}

.site-header-lower::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/img/top/head-bg-lower.svg');
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: 110% auto;
    filter: drop-shadow(0px -2px 1px rgba(0, 0, 0, 0.1));
    z-index: 1;
    pointer-events: none;
}

.site-header-lower .main-nav,
.site-header-lower #logo {
    background-color: transparent;
}

.site-header-lower #logo {
    margin-bottom: 20px;
}

.site-header-lower .header-content-wrapper {
    position: static;
    display: grid;
    grid-template-columns: 180px 1fr 200px;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
        "logo util1 util2"
        "logo mega  util2"
        ". . .";
    gap: 0px;
    z-index: 20;
    margin: 0 auto;
    padding: 0px;
}

.site-header-lower .main-nav>ul {
    margin: 0;
}


/* --- 下層ページ用のレスポンシブ調整 --- */
@media (max-width: 1200px) {
    .site-header-lower::after {
        background-size: cover;
        bottom: 0px;
        height: 18px;
        top: auto;
    }

    .site-header-lower .header-content-wrapper {
        grid-template-columns: 70px 1fr;
        grid-template-rows: auto;
        grid-template-areas:
            "logo .";
        padding: 5px 15px;
        box-sizing: border-box;
    }

    .site-header-lower #logo {
        width: 80px;
        padding: 7px 5px;
        box-sizing: border-box;
        box-shadow: none;
        border-radius: 0;
    }

    .site-header-lower .main-nav>ul {
        margin: 15px auto;
    }

}

/* --- スクロールロック時のfixed要素の位置補正 --- */
@media (min-width: 1201px) {
    body.is-scroll-locked .headerUtility2 {
        right: calc(28px + var(--scrollbar-compensation, 0px));
    }
}

/* ショートカットメニューのアクティブスタイル */
.shortcutLinks a.is-active {
    background-color: #0c446e;
    color: #fff;
    border-color: #0c446e;
}