:root {
  --ink: #f5f2ea;
  --gap: clamp(0.9rem, 2.5vw, 1.4rem);
  /* グリフ自体はやわらかい影のみ（輪郭を汚さない）。
     コントラストは下グラデのスクリム（.stage__scrim）＋中央テキストの .praying::before で確保する。 */
  --text-shadow:
    0 1px 2px rgba(0,0,0,0.55),
    0 2px 10px rgba(0,0,0,0.5);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #0c0f0c;
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { overflow: hidden; }

/* --- ページ背景（フル + オーバーレイ） --- */
.stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 背景画像レイヤー（黒の body の上に重ね、後から「見えてくる」） */
.stage__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.page-home .stage__bg    { background-image: url("assets/images/home.png"); }
.page-worship .stage__bg { background-image: url("assets/images/worship.png"); }

/* 演出（JS 有効時のみ）：最初はすべて不可視＝黒画面。
   reveal.js が「文字 → 画像 → ボタン」の順に .is-in を付けてフェードインさせる。 */
.js-reveal .stage__bg { opacity: 0; }
.js-reveal .stage__bg.is-in { opacity: 1; transition: opacity 2200ms ease; }
.js-reveal .reveal { opacity: 0; }
.js-reveal .reveal.is-in { opacity: 1; transition: opacity 1100ms ease; }

/* 可読性のための暗幕（下ほど濃いグラデ＝文字が乗る下側を確実に暗くする）。
   画像は活かしたまま、文字側だけコントラストを確保する王道スクリム。 */
.stage__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(0,0,0,0.78) 0%,
    rgba(0,0,0,0.60) 22%,
    rgba(0,0,0,0.36) 45%,
    rgba(0,0,0,0.14) 62%,
    rgba(0,0,0,0) 78%);
  pointer-events: none;
}

.stage__overlay {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(2rem + var(--safe-b)) calc(1.5rem + var(--safe-r)) calc(2.5rem + var(--safe-b)) calc(1.5rem + var(--safe-l));
  width: 100%;
  height: 100%;
}

.stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap);
  text-align: center;
  max-width: 28rem;
  width: 100%;
}

.title {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3.4rem);
  letter-spacing: 0.18em;
  text-shadow: var(--text-shadow);
}
.lead {
  margin: -0.2rem 0 0.4rem;
  font-size: clamp(1.15rem, 4.6vw, 1.5rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-shadow: var(--text-shadow);
}

/* ホームは文言を上・操作ボタンを下に離して配置 */
.page-home .stage__overlay {
  flex-direction: column;
  justify-content: flex-end;
  gap: clamp(1.5rem, 5vh, 3rem);
  padding-bottom: clamp(5rem, 30vh, 17rem);
}
.home-intro,
.home-actions { width: auto; }

/* 中央に出る「お祈り中…」は下グラデが届かないので、その文字裏だけ控えめスクリム */
.praying { position: relative; }
.praying::before {
  content: "";
  position: absolute;
  inset: -1.4rem -2.6rem;
  z-index: -1;
  background: radial-gradient(ellipse at center,
    rgba(0,0,0,0.5) 0%,
    rgba(0,0,0,0.32) 45%,
    rgba(0,0,0,0) 75%);
  pointer-events: none;
}

/* --- ボタン --- */
.btn {
  appearance: none;
  border: 1px solid rgba(245,242,234,0.45);
  border-radius: 999px;
  padding: 0.85em 2.4em;
  min-height: 48px;
  min-width: 12rem;
  font: inherit;
  font-size: clamp(1rem, 3.6vw, 1.15rem);
  letter-spacing: 0.16em;
  color: var(--ink);
  background: rgba(20,24,20,0.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease, background-color 200ms ease, opacity 200ms ease;
}
.btn:hover { background: rgba(40,46,40,0.6); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.btn--primary { border-color: rgba(214,84,58,0.85); background: rgba(120,38,26,0.5); }
.btn--primary:hover { background: rgba(150,48,33,0.62); }
.btn--ghost { font-size: 0.85rem; padding: 0.6em 1.6em; min-width: 0; min-height: 40px; opacity: 0.85; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn[hidden] { display: none; }

.praying {
  margin: 0;
  font-size: clamp(1rem, 4vw, 1.25rem);
  letter-spacing: 0.3em;
  text-shadow: var(--text-shadow);
  animation: pulse 1.6s ease-in-out infinite;
}
.praying[hidden] { display: none; }
@keyframes pulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }

/* --- 右下：注釈 + クレジット（常時） --- */
.corner {
  position: fixed;
  right: calc(0.7rem + var(--safe-r));
  bottom: calc(0.6rem + var(--safe-b));
  z-index: 2;
  text-align: right;
  pointer-events: none;
}
.disclaimer {
  margin: 0;
  font-size: clamp(0.62rem, 2.2vw, 0.72rem);
  line-height: 1.5;
  color: rgba(245,242,234,0.9);
  text-shadow: 0 1px 6px rgba(0,0,0,0.9);
}
.corner a {
  display: block;
  margin-top: 0.3rem;
  font-size: clamp(0.62rem, 2.2vw, 0.72rem);
  color: rgba(245,242,234,0.78);
  text-shadow: 0 1px 6px rgba(0,0,0,0.9);
  text-decoration: none;
  pointer-events: auto;
}
.corner a:hover { color: var(--ink); text-decoration: underline; }

/* --- 法務ページ（通常フロー・読みやすさ優先） --- */
body.page-policies { overflow: auto; height: auto; min-height: 100%; }
.doc {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) clamp(1.2rem, 5vw, 2rem) 5rem;
  line-height: 1.85;
  color: var(--ink);
}
.doc h1 { font-size: clamp(1.4rem, 5vw, 2rem); letter-spacing: 0.08em; margin: 0 0 0.6rem; }
.doc h2 {
  margin: 2.6rem 0 0.6rem;
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  border-bottom: 1px solid rgba(245,242,234,0.22);
  padding-bottom: 0.3rem;
}
.doc h3 { margin: 1.7rem 0 0.3rem; font-size: 1.05rem; }
.doc ol, .doc ul { padding-left: 1.4rem; }
.doc li { margin: 0.2rem 0; }
.doc a { color: #e6b9a6; }
.doc code { font-size: 0.92em; opacity: 0.95; }
.doc .note { opacity: 0.8; font-size: 0.92em; }
.doc .back { display: inline-block; margin: 0.4rem 0 1.5rem; color: #e6b9a6; text-decoration: none; }
.doc .back:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  .js-reveal .stage__bg,
  .js-reveal .reveal { opacity: 1; transition: none; }
  .praying { animation: none; opacity: 0.9; }
  .btn { transition: none; }
}
