/* ====== 基本設定 ====== */
body {
  margin: 0;
  background-color: #000;
  color: #e0e0e0;
  font-family: 'Segoe UI', sans-serif;
  overflow-x: hidden;
}

/* フォント自動拡大の抑制（iOS/Safariの文字ズレ対策） */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* 起動画面 */
.intro-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #000;
  z-index: 10;
  animation: fadeOut 1s ease forwards;
  animation-delay: 3.5s; 
}

.intro-text {
  text-align: center;
}

/* グリッチ効果 */
.glitch {
  position: relative;
  color: #fff;
  font-size: 4em;
  animation: glitchMove 1.5s infinite linear alternate;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  width: 100%;
  overflow: hidden;
}

.glitch::before {
  left: 2px;
  color: #0ff;
  text-shadow: -2px 0 red;
  clip: rect(0, 900px, 0, 0);
  animation: glitchTop 1s infinite linear alternate-reverse;
}

.glitch::after {
  left: -2px;
  color: #f0f;
  text-shadow: -2px 0 blue;
  clip: rect(0, 900px, 0, 0);
  animation: glitchBottom 1.2s infinite linear alternate-reverse;
}

/* uncannily-funny */
.subtitle-english {
  color: #999;
  font-size: 1.4em;
  letter-spacing: 0.15em;
  margin-top: 1.2em;
  opacity: 0;
  animation: fadeInSubtitle 2s ease forwards;
  animation-delay: 1s;
}

/* 全画像の暴走対策 */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* 展示写真の統一サイズ */
.photo-gallery img,
/* ====== 展示写真・作品イラスト共通サイズ ====== */
.photos img,
.top-photos img,
.item img {
  width: 250px;       /* 作品展示イラスト・展示写真の幅を統一 */
  height: 250px;      /* 高さも固定 */
  object-fit: cover;  /* 枠いっぱいに表示 */
  border-radius: 12px;
  border: 2px solid #fff;
  box-shadow: 0 0 15px rgba(255,255,255,0.2);
  margin: 0.5rem;
}

/* ====== 写真・作品イラストを横並びに ====== */
.photos,
.top-photos,
/* 作品展示のコンテナ（flex のまま） */
.work {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: stretch; /* 高さを揃える */
  padding: 2rem;
}

/* 各アイテム */
.item {
  display: flex;
  flex-direction: column;
  align-items: center;  /* 中央揃え */
  text-align: center;   /* テキスト中央揃え */
  width: 250px;         /* 画像サイズに固定 */
  flex: 1 1 250px;      /* 最小250px、必要に応じて拡張 */
  box-sizing: border-box;
}

/* 画像 */
.item img,
.item video.exhibit-video {
  width: 250px;
  height: 250px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid #fff;
  box-shadow: 0 0 15px rgba(255,255,255,0.2);
  margin-bottom: 0.5rem;
}

/* 音声プレイヤー */
.item audio {
  width: 250px;
  margin-top: 0.5rem;
}

/* スマホ用 */
@media (max-width: 600px) {
  .work {
    flex-direction: column;
    align-items: center;
  }
  .item {
    width: 250px;
  }
}


/* ====== スマホ用 ====== */
@media (max-width: 600px) {
  .photos img,
  .top-photos img,
  .item img,
  .photos video.exhibit-video,
  .photos audio {
    width: 250px;      /* 幅固定 */
    height: 250px;     /* 高さ固定 */
  }

  .glitch {
    font-size: 2.6em;
    line-height: 1.1;
    transform-origin: left;
    display: block;
    text-align: left;
  }
  .photo-section p {
    text-align: center;
  }
}

/* ====== アニメーション ====== */
@keyframes glitchMove {
  0% { transform: none; }
  20% { transform: skew(1deg, 0deg) translate(2px, 0); }
  40% { transform: translate(-2px, -1px) skew(-1deg); }
  60% { transform: translate(3px, 2px); }
  80% { transform: skew(0.5deg, -0.5deg) translate(-1px, 1px); }
  100% { transform: none; }
}

@keyframes fadeInSubtitle {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  to { opacity: 0; visibility: hidden; }
}

@keyframes glitchTop {
  0% { clip: rect(0, 9999px, 0, 0); }
  10% { clip: rect(10px, 9999px, 50px, 0); }
  20% { clip: rect(85px, 9999px, 140px, 0); }
  40% { clip: rect(10px, 9999px, 80px, 0); }
  60% { clip: rect(50px, 9999px, 90px, 0); }
  80% { clip: rect(120px, 9999px, 170px, 0); }
  100% { clip: rect(0, 9999px, 0, 0); }
}

@keyframes glitchBottom {
  0% { clip: rect(0, 9999px, 0, 0); }
  15% { clip: rect(60px, 9999px, 100px, 0); }
  35% { clip: rect(100px, 9999px, 150px, 0); }
  55% { clip: rect(10px, 9999px, 60px, 0); }
  75% { clip: rect(90px, 9999px, 120px, 0); }
  100% { clip: rect(0, 9999px, 0, 0); }
}

/* ====== ナビゲーション ====== */
.nav {
  position: relative;
  padding: 1rem 2rem;
  background: transparent;
  z-index: 5;
}

.nav .logo {
  font-size: 2rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 
    0 0 5px #0ff,
    0 0 10px #0ff,
    0 0 20px #0ff,
    0 0 40px #0ff,
    0 0 80px #0ff;
}

.nav .back-btn {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.8rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid #fff;
  border-radius: 5px;
  background-color: rgba(0,0,0,0.4);
  transition: 0.3s;
}

.nav .back-btn:hover {
  background-color: rgba(0,255,255,0.2);
  color: #0ff;
  box-shadow: 0 0 10px #0ff;
}

.nav-title {
  font-size: 1.2rem;
}

/* ====== メインコンテンツ ====== */
.hidden { opacity: 0; transition: opacity 1.5s ease; }
.show { opacity: 1; }

/* ====== 四角いボックス共通 ====== */
.intro-box,
.exhibition-purpose,
.ending-question {
  max-width: 700px;
  margin: 2rem auto;
  padding: 1.5rem 2rem;
  box-sizing: border-box;
  background-color: rgba(0,0,0,0.6);
  border-radius: 12px;
  border: 2px solid #fff;
  text-align: center;
}

.intro-box h2 {
  margin-top: 0;
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.intro-box p,
.exhibition-purpose p,
.ending-question p {
  font-size: 1.1rem;
  line-height: 1.6;
}

/* ====== ギャラリー ====== */
.gallery {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: 2rem;
  align-items: stretch;
}

.work h2 {
  text-align: center !important;
}

/* ====== 展示写真タイトル ====== */
.photo-gallery h2 {
  text-align: center;
  font-size: 2rem;
  margin: 3rem 0 2rem;
}

/* ====== 各項目のタイトル ====== */
.photo-section h3 {
  font-size: 1.5rem;
  margin: 1rem 0;
  text-align: center;
}

/* ====== 写真の並び ====== */
.photos,
.top-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}

/* ====== 写真スタイル ====== */
.photo img,
.photos img,
.top-photos img {
  width: 300px;
  max-width: 90%;
  height: 250px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid #fff;
  box-shadow: 0 0 15px rgba(255,255,255,0.2);
}

/* ====== 動画・音声プレイヤーのスタイル ====== */
.photos video.exhibit-video {
  width: 300px;
  height: 250px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 0 15px rgba(255,255,255,0.2);
}

.photos audio {
  width: 300px;
  margin: 0;
  display: block;
}

/* ====== 背景の目 ====== */
.eyes-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  overflow: hidden;
  z-index: -1;
}

.eye {
  position: absolute;
  width: 80px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #fff 10%, #222 30%, #000 80%);
  top: 40%;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
  transform: translateX(-50%) scaleY(1);
  left: 50%;
  animation: blink 3s infinite ease-in-out;
}

.eye:first-child { --shift: calc(-50% - 40px); }
.eye:last-child  { --shift: calc(-50% + 40px); }

@keyframes blink {
  0%, 90%, 100% { transform: translateX(var(--shift)) scaleY(1); }
  95% { transform: translateX(var(--shift)) scaleY(0.1); }
}

/* ====== スマホ対応 ====== */
@media (max-width: 600px) {

  /* 起動画面・タイトル調整 */
  .intro-box,
  .exhibition-purpose,
  .ending-question {
    width: 90%;
    max-width: none;
    padding: 1rem;
  }
  .intro-text {
    width: 100%;
    padding: 0 16px;
    text-align: center;
  }
  .glitch {
    font-size: 2.6em;
    line-height: 1.1;
    transform-origin: center;
    display: inline-block;
  }
  .glitch::before { left: 1px; text-shadow: -1px 0 red; }
  .glitch::after  { left: -1px; text-shadow: -1px 0 blue; }
  .subtitle-english {
    font-size: 1.05em;
    letter-spacing: 0.06em;
  }
  .nav .logo {
    font-size: 1.6rem;
    text-align: center;
    display: block;
  }
  .nav { padding-left: 1rem; padding-right: 1rem; }

  /* ギャラリー・写真の幅を作品展示イラストに揃える */
  .photos img,
  .top-photos img {
    width: 250px;
    max-width: 90%;
    height: 250px;
    object-fit: cover;
  }

  .photos video.exhibit-video {
    width: 250px;
    height: 250px;
  }

  .photos audio {
    width: 250px;
  }

  /* 写真タイトル */
  .photo-gallery h2 { font-size: 1.7rem; }
  .photo-section h3 { font-size: 1.3rem; }

  /* アイテムサイズ調整 */
  .item { width: 90%; max-width: none; margin-bottom: 1.5rem; }

  /* 背景の目 */
  .eye { width: 60px; height: 30px; }
  .eye:first-child { --shift: calc(-50% - 25px); }
  .eye:last-child  { --shift: calc(-50% + 25px); }
}

/* ====== 展示作品の説明文を中央揃え ====== */
.photo-section p {
  text-align: center;
}

/* === 展示詳細（不気味の谷ページ用追加スタイル） === */
.photo-gallery { max-width: 900px; margin: 0 auto 3rem; padding: 2rem 2rem; box-sizing: border-box; }
.photo-gallery > h2 { text-align: center; margin-top: 0; }
.photo-section { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.12); border-radius: 14px; padding: 1.4rem 1.6rem; margin: 1.8rem auto; max-width: 800px; box-sizing: border-box; }
.photo-section h3 { text-align: center; margin-top: 0; }
.photo-section p { text-align: center; line-height: 1.55; }
.photos { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; align-items: flex-start; margin-top: 1rem; }
.photos img, .photos video { width: 100%; max-width: 340px; flex: 1 1 140px; height: auto; border-radius: 12px; display: block; box-shadow: 0 4px 14px rgba(0,0,0,0.35); object-fit: cover; }
.exhibit-video, .exhibit-audio { width: 100%; max-width: 360px; }

/* 主要ボックスを中央に収め余白確保 */
.intro-box, .exhibition-purpose, .ending-question { max-width: 800px; margin-left: auto; margin-right: auto; }

@media (max-width: 640px) {
  body { padding: 0; }
  .photo-gallery { padding: 1.6rem 1.1rem; }
  .photo-section { padding: 1.1rem 1.1rem; margin: 1.2rem auto; }
  .photos { gap: 0.75rem; }
  .photos img, .photos video { max-width: 100%; flex: 1 1 100%; }
  .intro-box, .exhibition-purpose, .ending-question { padding: 1.1rem 1rem; }
}

/* === 余白拡張（More breathing space） === */
/* デスクトップ基準で少し内部余白を増やす */
.photo-gallery { padding: 2.6rem 2.8rem !important; }
.photo-section { padding: 2rem 2.2rem !important; }
.intro-box, .exhibition-purpose, .ending-question { padding: 2rem 2.2rem !important; }
.work { max-width: 1200px; margin-left: auto; margin-right: auto; padding: 2.2rem 2.4rem !important; }

/* モバイルで左右の圧迫をさらに緩和 */
@media (max-width: 640px) {
  body { padding: 0 12px !important; }
  .photo-gallery { padding: 2.1rem 1.7rem !important; }
  .photo-section { padding: 1.6rem 1.5rem !important; margin: 1.4rem auto !important; }
  .photos { gap: 0.95rem !important; }
  .intro-box, .exhibition-purpose, .ending-question { padding: 1.5rem 1.35rem !important; }
  .item { padding: 0.4rem 0.2rem !important; }
}
