/* 有権者 — 新しいトップ（index.html）だけの演出
   背面: 固定の夜のグラデーション（.night）＋ WebGL の海（#scene）。手前の HTML はふつうにスクロールする。 */

body.home { padding-top: 0; background: var(--night-0); }
body.home::before { display: none; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ── 背面 ── */
.night { /* WebGL が無いときもこれが夜の海に見える */
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 30% at 32% 30%, rgba(214, 236, 255, .07), transparent 70%),
    radial-gradient(90% 40% at 50% 62%, rgba(143, 208, 255, .10), transparent 70%),
    linear-gradient(180deg, #04080f 0%, #071426 45%, #0b1d34 61.5%, #050c18 62%, #02060c 100%);
}
#scene {
  position: fixed; top: 0; left: 0; z-index: 0; display: block;
  width: 100%; height: 100vh; height: 100lvh;
  pointer-events: none; opacity: 0;
}
html.webgl #scene { opacity: 1; transition: opacity 1.2s ease; }
html.emblem-hover, html.emblem-hover body { cursor: pointer; }

main { position: relative; z-index: 2; padding: 0; }
body.home footer { position: relative; z-index: 2; background: linear-gradient(180deg, transparent, rgba(2, 6, 12, .9) 40%); }

/* ── ローディング ── */
.loader {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center;
  background: var(--night-0);
  animation: loader-safety .4s ease 2.6s forwards; /* スクリプトが動かなくても必ず消える */
}
.loader-box { position: relative; width: 132px; height: 132px; display: grid; place-items: center; }
.loader-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.loader-ring circle { fill: none; stroke: rgba(143, 208, 255, .14); stroke-width: 1; }
.loader-ring circle.on {
  stroke: var(--glow); stroke-width: 1.4; stroke-linecap: round;
  stroke-dasharray: 1 1; stroke-dashoffset: 1;
  filter: drop-shadow(0 0 4px rgba(143, 208, 255, .9));
}
.loader-num { font-family: var(--serif); font-weight: 800; font-size: 26px; letter-spacing: .06em; color: var(--glow); font-variant-numeric: tabular-nums; }
@keyframes loader-safety { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .loader { display: none; } }
.site-logo.is-arrived { animation: logo-arrive .6s ease-out; }
@keyframes logo-arrive { from { text-shadow: 0 0 18px rgba(143, 208, 255, .95); } to { text-shadow: none; } }

/* ── 光の流れ（WebGL が使えないときだけ。WebGL のときは天の川の帯が府省をつなぐ） ── */
html.webgl .flow { display: none; }
.flow { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; overflow: visible; }
.flow path { fill: none; stroke-linecap: round; }
.flow-glow { stroke: #8fd0ff; stroke-width: 10; opacity: .32; }
.flow-core { stroke: url(#flow-grad); stroke-width: 1.6; opacity: .9; }
.flow-spark { fill: #eaf6ff; opacity: 0; filter: drop-shadow(0 0 6px #8fd0ff) drop-shadow(0 0 14px #8fd0ff); transition: opacity .3s; }
@media (prefers-reduced-motion: reduce) { .flow-glow, .flow-core { stroke-dashoffset: 0 !important; } .flow-spark { display: none; } }

/* ── ヒーロー ── */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center; text-align: center; padding: calc(var(--header-h) + 24px) 20px 120px;
}
.hero-inner { position: relative; z-index: 1; max-width: 960px; }
/* 日本のサイトだとひと目でわかる見出し。国旗は加工せず正しい比率（縦2:横3、円の直径は縦の3/5）で小さく置く */
.hero-eyebrow { margin: 0 0 6px; display: inline-flex; align-items: center; gap: 12px; font-size: clamp(14px, 1.5vw, 18px); letter-spacing: .24em; color: var(--text); }
.hinomaru { flex: none; border-radius: 1px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25), 0 2px 10px rgba(0, 0, 0, .5); }
.hero-title {
  margin: 0; font-family: var(--serif); font-weight: 800;
  font-size: clamp(76px, 17vw, 230px); line-height: 1.05; letter-spacing: .18em; text-indent: .18em;
  color: var(--text);
  background: linear-gradient(180deg, #ffffff 10%, #cfe6fb 55%, #7fb7e6 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px rgba(143, 208, 255, .28));
}
.hero-lead { margin: 26px auto 0; font-size: clamp(17px, 2vw, 21px); line-height: 1.9; color: #cfd9e6; letter-spacing: .06em; }
.hero-note { margin: 10px auto 0; font-size: clamp(13px, 1.3vw, 15px); color: var(--sub); letter-spacing: .06em; }
.hero-latest {
  margin: 30px auto 0; max-width: 680px; display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 12px;
  padding: 10px 18px; border: 1px solid rgba(214, 236, 255, .16); border-radius: 999px;
  background: rgba(4, 8, 15, .45); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-size: 15px; line-height: 1.6;
}
.hero-latest[hidden] { display: none; }
.hero-latest-label { color: var(--shu); font-weight: 700; font-size: 13px; letter-spacing: .1em; }
.hero-latest a { text-decoration: none; color: var(--text); }
.hero-latest a:hover { color: var(--glow); text-decoration: underline; }
.hero-latest-m { color: var(--sub); font-size: 13px; }
.hero-scroll {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: #cfd9e6; font-size: clamp(15px, 1.3vw, 17px); letter-spacing: .22em; text-indent: .22em; text-decoration: none; min-height: 44px;
  text-shadow: 0 0 10px rgba(2, 6, 12, .9);
}
.hero-scroll::after {
  content: ""; width: 1.5px; height: 52px;
  background: linear-gradient(180deg, var(--glow), transparent);
}
@media (prefers-reduced-motion: no-preference) {
  .hero-scroll::after { animation: scroll-hint 2.2s ease-in-out infinite; transform-origin: top; }
}
@keyframes scroll-hint { 0% { transform: scaleY(0); opacity: 1; } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* ── ピンボケから焦点が合って現れる ── */
/* html.js は index.html の先頭で付ける（スクリプトが動かない環境では最初から見える） */
html.js .reveal { opacity: 0; filter: blur(12px); transform: translateY(28px); }
html.js .reveal.is-in { opacity: 1; filter: none; transform: none; transition: opacity 1s ease, filter 1.1s ease, transform 1.1s cubic-bezier(.2, .8, .2, 1); }
@media (prefers-reduced-motion: reduce) {
  html.js .reveal, html.js .reveal.is-in { opacity: 1; filter: none; transform: none; transition: none; }
}

/* ── 府省の流れ ── */
.eyebrow { margin: 0 0 10px; font-size: 12px; letter-spacing: .32em; color: var(--glow-2); }
.stream-head { position: relative; text-align: center; padding: 18vh 20px 6vh; max-width: 760px; margin: 0 auto; }
.stream-title { margin: 0; font-family: var(--serif); font-weight: 800; font-size: clamp(34px, 5vw, 64px); letter-spacing: .16em; line-height: 1.3; }
.stream-meta { margin: 12px 0 0; color: var(--sub); font-size: 15px; letter-spacing: .08em; }
.stream-note { margin: 18px auto 0; color: var(--sub); font-size: 14px; max-width: 34em; }

.chapter {
  --a: min(42vw, 70vh, 620px); /* 物体を画面の主役に */
  position: relative; min-height: 125vh;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  max-width: 1440px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 64px);
}
/* 物体はいつも右の列（WebGL のときは画面に固定した1つの物体がこの位置に来る）、文章は左の列 */
.ch-visual { position: relative; order: 2; }
.ch-anchor {
  position: sticky; top: calc(50vh - var(--a) / 2 + var(--header-h) / 2);
  width: var(--a); height: var(--a); margin: 12vh auto;
}
.ch-text { display: flex; align-items: center; justify-content: flex-start; padding: 18vh 0; }
.ch-card {
  width: 100%; max-width: 540px; padding: 30px 32px;
  border-radius: 18px; border: 1px solid rgba(214, 236, 255, .08);
  background: linear-gradient(180deg, rgba(4, 8, 15, .55), rgba(4, 8, 15, .3));
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.ch-no { margin: 0; font-family: var(--serif); font-size: 18px; letter-spacing: .16em; color: var(--sub); font-variant-numeric: tabular-nums; }
.ch-no b { color: var(--glow); font-weight: 800; font-size: 26px; }
.ch-name {
  margin: 6px 0 4px; font-family: var(--serif); font-weight: 800;
  font-size: clamp(38px, 4.8vw, 72px); line-height: 1.25; letter-spacing: .2em;
  text-shadow: 0 0 26px rgba(143, 208, 255, .25);
}
.ch-count { margin: 0 0 20px; color: var(--sub); font-size: 15px; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.ch-count span { font-size: 13px; }
.ch-latest { list-style: none; margin: 0 0 26px; padding: 0; border-top: 1px solid rgba(143, 208, 255, .14); }
.ch-latest li { padding: 12px 0; border-bottom: 1px solid rgba(143, 208, 255, .14); }
.ch-latest time { display: block; font-size: 13px; color: var(--sub); }
.ch-latest a { font-size: 17px; line-height: 1.6; text-decoration: none; color: var(--text); }
.ch-latest a:hover { color: var(--glow); text-decoration: underline; }
.ch-open {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border: 1px solid rgba(143, 208, 255, .5); border-radius: 999px;
  background: rgba(143, 208, 255, .08); color: var(--glow);
  font: inherit; font-weight: 700; font-size: 15px; letter-spacing: .08em; cursor: pointer;
  box-shadow: 0 0 24px rgba(143, 208, 255, .12);
}
.ch-open::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--shu); }
.ch-open:hover { background: rgba(143, 208, 255, .16); border-color: var(--glow); }

/* エンブレムの透明ボタン（WebGL のときは見えない。キーボードで選ぶと光の輪が出る） */
.emblem-hit {
  position: absolute; inset: 8%; padding: 0; border: 0; border-radius: 50%;
  background: none; color: inherit; cursor: pointer;
}
html.webgl .emblem-hit { pointer-events: none; }
.emblem-hit:focus-visible { outline: 2px solid var(--glow-2); outline-offset: 6px; box-shadow: 0 0 40px rgba(143, 208, 255, .35); }
.emblem-fallback { display: none; }

/* フォールバック：CSS の割れた石＋大きな明朝の1文字 */
html:not(.webgl) .emblem-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  clip-path: polygon(50% 0%, 78% 8%, 97% 34%, 92% 68%, 70% 94%, 38% 100%, 10% 80%, 2% 46%, 18% 14%);
  background:
    linear-gradient(118deg, transparent 47.6%, rgba(143, 208, 255, .85) 48.2%, transparent 48.9%),
    linear-gradient(32deg, transparent 61.5%, rgba(143, 208, 255, .6) 62%, transparent 62.6%),
    linear-gradient(160deg, transparent 30%, rgba(143, 208, 255, .45) 30.5%, transparent 31%),
    radial-gradient(circle at 40% 30%, #2a3546, #141c28 55%, #0a0f17 100%);
  filter: drop-shadow(0 0 30px rgba(143, 208, 255, .25));
  transition: filter .3s;
}
html:not(.webgl) .emblem-fallback span {
  font-family: var(--serif); font-weight: 800; font-size: calc(var(--a) * .44); line-height: 1;
  color: #e6f0fb; text-shadow: 0 0 2px #fff, 0 0 18px rgba(143, 208, 255, .9), 0 0 50px rgba(143, 208, 255, .5);
}
html:not(.webgl) .emblem-hit:hover .emblem-fallback,
html:not(.webgl) .emblem-hit:focus-visible .emblem-fallback { filter: drop-shadow(0 0 46px rgba(143, 208, 255, .55)) brightness(1.15); }
html:not(.webgl) .emblem-hit:focus-visible { outline: none; box-shadow: none; }
@media (prefers-reduced-motion: no-preference) {
  html:not(.webgl) .emblem-fallback { animation: stone-float 7s ease-in-out infinite; }
}
@keyframes stone-float { 50% { transform: translateY(-10px) rotate(1.2deg); } }

.quiet { max-width: 760px; margin: 0 auto; padding: 8vh 20px 4vh; text-align: center; }
.quiet-title { margin: 0 0 14px; font-family: var(--serif); font-size: 17px; letter-spacing: .2em; color: var(--sub); }
.quiet-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; }
.quiet-list li { font-family: var(--serif); font-size: 18px; color: #b8c4d4; letter-spacing: .12em; }

/* ── 後半：見出しだけのセクション ── */
.later { position: relative; min-height: 64vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 12vh 20px; }
.later-title { margin: 0; font-family: var(--serif); font-weight: 800; font-size: clamp(44px, 8vw, 120px); line-height: 1.2; letter-spacing: .2em; text-indent: .2em; color: rgba(232, 237, 244, .92); }
.later-soon { margin: 18px 0 0; font-size: 16px; letter-spacing: .4em; text-indent: .4em; color: var(--sub); }
.later-soon::before, .later-soon::after { content: ""; display: inline-block; width: 28px; height: 1px; margin: 0 14px; vertical-align: middle; background: rgba(143, 208, 255, .4); }
.later-link { margin: 18px 0 0; font-size: 13px; }
.later-link a { color: var(--sub); }

/* ── スマホ ── */
@media (max-width: 720px) {
  .hero { padding-bottom: 110px; }
  .hero-title { letter-spacing: .12em; text-indent: .12em; }
  .hero-latest { border-radius: 16px; font-size: 14px; }
  /* スマホ：エンブレムを章の文章の上に置き、一緒にスクロールする（文章がエンブレムを隠さない） */
  .chapter {
    --a: min(72vw, 40vh);
    display: block; min-height: 0; padding: 12vh 16px 18vh;
  }
  .ch-visual { position: relative; height: calc(var(--a) + 4vh); }
  .ch-anchor { position: absolute; top: 2vh; left: 50%; margin: 0 0 0 calc(var(--a) / -2); }
  .ch-text { position: relative; z-index: 1; padding: 0; justify-content: center; }
  .ch-card {
    padding: 22px 20px; border-radius: 16px;
    background: rgba(6, 12, 22, .78); border-color: rgba(214, 236, 255, .12);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
  /* WebGL のとき：物体は画面の上に固定。カードとカードのあいだを画面ほぼ1枚分あけ、そこで物体が変形する */
  html.webgl .chapter { --a: min(84vw, 44vh); padding: 0 16px; }
  html.webgl .ch-visual { height: 96vh; height: 96svh; }
  .ch-name { font-size: clamp(32px, 10vw, 44px); letter-spacing: .14em; }
  .ch-latest a { font-size: 16px; }
  .stream-head { padding-top: 14vh; }
}

/* 公約チェッカー（公開中）への入口：準備中のセクションより目立たせる */
.later--live { min-height: 80vh; }
.later--live .later-title a { color: inherit; text-decoration: none; }
.later--live .later-title a:hover { color: #fff; text-shadow: 0 0 32px rgba(94, 234, 212, .45); }
.pledge-lead { max-width: 34em; margin: 26px auto 0; font-size: clamp(16px, 1.6vw, 19px); line-height: 1.9; color: rgba(232, 237, 244, .88); }
.pledge-parties { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 24px 0 0; padding: 0; list-style: none; }
.pledge-parties li { padding: 6px 16px; border: 1px solid rgba(94, 234, 212, .35); border-radius: 999px; font-size: 15px; color: rgba(232, 237, 244, .9); background: rgba(8, 20, 30, .45); }
.pledge-cta { margin: 34px 0 0; }
.pledge-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 60px; padding: 0 38px; border-radius: 999px; font-size: clamp(17px, 1.8vw, 21px); font-weight: 700; letter-spacing: .06em; color: #04131a; text-decoration: none; background: linear-gradient(120deg, #5eead4, #8fd0ff); box-shadow: 0 10px 34px rgba(94, 234, 212, .28); transition: transform .2s ease, box-shadow .2s ease; }
.pledge-btn:hover, .pledge-btn:focus-visible { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(94, 234, 212, .42); }
.pledge-btn:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
@media (max-width: 600px) { .pledge-btn { width: 100%; max-width: 340px; padding: 0 20px; } }
@media (prefers-reduced-motion: reduce) { .pledge-btn { transition: none; } .pledge-btn:hover { transform: none; } }
@media (max-width: 600px) { .later--live .later-title { font-size: clamp(34px, 10vw, 44px); letter-spacing: .08em; text-indent: .08em; white-space: nowrap; } }
.pledge-btn span { margin-left: .4em; }
