/*
 * ウイルス感染系サイコホラーサイト CSS
 * スマホ対応 (レスポンシブデザイン)
 */

/* --- 全体的なリセットと基本設定 --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none; /* Safari対応 */
  -ms-user-select: none; /* IE対応 */
}

:root {
  /* カラーパレット */
  --color-dark-bg: #1a1a1a; /* 非常に暗い背景 */
  --color-medium-dark: #2c2c2c; /* 中間の暗さの要素 */
  --color-text-primary: #e0e0e0; /* 主なテキスト色 (白に近いが純粋ではない) */
  --color-text-secondary: #999999; /* サブテキスト、ヒントなど */
  --color-accent-blood: #8b0000; /* 血のような赤 (アクセント) */
  --color-glitch-primary: #ff00ff; /* グリッチ用マゼンタ */
  --color-glitch-secondary: #00ffff; /* グリッチ用シアン */

  /* フォント設定 (Google Fontsなどからインポートを想定) */
  /* 例: 'Creepster', 'Special Elite', 'Roboto Mono', 'Noto Sans JP' */
  --font-heading: "Creepster", cursive; /* ホラー感を出す見出し用 */
  --font-body: "Noto Sans JP", "Roboto Mono", monospace; /* 本文・モノスペース系 */

  /* 基本サイズ */
  font-size: 16px; /* 基準フォントサイズ */
}

html,
body {
  height: 100%;
  overflow-x: hidden; /* 横スクロール禁止 */
  scroll-behavior: smooth; /* スムーズスクロール */
}

body {
  font-family: var(--font-body);
  color: var(--color-text-primary);
  background-color: var(--color-dark-bg);
  line-height: 1.6;
  position: relative; /* 背景エフェクトの基準 */
  min-height: 100vh; /* 少なくともビューポートの高さ */

  /* 背景のノイズ/テクスチャ */
  background-image: url("data:image/svg+xml;base64,PHN2ZyB2aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMjUwIDI1MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZmlsdGVyIGlkPSJhIiB4PSIwIiB5PSIwIj48ZmVBbmFsb2dOb2lzZSB0eXBlPSJmcmFjdGFsdGFuZnVuY3Rpb24iIGJhc2lceWZ0cmVxdWVuY3k9IjAuODUiIG51bW9jdGF2ZXM9IjIiIHN0aXRjaFRpbGVzPSJub2lzZXRpbGVzIi8+PC9maWx0ZXI+PHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0iI2E2YTZhNiIvPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNhKSIgb3BhY2l0eT0iMC4wNyIvPjwvc3ZnPg==");
  background-size: 250px;
  background-blend-mode: overlay; /* 背景画像をオーバーレイで重ねる */
  animation: background-flicker 15s infinite alternate; /* 背景の微細なちらつき */
}

@keyframes background-flicker {
  0% {
    background-position: 0 0;
    opacity: 1;
  }
  50% {
    background-position: 5px 5px;
    opacity: 0.98;
  }
  100% {
    background-position: 0 0;
    opacity: 1;
  }
}

/* --- コンテンツのラッパー --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  position: relative;
  z-index: 10; /* 背景エフェクトの上に表示 */
}

/* --- ヘッダー --- */
header {
  background-color: transparent;
  padding: 1.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-family: var(--font-heading);
  font-size: 2.5rem; /* PC向け */
  color: var(--color-accent-blood);
  text-shadow: 0 0 5px rgba(255, 0, 0, 0.5), 0 0 10px rgba(255, 0, 0, 0.3);
  letter-spacing: 0.1em;
  animation: text-glitch 5s infinite linear alternate;
  line-height: 1;
}

@keyframes text-glitch {
  0% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-1px, 1px);
  }
  40% {
    transform: translate(1px, -1px);
  }
  60% {
    transform: translate(-0.5px, 0.5px);
  }
  80% {
    transform: translate(0.5px, -0.5px);
  }
  100% {
    transform: translate(0, 0);
  }
}

/* ナビゲーションメニュー (スマホ時はハンバーガーメニューを想定) */
nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
}

nav ul li a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 1rem;
  position: relative;
  transition: color 0.3s ease, transform 0.3s ease;
  padding-bottom: 0.3rem; /* 下線アニメーション用 */
}

nav ul li a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background-color: var(--color-accent-blood);
  transition: width 0.3s ease;
}

nav ul li a:hover {
  color: var(--color-text-primary);
  transform: translateY(-2px);
}

nav ul li a:hover::after {
  width: 100%;
}

/* --- メインコンテンツ --- */
main {
  padding: 2rem 0;
}

section {
  margin-bottom: 4rem;
  background-color: var(--color-medium-dark);
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden; /* グリッチエフェクトがはみ出さないように */
  animation: section-fade-in 1s ease-out forwards;
}

@keyframes section-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

section h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--color-accent-blood);
  margin-bottom: 1.5rem;
  text-align: center;
  position: relative;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

section h2::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background-color: var(--color-accent-blood);
  box-shadow: 0 0 5px var(--color-accent-blood);
}

p {
  margin-bottom: 1rem;
  color: var(--color-text-primary);
  font-size: 1.05rem;
}

/* --- トレーラーセクション --- */
.trailer-section {
  background-color: var(--color-dark-bg);
  padding: 0; /* 子要素でパディング調整 */
  border: none;
  box-shadow: none;
  overflow: hidden;
  position: relative;
}

.trailer-section-frame {
  max-width: 400px;
  margin: 10px auto;
}
.trailer-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 アスペクト比 */
  height: 0;
  overflow: hidden;
  background-color: black;
  border: 2px solid var(--color-accent-blood);
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
  transition: transform 0.3s ease-out; /* ホバーエフェクト用 */
}

.trailer-wrapper:hover {
  transform: scale(1.01);
}

.trailer-wrapper iframe,
.trailer-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  filter: grayscale(80%) contrast(120%); /* 色を失わせ、コントラストを強調 */
  opacity: 0.9;
  transition: filter 0.5s ease-out, opacity 0.5s ease-out;
}

/* ホバーで色が戻る、明るくなる */
.trailer-wrapper:hover iframe,
.trailer-wrapper:hover video {
  filter: grayscale(0%) contrast(100%);
  opacity: 1;
}

.play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(139, 0, 0, 0.7);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 3rem;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s, border-color 0.3s;
  z-index: 2; /* 動画の上に表示 */
}

.play-button:hover {
  background-color: rgba(255, 0, 0, 0.9);
  border-color: var(--color-accent-blood);
  transform: translate(-50%, -50%) scale(1.1);
}

/* --- 作品紹介カード --- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* スマホ対応 */
  gap: 2rem;
  margin-top: 2rem;
}

.work-card {
  background-color: var(--color-dark-bg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.5rem;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0;
  height: 100%;
}

.work-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 10px var(--color-accent-blood);
  border-color: var(--color-accent-blood);
}

.work-card img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 1rem;
  filter: grayscale(50%) brightness(80%);
  transition: filter 0.3s ease;
}

.work-card:hover img {
  filter: grayscale(0%) brightness(100%);
}

.work-card h3 {
  font-family: var(--font-heading);
  color: var(--color-text-primary);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.work-card p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 0;
}

.worning {
  color: var(--color-accent-blood);
  font-weight: bold;
}
.link-with-icon {
  color: #444;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  text-decoration: none;
  transition: color 0.3s ease;
}
.link-with-icon:hover {
  color: var(--color-accent-blood);
}

/* --- 入力フォーム --- */

#uploadForm {
  width: 80%;
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem;
}

.form-container {
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 500px;
}
label {
  display: block;
  margin-top: 16px;
  font-weight: bold;
  color: #555;
}
input[type="text"],
input[type="url"],
textarea {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}
input[type="file"] {
  margin-top: 6px;
}
button {
  margin-top: 24px;
  width: 100%;
  padding: 12px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}
button:hover {
  background-color: #0056b3;
}
.message {
  margin-top: 20px;
  text-align: center;
  font-weight: bold;
}
.success {
  color: green;
}
.error {
  color: red;
}

/* --- フッター --- */
footer {
  background-color: var(--color-medium-dark);
  color: var(--color-text-secondary);
  text-align: center;
  padding: 1.5rem;
  margin-top: 4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
}

/* --- レスポンシブ対応 (メディアクエリ) --- */

/* 小さいデバイス (スマホ縦向き) */
@media (max-width: 768px) {
  :root {
    font-size: 14px; /* スマホではフォントを少し小さく */
  }

  .site-title {
    font-size: 2rem; /* スマホ向け */
  }

  header {
    flex-direction: column; /* スマホではタイトルとナビを縦に並べる */
    padding: 1rem;
  }

  nav ul {
    flex-direction: column; /* ナビメニューも縦に */
    gap: 0.8rem;
    margin-top: 1rem;
    width: 100%;
    text-align: center;
  }

  nav ul li a {
    font-size: 1.1rem; /* スマホでタップしやすいように少し大きく */
  }

  section {
    padding: 1.5rem;
    margin-bottom: 2.5rem;
  }

  section h2 {
    font-size: 1.8rem;
  }

  .work-grid {
    grid-template-columns: 1fr; /* 1列表示 */
    gap: 1.5rem;
  }

  .play-button {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }
}

/* 中くらいのデバイス (タブレット・PC横幅狭め) */
@media (min-width: 769px) and (max-width: 1024px) {
  .site-title {
    font-size: 2.2rem;
  }

  nav ul {
    gap: 1.5rem;
  }

  .work-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

@media (min-width: 1024px) {
  .work-card {
    max-width: 300px;
  }
}

/* グリッチエフェクトのCSS変数とアニメーション (JavaScriptで適用推奨) */
/* これはあくまでCSSのみの例であり、より高度なグリッチはJSと連携します */
.glitch-text {
  position: relative;
  display: inline-block;
  color: var(--color-text-primary);
}

.glitch-text::before,
.glitch-text::after {
  content: attr(
    data-text
  ); /* HTMLでデータ属性を指定 <span data-text="TEXT">TEXT</span> */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--color-glitch-primary);
}

.glitch-text::before {
  left: 2px;
  text-shadow: -2px 0 var(--color-glitch-secondary);
  animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch-text::after {
  left: -2px;
  text-shadow: -2px 0 var(--color-glitch-primary);
  animation: glitch-anim-2 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
  0% {
    clip-path: inset(0 0 100% 0);
    transform: translateX(0);
  }
  10% {
    clip-path: inset(30% 0 50% 0);
    transform: translateX(-3px);
  }
  20% {
    clip-path: inset(0 0 100% 0);
    transform: translateX(0);
  }
  /* ... 複数のランダムなクリップパスとトランスフォームを追加 */
  80% {
    clip-path: inset(10% 0 70% 0);
    transform: translateX(2px);
  }
  100% {
    clip-path: inset(0 0 100% 0);
    transform: translateX(0);
  }
}

@keyframes glitch-anim-2 {
  0% {
    clip-path: inset(0 0 100% 0);
    transform: translateX(0);
  }
  15% {
    clip-path: inset(10% 0 80% 0);
    transform: translateX(2px);
  }
  30% {
    clip-path: inset(0 0 100% 0);
    transform: translateX(0);
  }
  /* ... 複数のランダムなクリップパスとトランスフォームを追加 */
  85% {
    clip-path: inset(40% 0 30% 0);
    transform: translateX(-2px);
  }
  100% {
    clip-path: inset(0 0 100% 0);
    transform: translateX(0);
  }
}

/* カーソルエフェクト (JSでクラス追加推奨) */
.body-cursor-infected {
  cursor: url("path/to/infected_cursor.png") 16 16, auto; /* 感染したようなカーソル画像 */
}

/* 特定の要素が汚染されているような効果 */
.infected-element {
  filter: blur(1px) brightness(80%) saturate(50%);
  animation: pulse-infect 3s infinite ease-in-out alternate;
}

@keyframes pulse-infect {
  0% {
    filter: blur(1px) brightness(80%) saturate(50%);
    transform: scale(1);
  }
  50% {
    filter: blur(0.5px) brightness(90%) saturate(60%);
    transform: scale(1.005);
  }
  100% {
    filter: blur(1px) brightness(80%) saturate(50%);
    transform: scale(1);
  }
}

/* 背景にノイズオーバーレイを追加する例 (HTMLに別途divが必要) */
/*
<div class="noise-overlay"></div>
*/
.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* クリックイベントを妨げない */
  z-index: 100; /* 最前面に */
  opacity: 0.05; /* 薄く */
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYUM+UAAAAAInRSTlMAIiMjJCYlKCkuMDM4ODk6Ojo7PD09Pj4+Pz9AQUEBQkNDREREBAEBCzC1AAAARUlEQVQ4y2NgGAWDCUg+WJkYGNkYmRmZGIABjY0FDBpL2FmYGJuYgoMDs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzoGBAgAAwAEFfX022IAAAAASUVORK5CYII="); /* 微細なノイズ画像 */
  background-size: 50px;
  animation: noise-animation 1s steps(2) infinite; /* 細かく動かす */
}

@keyframes noise-animation {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: -50px -50px;
  }
}

/* ボックス内や重要度の高いリンク (例: 作品紹介カード内の詳細リンクなど) */
.box-link {
  display: inline-block; /* ブロック要素にしてpaddingを適用 */
  padding: 0.5rem 1rem;
  margin-top: 1rem;
  background-color: #fff;
  border: 1px solid var(--color-accent-blood);
  color: var(--color-accent-blood);
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-transform: uppercase; /* 大文字 */
  letter-spacing: 0.05em;
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease, transform 0.3s ease;
  box-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
  overflow: hidden; /* 中の要素がはみ出さないように */
  position: relative;
  z-index: 1;
  text-decoration: none;
}

.box-link::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%; /* 左から右へスライドするオーバーレイ */
  width: 100%;
  height: 100%;
  background-color: rgba(139, 0, 0, 0.2); /* 半透明の赤 */
  transition: left 0.3s ease;
  z-index: -1;
}

.box-link:hover {
  color: var(--color-text-primary); /* ホバーでテキスト色を明るく */
  background-color: var(--color-accent-blood); /* 背景を赤に */
  border-color: var(--color-text-primary);
  transform: translateY(-2px); /* わずかに上に移動 */
  box-shadow: 0 5px 15px rgba(255, 0, 0, 0.4), 0 0 20px rgba(255, 0, 0, 0.6);
}

.box-link:hover::before {
  left: 0; /* ホバーでオーバーレイがスライド */
}
