@charset "utf-8";
/* トップページ ファーストビュー（鳳凰賞典レース）
   ===========================================
   部品の位置と大きさは fv-parts.css（tools/build-fv-parts.py が生成）の --x / --y / --w / --h。
   このファイルは 重ね方・登場の動き・待機の動き・カウントダウンの文字。
   登場の時刻は各部品の --t（再生開始からの秒）。流れは docs/tachikawa/graderace75/fv-animation.md。

   JS が無いと .is-ready が付かず、動きなしの完成形がそのまま出る。 */

.fv {
  position: relative;
}

.fv-stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--sw) / var(--sh);
  overflow: hidden;
  /* 地面の放射線の消失点（ステージに対する %）。選手と遠景はここを基準に拡大する */
  --vpx: 49.4;
  --vpy: 73.7;
  /* マウス視差（-1〜1。fv.js が書き換える） */
  --px: 0;
  --py: 0;
}

.fv-p {
  position: absolute;
  left: calc(var(--x) * 1%);
  /* --dy: ラフの位置から縦にずらす量（ステージの高さに対する %）。PC の富士と太陽で使う */
  top: calc((var(--y) + var(--dy, 0)) * 1%);
  width: calc(var(--w) * 1%);
  height: calc(var(--h) * 1%);
  /* 消失点を、この部品の箱に対する % に直したもの */
  --ox: calc((var(--vpx) - var(--x)) / var(--w) * 100%);
  --oy: calc((var(--vpy) - var(--y) - var(--dy, 0)) / var(--h) * 100%);
  /* 視差: --d = 幅 1920px のときの最大移動量 (px)。手前の部品ほど大きい */
  transform: translate3d(
    calc(var(--px) * var(--d, 0) * -0.052vw),
    calc(var(--py) * var(--d, 0) * -0.026vw),
    0
  );
  pointer-events: none;
}

.fv-in,
.fv-p picture,
.fv-p img {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---- 登場（.is-ready で初期状態に止め、.is-play で再生） ---- */

.fv.is-ready .fv-in {
  animation-duration: 0.9s;
  animation-timing-function: cubic-bezier(0.16, 0.84, 0.3, 1);
  animation-delay: calc(var(--t, 0) * 1s);
  animation-fill-mode: both;
  animation-play-state: paused;
}

.fv.is-ready.is-play .fv-in,
.fv.is-ready.is-play .fv-in img {
  animation-play-state: running;
}

.fv.is-paused .fv-in,
.fv.is-paused .fv-in img {
  animation-play-state: paused !important;
}

/* 放射線: 消失点から外へ */
.fv.is-ready .fv-p--rays .fv-in {
  --t: 0;
  animation-name: fv-rays;
  animation-duration: 0.7s;
  animation-timing-function: cubic-bezier(0.3, 0.6, 0.3, 1);
}

@keyframes fv-rays {
  from {
    clip-path: circle(0% at var(--ox) var(--oy));
    opacity: 0.3;
  }

  to {
    clip-path: circle(150% at var(--ox) var(--oy));
    opacity: 1;
  }
}

/* 選手: 消失点側から迫る（55% → 103% → 100%。中央だけ 110% まで出る）。
   行き過ぎて戻る動きは、キーフレームを 55% → 100% の 2 点だけにして、行き過ぎ量をイージング 1 本
   （cubic-bezier の y1 > 1）で作る。途中にキーフレームを置くと、そこで速度が切れてガクつく。
   登場が終わったら、消失点を基準にわずかに前後し続ける（競り合い。--gd = 1 往復の秒、--ga = 幅。
   1 人ずつ周期と向きを変えてある。動きは控えめに: 中央で ±0.8%、ほかは消失点からの距離の ±1.2〜1.6%） */
.fv.is-ready .fv-rider .fv-in {
  transform-origin: var(--ox) var(--oy);
  animation-name: fv-rush, fv-surge;
  animation-duration: 0.8s, var(--gd);
  /* 行き過ぎ 6.9% → 最大 103% */
  animation-timing-function: cubic-bezier(0.19, 1.46, 0.5, 1), linear;
  animation-delay: calc(var(--t) * 1s), calc(var(--t) * 1s + 1.2s);
  animation-iteration-count: 1, infinite;
  animation-fill-mode: both, none;
}

.fv.is-ready .fv-p--rider-red .fv-in {
  animation-duration: 1.1s, var(--gd);
  /* 行き過ぎ 22% → 最大 110%。全体の 27% の時点で 100% を通過し、50% で最大、あとはなだらかに戻る */
  animation-timing-function: cubic-bezier(0.37, 1.92, 0.6, 1), linear;
}

@keyframes fv-rush {
  from {
    opacity: 0;
    transform: scale(0.55);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fv-surge {
  0% {
    transform: scale(1);
    animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1);
  }

  25% {
    transform: scale(calc(1 + var(--ga)));
    animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1);
  }

  75% {
    transform: scale(calc(1 - var(--ga)));
    animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1);
  }

  100% {
    transform: scale(1);
  }
}

/* 中央 → 奥の選手から順に 70ms 刻み。
   --a = 漕ぐ揺れの振れ幅 (deg)、--sd = 揺れ 1 往復の秒、--gd / --ga = 前後の動き（上の説明） */
.fv-p--rider-red {
  --t: 0.2;
  --a: 0.3;
  --sd: 1.44s;
  --gd: 5s;
  --ga: 0.04;
}

.fv-p--rider-black {
  --t: 0.6;
  --a: 0.3;
  --sd: 1.25s;
  --gd: 4.2s;
  --ga: 0.04;
}

.fv-p--rider-purple {
  --t: 0.67;
  --a: 0.3;
  --sd: 1.56s;
  --gd: 4.8s;
  --ga: -0.04;
}

.fv-p--rider-pink {
  --t: 0.74;
  --a: 0.3;
  --sd: 1.19s;
  --gd: 3.8s;
  --ga: -0.04;
}

.fv-p--rider-orange {
  --t: 0.81;
  --a: 0.3;
  --sd: 1.5s;
  --gd: 4.6s;
  --ga: 0.04;
}

.fv-p--rider-green {
  --t: 0.88;
  --a: 0.3;
  --sd: 1.31s;
  --gd: 5.4s;
  --ga: -0.04;
}

.fv-p--rider-white {
  --t: 0.95;
  --a: 0.3;
  --sd: 1.63s;
  --gd: 4.3s;
  --ga: 0.04;
}

.fv-p--rider-yellow {
  --t: 1.02;
  --a: 0.3;
  --sd: 1.38s;
  --gd: 5.1s;
  --ga: 0.04;
}

.fv-p--rider-blue {
  --t: 1.09;
  --a: 0.3;
  --sd: 1.53s;
  --gd: 4.4s;
  --ga: -0.012;
}

/* 鳳凰: 中央の選手の背後から上昇 → 到達時に一瞬発光 */
.fv-p--phoenix {
  --t: 1.3;
}

.fv.is-ready .fv-p--phoenix .fv-in {
  animation-name: fv-rise;
  animation-duration: 1.3s;
  animation-timing-function: cubic-bezier(0.23, 1.56, 0.55, 1);
  /* 行き過ぎ 10%（上へ 4% ほど出て戻る） */
}

@keyframes fv-rise {
  from {
    opacity: 0;
    transform: translateY(44%) scale(0.8);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* 遠景: 奥から順に、消失点基準で少し拡大しながら出る */
.fv-p--sun {
  --t: 1.5;
}

.fv-p--fuji {
  --t: 1.65;
}

.fv-p--mountain {
  --t: 1.8;
}

.fv-p--cloud-l {
  --t: 1.9;
  --shift: -9%;
}

.fv-p--cloud-r {
  --t: 2.05;
  --shift: 9%;
}

.fv.is-ready .fv-far .fv-in {
  transform-origin: var(--ox) var(--oy);
  animation-name: fv-far;
  animation-duration: 1s;
  animation-timing-function: cubic-bezier(0.25, 0.6, 0.3, 1);
}

@keyframes fv-far {
  from {
    opacity: 0;
    transform: scale(0.93);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 山並み: 枠の左右いっぱいまである絵。横に縮めたり視差で横にずれたりすると枠との間に切れ目が見えるので、
   縦方向だけ伸ばして出し、左右の端 3% は透明へなじませる */
.fv-p--mountain {
  -webkit-mask-image: linear-gradient(
    to right,
    transparent,
    var(--c-black) 3%,
    var(--c-black) 97%,
    transparent
  );
  mask-image: linear-gradient(
    to right,
    transparent,
    var(--c-black) 3%,
    var(--c-black) 97%,
    transparent
  );
}

.fv.is-ready .fv-p--mountain .fv-in {
  transform-origin: 50% 100%;
  animation-name: fv-far-y;
}

@keyframes fv-far-y {
  from {
    opacity: 0;
    transform: scaleY(0.9);
  }

  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

/* 雲: 左右から寄る */
.fv.is-ready .fv-cloud .fv-in {
  animation-name: fv-cloud;
  animation-duration: 1.1s;
  animation-timing-function: cubic-bezier(0.25, 0.6, 0.3, 1);
}

@keyframes fv-cloud {
  from {
    opacity: 0;
    transform: translateX(var(--shift));
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* コピー・冠名の札（題字の地と細枠）・75周年の札: 上から下へ。
   冠名の札はコピーと同じ時刻・同じ動き（題字はこのあと 3.2 秒から札の上に押す） */
.fv-p--copy,
.fv-p--title-frame {
  --t: 2.6;
}

.fv-p--pill75 {
  --t: 3;
}

.fv.is-ready .fv-wipe .fv-in {
  animation-name: fv-wipe;
  animation-duration: 0.7s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.3, 1);
}

.fv.is-ready .fv-p--pill75 .fv-in {
  animation-duration: 0.5s;
}

@keyframes fv-wipe {
  from {
    clip-path: inset(0 0 100% 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

/* 落款: コピーに続けて出す */
.fv-p--seal {
  --t: 3.1;
}

.fv.is-ready .fv-p--seal .fv-in {
  animation-name: fv-fade;
  animation-duration: 0.5s;
  animation-timing-function: ease-out;
}

@keyframes fv-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* 題字: 1 字ずつ、判を押すように（--i = 何文字目か） */
.fv-title {
  --t: calc(3.2 + var(--i) * 0.07);
}

.fv.is-ready .fv-title .fv-in {
  animation-name: fv-stamp;
  animation-duration: 0.3s;
  animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes fv-stamp {
  0% {
    opacity: 0;
    transform: scale(1.2);
  }

  55% {
    opacity: 1;
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* 日付: 左から順に */
.fv-date {
  --t: calc(3.7 + var(--i) * 0.12);
}

.fv.is-ready .fv-date .fv-in {
  animation-name: fv-pop;
  animation-duration: 0.36s;
  animation-timing-function: cubic-bezier(0.19, 1.46, 0.5, 1);
}

@keyframes fv-pop {
  from {
    opacity: 0;
    transform: translateY(22%) scale(0.86);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ---- 待機（登場後も続く動き。選手の揺れと鳳凰の浮遊だけ） ---- */

/* 選手: 接地点を軸に左右へ揺れる（--a = 振れ幅 deg、--sd = 1 往復の秒） */
.fv.is-ready .fv-rider img {
  transform-origin: 50% 97%;
  animation: fv-sway var(--sd) linear calc(var(--t) * 1s + 0.55s) infinite;
  animation-play-state: paused;
}

@keyframes fv-sway {
  0% {
    transform: rotate(0deg);
    animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1);
  }

  25% {
    transform: rotate(calc(var(--a) * 1deg));
    animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1);
  }

  75% {
    transform: rotate(calc(var(--a) * -1deg));
    animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1);
  }

  100% {
    transform: rotate(0deg);
  }
}

.fv.is-ready .fv-p--phoenix img {
  animation:
    fv-flash 0.55s ease-out calc(var(--t) * 1s + 0.95s) both,
    fv-float 6s ease-in-out calc(var(--t) * 1s + 1.4s) infinite;
  animation-play-state: paused;
}

@keyframes fv-flash {
  0%,
  100% {
    filter: none;
  }

  30% {
    filter: brightness(1.5) saturate(1.15);
  }
}

@keyframes fv-float {
  0%,
  100% {
    transform: none;
  }

  50% {
    transform: translateY(-1.6%);
  }
}

/* ---- カウントダウン（HTML の文字。黒は小さめ、赤い数字は大きめ。大きさは画面幅に比例） ---- */

.fv-count {
  margin: 0;
  color: var(--c-ink);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.fv-count p {
  position: absolute;
  margin: 0;
  transform: translate(-50%, -50%);
  letter-spacing: -0.02em;
  word-spacing: 0.2em;
  /* 「開催まで あと」「全日4日間 開門時間」の区切り */
}

.fv-count span {
  display: inline-block;
  margin: 0 0.1em 0 0.1em;
  color: var(--c-red);
  letter-spacing: -0.03em;
  text-align: center;
  vertical-align: -0.03em;
}

/* 開催終了（countdown.js が出す）は黒の文字だけ */
.fv-count .timeover {
  margin: 0;
  color: var(--c-ink);
  font-size: 1.15em;
  letter-spacing: 0;
  vertical-align: baseline;
}

.fv.is-ready .fv-count p {
  animation: fv-up 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) calc(var(--t) * 1s) both;
  animation-play-state: paused;
}

.fv.is-ready.is-play .fv-count p {
  animation-play-state: running;
}

.fv-count__days {
  --t: 4.2;
}

.fv-count__open {
  --t: 4.32;
}

@keyframes fv-up {
  from {
    opacity: 0;
    transform: translate(-50%, -20%);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* ---- PC: マウス視差の深さ ---- */

@media (min-width: 768px) {
  /* カウントダウン: 枠の下の左半分・右半分それぞれの中央に置く */
  /* 縦位置: 枠の下端〜ステージ下端の帯の中央に文字が来る高さ */
  .fv-count p {
    top: 92.5%;
    font-size: 2.4vw;
  }

  .fv-count span {
    font-size: 4vw;
  }

  .fv-count__days {
    left: 25%;
  }

  .fv-count__open {
    left: 75%;
  }

  /* 富士と太陽: ラフの位置だと富士の裾の消え際が唐突に見えるので、40px（幅 1920 のとき）下げて山並みに寄せる。
     山並みの稜線まではまだ約 19px 空く */
  .fv-p--fuji,
  .fv-p--sun {
    --dy: 4;
  }

  .fv-p--sun {
    --d: 2;
  }

  .fv-cloud {
    --d: 3;
  }

  .fv-p--fuji {
    --d: 5;
  }

  .fv-p--mountain {
    --d: 8;
  }

  .fv-p--phoenix {
    --d: 12;
  }

  .fv-p--rider-black,
  .fv-p--rider-purple,
  .fv-p--rider-pink,
  .fv-p--rider-orange {
    --d: 15;
  }

  .fv-p--rider-green,
  .fv-p--rider-yellow {
    --d: 19;
  }

  .fv-p--rider-white,
  .fv-p--rider-blue {
    --d: 23;
  }

  .fv-p--rider-red {
    --d: 30;
  }
}

/* ---- SP ---- */

@media (max-width: 767px) {
  .fv-stage {
    --vpx: 49.5;
    --vpy: 59.4;
  }

  /* カウントダウン: 中央ぞろえの 2 行。「立川競輪場」の札のすぐ下に寄せる。
     2 行とも黒・赤それぞれ同じ大きさ（そろっていないと赤い数字の差が目立つ） */
  .fv-count p {
    left: 50%;
    font-size: 7vw;
  }

  .fv-count span {
    font-size: 8.4vw;
  }

  .fv-count__days {
    top: 88.6%;
  }

  .fv-count__open {
    top: 95.8%;
  }
}

/* ---- 動きを減らす設定: 完成形を静止で出す ---- */

@media (prefers-reduced-motion: reduce) {
  .fv.is-ready .fv-in,
  .fv.is-ready .fv-in img,
  .fv.is-ready .fv-count p {
    animation: none !important;
  }
}

/* aspect-ratio の無い古いブラウザ向け（高さだけ確保する） */
@supports not (aspect-ratio: 1 / 1) {
  .fv-stage {
    height: 51.5625vw;
  }

  @media (max-width: 767px) {
    .fv-stage {
      height: 144.186vw;
    }
  }
}
