/* ════════════════════════════════════════════════
   ネオシャーマニズム講座 vol.1 — 没入型LP
   ゼロから新規構築。vanilla Three.js + GSAP。
════════════════════════════════════════════════ */

:root {
  --bg: #05030f;
  --magenta: #ff5edb;
  --violet: #a06bff;
  --cyan: #4fd6ff;
  --gold: #ffd76a;
  --ink: #f4eefe;
  --ink-soft: rgba(244, 238, 254, 0.62);
  --ink-faint: rgba(244, 238, 254, 0.3);
  --font-serif: 'Shippori Mincho', serif;
  --font-sans: 'Zen Kaku Gothic New', system-ui, sans-serif;
  --font-latin: 'Cinzel', serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ───── 3D 背景キャンバス ───── */
#bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
}

/* ビネット & グレイン（映画的） */
#vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 80% at 50% 45%, transparent 40%, rgba(5, 3, 15, 0.55) 100%);
}
#grain {
  position: fixed;
  inset: -50%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.6s steps(2) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  50% { transform: translate(-3%, 2%); }
  100% { transform: translate(2%, -3%); }
}

/* ───── ローダー ───── */
#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  background: var(--bg);
  transition: opacity 1s ease, visibility 1s ease;
}
#loader.hidden {
  opacity: 0;
  visibility: hidden;
}
.loader-ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid rgba(160, 107, 255, 0.18);
  border-top-color: var(--magenta);
  border-right-color: var(--cyan);
  animation: spin 1s linear infinite;
  box-shadow: 0 0 30px rgba(160, 107, 255, 0.4);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loader-text {
  font-family: var(--font-serif);
  letter-spacing: 0.3em;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* ───── スクロール進捗バー ───── */
#progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  z-index: 30;
  background: linear-gradient(90deg, var(--magenta), var(--violet) 50%, var(--cyan));
  box-shadow: 0 0 12px rgba(255, 94, 219, 0.6);
  transition: width 0.1s linear;
}

/* ───── ナビ ───── */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem clamp(1.2rem, 4vw, 3rem);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  transition: background 0.4s ease, padding 0.4s ease, backdrop-filter 0.4s ease, border-color 0.4s ease;
  border-bottom: 1px solid transparent;
}
/* スクロールでガラス背景が出現 */
#nav.scrolled {
  padding-top: 1rem;
  padding-bottom: 1rem;
  background: rgba(8, 4, 20, 0.55);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-bottom-color: rgba(160, 107, 255, 0.18);
}
.nav-mark {
  color: var(--ink-soft);
  font-family: var(--font-serif);
}
.nav-cta {
  color: var(--ink);
  text-decoration: none;
  padding: 0.5rem 1.2rem;
  border: 1px solid rgba(255, 94, 219, 0.4);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}
.nav-cta:hover {
  background: rgba(255, 94, 219, 0.15);
  border-color: var(--magenta);
}

/* ───── セクション共通 ───── */
main {
  position: relative;
  z-index: 10;
}
.sec {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(5rem, 12vh, 9rem) clamp(1.4rem, 5vw, 3rem);
}
/* radial スクリム：明るい銀河が文字裏に来ても白飛びしないよう
   「文字の裏だけ」沈める。銀河外周の輝きは残す（背景全体は暗くしない） */
.sec::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    ellipse 78% 62% at 50% 48%,
    rgba(4, 2, 10, 0.62) 0%,
    rgba(4, 2, 10, 0.34) 48%,
    rgba(4, 2, 10, 0) 78%
  );
}
.sec.center {
  align-items: center;
  text-align: center;
}
.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}
.wrap-narrow {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}
.center-text {
  text-align: center;
}

/* ───── タイポ部品 ───── */
.eyebrow {
  font-size: 0.74rem;
  letter-spacing: 0.42em;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-bottom: 1.6rem;
}
/* 中央見出しの下に細いグラデアクセント線 */
.center .eyebrow::after,
.eyebrow.center-text::after {
  content: '';
  display: block;
  width: 44px;
  height: 2px;
  margin: 0.95rem auto 0;
  background: linear-gradient(90deg, var(--magenta), var(--cyan));
  border-radius: 2px;
  opacity: 0.7;
}
.lead {
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  color: var(--ink-soft);
  margin-top: 1.6rem;
  line-break: strict;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6), 0 0 14px rgba(0, 0, 0, 0.4);
}
.big {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 1.25;
  letter-spacing: 0.01em;
  /* 日本語の自然な改行（文節折り＋禁則＋バランス） */
  word-break: auto-phrase;
  line-break: strict;
  text-wrap: balance;
  overflow-wrap: anywhere;
  /* 明るい背景でも読めるよう輪郭を立てる */
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), 0 0 18px rgba(0, 0, 0, 0.4);
}
.big em {
  font-style: normal;
}
/* BudouX が挿入する文節境界をブロック内で機能させる */
budoux-ja {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* グラデーションテキスト（clip:text のため text-shadow は効かない→ drop-shadow で可読性確保） */
.grad-magenta {
  background: linear-gradient(100deg, var(--magenta), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.55));
}
.grad-cyan {
  background: linear-gradient(100deg, var(--cyan), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.55));
}
.grad-gold {
  /* 暖色ゴールド（旧版は magenta が背景の紫銀河と被っていた→英雄の金で際立たせる） */
  background: linear-gradient(100deg, #ffe9a3, #ffc24d 55%, #ff9e3d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 20px rgba(255, 160, 60, 0.25));
}

/* ───── HERO ───── */
.hero {
  align-items: flex-start;
  max-width: 1180px;
  margin: 0 auto;
}
.hero-title {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: clamp(2.4rem, 8.2vw, 6.2rem);
  line-height: 1.06;
  letter-spacing: 0.01em;
  line-break: strict;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55), 0 0 26px rgba(0, 0, 0, 0.35);
}
.hero-title .line {
  display: block;
  white-space: nowrap; /* 各行は1フレーズ＝途中で折らない（フォントサイズで収める） */
}
/* 「量子シミュレーションゲームの」＝導入の小行（大きい「攻略法」へのジャンプ） */
.hero-title .line-sm {
  font-size: clamp(1.35rem, 4.8vw, 3.2rem);
  white-space: normal;
  word-break: auto-phrase;
  line-height: 1.25;
  letter-spacing: 0.02em;
  color: var(--ink);
}
/* 講座名 */
.hero-course {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.3rem, 4vw, 2.4rem);
  margin-top: 1.1rem;
  letter-spacing: 0.05em;
  background: linear-gradient(100deg, #ffe9a3, #ffc24d 55%, #ff9e3d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.6));
}
.glow-text {
  background: linear-gradient(100deg, var(--magenta) 0%, var(--violet) 35%, var(--cyan) 65%, var(--magenta) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 28px rgba(255, 94, 219, 0.4));
  animation: heroShimmer 6s linear infinite;
}
@keyframes heroShimmer {
  to { background-position: 200% center; }
}
.hero-sub {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2.8vw, 1.7rem);
  color: var(--ink);
  margin-top: 2rem;
  line-height: 1.7;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6), 0 0 14px rgba(0, 0, 0, 0.4);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.8rem;
}
.scroll-hint {
  position: absolute;
  bottom: 2.4rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.62rem;
  letter-spacing: 0.35em;
  color: var(--ink-faint);
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 10px); }
}

/* ───── ボタン ───── */
.btn {
  display: inline-block;
  padding: 0.9rem 2rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.06em;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  cursor: pointer;
}
.btn-ghost {
  color: var(--ink);
  border: 1px solid rgba(160, 107, 255, 0.45);
  backdrop-filter: blur(10px);
  background: rgba(160, 107, 255, 0.08);
}
.btn-ghost:hover {
  background: rgba(160, 107, 255, 0.2);
  border-color: var(--violet);
}
.btn-primary {
  color: #fff;
  background: linear-gradient(120deg, #c026d3 0%, #7c3aed 50%, #0ea5e9 100%);
  box-shadow: 0 0 30px rgba(192, 38, 211, 0.45);
  animation: glowPulse 3.5s ease-in-out infinite;
}
.btn-primary:hover {
  transform: scale(1.05);
}
.btn-xl {
  padding: 1.2rem 3.2rem;
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 2.6rem;
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 30px rgba(192, 38, 211, 0.45), 0 0 60px rgba(192, 38, 211, 0.2); }
  50% { box-shadow: 0 0 55px rgba(192, 38, 211, 0.85), 0 0 110px rgba(192, 38, 211, 0.45); }
}

/* ───── PLAY × PRAY ───── */
.pp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.6rem, 2vw, 1.6rem);
  margin: 2rem 0;
  flex-wrap: wrap;
}
.pp-word {
  font-family: var(--font-latin);
  font-weight: 900;
  font-size: clamp(3.5rem, 14vw, 11rem);
  line-height: 1;
  letter-spacing: 0.02em;
  filter: drop-shadow(0 0 40px rgba(255, 94, 219, 0.25));
}
.pp-x {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(2rem, 6vw, 5rem);
  color: var(--ink-faint);
}

/* ───── 精霊カード ───── */
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 四精霊を横一列に整列 */
  gap: 1.2rem;
  margin-top: 3.4rem;
}
@media (max-width: 920px) {
  .cards { grid-template-columns: repeat(2, 1fr); } /* 2×2 */
}
@media (max-width: 520px) {
  .cards { grid-template-columns: 1fr; } /* 縦1列 */
}
.card {
  position: relative;
  padding: 2rem 1.6rem;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
  background: rgba(10, 6, 24, 0.5);
  backdrop-filter: blur(12px);
  overflow: hidden;
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, var(--g) 0%, transparent 65%);
  opacity: 0;
  transition: opacity 0.45s ease;
  z-index: -1;
}
.card:hover {
  transform: translateY(-8px);
  border-color: var(--c);
  box-shadow: 0 18px 50px -12px var(--g);
}
.card:hover::before {
  opacity: 1;
}
.card-en {
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  font-weight: 700;
  color: var(--c);
}
.card h3 {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 700;
  margin: 0.3rem 0 0.9rem;
  color: var(--c);
}
.card p {
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--ink-soft);
}

/* ───── YouTube ───── */
.video {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin-top: 2.6rem;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(160, 107, 255, 0.3);
  box-shadow: 0 0 60px rgba(124, 58, 237, 0.25), 0 0 120px rgba(124, 58, 237, 0.1);
}
.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ───── 合言葉 ───── */
.passcode {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  margin: 3.2rem auto 0;
  max-width: 420px;
  padding: 2.2rem;
  border-radius: 20px;
  border: 1px solid rgba(160, 107, 255, 0.3);
  background: rgba(88, 28, 135, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: borderPulse 3.6s ease-in-out infinite;
  transition: transform 0.3s ease, background 0.3s ease;
}
.passcode:hover {
  transform: translateY(-4px) scale(1.02);
  background: rgba(120, 40, 175, 0.32);
}
@keyframes borderPulse {
  0%, 100% { border-color: rgba(160, 107, 255, 0.3); box-shadow: 0 0 24px rgba(160, 107, 255, 0.1); }
  50% { border-color: rgba(255, 94, 219, 0.7); box-shadow: 0 0 55px rgba(255, 94, 219, 0.3); }
}
.passcode-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.4em;
  color: var(--ink-faint);
  margin-bottom: 1rem;
}
.passcode-text {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 4vw, 1.7rem);
  font-weight: 700;
  line-height: 1.6;
  color: #fff;
}
.passcode-note {
  display: block;
  margin-top: 1.1rem;
  font-size: 0.84rem;
  color: var(--ink-soft);
}
.foot {
  margin-top: 5rem;
  font-size: 0.72rem;
  color: var(--ink-faint);
}

/* ───── スクロールリビール ───── */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* ───── レスポンシブ ───── */
@media (max-width: 640px) {
  .hero-actions {
    width: 100%;
  }
  .btn {
    flex: 1;
    text-align: center;
  }
  .scroll-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #grain, .btn-primary, .passcode, .scroll-hint {
    animation: none;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
