/* ============================================================
   深海ことづて局 公式サイト スタイルシート
   全体の構成:
   1. リセット & 基本設定
   2. カラーパレット(CSS変数で一括管理)
   3. ローディング画面
   4. 背景演出(深海グラデーション・粒子)
   5. 共通パーツ(見出し・カード・ボタンなど)
   6. 各セクション個別のスタイル
   7. スクロールアニメーション
   8. レスポンシブ対応
   ============================================================ */

/* ---------- 1. リセット & 基本設定 ---------- */
/* box-sizing を border-box にすることで、padding や border を含めたサイズ計算がしやすくなる */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* スクロールで別セクションへジャンプする際、ふわっと滑らかに移動させる */
  scroll-behavior: smooth;
}

body {
  /* 指定フォント「DotGothic16」を最優先で使用し、読み込めない場合はOSの標準フォントへ */
  font-family: "DotGothic16", "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--color-foam);
  line-height: 1.9;
  letter-spacing: 0.03em;
  overflow-x: hidden; /* 横方向の演出がはみ出してもスクロールバーが出ないようにする */
  background: var(--color-deep); /* JSが読み込まれるまでの初期背景色 */
}

/* ---------- 2. カラーパレット ---------- */
/* :root に定義した変数は、どのCSSからでも var(--変数名) で呼び出せる */
:root {
  /* ブリーフ指定のメインカラー群 */
  --color-deep: #26255f;      /* 深海(最も濃い) */
  --color-mid: #154f8a;       /* 中層 */
  --color-shallow: #33aacb;   /* 浅い海 */
  --color-accent: #21fdfd;    /* アクセント(光・強調) */

  /* 補助色。絵本のような柔らかさを出すための泡色とサンゴ色 */
  --color-foam: #eaf6fb;      /* 泡・テキスト用の明るいオフホワイト */
  --color-coral: #ffb199;     /* あたたかみを添える差し色(ボタンなど最小限に使用) */

  /* 現在の「深さ」に応じてJSが書き換える背景色変数。初期値は浅い海 */
  --bg-current: var(--color-shallow);

  /* 角丸・影・余白のトーンをここで統一管理 */
  --radius-md: 20px;
  --radius-lg: 32px;
  --shadow-soft: 0 12px 40px rgba(8, 20, 40, 0.25);
  --section-padding: clamp(72px, 12vw, 160px);
}

/* ---------- 3. ローディング画面 ---------- */
#loading-screen {
  position: fixed;
  inset: 0; /* top/right/bottom/left をすべて0にする省略記法 */
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--color-shallow) 0%, var(--color-mid) 100%);
  transition: opacity 0.9s ease, visibility 0.9s ease;
  overflow: hidden;
}

/* JSが .is-hidden を付与すると、フェードアウトして操作不能になる */
#loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: var(--color-foam);
}

.loading-logo {
  font-size: clamp(28px, 6vw, 44px);
  letter-spacing: 0.15em;
  /* 上下にふわふわ浮遊させるアニメーション(3秒かけて往復) */
  animation: float-logo 3s ease-in-out infinite;
  text-shadow: 0 0 18px rgba(33, 253, 253, 0.5);
}

@keyframes float-logo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

.loading-text {
  margin-top: 18px;
  font-size: 14px;
  letter-spacing: 0.2em;
  opacity: 0.85;
}

/* 泡を流す入れ物。中の泡要素(.bubble)はJSが動的に追加する */
.loading-bubbles {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.loading-bubbles .bubble {
  position: absolute;
  bottom: -40px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.85), rgba(255,255,255,0.1));
  animation-name: bubble-rise;
  animation-timing-function: ease-in;
  animation-iteration-count: 1;
}

@keyframes bubble-rise {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 0.9; }
  100% { transform: translateY(-110vh) translateX(var(--drift, 20px)); opacity: 0; }
}

/* 下部の波。ゆっくり左右に揺れるだけのシンプルな演出 */
.loading-wave {
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 200%; /* 横に長くしてスライドさせても切れ目が見えないようにする */
  height: 120px;
  animation: wave-shift 6s ease-in-out infinite;
}

@keyframes wave-shift {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-4%); }
}

/* ---------- 4. 背景演出(深海グラデーション・粒子) ---------- */
#ocean-background {
  position: fixed;
  inset: 0;
  z-index: -2; /* 常にコンテンツの一番後ろに置く */
  /* var(--bg-current) をJSがスクロール量に応じて連続的に書き換えることで、
     「浅い海→中層→深海」の変化をなめらかに表現する */
  background: linear-gradient(180deg, var(--bg-current) 0%, var(--color-deep) 140%);
  transition: background 0.4s linear;
}

#particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* 泡・クラゲ・魚などを漂わせるレイヤー。中身の要素はJSが生成する */
.drifters {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.drifters .drift-item {
  position: absolute;
  opacity: 0.55;
  will-change: transform;
}

/* ---------- 5. 共通パーツ ---------- */
.section {
  position: relative;
  padding: var(--section-padding) 24px;
  z-index: 1;
}

.section-inner {
  max-width: 1040px;
  margin: 0 auto;
}

.eyebrow {
  display: inline-block;
  font-size: 13px;
  letter-spacing: 0.35em;
  color: var(--color-accent);
  margin-bottom: 14px;
}

.section-title {
  font-size: clamp(26px, 4.4vw, 40px);
  letter-spacing: 0.08em;
  margin-bottom: 36px;
  color: var(--color-foam);
}

.section-subtitle {
  font-size: clamp(18px, 2.6vw, 22px);
  margin: 48px 0 24px;
  color: var(--color-foam);
}

.body-text {
  font-size: 16px;
  max-width: 640px;
  color: var(--color-foam);
  opacity: 0.92;
  margin-bottom: 20px;
}

/* ガラス風・半透明のカードUI。ぼかし(backdrop-filter)で奥行きを出す */
.glass-card,
.nav-card,
.step-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.glass-card {
  padding: 24px;
}

.card-label {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--color-accent);
  margin-bottom: 10px;
}

.card-value {
  font-size: 16px;
  color: var(--color-foam);
}

/* ---------- 6. 各セクション個別のスタイル ---------- */

/* --- ヒーロー --- */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  padding: clamp(24px, 5vw, 72px);
  overflow: hidden;
}

.hero-art {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-art::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(10, 25, 58, 0.62), rgba(10, 25, 58, 0.18) 68%, rgba(10, 25, 58, 0.04)),
    linear-gradient(0deg, rgba(10, 25, 58, 0.32), transparent 48%);
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero-logo {
  width: min(320px, 70vw);
  /* 初期状態は画面外(左)に隠しておき、JSがクラスを付けたら中央へスライドさせる */
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}

.hero-logo-image {
  display: block;
  width: 100%;
  height: auto;
}

.hero-logo.is-in {
  opacity: 1;
  transform: translateX(0);
}

.hero-copy {
  margin-top: 20px;
  font-size: clamp(14px, 2vw, 18px);
  letter-spacing: 0.12em;
  color: var(--color-foam);
  opacity: 0;
  transition: opacity 1.4s ease 0.6s; /* ロゴの後、少し遅れてフェードイン */
}

.hero-copy.is-in {
  opacity: 0.9;
}

.scroll-cue {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--color-foam);
  opacity: 0.8;
}

.scroll-mouse {
  width: 22px;
  height: 36px;
  border: 2px solid var(--color-foam);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.scroll-dot {
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: var(--color-accent);
  animation: scroll-dot-move 1.6s ease-in-out infinite;
}

@keyframes scroll-dot-move {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

.scroll-word {
  font-size: 11px;
  letter-spacing: 0.3em;
}

/* --- 導線カード --- */
.nav-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.nav-card {
  padding: 28px 20px;
  text-align: center;
  text-decoration: none;
  color: var(--color-foam);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: transform 0.4s ease, background 0.4s ease;
}

.nav-card:hover,
.nav-card:focus-visible {
  transform: translateY(-6px);
  background: rgba(255, 255, 255, 0.14);
}

.nav-card-icon {
  font-size: 26px;
}

.nav-card-title {
  font-size: 15px;
  letter-spacing: 0.1em;
}

.nav-card-desc {
  font-size: 12px;
  opacity: 0.75;
}

/* --- キャラクターカルーセル --- */
.carousel {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
}

.carousel-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 460px;
  min-width: 0;
  border-radius: var(--radius-lg);
  overflow: clip;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.carousel-slide {
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  align-items: center;
  gap: clamp(20px, 3vw, 32px);
  min-width: 0;
  padding: 40px 40px 68px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(24px);
  transition: opacity 0.6s ease, transform 0.6s ease, visibility 0.6s;
  pointer-events: none;
}

/* JSが is-active クラスを付けたスライドだけを表示する */
.carousel-slide.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
  /* data-color属性の色をJS側で薄く適用し、キャラごとに背景トーンを変える */
}

.slide-portrait {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
}

.slide-portrait-image {
  display: block;
  width: 100%;
  height: clamp(240px, 30vw, 360px);
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(var(--shadow-soft));
}

.slide-name {
  font-size: 26px;
  letter-spacing: 0.08em;
  color: var(--color-foam);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}

.slide-name-sub {
  font-size: 12px;
  opacity: 0.7;
  letter-spacing: 0.1em;
}

.slide-meta {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.slide-meta div {
  display: flex;
  gap: 10px;
  font-size: 13px;
  min-width: 0;
}

.slide-meta dt {
  flex: 0 0 48px;
  opacity: 0.6;
}

.slide-meta dd,
.slide-profile {
  min-width: 0;
  overflow-wrap: anywhere;
}

.slide-text {
  font-size: 14px;
  line-height: 1.9;
  opacity: 0.9;
  overflow-wrap: anywhere;
}

.carousel-arrow {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-foam);
  font-size: 22px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease;
}

.carousel-arrow:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
}

.carousel-dots {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}

.carousel-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease;
}

.carousel-dots .dot.is-active {
  background: var(--color-accent);
  transform: scale(1.3);
}

/* --- ゲームシステム --- */
.system-purpose {
  font-weight: bold;
  border-left: 3px solid var(--color-accent);
  padding-left: 16px;
}

.step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 12px;
}

.step-card {
  padding: 24px;
  text-align: center;
}

.step-shot {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(51, 170, 203, 0.35), rgba(21, 79, 138, 0.5));
  overflow: hidden;
  margin-bottom: 16px;
}

.step-shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.step-num {
  font-size: 12px;
  color: var(--color-accent);
  letter-spacing: 0.2em;
  margin-bottom: 6px;
}

.step-title {
  font-size: 16px;
  margin-bottom: 8px;
}

.step-desc {
  font-size: 13px;
  opacity: 0.8;
  line-height: 1.7;
}

.hint-text {
  max-width: 760px;
}

/* --- ギャラリー --- */
.gallery-viewer {
  display: grid;
  gap: 20px;
}

.gallery-feature {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-soft);
}

.gallery-feature-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-feature-caption {
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 48px 24px 20px;
  color: var(--color-foam);
  font-size: 16px;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.68));
  pointer-events: none;
}

.gallery-arrow {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  color: var(--color-foam);
  background: rgba(8, 20, 40, 0.48);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background 0.2s ease, transform 0.2s ease;
}

.gallery-arrow svg {
  display: block;
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.gallery-arrow:hover,
.gallery-arrow:focus-visible {
  background: rgba(8, 20, 40, 0.78);
  transform: translateY(-50%) scale(1.06);
}

.gallery-arrow--prev {
  left: 20px;
}

.gallery-arrow--next {
  right: 20px;
}

.gallery-thumbnails {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.gallery-thumb {
  min-width: 0;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  color: var(--color-foam);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-soft);
  text-align: left;
  cursor: pointer;
  opacity: 0.72;
  transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.gallery-thumb:hover,
.gallery-thumb:focus-visible {
  opacity: 1;
  transform: translateY(-3px);
}

.gallery-thumb.is-active {
  opacity: 1;
  border-color: var(--color-accent);
}

.gallery-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb span {
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 24px 10px 8px;
  font-size: 12px;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
  pointer-events: none;
}

.gallery-thumb:focus-visible,
.gallery-arrow:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

@media (max-width: 760px) {
  .gallery-thumbnails {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .gallery-feature-caption {
    padding: 40px 16px 14px;
    font-size: 14px;
  }

  .gallery-arrow {
    width: 40px;
    height: 40px;
  }

  .gallery-arrow svg {
    width: 24px;
    height: 24px;
  }

  .gallery-arrow--prev {
    left: 12px;
  }

  .gallery-arrow--next {
    right: 12px;
  }
}

/* --- ダウンロード --- */
.download-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
}

.download-btn {
  display: inline-block;
  padding: 16px 30px;
  border-radius: 999px;
  background: var(--color-coral);
  color: var(--color-deep);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-decoration: none;
  font-weight: bold;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.download-btn:hover,
.download-btn:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(255, 177, 153, 0.4);
}

/* --- フッター --- */
.footer {
  text-align: center;
  padding: 60px 24px 40px;
  color: var(--color-foam);
  opacity: 0.7;
  font-size: 12px;
}

.footer-logo {
  font-size: 18px;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

/* ---------- 7. スクロールアニメーション(ふわっと下から浮き上がる) ---------- */
/* .reveal を持つ要素は、初期状態を少し透明&下にずらしておく */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

/* JSがIntersectionObserverで画面に入ったことを検知すると .is-visible を付与する */
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- 8. レスポンシブ対応 ---------- */
@media (max-width: 760px) {
  .carousel-slide {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 16px;
    padding: 24px 24px 64px;
  }

  .slide-portrait {
    margin-bottom: 0;
  }

  .slide-portrait-image {
    height: clamp(180px, 30vh, 260px);
  }

  .slide-profile {
    width: 100%;
  }

  .slide-name {
    font-size: 22px;
    margin-bottom: 12px;
  }

  .slide-meta div {
    text-align: left;
  }

  .slide-text {
    font-size: 13px;
  }

  .carousel-stage {
    min-height: 0;
  }

  .carousel-arrow {
    position: absolute;
    top: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    transform: translateY(-50%);
  }

  .carousel {
    display: block;
    padding: 0 16px;
  }

  .carousel-arrow--prev {
    left: 0;
  }

  .carousel-arrow--next {
    right: 0;
  }

  .carousel-arrow:hover {
    transform: translateY(-50%) scale(1.08);
  }

  .card-grid,
  .nav-card-grid,
  .step-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .card-grid,
  .nav-card-grid,
  .step-grid {
    grid-template-columns: 1fr;
  }
}

/* ユーザーが「視差効果を減らす」設定をしている場合は、演出を最小限にする(アクセシビリティ配慮) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
