/* ==========================================================
   グローバルナビゲーション（2026.10.19）
   部品の原本 template-parts/hk/site-header.html ／ 動き assets/js/hk-nav.js
   ・旧CSS（custom-style.css / common.css / header.css）の .custom-header 指定に負けないよう、#header.hkn で指定する
   ・ページ本文には効かせない（.hkn* のクラスと、固定ボタンの持ち上げだけ）
   ========================================================== */
:root {
    --hkn-teal: #29a9b8;
    --hkn-teal-dk: #15737e;
    --hkn-teal-soft: #eaf6f7;
    --hkn-green: #1f5f45;
    --hkn-green-dk: #174a36;
    --hkn-ink: #1c2735;
    --hkn-sub: #55606c;
    --hkn-line: #e3e0d7;
    --hkn-off: #f8f7f3;
    --hkn-h: 72px;
    --hkn-sub-h: 0px;
    --hkn-tab-h: 0px;
    --hk-header-h: calc(var(--hkn-h) + var(--hkn-sub-h));   /* CANOPY のページの本文の余白（hk-brand.css と同じ名前） */
    --hkn-font: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
}
body.hkn-has-sub { --hkn-sub-h: 46px; --hk-header-h: calc(var(--hkn-h) + 46px); }

.hkn, .hkn *, .hkn-drawer, .hkn-drawer *, .hkn-tabbar, .hkn-tabbar * { box-sizing: border-box; }
.hkn ul, .hkn-drawer ul { list-style: none; margin: 0; padding: 0; }
.hkn a, .hkn-drawer a, .hkn-tabbar a { text-decoration: none; }
.hkn button, .hkn-drawer button { font-family: var(--hkn-font); line-height: 1.4; }

/* 本文へ移動（キーボード操作のとき最初に出る） */
.hkn-skip { position: fixed; left: 12px; top: -60px; z-index: 1100; padding: 10px 16px; border-radius: 8px; background: var(--hkn-ink); color: #fff !important; font: 700 14px/1.4 var(--hkn-font); text-decoration: none; }
.hkn-skip:focus { top: 10px; }

/* ---------- ヘッダー本体 ---------- */
#header.hkn,
body #header.hkn.scrolled,
body #header.hkn.header-scrolled,
body:not(.home) #header.hkn,
body:not(.home) #header.hkn.header-scrolled {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0 !important;
    z-index: 1000;
    background: #fff !important;
    background-image: none !important;
    backdrop-filter: none !important;
    box-shadow: 0 1px 0 var(--hkn-line), 0 6px 18px rgba(28, 39, 53, .05) !important;
    transition: none;
    font-family: var(--hkn-font);
    color: var(--hkn-ink);
}
body.admin-bar #header.hkn { top: 32px; }
.hkn-bar { display: flex; align-items: center; gap: 12px; height: var(--hkn-h); max-width: 1440px; margin: 0 auto; padding: 0 20px; }
.hkn-logo { flex: none; display: flex; align-items: center; border: 0 !important; }
.hkn-logo img { display: block; width: auto !important; height: 44px !important; max-width: none; border: 0 !important; padding: 0 !important; }

/* PCのメニュー */
.hkn-nav { flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; }
.hkn-menu { display: flex; align-items: stretch; height: var(--hkn-h); }
.hkn-item { position: relative; display: flex; align-items: center; }
.hkn-top {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 100%;
    padding: 0 12px;
    border: 0;
    background: none;
    color: var(--hkn-ink) !important;
    font-family: var(--hkn-font);
    font-size: 14.5px;
    font-weight: 500;
    letter-spacing: .02em;
    white-space: nowrap;
    cursor: pointer;
}
.hkn-top::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 14px; height: 2px; border-radius: 2px; background: var(--hkn-teal); transform: scaleX(0); transition: transform .18s ease; }
.hkn-top:hover::after, .hkn-item.is-open > .hkn-top::after { transform: scaleX(1); }
/* いま見ているページ：太字＋下線（色だけに頼らない） */
.hkn-item.is-current > .hkn-top { font-weight: 700; }
.hkn-item.is-current > .hkn-top::after { transform: scaleX(1); height: 3px; background: var(--hkn-teal-dk); }
.hkn-chev { width: 7px; height: 7px; margin-top: -3px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); transition: transform .18s ease; }
.hkn-item.is-open .hkn-chev { transform: rotate(-135deg); margin-top: 3px; }

/* プルダウン */
.hkn-dd {
    position: absolute;
    top: calc(100% - 8px);
    left: 0;
    min-width: 290px;
    padding: 10px;
    border: 1px solid var(--hkn-line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(28, 39, 53, .14);
    visibility: hidden;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
    z-index: 2;
}
.hkn-dd::before { content: ''; position: absolute; left: 0; right: 0; top: -14px; height: 14px; }   /* マウスをメニューへ動かす間に閉じない */
.hkn-dd--end { left: auto; right: 0; }
.hkn-item.is-open > .hkn-dd { visibility: visible; opacity: 1; transform: none; transition: opacity .15s ease, transform .15s ease; }
html:not(.hkn-js) .hkn-item:hover > .hkn-dd, html:not(.hkn-js) .hkn-item:focus-within > .hkn-dd { visibility: visible; opacity: 1; transform: none; }
.hkn-dd a {
    display: block;
    padding: 10px 14px;
    border-radius: 9px;
    color: var(--hkn-ink) !important;
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.5;
}
.hkn-dd a small { display: block; font-size: 12px; font-weight: 400; color: var(--hkn-sub); }
.hkn-dd a:hover, .hkn-dd a:focus-visible { background: var(--hkn-teal-soft); }
.hkn-dd a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--hkn-teal-dk); background: var(--hkn-off); }
.hkn-dd__member { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--hkn-line); }

/* 右側：お気に入り・マイページ・会員登録・相談予約 */
.hkn-acts { flex: none; display: flex; align-items: center; gap: 4px; }
.hkn-icon { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 56px; height: 52px; padding: 0 4px; border-radius: 10px; color: var(--hkn-ink) !important; font-size: 11px; font-weight: 500; line-height: 1.2; white-space: nowrap; }
.hkn-icon:hover { background: var(--hkn-off); }
.hkn-reg, .hkn-cta, .hkn-line {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    font-family: var(--hkn-font);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}
.hkn-reg { border: 1.5px solid var(--hkn-green); color: var(--hkn-green) !important; background: #fff; }
.hkn-reg:hover { background: #e9f2ee; }
.hkn-cta { margin-left: 4px; border: 1.5px solid var(--hkn-green); background: var(--hkn-green); color: #fff !important; }
.hkn-cta:hover { background: var(--hkn-green-dk); border-color: var(--hkn-green-dk); }
.hkn-line { border: 1.5px solid var(--hkn-ink); color: var(--hkn-ink) !important; background: #fff; }
body.hkn-in [data-hkn-guest] { display: none !important; }

.hkn-burger { display: none; flex: none; flex-direction: column; justify-content: center; gap: 5px; width: 46px; height: 46px; margin-left: 2px; padding: 0 11px; border: 0; border-radius: 10px; background: none; cursor: pointer; }
.hkn-burger span { display: block; height: 2px; border-radius: 2px; background: var(--hkn-ink); transition: transform .2s ease, opacity .2s ease; }
.hkn-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hkn-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hkn-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* キーボードの位置 */
.hkn a:focus-visible, .hkn button:focus-visible, .hkn-drawer a:focus-visible, .hkn-drawer button:focus-visible, .hkn-tabbar a:focus-visible, .hkn-sub a:focus-visible {
    outline: 3px solid #f2b705;
    outline-offset: 2px;
}

/* ---------- CANOPY HOUSE 専用メニュー（2段目） ---------- */
.hkn-sub { height: var(--hkn-sub-h); border-top: 1px solid var(--hkn-line); background: #1d2d4a; }
.hkn-sub__inner { display: flex; align-items: center; gap: 16px; height: 100%; max-width: 1440px; margin: 0 auto; padding: 0 20px; }
.hkn-sub__brand { flex: none; color: #fff !important; font-size: 12px; font-weight: 700; letter-spacing: .18em; }
.hkn-sub__list { flex: 1 1 auto; display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.hkn-sub__list::-webkit-scrollbar { display: none; }
.hkn-sub__list li { flex: none; }
.hkn-sub__list a { display: inline-flex; align-items: center; min-height: 34px; padding: 0 10px; border-radius: 999px; color: rgba(255, 255, 255, .9) !important; font-size: 13px; font-weight: 500; white-space: nowrap; }
.hkn-sub__list a:hover { background: rgba(255, 255, 255, .12); }
.hkn-sub__list a[aria-current] { color: #fff !important; font-weight: 700; box-shadow: inset 0 -2px 0 #fff; border-radius: 0; }
.hkn-sub__cta { margin-left: auto; }
.hkn-sub__cta a { background: #a84e2d; color: #fff !important; font-weight: 700; }
.hkn-sub__cta a:hover { background: #8a3e22; }

/* ---------- スマホのメニュー（ハンバーガー） ---------- */
.hkn-drawer { position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--hkn-h) + var(--hkn-sub-h)); z-index: 999; background: rgba(28, 39, 53, .35); font-family: var(--hkn-font); }
body.admin-bar .hkn-drawer { top: calc(var(--hkn-h) + var(--hkn-sub-h) + 46px); }
.hkn-drawer[hidden] { display: none; }
.hkn-drawer__body { width: min(440px, 100%); height: 100%; margin-left: auto; padding: 8px 18px calc(24px + var(--hkn-tab-h) + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; background: #fff; }
.hkn-dlist > li { border-bottom: 1px solid var(--hkn-line); }
.hkn-dtop { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 56px; padding: 0 4px; border: 0; background: none; color: var(--hkn-ink) !important; font-size: 16px; font-weight: 700; text-align: left; cursor: pointer; }
.hkn-dtop .hkn-pm { position: relative; flex: none; width: 14px; height: 14px; }
.hkn-dtop .hkn-pm::before, .hkn-dtop .hkn-pm::after { content: ''; position: absolute; left: 0; right: 0; top: 6px; height: 2px; border-radius: 2px; background: var(--hkn-teal-dk); transition: transform .18s ease; }
.hkn-dtop .hkn-pm::after { transform: rotate(90deg); }
.hkn-dtop[aria-expanded="true"] .hkn-pm::after { transform: rotate(0); }
.hkn-dtop.is-current { box-shadow: inset 3px 0 0 var(--hkn-teal-dk); padding-left: 12px; }
.hkn-dsub { padding: 0 0 12px; }
.hkn-dsub a { display: block; padding: 12px 12px; border-radius: 10px; color: var(--hkn-ink) !important; font-size: 15px; line-height: 1.5; }
.hkn-dsub a small { display: block; font-size: 12px; color: var(--hkn-sub); }
.hkn-dsub a:active, .hkn-dsub a:hover { background: var(--hkn-off); }
.hkn-dsub a[aria-current="page"] { font-weight: 700; background: var(--hkn-off); box-shadow: inset 3px 0 0 var(--hkn-teal-dk); }
.hkn-drawer__acts { display: flex; flex-direction: column; gap: 10px; padding: 20px 0 0; }
.hkn-cta--block, .hkn-reg--block, .hkn-line--block { width: 100%; min-height: 52px; margin: 0; font-size: 15.5px; }
.hkn-tel { margin: 6px 0 0; text-align: center; font-size: 13px; color: var(--hkn-sub); }
.hkn-tel a { color: var(--hkn-ink) !important; font-weight: 700; font-size: 16px; }
body.hkn-lock { overflow: hidden; }

/* ---------- スマホ下部の固定メニュー ---------- */
.hkn-tabbar { display: none; }

/* ---------- 画面幅ごとの調整 ---------- */
@media (max-width: 1360px) {
    .hkn-top { padding: 0 9px; font-size: 14px; }
    .hkn-top::after { left: 9px; right: 9px; }
    .hkn-icon { min-width: 50px; }
    .hkn-reg, .hkn-cta { padding: 0 13px; font-size: 13.5px; }
}
@media (max-width: 1360px) {
    .hkn-sub__brand { display: none; }
}
@media (max-width: 1240px) {
    .hkn-logo img { height: 38px !important; }
    .hkn-top { padding: 0 7px; font-size: 13.5px; gap: 4px; }
    .hkn-top::after { left: 7px; right: 7px; }
    .hkn-icon { min-width: 44px; }
    .hkn-icon span { font-size: 10px; }
}
@media (max-width: 1100px) {
    :root { --hkn-h: 64px; }
    .hkn-nav { display: none; }
    .hkn-acts { margin-left: auto; }
    .hkn-burger { display: flex; }
    .hkn-bar { padding: 0 12px 0 16px; }
}
@media (max-width: 767px) {
    :root { --hkn-h: 58px; --hkn-tab-h: 62px; }
    body.hkn-has-sub { --hkn-sub-h: 44px; --hk-header-h: calc(var(--hkn-h) + 44px); }
    .hkn-logo img { height: 34px !important; }
    .hkn-bar { gap: 6px; padding: 0 6px 0 12px; }
    .hkn-icon--fav, .hkn-acts > .hkn-cta { display: none; }
    .hkn-icon { min-width: 48px; height: 48px; }
    .hkn-acts > .hkn-reg { min-height: 36px; padding: 0 12px; font-size: 12.5px; }
    body:not(.hkn-in) .hkn-acts > .hkn-icon--me { display: none; }   /* 未ログイン：会員登録を出す（ログインはメニューと下部から） */
    .hkn-burger { width: 44px; height: 44px; padding: 0 10px; }
    .hkn-sub__brand { display: none; }
    .hkn-sub__inner { padding: 0 8px; }
    .hkn-sub__cta { margin-left: 0; }

    .hkn-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 998;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        height: calc(var(--hkn-tab-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        border-top: 1px solid var(--hkn-line);
        background: rgba(255, 255, 255, .97);
        box-shadow: 0 -4px 16px rgba(28, 39, 53, .06);
        font-family: var(--hkn-font);
        transition: transform .2s ease;
    }
    .hkn-tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 48px; color: var(--hkn-ink) !important; font-size: 11px; font-weight: 700; line-height: 1.2; }
    .hkn-tabbar a[aria-current="page"] { color: var(--hkn-teal-dk) !important; box-shadow: inset 0 3px 0 var(--hkn-teal-dk); }
    .hkn-tabbar__cta { color: var(--hkn-green) !important; }
    /* 文字入力中（キーボード表示中）は隠して、入力欄やボタンを覆わない */
    body.hkn-typing .hkn-tabbar { transform: translateY(110%); }
    /* 固定メニューの分だけ、ページの最後に余白を足す（フッターやボタンを隠さない） */
    body.hkn-on::after { content: ''; display: block; height: calc(var(--hkn-tab-h) + env(safe-area-inset-bottom)); }
    /* ほかの固定ボタン（AI相談・LPのお知らせ）は固定メニューの上へ */
    body.hkn-on #hkk-btn, body.hkn-on #hkki-btn { bottom: calc(var(--hkn-tab-h) + 12px + env(safe-area-inset-bottom)) !important; }
    body.hkn-on #hkk-panel, body.hkn-on #hkki-panel { bottom: calc(var(--hkn-tab-h) + 8px + env(safe-area-inset-bottom)) !important; max-height: calc(100dvh - var(--hkn-h) - var(--hkn-tab-h) - 24px) !important; }
    body.hkn-on .cs-update { bottom: calc(var(--hkn-tab-h) + 10px + env(safe-area-inset-bottom)) !important; }
    body.hkn-typing #hkk-btn, body.hkn-typing #hkki-btn { bottom: 18px !important; }
}
@media (max-width: 359px) {
    .hkn-acts > .hkn-reg { padding: 0 9px; font-size: 12px; }
    .hkn-logo img { height: 30px !important; }
}
@media (prefers-reduced-motion: reduce) {
    .hkn *, .hkn-tabbar { transition: none !important; }
}
@media print {
    .hkn-tabbar, .hkn-drawer, .hkn-skip { display: none !important; }
    #header.hkn { position: static !important; box-shadow: none !important; }
}

/* 2026-10-21 旧ページの見出し部分の上余白が、旧ヘッダーの高さのままで新ヘッダーの下に文字が入る
   （/search/ /plans/ /partners/ のヒーロー、WordPress のお知らせ一覧）→ ヘッダーの高さ分を足す */
body.hkn-on .se-hero, body.hkn-on .pl-hero, body.hkn-on .pt-hero { padding-top: calc(var(--hkn-h) + 36px) !important; }
body.hkn-on .archive-header { padding-top: calc(var(--hkn-h) + 32px) !important; }
