/* トップページと導入の演出（夜の場面・扉・ろうそく・札を配る） */
:root {
  --night: #0E1430;          /* 夜空 */
  --night-2: #1A2150;
  --on-night: #F3EFE6;       /* 夜の上の文字 */
  --on-night-sub: #C5C9D8;   /* 夜の上の補助文字（7:1 以上） */
  --gold-bright: #D8B865;    /* 夜の上の金（文字にも使える） */
  --gold-btn-top: #E6CB7E;
  --gold-btn-bottom: #C9A24E;
  --gold-btn-ink: #22190A;
}

/* ── 画面の切り替え ── */
body[data-view="landing"] #reading-view,
body[data-view="reading"] #landing { display: none; }
.only-reading { display: none; }
body[data-view="reading"] .only-reading { display: inline-flex; }
.header-nav { display: flex; gap: 12px; }

/* トップではヘッダーを夜空の上に重ねる */
body[data-view="landing"] .site-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3; color: var(--on-night);
}
body[data-view="landing"] .brand,
body[data-view="landing"] .header-link { color: var(--on-night); }
body[data-view="landing"] .brand small { color: var(--on-night-sub); }
body[data-view="landing"] :focus-visible { outline-color: var(--on-night); }
body[data-view="landing"] .themes-sec :focus-visible,
body[data-view="landing"] .how-sec :focus-visible,
body[data-view="landing"] .about :focus-visible { outline-color: var(--navy); }

/* ── ボタン ── */
.btn-gold {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 56px; padding: 0 40px; border: 0; border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-btn-top), var(--gold-btn-bottom));
  color: var(--gold-btn-ink); font-weight: 700; letter-spacing: .2em; font-size: 1.02rem;
  box-shadow: 0 0 0 1px rgba(255, 240, 200, .35) inset, 0 8px 30px rgba(216, 184, 101, .28);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.btn-gold:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 0 0 1px rgba(255, 240, 200, .5) inset, 0 12px 40px rgba(216, 184, 101, .4); }
.btn-gold:focus-visible { outline: 3px solid var(--on-night); outline-offset: 4px; }
.btn-line {
  min-height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 700;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line-strong);
}
.btn-line:hover { border-color: var(--navy); background: var(--paper); }

/* ── ヒーロー（雪の夜） ── */
.hero {
  position: relative; overflow: hidden; color: var(--on-night);
  min-height: 100vh; min-height: 100svh;
  background:
    radial-gradient(60% 50% at 72% 38%, rgba(216, 184, 101, .16), transparent 70%),
    radial-gradient(80% 60% at 20% 100%, rgba(60, 80, 160, .35), transparent 70%),
    linear-gradient(180deg, #080C22 0%, var(--night) 45%, var(--night-2) 100%);
  display: flex; align-items: center;
}
.snow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero-inner {
  position: relative; z-index: 1; width: 100%; max-width: 1080px; margin: 0 auto;
  padding: 76px 20px 64px; display: grid; gap: 18px; align-items: center;
}
@media (min-width: 880px) {
  .hero-inner { grid-template-columns: 1.1fr .9fr; gap: 56px; padding: 110px 24px 90px; }
}
.hero-eyebrow { margin: 0 0 10px; color: var(--gold-bright); font-size: .85rem; letter-spacing: .18em; }
.hero h1 {
  font-family: var(--serif); font-weight: 600; margin: 0 0 16px;
  font-size: clamp(2.5rem, 1.6rem + 4.2vw, 4.6rem); line-height: 1.35; letter-spacing: .14em;
  text-shadow: 0 0 40px rgba(216, 184, 101, .25);
}
.hero-lead { margin: 0 0 26px; max-width: 32em; color: var(--on-night-sub); font-size: 1.02rem; line-height: 2; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
.hero-sub {
  color: var(--on-night); min-height: 44px; display: inline-flex; align-items: center;
  text-underline-offset: 6px; font-size: .95rem;
}
.hero-note { margin: 18px 0 0; font-size: .82rem; color: var(--on-night-sub); letter-spacing: .06em; }

.hero-door { order: -1; text-align: center; }
@media (min-width: 880px) { .hero-door { order: 0; } }
.door-frame {
  position: relative; width: min(42vw, 176px); margin: 0 auto; aspect-ratio: 5 / 7;
  border-radius: 999px 999px 10px 10px; overflow: hidden;
  border: 1px solid rgba(216, 184, 101, .75);
  box-shadow: 0 0 0 7px rgba(14, 20, 48, .6), 0 0 0 8px rgba(216, 184, 101, .35), 0 0 90px rgba(216, 184, 101, .22);
}
@media (min-width: 880px) { .door-frame { width: min(100%, 380px); } }
.door-frame img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.door-frame::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(14, 20, 48, .75) 100%);
}
.door-caption { margin: 10px 0 0; font-family: var(--serif); color: var(--gold-bright); letter-spacing: .3em; font-size: .9rem; }

.scroll-cue {
  position: absolute; z-index: 1; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: 44px; height: 52px; display: grid; place-items: center;
}
.scroll-cue span { width: 1px; height: 40px; background: linear-gradient(var(--gold-bright), transparent); animation: cue 2.4s ease-in-out infinite; }
@keyframes cue { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }
@media (max-height: 640px) { .scroll-cue { display: none; } }

/* 開いたときに、ゆっくり浮かび上がる */
.hero-eyebrow, .hero h1, .hero-lead, .hero-actions, .hero-note, .hero-door {
  animation: rise 1.4s cubic-bezier(.2, .7, .2, 1) both;
}
.hero-door { animation-duration: 2s; }
.hero h1 { animation-delay: .25s; }
.hero-lead { animation-delay: .5s; }
.hero-actions { animation-delay: .75s; }
.hero-note { animation-delay: .9s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* ── 共通の見出し ── */
.sec-en { margin: 0; font-family: var(--serif); letter-spacing: .26em; font-size: .78rem; color: var(--gold-text); }
.themes-sec h2, .how-sec h2 {
  font-family: var(--serif); font-weight: 600; margin: 6px 0 10px;
  font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.3rem); letter-spacing: .1em; line-height: 1.45;
}
.sec-lead { margin: 0 0 28px; color: var(--ink-sub); }

/* ── 占えること ── */
.themes-sec { max-width: 1080px; margin: 0 auto; padding: 72px 16px 56px; scroll-margin-top: 8px; }
.theme-cards { display: grid; gap: 14px; }
@media (min-width: 820px) { .theme-cards { grid-template-columns: repeat(3, 1fr); gap: 22px; } }
.theme-card {
  display: grid; grid-template-columns: 92px 1fr; gap: 16px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px;
  transition: transform .25s ease, box-shadow .25s ease;
}
.theme-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(26, 33, 64, .10); }
@media (min-width: 820px) {
  .theme-card { grid-template-columns: 1fr; padding: 20px 20px 22px; text-align: center; }
  .theme-card img { width: 132px; margin: 0 auto; }
}
.theme-card img { border-radius: 8px; box-shadow: 0 6px 16px rgba(26, 33, 64, .18); }
.theme-card h3 { font-family: var(--serif); font-size: 1.3rem; margin: 0 0 6px; letter-spacing: .08em; }
.theme-card p { margin: 0 0 14px; font-size: .95rem; line-height: 1.85; }
@media (min-width: 820px) { .theme-card p { min-height: 5.6em; } }

/* ── 絵が語る占い ── */
.how-sec {
  max-width: 1080px; margin: 0 auto; padding: 56px 16px 72px;
  display: grid; gap: 40px; align-items: center;
}
@media (min-width: 880px) { .how-sec { grid-template-columns: .9fr 1.1fr; gap: 56px; } }
.fan { position: relative; height: 290px; max-width: 420px; width: 100%; margin: 0 auto; }
.fan img {
  position: absolute; left: 50%; bottom: 0; width: 124px; margin-left: -62px;
  border-radius: 8px; box-shadow: 0 10px 24px rgba(26, 33, 64, .22);
  transform-origin: 50% 130%; transform: rotate(calc((var(--k) - 2) * 13deg));
  transition: transform .4s ease;
}
.fan img:nth-child(1) { --k: 0; } .fan img:nth-child(2) { --k: 1; } .fan img:nth-child(3) { --k: 2; z-index: 2; }
.fan img:nth-child(4) { --k: 3; } .fan img:nth-child(5) { --k: 4; }
.how-sec:hover .fan img { transform: rotate(calc((var(--k) - 2) * 16deg)); }
@media (min-width: 880px) { .fan { height: 360px; } .fan img { width: 150px; margin-left: -75px; } }
.how-body > p { margin: 0 0 18px; }
.sample { margin: 0 0 26px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.sample blockquote { margin: 0; font-family: var(--serif); font-size: 1.05rem; line-height: 1.95; }
.sample blockquote p { margin: 0; }
.sample figcaption { margin-top: 6px; font-size: .85rem; color: var(--gold-text); text-align: right; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; }
.steps strong { display: block; font-family: var(--serif); font-size: 1.08rem; }
.steps-no {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--navy); color: #fff; font-family: var(--serif); font-weight: 600;
}

.ai-note { margin: 18px 0 0 !important; font-size: .8rem; color: var(--ink-sub); line-height: 1.8; }

/* ── 最後の呼びかけ ── */
.final-cta {
  text-align: center; color: var(--on-night); padding: 80px 16px 88px; margin-bottom: 40px;
  background:
    radial-gradient(50% 70% at 50% 100%, rgba(216, 184, 101, .18), transparent 70%),
    linear-gradient(180deg, var(--night), var(--night-2));
}
.final-cta h2 {
  font-family: var(--serif); font-weight: 600; margin: 0 0 30px;
  font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem); letter-spacing: .12em; line-height: 1.6;
}

.footer-ai { font-size: .75rem; color: var(--on-night-sub); text-align: center; max-width: 36em; line-height: 1.7; }

/* ── 札を配る ── */
.spread.is-dealing .deck-card {
  animation: deal .75s cubic-bezier(.2, .8, .25, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes deal {
  from { opacity: 0; transform: translate(var(--dx, 0), var(--dy, 0)) rotate(-10deg) scale(.55); }
  40% { opacity: 1; }
  to { opacity: 1; transform: rotate(var(--tilt, 0deg)); }
}

/* ════════ 導入の演出 ════════ */
.ritual { position: fixed; inset: 0; z-index: 100; overflow: hidden; color: var(--on-night); }
.door {
  position: absolute; top: 0; bottom: 0; width: 50.2%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .03) 0 1px, transparent 1px 100%) 0 0 / 22px 100%,
    linear-gradient(180deg, #0A0F28, var(--night) 50%, #0A0F28);
  transition: transform .95s cubic-bezier(.7, 0, .3, 1);
}
.door::before {
  content: ''; position: absolute; top: 9%; bottom: 7%; width: 64%;
  border: 1px solid rgba(216, 184, 101, .45); border-radius: 999px 999px 4px 4px;
}
.door::after {
  content: ''; position: absolute; top: 52%; width: 10px; height: 38px; border-radius: 5px;
  background: linear-gradient(var(--gold-btn-top), var(--gold-btn-bottom)); opacity: .8;
  transition: opacity .8s ease;
}
.ritual.is-lit .door::after { opacity: 0; }
.door-l { left: 0; transform: translateX(-101%); box-shadow: inset -1px 0 0 rgba(216, 184, 101, .6); }
.door-l::before { right: 10%; } .door-l::after { right: 18px; }
.door-r { right: 0; transform: translateX(101%); box-shadow: inset 1px 0 0 rgba(216, 184, 101, .6); }
.door-r::before { left: 10%; } .door-r::after { left: 18px; }
.ritual.is-closed .door { transform: translateX(0); }
.ritual.is-open .door { transition-duration: 1.35s; }
.ritual.is-open .door-l { transform: translateX(-101%); }
.ritual.is-open .door-r { transform: translateX(101%); }

.door-seal {
  position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px;
  border-radius: 50%; overflow: hidden; opacity: 0; transform: scale(.8);
  box-shadow: 0 0 0 1px rgba(216, 184, 101, .7), 0 0 60px rgba(216, 184, 101, .45);
  transition: opacity .8s ease, transform .8s ease;
}
.ritual.is-sealed .door-seal { opacity: 1; transform: scale(1); }
.ritual.is-lit .door-seal { opacity: 0; transform: scale(1.15); }

.ritual-stage {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center; outline: none;
  transition: opacity .5s ease;
}
.ritual.is-open .ritual-stage { opacity: 0; }
.candle { position: relative; width: 16px; height: 60px; margin-bottom: 36px; opacity: 0; transition: opacity 1.4s ease; }
.candle::before {           /* 灯りのひろがり */
  content: ''; position: absolute; left: 50%; top: 10px; width: 520px; height: 520px; margin: -260px 0 0 -260px;
  background: radial-gradient(circle, rgba(255, 200, 110, .22), rgba(255, 190, 100, .06) 40%, transparent 70%);
  pointer-events: none;
}
.candle::after {            /* ろうそく本体 */
  content: ''; position: absolute; left: 1px; right: 1px; top: 26px; bottom: 0; border-radius: 3px 3px 1px 1px;
  background: linear-gradient(90deg, #E8E0CC, #FFF8E8 45%, #D8CFB8);
}
.flame {
  position: absolute; left: 50%; top: 0; width: 12px; height: 24px; margin-left: -6px;
  border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%;
  background: radial-gradient(ellipse at 50% 70%, #FFF6D8 0 25%, #FFC45C 55%, rgba(255, 140, 40, .6) 80%, transparent);
  box-shadow: 0 0 18px 6px rgba(255, 190, 90, .45);
  transform-origin: 50% 90%; animation: flicker 2.6s ease-in-out infinite;
}
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(-1deg); }
  30% { transform: scale(1.06, .96) rotate(1.5deg); }
  60% { transform: scale(.96, 1.05) rotate(-2deg); }
}
.ritual.is-lit .candle { opacity: 1; }

.ritual-line {
  min-height: 3.6em; max-width: 22em; margin: 0 0 24px;
  font-family: var(--serif); font-size: clamp(1.25rem, 1rem + 1.4vw, 1.8rem); line-height: 1.8; letter-spacing: .1em;
  text-shadow: 0 0 24px rgba(255, 200, 110, .25);
  transition: opacity .45s ease, filter .45s ease;
}
.ritual-line.is-fading { opacity: 0; filter: blur(3px); }
.ritual-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; animation: rise .8s ease both; }
.ritual-choices .btn-gold { min-width: 150px; padding: 0 28px; letter-spacing: .12em; }

.ritual-skip {
  position: absolute; top: 12px; right: 12px; z-index: 2; min-height: 44px; padding: 8px 14px;
  background: none; border: 0; color: var(--on-night-sub); font-size: .88rem;
  text-decoration: underline; text-underline-offset: 5px;
}
.ritual-skip:hover { color: var(--on-night); }
.ritual :focus-visible { outline-color: var(--on-night); }

@media (prefers-reduced-motion: reduce) {
  .hero-eyebrow, .hero h1, .hero-lead, .hero-actions, .hero-note, .hero-door,
  .ritual-choices, .scroll-cue span, .flame { animation: none; }
  .door, .door-seal, .candle, .ritual-line { transition: none; }
  .theme-card, .fan img { transition: none; }
}

@media (min-width: 880px) {
  .hero-eyebrow { margin-bottom: 14px; }
  .hero h1 { margin-bottom: 22px; }
  .hero-lead { margin-bottom: 30px; }
  .door-caption { margin-top: 16px; }
}

/* 日本語を文節で折り返し、一文字だけが次の行に残らないようにする */
.ritual-line, .hero h1, .hero-lead, .final-cta h2 { word-break: auto-phrase; text-wrap: balance; }
@media (max-width: 480px) {
  .ritual-line { font-size: 1.2rem; letter-spacing: .06em; }
  body[data-view="reading"] .brand small { display: none; }
}
.header-link { white-space: nowrap; }
