/* ============================================================
   ヒーロー演出 ＋ サッカーモチーフ
   既存レイアウトには干渉しない方針:
     - 装飾は全て position:absolute / pointer-events:none
     - 動きは transform ではなく translate / scale / rotate の
       独立プロパティを使用 → Tailwind の hover:translate 等と共存
   ============================================================ */

:root {
  --fx-cyan: #38e8ff;
  --fx-blue: #00a8ff;
  --fx-pink: #ff2fb3;
  --fx-cone: #ff7a1a;
  --fx-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- 背景レイヤー共通 ---------- */
.fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
}
.fx svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ------------------------------------------------------------
   1. ピッチライン（線が引かれるアニメーション）
   ------------------------------------------------------------ */
.fx-pitch {
  z-index: -3;
  opacity: 0;
  animation: fx-fade 1.4s 0.15s ease forwards;
}
.fx-pitch .fx-line {
  fill: none;
  stroke: rgba(223, 251, 255, 0.17);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: fx-draw 2.6s 0.4s var(--fx-ease) forwards;
}
.fx-pitch .fx-line:nth-child(2) { animation-delay: 0.62s; }
.fx-pitch .fx-line:nth-child(3) { animation-delay: 0.84s; }
.fx-pitch .fx-line:nth-child(4) { animation-delay: 1.02s; }
.fx-pitch .fx-line:nth-child(5) { animation-delay: 1.18s; }
.fx-pitch .fx-spot {
  fill: rgba(223, 251, 255, 0.3);
  stroke: none;
  opacity: 0;
  animation: fx-fade 0.8s 1.6s ease forwards;
}

/* ------------------------------------------------------------
   2. スタジアム照明（上からのビーム＋ゆらぎ）
   ------------------------------------------------------------ */
.fx-lights {
  z-index: -3;
  overflow: hidden;
}
.fx-lights::before,
.fx-lights::after {
  content: "";
  position: absolute;
  top: -34%;
  width: 34%;
  height: 128%;
  background: linear-gradient(
    to bottom,
    rgba(196, 246, 255, 0.16),
    rgba(196, 246, 255, 0.05) 45%,
    transparent 72%
  );
  filter: blur(30px);
}
.fx-lights::before {
  left: 4%;
  rotate: 10deg;
  animation: fx-flicker 6.5s ease-in-out infinite;
}
.fx-lights::after {
  right: 8%;
  rotate: -12deg;
  animation: fx-flicker 8s 0.9s ease-in-out infinite;
}

/* ------------------------------------------------------------
   3. 照明のスイープ（横断する光）
   ------------------------------------------------------------ */
.fx-sweep {
  z-index: -3;
  background: linear-gradient(
    104deg,
    transparent 40%,
    rgba(186, 242, 255, 0.13) 50%,
    transparent 60%
  );
  opacity: 0;
  animation: fx-sweep 11s 2.2s ease-in-out infinite;
}

/* ------------------------------------------------------------
   4. ゴールネット（右上のテクスチャ）
   ------------------------------------------------------------ */
.fx-net {
  z-index: -3;
  left: auto;
  width: 48%;
  background-image:
    repeating-linear-gradient(58deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(-58deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 24px);
  -webkit-mask-image: linear-gradient(202deg, #000 4%, transparent 60%);
  mask-image: linear-gradient(202deg, #000 4%, transparent 60%);
  opacity: 0;
  animation: fx-fade 1.8s 0.6s ease forwards;
}

/* ------------------------------------------------------------
   5. ドリブル軌跡＋転がるボール＋マーカーコーン
   ------------------------------------------------------------ */
.fx-run {
  top: auto;
  bottom: 0;
  height: min(36%, 260px);
  z-index: -2;
  opacity: 0;
  /* 左側（CTA まわり）と下端はフェードさせて、主役の文字を邪魔しない */
  -webkit-mask-image:
    linear-gradient(to right, transparent 0, #000 22%),
    linear-gradient(to bottom, #000 62%, transparent 96%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent 0, #000 22%),
    linear-gradient(to bottom, #000 62%, transparent 96%);
  mask-composite: intersect;
  animation: fx-fade 1.1s 1.15s ease forwards;
}
.fx-run-path {
  fill: none;
  stroke: rgba(56, 232, 255, 0.38);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 13 17;
  filter: drop-shadow(0 0 6px rgba(0, 183, 255, 0.45));
  animation: fx-flow 1.15s linear infinite;
}
.fx-cone {
  fill: var(--fx-cone);
  opacity: 0.55;
  filter: drop-shadow(0 0 8px rgba(255, 122, 26, 0.4));
}
.fx-ball-wrap { filter: drop-shadow(0 4px 11px rgba(0, 0, 0, 0.55)); }
.fx-ball-spin {
  transform-box: fill-box;
  transform-origin: center;
  animation: fx-spin 1.15s linear infinite;
}
.fx-ball-body { fill: #fff; }
.fx-ball-mark { fill: #0b1220; }
.fx-ball-line {
  stroke: #0b1220;
  stroke-width: 1.7;
  stroke-linecap: round;
  fill: none;
}
.fx-ball-ring {
  fill: none;
  stroke: #0b1220;
  stroke-width: 1.6;
}

/* ------------------------------------------------------------
   6. ヒーロー本文の登場（badge → 見出し → リード → CTA）
   ------------------------------------------------------------ */
/* fill-mode は forwards ではなく backwards を使う。
   Tailwind v4 の hover:translate-y / hover:scale は transform ではなく
   translate / scale プロパティを出力するため、forwards で終了状態を
   保持するとホバー時の動きを恒久的に上書きしてしまう。
   backwards なら「遅延中だけ開始状態を適用」し、終了後は
   要素本来のスタイルに戻るのでホバーが生きる。 */
[data-anim="badge"],
[data-anim="lead"],
[data-anim="cta"] {
  animation-name: fx-rise;
  animation-duration: 0.9s;
  animation-timing-function: var(--fx-ease);
  animation-fill-mode: backwards;
}
[data-anim="badge"] { animation-delay: 0.2s; }
[data-anim="lead"]  { animation-delay: 1.05s; }
[data-anim="cta"]   { animation-delay: 1.25s; }

/* 見出しは1行ずつワイプで立ち上げる */
[data-anim="title"] > span {
  animation-name: fx-line;
  animation-duration: 1s;
  animation-timing-function: var(--fx-ease);
  animation-fill-mode: backwards;
}
[data-anim="title"] > span:nth-child(1) { animation-delay: 0.4s; }
[data-anim="title"] > span:nth-child(2) { animation-delay: 0.55s; }
[data-anim="title"] > span:nth-child(3) {
  animation:
    fx-line 1s 0.7s var(--fx-ease) backwards,
    fx-evolve 3.8s 1.9s ease-in-out infinite;
}

/* CTA から広がる光のリング */
[data-anim="cta"] { position: relative; }
[data-anim="cta"]::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 1px solid rgba(56, 232, 255, 0.85);
  opacity: 0;
  pointer-events: none;
  animation: fx-ring 3s 2.3s ease-out infinite;
}

/* ------------------------------------------------------------
   7. スクロールキュー
   ------------------------------------------------------------ */
.fx-scroll {
  position: absolute;
  right: 3%;
  bottom: 5%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  opacity: 0;
  animation: fx-fade 1s 2s ease forwards;
}
.fx-scroll span {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: rgba(223, 251, 255, 0.75);
  writing-mode: vertical-rl;
}
.fx-scroll i {
  width: 1px;
  height: 58px;
  background: linear-gradient(to bottom, rgba(56, 232, 255, 0.9), transparent);
  position: relative;
  overflow: hidden;
}
.fx-scroll i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--fx-cyan);
  animation: fx-scroll 2.1s ease-in-out infinite;
}
@media (max-width: 768px) {
  .fx-scroll { display: none; }
}

/* ------------------------------------------------------------
   8. 下部セクションのスクロールリビール
      .reveal は JS が付与 → JS 無効時は常に表示。
      表示後は JS がクラスを外す（translate を残すと
      カードの hover:translate-y と競合するため）。
   ------------------------------------------------------------ */
.reveal {
  opacity: 0;
  translate: 0 34px;
  transition:
    opacity 0.85s var(--fx-ease),
    translate 0.85s var(--fx-ease);
}
.reveal.is-in {
  opacity: 1;
  translate: 0 0;
}

/* ------------------------------------------------------------
   keyframes
   ------------------------------------------------------------ */
@keyframes fx-fade {
  to { opacity: 1; }
}
@keyframes fx-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes fx-rise {
  from { opacity: 0; translate: 0 28px; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes fx-line {
  0% {
    opacity: 0;
    clip-path: inset(0 0 106% 0);
    translate: 0 0.2em;
  }
  100% {
    opacity: 1;
    clip-path: inset(0 0 -20% 0);
    translate: 0 0;
  }
}
@keyframes fx-evolve {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(0, 183, 255, 0.7)); }
  50%      { filter: drop-shadow(0 0 34px rgba(0, 183, 255, 0.98)); }
}
@keyframes fx-ring {
  0%        { opacity: 0.85; scale: 1; }
  70%, 100% { opacity: 0;    scale: 1.16; }
}
@keyframes fx-sweep {
  0%        { translate: -42% 0; opacity: 0; }
  12%       { opacity: 1; }
  46%       { opacity: 1; }
  60%, 100% { translate: 56% 0;  opacity: 0; }
}
@keyframes fx-flicker {
  0%, 100% { opacity: 0.85; }
  42%      { opacity: 1; }
  55%      { opacity: 0.68; }
  62%      { opacity: 0.95; }
}
@keyframes fx-flow {
  to { stroke-dashoffset: -30; }
}
@keyframes fx-spin {
  to { rotate: 360deg; }
}
@keyframes fx-scroll {
  0%       { translate: 0 -100%; }
  60%, 100% { translate: 0 100%; }
}

/* ------------------------------------------------------------
   アクセシビリティ: 視差軽減設定を尊重
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .fx-sweep,
  .fx-run,
  .fx-scroll,
  .fx-lights::before,
  .fx-lights::after {
    display: none;
  }
  .fx-pitch,
  .fx-net {
    opacity: 1;
    animation: none;
  }
  .fx-pitch .fx-line {
    animation: none;
    stroke-dashoffset: 0;
  }
  .fx-pitch .fx-spot { opacity: 1; animation: none; }
  [data-anim],
  [data-anim] > span,
  [data-anim="cta"]::after {
    animation: none !important;
    opacity: 1;
    translate: none;
    clip-path: none;
  }
  [data-anim="cta"]::after { opacity: 0; }
  .reveal,
  .reveal.is-in {
    opacity: 1;
    translate: none;
    transition: none;
  }
}
