/* 新テーマ the-n-2026-ver2（H-B のデザイン）: 最後に読む動きの調整
   - 裏サイトへの入口の演出（今の style.css の「裏サイト演出用スタイル」をそのまま写したもの）
   - 動きを減らす設定（H-B の試作の h.css の同じ節。入口の点滅もここで止める）
   ほかの CSS より後に読む（動きを減らす設定を後から上書きさせない）。 */

/* ====================================
   The N - 裏サイト演出用スタイル
   ==================================== */

/* グリッチ・オーバーレイの基本設定 */
#glitch-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #000;
  z-index: 99999; /* 最前面に（念のため9を増やしました） */
  display: none; /* JSでflexに切り替えます */
  justify-content: center;
  align-items: center;
  flex-direction: column;
  overflow: hidden;
}

/* 発動時に付与するクラス */
#glitch-overlay.active {
  display: flex !important; /* 強制的に表示 */
  animation: flash-crackle 0.1s infinite; /* 画面全体を点滅 */
}

/* メインテキストのグリッチ演出 */
.glitch-text {
  font-size: 3rem; /* スマホなら少し小さくてもOK */
  font-weight: bold;
  color: #fff;
  font-family: "Courier New", monospace; /* 等幅フォントでハッカーっぽく */
  position: relative;
  text-shadow:
    2px 0 red,
    -2px 0 blue;
}

/* 激しく揺れるアニメーション（疑似要素） */
.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

.glitch-text::before {
  left: 2px;
  text-shadow: -1px 0 #ff00c1;
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch-text::after {
  left: -2px;
  text-shadow: -1px 0 #00fff9;
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim-2 2s infinite linear alternate-reverse;
}

/* サブテキスト（点滅） */
.glitch-sub {
  margin-top: 20px;
  color: #0f0; /* ターミナルグリーン */
  font-family: monospace;
  font-size: 1.2rem;
  animation: blink 0.2s infinite;
}

/* --- アニメーション定義 --- */

@keyframes glitch-anim-1 {
  0% {
    clip: rect(20px, 9999px, 10px, 0);
  }
  20% {
    clip: rect(50px, 9999px, 60px, 0);
  }
  40% {
    clip: rect(10px, 9999px, 30px, 0);
  }
  60% {
    clip: rect(80px, 9999px, 90px, 0);
  }
  80% {
    clip: rect(40px, 9999px, 50px, 0);
  }
  100% {
    clip: rect(70px, 9999px, 100px, 0);
  }
}

@keyframes glitch-anim-2 {
  0% {
    clip: rect(10px, 9999px, 90px, 0);
  }
  20% {
    clip: rect(80px, 9999px, 10px, 0);
  }
  40% {
    clip: rect(30px, 9999px, 50px, 0);
  }
  60% {
    clip: rect(60px, 9999px, 20px, 0);
  }
  80% {
    clip: rect(100px, 9999px, 40px, 0);
  }
  100% {
    clip: rect(50px, 9999px, 70px, 0);
  }
}

/* ▼▼▼ 修正版：目に優しいマイルドな点滅 ▼▼▼ */
@keyframes flash-crackle {
  0% {
    background-color: #000;
    opacity: 0.9;
  }
  50% {
    background-color: #1a1a1a;
    opacity: 1;
  } /* 少しだけ明るく */
  90% {
    background-color: #050505;
  } /* 反転(invert)を削除 */
  100% {
    background-color: #000;
  }
}

@keyframes blink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* スマホ調整 */
@media screen and (max-width: 767px) {
  .glitch-text {
    font-size: 2rem;
  }
}

/* --------------------------------------------------------------------------
   動きを減らす設定
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .h-marquee__row { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  #glitch-overlay.active,
  .glitch-text::before,
  .glitch-text::after,
  .glitch-sub { animation: none; }
}
