/* ============================================================
   Island Header — コーポレート仕様
   SWELL テーマの .l-header を上書きしてアイランド形式にする
   コーポレートサイト (all-connect.co.jp) のデザインをトレース
   ============================================================ */

/* --- 0) ヘッダー本体：透明背景 + fixed --- */
#header.l-header {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    transition: opacity .3s ease-out, transform .3s ease-out;
}

/* WP管理バーが表示されている場合の対応 */
.admin-bar #header.l-header {
    top: 32px;
}
@media screen and (max-width: 782px) {
    .admin-bar #header.l-header {
        top: 46px;
    }
}

/* --- 1) スクロール時の表示制御 --- */
#header.l-header.is-island-hidden {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
}
#header.l-header.is-island-shown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* --- 2) アイランドピル（.l-header__inner） --- */
#header .l-header__inner {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    column-gap: clamp(16px, 2.5vw, 32px);
    background: #fff;
    border-radius: 30px;
    height: 56px;
    padding: 0 16px !important;
    margin: 12px 12px 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    max-width: none;
    transition: box-shadow .3s ease;
    position: relative;
}

/* スクロール中は影を強める */
#header.l-header.is-island-shown .l-header__inner {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* --- 3) ロゴ --- */
#header .l-header__logo {
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

#header .l-header__logo .c-headLogo {
    height: 36px !important;
}

#header .l-header__logo .c-headLogo__link {
    display: flex;
    align-items: center;
    height: 100%;
}

#header .l-header__logo .c-headLogo__img {
    height: 36px !important;
    width: auto !important;
    max-width: 220px;
    object-fit: contain;
}

/* キャッチフレーズは非表示 */
#header .c-catchphrase {
    display: none !important;
}

/* --- 4) PC ナビゲーション（左寄せ、コーポレート準拠） --- */
#header .l-header__gnav {
    flex: none;
    min-width: 0;
}

#header .c-gnav {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    height: 56px;
    list-style: none;
    margin: 0;
    padding: 0;
}

#header .c-gnav > .menu-item {
    position: relative;
}

#header .c-gnav > .menu-item > a {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 clamp(6px, 1vw, 14px);
    height: 56px;
    font-size: clamp(12px, 14/1200 * 100vw, 14px);
    font-weight: 700;
    color: #181a1a;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: color .2s ease;
    position: relative;
    z-index: 2;
}

#header .c-gnav > .menu-item > a:hover {
    color: #00c6cf;
    opacity: 1;
}

/* ナビの英語サブタイトル — PC では非表示にしてシンプルに */
#header .c-gnav > .menu-item > a .c-smallNavTitle {
    display: none;
}

/* --- 4b) ＋アイコン（サブメニュー付き項目） --- */
#header .c-gnav > .menu-item.menu-item-has-children > a::after {
    content: "" !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 11px;
    height: 11px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' fill='none'%3E%3Cline y1='5.5' x2='11' y2='5.5' stroke='%23181a1a'/%3E%3Cline x1='5.5' y1='0' x2='5.5' y2='11' stroke='%23181a1a'/%3E%3C/svg%3E") no-repeat center/contain;
    transition: transform .3s ease, background .2s ease;
    flex-shrink: 0;
    border: none !important;
    position: static !important;
}

#header .c-gnav > .menu-item.menu-item-has-children > a:hover::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' fill='none'%3E%3Cline y1='5.5' x2='11' y2='5.5' stroke='%2300c6cf'/%3E%3Cline x1='5.5' y1='0' x2='5.5' y2='11' stroke='%2300c6cf'/%3E%3C/svg%3E");
}

/* ドロップダウンが開いている時は＋を回転 */
#header .c-gnav > .menu-item.menu-item-has-children.is-dropdown-open > a::after {
    transform: rotate(45deg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' fill='none'%3E%3Cline y1='5.5' x2='11' y2='5.5' stroke='%2300c6cf'/%3E%3Cline x1='5.5' y1='0' x2='5.5' y2='11' stroke='%2300c6cf'/%3E%3C/svg%3E");
}

#header .c-gnav > .menu-item.menu-item-has-children.is-dropdown-open > a {
    color: #00c6cf;
}

/* --- 4c) ドロップダウン（コーポレート準拠） --- */

/* SWELLデフォルトのhoverドロップダウンを無効化 */
#header .c-gnav > .menu-item:hover > .sub-menu {
    opacity: 0 !important;
    visibility: hidden !important;
}

#header .c-gnav > .menu-item > .sub-menu {
    display: none !important;
    position: absolute;
    top: 23px;
    left: 0;
    min-width: 260px;
    background: #fff;
    border-radius: 0 0 23px 23px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    padding: 32px 24px 24px;
    z-index: 0;
    list-style: none;
    /* SWELLデフォルトの opacity/visibility/transform をリセット */
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    transition: none !important;
    width: auto !important;
}

/* ドロップダウンが右端からはみ出す場合の対応 */
#header .c-gnav > .menu-item:nth-last-child(-n+3) > .sub-menu {
    left: auto;
    right: 0;
}

/* is-dropdown-open の時だけ表示 */
#header .c-gnav > .menu-item.is-dropdown-open > .sub-menu {
    display: block !important;
}

/* SWELLのhover時もis-dropdown-openがあれば表示維持 */
#header .c-gnav > .menu-item.is-dropdown-open:hover > .sub-menu {
    opacity: 1 !important;
    visibility: visible !important;
}

/* SWELLの左矢印（::before icomoon）を非表示 */
#header .c-gnav .sub-menu .menu-item a::before {
    display: none !important;
}

/* ドロップダウン内のリンク */
#header .c-gnav .sub-menu .menu-item {
    border-bottom: 1px solid #f5f5f5;
    position: static !important;
}

#header .c-gnav .sub-menu .menu-item:last-child {
    border-bottom: none;
}

#header .c-gnav .sub-menu .menu-item a {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 !important;
    font-size: 13px;
    font-weight: 500;
    color: #181a1a;
    transition: color .2s ease;
    white-space: nowrap;
    background: transparent !important;
}

#header .c-gnav .sub-menu .menu-item a .c-smallNavTitle {
    display: none;
}

/* SWELLの .ttl hover アニメーション（left移動）を無効化 */
#header .c-gnav .sub-menu .menu-item a .ttl {
    flex: 1;
    left: 0 !important;
    position: static !important;
    transition: none !important;
}

/* ドロップダウンリンクの右矢印 */
#header .c-gnav .sub-menu .menu-item a::after {
    content: "" !important;
    display: block !important;
    width: 6px;
    height: 6px;
    border-top: 1.5px solid #b2bec3 !important;
    border-right: 1.5px solid #b2bec3 !important;
    border-bottom: none !important;
    border-left: none !important;
    transform: rotate(45deg);
    flex-shrink: 0;
    margin-left: 12px;
    transition: border-color .2s ease;
    background: none !important;
    position: static !important;
}

#header .c-gnav .sub-menu .menu-item a:hover {
    color: #00c6cf;
    background: transparent !important;
}

#header .c-gnav .sub-menu .menu-item a:hover::after {
    border-top-color: #00c6cf !important;
    border-right-color: #00c6cf !important;
}

/* --- 検索ボタン（PC nav末尾・左寄せ） --- */
#header .c-gnav > .c-gnav__s {
    margin-left: 0;
    display: flex;
    align-items: center;
    align-self: center;
}

#header .c-gnav__sBtn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .2s ease;
}

#header .c-gnav__sBtn:hover {
    background: rgba(0, 198, 207, 0.1);
}

/* --- 5) SP: 検索 & ハンバーガー --- */
#header .l-header__customBtn,
#header .l-header__menuBtn {
    flex-shrink: 0;
}

#header .l-header__menuBtn .c-iconBtn {
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

#header .l-header__menuBtn .c-iconBtn__label {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin-top: 1px;
}

/* --- 6) SP ナビ（スワイパー横スクロール）を非表示 --- */
#header .l-header__spNav {
    display: none !important;
}

/* --- 7) 固定ヘッダー（SWELL の l-fixHeader）を無効化 --- */
.l-fixHeader {
    display: none !important;
}

/* --- 8) コンテンツの上マージン調整 --- */
/* ヘッダーが fixed なので本文がヘッダーの裏に隠れないようにする */
#body_wrap {
    padding-top: 76px !important; /* SP: header 52px + margin 10px + 余裕14px */
}

/* WP管理バー込み */
.admin-bar #body_wrap {
    padding-top: 108px !important; /* 76px + 32px admin bar */
}
@media screen and (max-width: 782px) {
    .admin-bar #body_wrap {
        padding-top: 122px !important; /* 76px + 46px admin bar */
    }
}

/* --- 9) SP レスポンシブ --- */
@media screen and (max-width: 959px) {
    /* SWELLの :root --logo_size_sp(80px) をグローバルで上書き */
    :root {
        --logo_size_sp: 40px !important;
    }

    #header .l-header__inner {
        height: 52px;
        padding: 0 6px !important;
        margin: 10px 8px 0;
        border-radius: 26px;
        justify-content: space-between !important;
        align-items: center !important;
        column-gap: 0;
        overflow: hidden;
        width: calc(100% - 16px) !important;
        box-sizing: border-box !important;
    }

    /* SWELLの order を維持（検索=左、ロゴ=中央、メニュー=右） */
    /* --logo_size_sp:80px を直接 width/height で上書き */
    #header .l-header__customBtn {
        order: 1;
        width: 40px !important;
        height: 40px !important;
        box-sizing: border-box !important;
        flex-shrink: 0;
        overflow: hidden;
    }

    #header .l-header__logo {
        order: 2;
        flex: 1;
        min-width: 0;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* ロゴを中央揃え（flex containerなのでtext-alignは効かない） */
    #header .l-header__logo .c-headLogo__link {
        justify-content: center;
    }

    #header .l-header__logo .c-headLogo {
        height: 32px !important;
        padding: 0 !important;
    }

    #header .l-header__logo .c-headLogo__img {
        height: 32px !important;
        max-width: 170px;
    }

    #header .l-header__menuBtn {
        order: 3;
        width: 40px !important;
        height: 40px !important;
        box-sizing: border-box !important;
        flex-shrink: 0;
        overflow: hidden;
    }

    /* PC ナビを非表示（SWELLデフォルトの挙動を維持） */
    #header .l-header__gnav {
        display: none !important;
    }
}

/* --- 10) PC レスポンシブ --- */
@media screen and (min-width: 960px) {
    #body_wrap {
        padding-top: 96px !important; /* PC: header 64px + margin 24px + 余裕8px */
    }

    .admin-bar #body_wrap {
        padding-top: 128px !important; /* 96px + 32px admin bar */
    }

    #header .l-header__inner {
        height: 64px;
        padding: 0 28px !important;
        margin: 24px auto 0;
        border-radius: 32px;
        width: fit-content;
        min-width: auto;
    }

    #header .l-header__logo .c-headLogo {
        height: 40px !important;
    }

    #header .l-header__logo .c-headLogo__img {
        height: 40px !important;
        max-width: 240px;
    }
}

/* --- 11) ワイドスクリーン --- */
@media screen and (min-width: 1400px) {
    #header .l-header__inner {
        margin: 24px auto 0;
    }
}

/* --- 12) コンテンツ〜フッター間の余白 --- */
.l-content {
    margin-bottom: 10em !important;
}

/* --- 13) パンくずリスト --- */
.p-breadcrumb.-bg-on {
    background: transparent !important;
    box-shadow: none !important;
}

.p-breadcrumb .p-breadcrumb__item a,
.p-breadcrumb .p-breadcrumb__item span {
    color: #00c6cf !important;
}

/* 現在のページ（最後の項目）は少し暗く */
.p-breadcrumb .p-breadcrumb__item:last-child span {
    color: #636e72 !important;
}

/* 矢印セパレータもターコイズに */
.p-breadcrumb .p-breadcrumb__item::after {
    opacity: 0.6 !important;
}

/* --- 14) ヒーローイメージ角丸 --- */
/* SWELLの -margin-on は padding:8px で余白を作る。
   その内側の .p-mainVisual__slide に角丸をかける */
.p-mainVisual.-margin-on {
    padding: 12px !important;
}

.p-mainVisual.-margin-on .p-mainVisual__slide {
    border-radius: 24px;
    overflow: hidden;
}

@media screen and (min-width: 960px) {
    .p-mainVisual.-margin-on {
        padding: 24px !important;
    }

    .p-mainVisual.-margin-on .p-mainVisual__slide {
        border-radius: 32px;
    }
}

/* --- 15) SP 記事ページ左右余白 --- */
/* SWELLデフォルト: l-content padding 2vw + l-mainContent padding 3vw ≈ 19px@375px
   少しだけ広げて画面端との隙間を確保する */
@media not all and (min-width: 960px) {
    .l-content {
        padding-left: 4vw !important;
        padding-right: 4vw !important;
    }
}

/* --- 16) reduced-motion --- */
@media (prefers-reduced-motion: reduce) {
    #header.l-header,
    #header .l-header__inner,
    #header .c-gnav > .menu-item.menu-item-has-children > a::after {
        transition-duration: 0.01ms !important;
    }
}
