/* Result-14：トップページの見た目。3D の街（#stage）は画面に固定し、文章・ナビ・CTA は通常の HTML で重ねる */
:root { --paper: #f4f2ec; --ink: #26323d; --sub: #5d6b76; --teal: #1f9e8a; --line: rgba(38, 50, 61, .14); --hdr: 64px; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: #e0dedb; color: var(--ink); font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", "Noto Sans CJK JP", sans-serif; line-height: 1.7; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 6px; }
.skip:focus { top: 12px; }

/* 3D の舞台：読み込み中は同じ構図の静止画（ポスター）を見せ、準備が済んだらキャンバスへ切り替える */
#stage { position: fixed; inset: 0; z-index: 0; background: #e0dedb url(./poster_pc.jpg) center / cover no-repeat; }
#stage canvas { display: block; opacity: 0; transition: opacity .7s ease; }
body.ready #stage canvas { opacity: 1; }
@media (max-aspect-ratio: 1/1) { #stage { background-image: url(./poster_m.jpg); } }
/* 本文に入る直前に 3D をやわらかく紙色へ沈める */
#veil { position: fixed; inset: 0; z-index: 1; background: var(--paper); opacity: 0; pointer-events: none; }

/* ナビゲーション */
.site-header { position: fixed; z-index: 20; top: 0; left: 0; right: 0; height: var(--hdr); display: flex; align-items: center; gap: 28px; padding: 0 clamp(16px, 4vw, 56px);
  background: linear-gradient(rgba(224,222,219,.94), rgba(224,222,219,0)); }
.site-header .logo { font-size: 12px; letter-spacing: .3em; font-weight: 700; text-decoration: none; margin-right: auto; }
.site-header nav ul { display: flex; gap: 24px; list-style: none; margin: 0; padding: 0; font-size: 13px; }
.site-header nav a { text-decoration: none; opacity: .8; } .site-header nav a:hover { opacity: 1; text-decoration: underline; }
body.in-content .site-header { background: rgba(244,242,236,.94); box-shadow: 0 1px 0 var(--line); }

/* ボタン */
.btn { display: inline-block; font-size: 14px; font-weight: 600; letter-spacing: .04em; text-decoration: none; padding: 12px 22px; border-radius: 999px; border: 1px solid var(--ink); transition: background .2s, color .2s; }
.btn-solid { background: var(--ink); color: #fff; } .btn-solid:hover { background: #3a4a57; }
.btn-line { background: rgba(244,242,236,.6); } .btn-line:hover { background: #fff; }
.btn-sm { padding: 8px 16px; font-size: 12px; }
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

main { position: relative; z-index: 2; }
/* ヒーロー：最初の 1 画面。3D は進行度 0（白紙）なので文章と重ならない */
.hero { min-height: 100svh; padding: calc(var(--hdr) + 14vh) clamp(20px, 6vw, 96px) 12vh; display: flex; flex-direction: column; justify-content: center; max-width: 920px; }
.eyebrow { font-size: 12px; letter-spacing: .3em; font-weight: 600; color: var(--sub); margin: 0 0 18px; }
.hero h1 { font-size: clamp(36px, 5.6vw, 76px); line-height: 1.25; letter-spacing: .04em; margin: 0 0 24px; font-weight: 700; }
.lead { font-size: clamp(15px, 1.25vw, 18px); color: #3c4a55; max-width: 36em; margin: 0 0 32px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.scroll-hint { margin: 9vh 0 0; font-size: 12px; letter-spacing: .1em; color: var(--sub); display: flex; align-items: center; gap: 12px; }
.scroll-hint span { width: 1px; height: 40px; background: var(--ink); opacity: .5; animation: hint 1.8s ease-in-out infinite; transform-origin: top; }
@keyframes hint { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(0); transform-origin: bottom; } }
@media (prefers-reduced-motion: reduce) { .scroll-hint span { animation: none; } }
/* 読み込み表示：ヒーローの中に小さく（待たずに文章が読める） */
#loader { margin-top: 18px; display: flex; align-items: center; gap: 10px; font-size: 11px; letter-spacing: .12em; color: var(--sub); transition: opacity .5s; }
#loader .bar { width: 120px; height: 2px; background: var(--line); overflow: hidden; } #loader .bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .3s; }
body.ready #loader { opacity: 0; }
#loader.float { position: fixed; z-index: 15; right: 20px; bottom: 18px; margin: 0; background: rgba(244,242,236,.9); padding: 8px 12px; border-radius: 999px; }

/* 物語のスクロール区間：高さだけを持つ（中身の文章は画面に固定して進行度で出し入れする） */
#story { position: relative; height: 640vh; }
.chapters { list-style: none; margin: 0; padding: 0; }
.ch { position: fixed; z-index: 3; max-width: min(30vw, 440px); opacity: 0; pointer-events: none; transition: none; will-change: opacity, transform;
  text-shadow: 0 0 10px rgba(244,242,236,.85), 0 0 2px rgba(244,242,236,.9); }
.ch.on { pointer-events: auto; }
.ch-no { font-size: 12px; letter-spacing: .12em; color: var(--sub); margin: 0 0 8px; font-weight: 500; }
.ch h3 { font-size: clamp(22px, 2.4vw, 34px); font-weight: 650; letter-spacing: .04em; line-height: 1.4; margin: 0 0 10px; }
.ch-body { font-size: clamp(13px, 1vw, 15px); color: #3c4a55; margin: 0; }
/* PC：Result-13B のカメラ構図が空けている余白（左下・左上・右下）に置く */
.ch[data-ch="0"] { left: 6vw; bottom: 14vh; }
.ch[data-ch="1"], .ch[data-ch="2"] { left: 6vw; top: calc(var(--hdr) + 7vh); }
.ch[data-ch="3"] { right: 5vw; bottom: 9vh; text-align: right; }
/* 縦長（スマートフォン）：文章は上部の余白（3D は下へ置く構図） */
@media (max-aspect-ratio: 1/1) {
  :root { --hdr: 56px; }
  .site-header nav { display: none; }
  .hero { padding-top: calc(var(--hdr) + 8vh); justify-content: flex-start; }
  .lead br.pc { display: none; }
  .ch, .ch[data-ch] { left: 7vw; right: 7vw; top: calc(env(safe-area-inset-top) + var(--hdr) + 1.5vh); bottom: auto; max-width: none; text-align: left; }
  .ch h3 { font-size: clamp(21px, 6vw, 27px); margin-bottom: 4px; }
  .ch-body { font-size: 13px; line-height: 1.6; }
  .ch-no { font-size: 11px; margin-bottom: 4px; }
}
@media (max-height: 520px) and (min-aspect-ratio: 1/1) { .ch h3 { font-size: 18px; } .ch-body { display: none; } .hero h1 { font-size: 30px; } }

/* 本文（不透明な紙色で 3D の上へ重なる） */
#content { position: relative; z-index: 4; background: var(--paper); }
#content::before { content: ""; position: absolute; left: 0; right: 0; top: -22vh; height: 22vh; background: linear-gradient(rgba(244,242,236,0), var(--paper)); pointer-events: none; }
.sec { padding: 14vh clamp(20px, 6vw, 96px); max-width: 1280px; margin: 0 auto; }
.sec h2 { font-size: clamp(26px, 3vw, 40px); letter-spacing: .04em; margin: 0 0 40px; line-height: 1.35; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { background: #fff; border-radius: 16px; padding: 28px; border: 1px solid var(--line); }
.card .num { font-size: 12px; letter-spacing: .2em; color: var(--teal); font-weight: 700; margin: 0 0 12px; }
.card h3 { margin: 0 0 8px; font-size: 19px; } .card p { margin: 0; color: #3c4a55; font-size: 14px; }
.sec-split { display: grid; grid-template-columns: 1fr 1.4fr; gap: 6vw; align-items: start; border-top: 1px solid var(--line); }
.sec-split > p { font-size: 16px; margin: 30px 0 0; color: #3c4a55; }
.contact { text-align: center; border-top: 1px solid var(--line); } .contact h2 { margin-bottom: 12px; } .contact .cta-row { justify-content: center; margin-top: 28px; }
.site-footer { display: flex; justify-content: space-between; align-items: center; padding: 28px clamp(20px, 6vw, 96px); border-top: 1px solid var(--line); font-size: 12px; }
.site-footer .logo { letter-spacing: .3em; font-weight: 700; margin: 0; } .site-footer .copy { margin: 0; color: var(--sub); }
@media (max-width: 760px) { .cards { grid-template-columns: 1fr; } .sec-split { grid-template-columns: 1fr; gap: 0; } .sec { padding: 10vh 22px; } }

/* ---------------- Result-14b ---------------- */
/* 章へのページ内リンク先（見えない目印。画面上端に合わせる） */
#story .anchor { position: absolute; left: 0; width: 1px; height: 1px; scroll-margin-top: 0; }
/* 章の目次：右端中央の点。物語区間にいる間だけ見せる。現在の章は塗りつぶし */
.chnav { position: fixed; z-index: 18; right: clamp(10px, 1.6vw, 24px); top: 50%; transform: translateY(-50%); opacity: 0; pointer-events: none; transition: opacity .3s; }
.chnav.show, .chnav:focus-within { opacity: 1; pointer-events: auto; }
.chnav ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.chnav a { display: flex; align-items: center; justify-content: flex-end; gap: 10px; text-decoration: none; font-size: 11px; color: var(--sub); }
.chnav a::after { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--ink); background: transparent; flex: none; }
.chnav a[aria-current="step"]::after { background: var(--ink); }
.chnav a > :not(.sr-only), .chnav a { white-space: nowrap; }
.chnav a { color: transparent; } .chnav a:hover, .chnav a:focus-visible, .chnav a[aria-current="step"] { color: var(--sub); }
@media (max-aspect-ratio: 1/1) { .chnav { right: 6px; } .chnav a, .chnav a[aria-current="step"] { color: transparent; font-size: 0; } .chnav a::after { width: 7px; height: 7px; } }
/* 動きを減らす設定：章の出入りは移動なし（site.js）・目次の切り替えも即時 */
@media (prefers-reduced-motion: reduce) { .chnav, #stage canvas, #loader { transition: none; } }
/* 3D を表示できない場合：完成した街の静止画を背景にし、章は普通の文章として順に並べる */
body.no3d #stage { background-image: url(./poster_end_pc.jpg); }
@media (max-aspect-ratio: 1/1) { body.no3d #stage { background-image: url(./poster_end_m.jpg); } }
body.no3d #stage canvas { display: none; }
body.no3d #veil { opacity: .72 !important; }
/* Result-15b：代替表示では 3D 用の長いスクロール領域を解除する（site.js が style で高さを入れるので !important） */
body.no3d #story { height: auto !important; padding: 8vh clamp(20px, 6vw, 96px) 16vh; }
body.no3d .chapters { display: grid; gap: 7vh; max-width: 640px; }
body.no3d .ch, body.no3d .ch[data-ch] { position: static; opacity: 1 !important; transform: none !important; max-width: none; text-align: left; background: rgba(244,242,236,.88); padding: 22px 26px; border-radius: 14px; }
body.no3d .chnav, body.no3d .anchor { display: none; }

/* ---------------- Result-14c ---------------- */
/* 縦長：ヘッダーを紙色の帯にする（3D は帯の高さぶん下げて描くので、建物がロゴの下に入らない） */
@media (max-aspect-ratio: 1/1) {
  .site-header { background: rgba(224,222,219,.94); box-shadow: 0 1px 0 rgba(38,50,61,.08); }
  .ch, .ch[data-ch] { top: calc(env(safe-area-inset-top) + var(--hdr) + 1.2vh); }
}
/* 章の目次：章名は紙色の小さな札に載せて、3D と重なっても読めるようにする（現在の章・フォーカス・ホバー時のみ表示） */
.chnav a > span:not(.sr-only) { display: none; }
.chnav a { color: transparent; }
.chnav a:hover, .chnav a:focus-visible, .chnav a[aria-current="step"] { color: var(--ink); }
.chnav a:hover, .chnav a:focus-visible, .chnav a[aria-current="step"] { text-shadow: none; }
.chnav a { padding: 3px 4px 3px 10px; border-radius: 999px; }
.chnav a[aria-current="step"], .chnav a:hover, .chnav a:focus-visible { background: rgba(244,242,236,.92); box-shadow: 0 1px 4px rgba(38,50,61,.12); }
@media (max-aspect-ratio: 1/1) { .chnav a[aria-current="step"], .chnav a:hover, .chnav a:focus-visible { background: transparent; box-shadow: none; } }

/* Result-14d：現在の章名の札は、章が切り替わった直後（.flash：2.4 秒）とホバー・フォーカスのときだけ。それ以外は点だけ（札が 3D に重なり続けないように） */
.chnav a[aria-current="step"]:not(.flash):not(:hover):not(:focus-visible) { color: transparent; background: transparent; box-shadow: none; }
.chnav a { transition: color .35s, background-color .35s, box-shadow .35s; }
@media (prefers-reduced-motion: reduce) { .chnav a { transition: none; } }
