/* ===================================
   cautas.HP - Main Stylesheet
   style.css
   =================================== */

/* ===================== リセット ===================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===================== ベース ===================== */
body {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', sans-serif;
  background: #030308;
  min-height: 100vh;
  overflow-x: hidden;
  color: #fff;
}

/* ===================== スクロールコンテナ ===================== */
.scroll-container {
  position: relative;
  z-index: 10;
  height: 600vh;
}

.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* ===================== 背景写真スライドショー ===================== */
.photo-slideshow {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  overflow: hidden;
  will-change: filter;
}

.sliding-photo {
  position: absolute;
  object-fit: cover;
  will-change: transform, opacity, filter;
  border-radius: 6px;
}

/* ===================== 飛び出しアイコン ===================== */
#fly-container {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 25;
  overflow: hidden;
}

/* ===================== Three.js canvas ===================== */
#three-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 60;          /* scene-notebook(50)より上 → GLBが絵本の前面に出る */
  pointer-events: none;
}

/* ===================== 絵本シーン（GIF） ===================== */
#scene-notebook {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;          /* 確実に最前面に */
  pointer-events: none;
  opacity: 0;
}

/* ===== 絵本位置調整（ここで上下を変更） =====
   BOOK_OFFSET_Y: 正の値→下へ、負の値→上へ（例: -10vh で上に10%移動）
   ============================================== */
:root {
  --phone-size: min(640px, 82vh);  /* スマホサイズ（viewport非超過） */
  --book-offset-y: 0vh;   /* ← ここを変更して上下位置を調整 */
}

#book-gif-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  transform: translateY(var(--book-offset-y));
}

#book-gif {
  width: 100%;
  height: 100%;
  object-fit: cover;    /* 画面比率100%ぴったり（余白なし） */
  mix-blend-mode: normal;
  filter: none;
  image-rendering: -webkit-optimize-contrast;
  display: block;
}

/* ===================== スマホシーン ===================== */
#scene-phone {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  display: flex;
  align-items: flex-end;        /* 画面下揃え */
  padding-bottom: 18px;         /* 画面ギリギリより少し余白 */
  z-index: 30;
  pointer-events: none;
  transform: translateX(-150vw);
}

/* かうたす 1文字ずつ */
#cautas-letters {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  margin-right: 6px;
  margin-bottom: 0;             /* 底辺同列 */
  position: relative;
  z-index: 1;
  align-self: flex-end;         /* 画面下揃えに追従 */
}

.kautas-char {
  font-size: 2.6rem;
  font-weight: 900;
  color: #fff;
  font-family: 'Noto Sans JP', sans-serif;
  text-shadow:
    0 0 12px rgba(255,100,220,1.0),
    0 0 30px rgba(255,100,220,0.6),
    0 0 60px rgba(100,220,255,0.4),
    0 2px 0 rgba(0,0,0,0.5);
  display: inline-block;
  letter-spacing: 0.08em;
}

/* キャラクター（rabbitl / rabbitr 切り替え） */
#phone-character {
  position: relative;
  width: 280px;                 /* サイズ拡大 200→280 */
  height: 280px;
  flex-shrink: 0;
  z-index: 4;
  align-self: flex-end;         /* 底辺をスマホ・かうたすと揃える */
  margin-bottom: 0;             /* 底辺同列 */
  margin-right: -195px;         /* スマホに重なるくらいまで右寄せ */
}

#rabbit-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.5));
  transform-origin: center bottom;
}

/* スマホ（smartphone.png ベース・1024×1024正方形） */
#big-phone {
  position: relative;
  width: var(--phone-size);
  height: var(--phone-size);
  flex-shrink: 0;
  z-index: 2;
}

#big-phone .phone-img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  filter: drop-shadow(-12px 24px 50px rgba(0,0,0,0.7)) drop-shadow(0 0 20px rgba(120,80,255,0.15));
}

/* 画面オーバーレイ（ピクセル解析値）
   画像1024x1024 → 500x500表示時:
   画面X: 262/1024=25.6% ～ 750/1024=73.2%
   画面Y: 52/1024=5.1%  ～ 975/1024=95.2%  */
.phone-screen {
  position: absolute;
  left: 25.6%;
  top: 8.5%;
  width: 47.5%;
  height: 86.5%;
  background: linear-gradient(160deg, #0d1220 0%, #130e30 40%, #0a0d1e 100%);
  border-radius: 3%;
  overflow: hidden;
  z-index: 3;
  box-shadow: inset 0 0 30px rgba(180,100,255,0.08);
}

.phone-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 10px 4px;
  font-size: 0.4rem;
  color: rgba(255,255,255,0.55);
}

.phone-app-name {
  text-align: center;
  padding: 2px 0 6px;
  font-size: 0.68rem;
  font-weight: 900;
  color: #ff64dc;
  letter-spacing: 0.4em;
  text-shadow: 0 0 10px rgba(255,100,220,0.8), 0 0 20px rgba(255,100,220,0.4);
}

#phone-icons-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 6px 10px;
}

.phone-icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  opacity: 0;
  transform: scale(0);
}

.phone-icon-emoji { font-size: 1.5rem; }
.phone-icon-label {
  font-size: 0.38rem;
  color: rgba(255,255,255,0.75);
  text-align: center;
}

/* ===================== 最終キャッチフレーズ ===================== */
#final-catchphrase {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 15;
  opacity: 0;
  pointer-events: none;
}

#final-catchphrase h1 {
  font-size: 2.8rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 30px rgba(255,100,220,0.5), 0 0 80px rgba(100,180,255,0.3);
  text-align: center;
  line-height: 1.7;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 50px rgba(255,100,220,0.5),
    0 0 100px rgba(100,200,255,0.3);
}

#final-catchphrase p {
  margin-top: 24px;
  font-size: 1rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.35em;
}

/* ===================== レスポンシブ ===================== */
@media (max-width: 768px) {
  .scroll-container { height: 600vh; }

  /* book-gif-wrap はルートCSSで100vw/100vh固定 */

  #big-phone { width: 400px; height: 400px; }

  #phone-character {
    width: 160px;
    height: 160px;
    margin-bottom: 0;
    margin-right: -70px;
  }

  .kautas-char { font-size: 1.6rem; }

  #final-catchphrase h1 {
    font-size: 2rem;
    padding: 0 20px;
  }
}

@media (max-width: 480px) {
  /* book-gif-wrap はルートCSSで100vw/100vh固定 */

  #big-phone { width: 300px; height: 300px; }

  #phone-character {
    width: 130px;
    height: 130px;
    margin-bottom: 0;
    margin-right: -50px;
  }

  .kautas-char { font-size: 1.3rem; }

  #final-catchphrase h1 { font-size: 1.6rem; }
}

/* ===================== プロ演出 ===================== */
/* スキャンライン（スマホ画面の深み） */
.phone-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.04) 2px,
    rgba(0,0,0,0.04) 4px
  );
  pointer-events: none;
  z-index: 10;
}

/* スマホ画面上部の光沢 */
.phone-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 35%;
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
  pointer-events: none;
  z-index: 9;
  border-radius: 3% 3% 0 0;
}

/* 背景明るさオーバーレイ */
#bg-light-overlay {
  position: fixed;
  inset: 0;
  background: rgba(180,160,255,0);
  z-index: 0;
  pointer-events: none;
  will-change: background;
}

/* ===================== 追加磨き（既存演出には不干渉） ===================== */

/* 背景写真をカード風に：細い縁取り＋浮遊感のある影 */
.sliding-photo {
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.45);
}

/* 奥行きビネット：画面周辺をわずかに落とし視線を中央へ
   （背景写真 z1-5 の上、キャッチz15・スマホz30・絵本z50 の下） */
#depth-vignette {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
    transparent 52%,
    rgba(0, 0, 0, 0.42) 100%);
}

/* スクロールヒント */
#scroll-hint {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
}

.scroll-hint-mouse {
  width: 22px;
  height: 34px;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.scroll-hint-wheel {
  width: 3px;
  height: 7px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.75);
  animation: scrollWheel 1.6s ease-in-out infinite;
}

@keyframes scrollWheel {
  0%   { transform: translateY(0);   opacity: 1; }
  60%  { transform: translateY(9px); opacity: 0; }
  61%  { transform: translateY(0);   opacity: 0; }
  100% { transform: translateY(0);   opacity: 1; }
}

.scroll-hint-label {
  font-size: 0.6rem;
  letter-spacing: 0.35em;
  color: rgba(255, 255, 255, 0.5);
  font-family: 'Noto Sans JP', sans-serif;
}

/* 最終キャッチコピー：フェードに「ピントが合う」ブラーインを重ねる */
#final-catchphrase {
  filter: blur(14px);
  will-change: opacity, filter;
}

/* ダークテーマのスクロールバー */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #0a0a12; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255,100,220,0.45), rgba(100,220,255,0.45));
  border-radius: 5px;
  border: 2px solid #0a0a12;
}
html { scrollbar-color: #5a4a7a #0a0a12; scrollbar-width: thin; }

/* テキスト選択色をブランドカラーに */
::selection { background: rgba(255, 100, 220, 0.35); color: #fff; }

/* ===================== 導入セクション（Before/After 2重構造） ===================== */
#scene-intro {
  position: relative;
  z-index: 70;              /* ヒーローの固定レイヤー群を覆いながらスライドイン */
  height: 260vh;            /* スクロール尺（キャラが歩き切る長さ） */
  background: #0b0a14;
}

.intro-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

/* --- 奥レイヤー：忙しい現実 --- */
.intro-bg {
  position: absolute;
  inset: 0;
  background: #050508;
}

/* 仮素材：写真のケンバーンズ（ゆっくりズーム＋クロスフェード）で動画の代替 */
.intro-photo {
  position: absolute;
  inset: -6%;
  background-size: cover;
  background-position: center;
  filter: grayscale(0.85) brightness(0.4) blur(1.5px);
  opacity: 0;
  animation: introKenburns 24s linear infinite;
  will-change: opacity, transform;
}
.intro-photo:nth-child(2) { animation-delay: -12s; }

@keyframes introKenburns {
  0%   { opacity: 0; transform: scale(1); }
  10%  { opacity: 1; }
  50%  { opacity: 1; transform: scale(1.07); }
  60%  { opacity: 0; }
  100% { opacity: 0; transform: scale(1.1); }
}

/* 本番動画用（素材が来たら <video> を有効化するだけで同じ見た目になる） */
.intro-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.85) brightness(0.45);
}

/* 奥レイヤーを締めるビネット */
.intro-bg-tint {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center,
    transparent 40%,
    rgba(0, 0, 0, 0.55) 100%);
}

/* --- 手前レイヤー：温かい世界を歩くキャラ --- */
.intro-fg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#intro-walker {
  position: absolute;
  bottom: 5vh;
  left: 0;
  width: clamp(200px, 26vw, 380px);
  will-change: transform;
}

/* キャラの周りだけ温かい光（Before世界との対比） */
#intro-walker::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 52%;
  width: 170%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    rgba(255, 195, 130, 0.30) 0%,
    rgba(255, 150, 185, 0.14) 42%,
    transparent 70%);
  filter: blur(8px);
}

#walker-img {
  position: relative;
  width: 100%;
  display: block;
  filter: drop-shadow(0 18px 32px rgba(0, 0, 0, 0.55));
}

/* --- コピー --- */
.intro-copy {
  position: absolute;
  top: 16%;
  width: 100%;
  text-align: center;
  opacity: 0;
  will-change: opacity, transform, filter;
}

.intro-copy-before {
  font-size: clamp(0.85rem, 1.6vw, 1.05rem);
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.22em;
  margin-bottom: 16px;
}

.intro-copy-after {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: clamp(1.5rem, 3.6vw, 2.6rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.08em;
  line-height: 1.7;
  text-shadow:
    0 0 40px rgba(255, 175, 120, 0.4),
    0 0 90px rgba(255, 120, 200, 0.25);
}

@media (max-width: 768px) {
  #scene-intro { height: 220vh; }
  #intro-walker { width: clamp(150px, 38vw, 240px); bottom: 8vh; }
  .intro-copy { top: 20%; padding: 0 20px; }
}
