/* ==========================================================================
   ハブ内サイトマップ（hub-sitemap.css）2026-10-10 新設・LFP でパイロット
   --------------------------------------------------------------------------
   HTML は dev-tools/generate-hub-sitemaps.py が生成（ページの HUB-SITEMAP マーカー間）。
   ヒーロー（hero.css）の直下に置く前提で、横幅（56rem）・角丸（12px）・緑の配色をそろえる。
   第2階層以下は <details>/<summary> で折りたたむ（JS 不要。JS 無効でも開閉・内容の表示ができる）。
   色は hero.css の変数（--hero-frame 等）を使い、hero.css が無いページでも同じ色になるよう既定値を持たせる。
   ========================================================================== */

/* 外側：hero-container と同じ「最大幅 56rem・左右 1rem」で、ヒーローと端をそろえる */
.hub-sitemap {
    max-width: 56rem;
    margin: 0 auto;
    padding: 0 1rem 1.5rem;
    box-sizing: border-box;
}
@media (min-width: 768px) {
    .hub-sitemap { padding-bottom: 2rem; }
}

/* ページ内リンク（例：手書きハブの「全体マップへ」→ #tree）で移動したとき、固定ヘッダー＋パンくず（スマホでは2行になる）に
   枠の上端が隠れないよう、上に余白を取る。ページ側の section[id] { scroll-margin-top } より優先させるため section.hub-sitemap[id] で指定 */
section.hub-sitemap[id] { scroll-margin-top: 160px; }   /* スマホ：ヘッダー約56px＋パンくず（2行）約64px＋余白 */
@media (min-width: 768px) {
    section.hub-sitemap[id] { scroll-margin-top: 184px; }   /* PC：ヘッダー＋メニュー＋パンくずで約165px＋余白 */
}

.hub-sitemap__inner {
    padding: 1.25rem 1.25rem 1rem;
    background: #fff;
    border: 1px solid #bbf7d0;        /* 若葉色の細い枠（hero の第3階層の地色と同系） */
    border-radius: var(--hero-radius, 12px);
}
@media (min-width: 768px) {
    .hub-sitemap__inner { padding: 1.5rem 2rem 1.25rem; }
}

.hub-sitemap__title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--hero-deep, #14532d);
    letter-spacing: 0.02em;
}

/* 先頭の案内（手書きハブ＝事業全体の概要へ） */
.hub-sitemap__lead {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--hero-l4-bg, #f0fdf4);
    border-left: 4px solid var(--hero-frame, #15803d);
    border-radius: 8px;
    color: var(--hero-deep, #14532d);
    text-decoration: none;
    transition: background-color .15s;
}
.hub-sitemap__lead:hover { background: #dcfce7; }
.hub-sitemap__lead:focus-visible { outline: 2px solid var(--hero-frame, #15803d); outline-offset: 2px; }
.hub-sitemap__lead-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--hero-frame, #15803d);
}
.hub-sitemap__lead-title { font-weight: 700; }
.hub-sitemap__lead-arrow { margin-left: auto; }

/* ツリー本体 */
.hub-sitemap__tree {
    list-style: none;
    margin: 0;
    padding: 0;
}
.hub-sitemap__tree--sub {
    margin: 0.25rem 0 0.25rem 0.25rem;
    padding-left: 0.875rem;
    border-left: 2px solid #bbf7d0;   /* 親の下にぶら下がる線 */
}

.hub-sitemap__item {
    padding: 0.375rem 0;
    border-top: 1px solid #f0fdf4;
}
.hub-sitemap__tree > .hub-sitemap__item:first-child { border-top: none; }
.hub-sitemap__tree--sub > .hub-sitemap__item { border-top: none; padding: 0.25rem 0; }

.hub-sitemap__link {
    color: #166534;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.5;
    text-decoration: none;
}
.hub-sitemap__tree--sub .hub-sitemap__link {
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;                    /* gray-700 */
}
/* 表示名は日本語の文節で改行する（word-break: auto-phrase。対応ブラウザ〈Chrome 系〉のみ。非対応では従来どおりの折り返し） */
.hub-sitemap__link,
.hub-sitemap__lead-title { word-break: auto-phrase; }
/* 表示名の末尾「（…）」は途中で折り返さない（生成スクリプトが短いものだけ囲む） */
.hub-sitemap__nowrap { white-space: nowrap; }
.hub-sitemap__link:hover { color: var(--hero-frame, #15803d); text-decoration: underline; }
.hub-sitemap__link:focus-visible { outline: 2px solid var(--hero-frame, #15803d); outline-offset: 2px; border-radius: 2px; }

/* 折りたたみ（第2階層以下）。初期状態は閉じる */
.hub-sitemap__more { margin-top: 0.125rem; }
.hub-sitemap__more > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    list-style: none;
    font-size: 0.75rem;
    color: #4b5563;                    /* gray-600 */
    padding: 0.125rem 0;
}
.hub-sitemap__more > summary::-webkit-details-marker { display: none; }
.hub-sitemap__more > summary::before {
    content: "▸";
    color: var(--hero-frame, #15803d);
    transition: transform .15s;
}
.hub-sitemap__more[open] > summary::before { transform: rotate(90deg); }
.hub-sitemap__more > summary:hover { color: var(--hero-frame, #15803d); }
.hub-sitemap__more > summary:focus-visible { outline: 2px solid var(--hero-frame, #15803d); outline-offset: 2px; border-radius: 2px; }

