/* 玄関(ルート /)。街の盤(3D)を1本の路線でつなぎ、スクロールで駅ごとに止まる。
   文法は妙蓮寺と同じ: 枠線カード・丸矢印・透かし文字・装飾ピルは使わない。識別子(番号)だけ街の色/朱色。 */
.portal { background: var(--paper); }
.portal-header { position: fixed; inset: 0 0 auto; z-index: 20; background: linear-gradient(var(--paper) 55%, rgba(247,248,242,0)); }
.portal-nav { display: flex; gap: 18px; font-size: .86rem; }
.portal-nav a { color: var(--ink); text-decoration: none; white-space: nowrap; }
/* 街が増えて1行に収まらないときは横に送る(折り返して街の名前が割れないように) */
.portal-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 70vw; }
.portal-nav a span { font: 500 .72rem "Lexend Exa", sans-serif; color: var(--accent, #e45f38); margin-right: 5px; }
.portal-nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---- 舞台 ---- */
.stage { position: relative; }
.stage-sticky { position: sticky; top: 0; height: 100svh; overflow: hidden; background: linear-gradient(180deg, #edf2f1 0%, var(--paper) 40%); }
/* 紙の質感(街ページの .dither-section と同じ素材)を舞台全体に薄く */
.stage-sticky::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3; background: url("assets/texture-dither.webp") 0 0 / 420px 420px; opacity: .12; mix-blend-mode: multiply; }
.stage-sticky::before { content: ""; position: absolute; inset: auto 0 0 0; height: 38%; pointer-events: none; z-index: 1; background: linear-gradient(180deg, rgba(247,248,242,0), rgba(236,239,230,.9)); }
.stage-canvas, .stage-posters { position: absolute; inset: 0; }
.stage-canvas canvas { display: block; width: 100%; height: 100%; }
.stage-canvas.is-hover { cursor: pointer; }
.stage-posters { display: none; }
.stage-posters img { position: absolute; top: 8%; right: 3%; width: 56%; height: 84%; object-fit: contain; opacity: 0; transition: opacity .5s; }
.stage-posters img[data-town="overview"] { top: 0; right: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
.stage-posters img.is-active { opacity: 1; }
.portal.no3d .stage-posters { display: block; }
.portal.no3d .stage-canvas { display: none; }
.stage-labels { position: absolute; inset: 0; pointer-events: none; }
/* 街へ降りていく演出: 紙の幕(3Dの上)と、文字・ラベルの退場 */
.stage-veil { position: absolute; inset: 0; z-index: 4; background: var(--paper); opacity: 0; pointer-events: none; }
.is-diving .stage-steps, .is-diving .stage-labels, .is-diving .portal-header { opacity: 0; transition: opacity .35s; }
.is-diving .stage-canvas { cursor: default; }
.stage-label { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); white-space: nowrap; font-size: .8rem; line-height: 1; color: var(--ink); opacity: 0; transition: opacity .3s; pointer-events: auto; text-decoration: none; padding: 6px 0 12px; }
.stage-label.is-visible { opacity: 1; }
.stage-label span { font: 500 .7rem "Lexend Exa", sans-serif; color: var(--town, var(--accent, #e45f38)); margin-right: 6px; }
.stage-label b { font-weight: 700; }
.stage-label::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 1px; height: 10px; background: var(--ink); opacity: .6; }
.stage-label.is-active { opacity: 0 !important; }

.stage-steps { position: relative; z-index: 2; pointer-events: none; margin-top: -100svh; }
.stage-step { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--header-height) + 24px) var(--gutter) 80px; max-width: min(46%, 560px); pointer-events: none; background: linear-gradient(90deg, rgba(247,248,242,.98) 0%, rgba(247,248,242,.95) 72%, rgba(247,248,242,0) 100%); }
.stage-step > * { pointer-events: auto; }
.stage-step--intro { max-width: min(58%, 720px); }
.portal-title { margin: 0 0 22px; font-size: clamp(2.6rem, 6.4vw, 5.6rem); line-height: 1.02; letter-spacing: -.06em; font-weight: 900; }
.portal-title span { display: inline-block; }
.portal-lead { max-width: 30em; margin: 0; font-size: 1.02rem; }
.portal-lead b { font: 600 1.4em/1 "Lexend Exa", sans-serif; letter-spacing: -.02em; margin: 0 2px; }
.portal-hint { margin: 40px 0 0; font-size: .8rem; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.portal-hint a { margin-left: 18px; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.portal-lead--sub { margin-top: 14px; font-size: .92rem; color: var(--muted); }
.portal-lead--sub b { color: var(--ink); }
.portal-section { scroll-margin-top: var(--header-height); }
.stage-no { color: var(--town, var(--accent, #e45f38)); font-weight: 600; }
.stage-title { margin: 6px 0 14px; font-size: clamp(2rem, 4.2vw, 3.6rem); line-height: 1.06; letter-spacing: -.05em; font-weight: 900; }
.stage-title span { display: inline-block; }
.stage-lead { margin: 0; max-width: 28em; }
.stage-meta { margin: 14px 0 0; font-size: .82rem; color: var(--muted); }
.stage-link { display: inline-block; margin-top: 22px; color: var(--ink); text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1.5px; font-weight: 600; }
.stage-link:hover { color: var(--town, var(--ink)); }
.stage-step:not(.is-active) { opacity: .5; }
.stage-step:not(.is-active):focus-within { opacity: 1; }
.stage-step { transition: opacity .35s; }
@media (prefers-reduced-motion: reduce) { .stage-step { transition: none; } }

/* ---- 下部 ---- */
.portal-section { padding-top: 72px; }
.towns-numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 24px 0 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); }
.towns-numbers > div { padding: 22px 24px 24px 0; border-right: 1px solid var(--line, #d9ddd6); }
.towns-numbers > div + div { padding-left: 24px; }
.towns-numbers > div:last-child { border-right: 0; }
.towns-numbers dt { font-size: .8rem; color: var(--muted); }
.towns-numbers dd { margin: 6px 0 0; font-size: .9rem; }
.towns-numbers b { font: 600 clamp(1.8rem, 4vw, 3rem) "Lexend Exa", sans-serif; letter-spacing: -.02em; margin-right: 4px; }
.towns-list { list-style: none; margin: 40px 0 0; padding: 0; border-top: 1px solid var(--ink); }
.towns-list li { border-bottom: 1px solid var(--line, #d9ddd6); }
.towns-list a { display: grid; grid-template-columns: 56px 240px 1fr; gap: 28px; align-items: center; padding: 26px 0; color: inherit; text-decoration: none; }
.towns-list a:hover b { text-decoration: underline; text-underline-offset: 5px; }
.towns-no { font: 500 .9rem "Lexend Exa", sans-serif; color: var(--town, var(--accent, #e45f38)); }
.towns-list img { width: 240px; height: 160px; object-fit: cover; object-position: 50% 62%; }
.towns-copy { display: grid; gap: 6px; }
.towns-copy small { font-size: .74rem; color: var(--muted); letter-spacing: .04em; }
.towns-copy b { font-size: clamp(1.3rem, 2.2vw, 1.8rem); letter-spacing: -.03em; font-weight: 900; }
.towns-copy span { font-size: .95rem; }
.towns-copy em { font-style: normal; font-size: .78rem; color: var(--muted); }
.towns-text { max-width: 40em; }
.portal-footer nav { display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: .86rem; margin-bottom: 18px; }
.portal-footer nav a { color: #fff; text-decoration: none; }
.portal-footer nav a:hover { text-decoration: underline; }
.portal-credit { font-size: .74rem; color: rgba(255,255,255,.6); margin: 0 0 12px; }
.portal-credit a { color: inherit; }

@media (max-width: 900px) {
  .portal-nav { display: none; }
  .stage-step, .stage-step--intro { max-width: none; justify-content: flex-end; padding-bottom: 56px; }
  .stage-step { background: linear-gradient(180deg, rgba(247,248,242,0), rgba(247,248,242,.94) 34%); }
  .portal-title { font-size: clamp(2.4rem, 12vw, 4rem); }
  .stage-lead { max-width: none; }
  .stage-posters img { top: 9%; left: 3%; right: 3%; width: 94%; height: 46%; }
  .towns-numbers { grid-template-columns: 1fr; }
  .towns-numbers > div { border-right: 0; border-bottom: 1px solid var(--line, #d9ddd6); padding: 14px 0; }
  .towns-numbers > div + div { padding-left: 0; }
  .towns-numbers > div:last-child { border-bottom: 0; }
  .towns-list a { grid-template-columns: 40px 1fr; gap: 12px 16px; }
  .towns-list img { grid-column: 2; width: 100%; height: auto; aspect-ratio: 3 / 2; }
  .towns-copy { grid-column: 2; }
}

/* ---- 路線(全駅)。準備中の駅は色なし ---- */
.stage-label.is-blank { color: var(--muted); font-size: .7rem; padding-bottom: 8px; }
.stage-label.is-blank b { font-weight: 500; }
.stage-label.is-blank::after { height: 6px; opacity: .4; }
.stage-label.is-blank.is-above { padding: 0 0 12px; }
.stage-label.is-blank.is-below { padding: 12px 0 0; }
.stage-label.is-blank.is-above::after { width: 1px; height: 8px; left: 50%; top: auto; bottom: 2px; }
.stage-label.is-blank.is-below::after { width: 1px; height: 8px; left: 50%; top: 2px; }
.stage-label.is-blank.is-right { padding: 0 0 0 14px; }
.stage-label.is-blank.is-left { padding: 0 14px 0 0; }
.stage-label.is-blank::after { width: 8px; height: 1px; top: 50%; bottom: auto; }
.stage-label.is-right::after { left: 2px; }
.stage-label.is-left::after { left: auto; right: 2px; }
.is-shot .portal-header, .is-shot .stage-steps, .is-shot .stage-sticky::after { display: none; }
.line-strip__title { margin: 40px 0 0; font-size: .8rem; color: var(--muted); font-weight: 500; }
.line-strip { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0; }
.line-strip li { position: relative; display: flex; align-items: center; gap: 7px; padding: 8px 18px 8px 0; font-size: .82rem; color: var(--muted); white-space: nowrap; }
.line-strip li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--muted); background: var(--paper); flex: none; }
.line-strip li.is-built::before { background: var(--town); border-color: var(--town); }
.line-strip li small { font-size: .66rem; margin-left: 2px; }
.line-strip li.is-built a { color: var(--ink); font-weight: 700; text-decoration: none; }
.line-strip li.is-built a:hover { text-decoration: underline; text-underline-offset: 4px; }
.line-strip li.is-built a span { font: 500 .68rem "Lexend Exa", sans-serif; color: var(--town); margin-right: 5px; }

/* 静止画の撮影モード: 空の階調は headless の描画で縞が出るので紙一色にする */
.is-shot .stage-sticky { background: var(--paper); }
