/* モーション。hover は既存の見た目を変えない範囲で上書きする。
   画面用かつ「視差効果を減らす」未設定のときだけ動かす（印刷・設定ありは全要素を静止表示） */

@property --sweep {
  syntax: "<angle>";
  inherits: false;
  initial-value: 372deg;
}

.kv__visual {
  --wheel-x: 65.52%;
  --wheel-y: 49.95%;
}

.kv__visual picture {
  display: block;
}

@media (max-width: 767px) {
  .kv__visual {
    --wheel-x: 50.22%;
    --wheel-y: 50.06%;
  }
}

@media screen and (prefers-reduced-motion: no-preference) {
  :root {
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* ---------- 読み込み時 ---------- */

  .kv__logo {
    animation: fade-up 0.9s var(--ease-out) 0.1s both;
  }

  .kv__company {
    animation: text-wipe 1s var(--ease-out) 0.25s both;
  }

  .kv__notice {
    animation: text-wipe 1.1s var(--ease-out) 0.4s both;
  }

  .kv__visual picture {
    animation: wheel-sweep 1.7s cubic-bezier(0.65, 0, 0.2, 1) 0.15s both;
    mask-image: conic-gradient(from 0deg at var(--wheel-x) var(--wheel-y), #000 calc(var(--sweep) - 12deg), transparent var(--sweep));
  }

  .hero__tagline {
    animation: fade-up 1s var(--ease-out) 0.9s both;
  }

  .hero__lead {
    animation: fade-up 1s var(--ease-out) 1.05s both;
  }

  .movie:nth-child(1) {
    animation: fade-up 1s var(--ease-out) 1.2s both;
  }

  .movie:nth-child(2) {
    animation: fade-up 1s var(--ease-out) 1.3s both;
  }

  .page-nav__list li:nth-child(1) {
    animation: fade-up 0.9s var(--ease-out) 1.4s both;
  }

  .page-nav__list li:nth-child(2) {
    animation: fade-up 0.9s var(--ease-out) 1.48s both;
  }

  .page-nav__list li:nth-child(3) {
    animation: fade-up 0.9s var(--ease-out) 1.56s both;
  }

  /* ---------- スクロール時（クラスは motion.js が付ける） ---------- */

  .reveal {
    transition-delay: calc(var(--i, 0) * 90ms);
    transition-timing-function: var(--ease-out);
  }

  .reveal--up {
    opacity: 0;
    transform: translateY(24px);
    transition-duration: 1s;
    transition-property: opacity, transform;
  }

  .reveal--up.is-visible {
    opacity: 1;
    transform: none;
  }

  /* 注意書き・注記は読み落としが出ないよう短いフェードのみ */
  .reveal--soft {
    opacity: 0;
    transition-duration: 0.5s;
    transition-property: opacity;
  }

  .reveal--soft.is-visible {
    opacity: 1;
  }

  /* 図版。clip-path で隠すと遅延読み込みが始まらないので、opacity だけで出す */
  .reveal--image {
    opacity: 0;
    transform: translateY(16px);
    transition-duration: 0.8s;
    transition-property: opacity, transform;
    transition-timing-function: cubic-bezier(0.33, 0, 0.2, 1);
  }

  .reveal--image.is-visible {
    opacity: 1;
    transform: none;
  }

  .reveal--pop {
    opacity: 0;
    transform: scale(0.5);
    transition-delay: 0.15s;
    transition-duration: 0.7s;
    transition-property: opacity, transform;
  }

  .reveal--pop.is-visible {
    opacity: 1;
    transform: none;
  }

  .reveal--bar {
    position: relative;
    overflow: hidden;
    clip-path: inset(0 50%);
    transition-duration: 1.1s;
    transition-property: clip-path;
  }

  .reveal--bar.is-visible {
    clip-path: inset(0);
  }

  .reveal--bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 35%, rgb(255 255 255 / 22%) 50%, transparent 65%);
    transform: translateX(-100%);
    pointer-events: none;
  }

  .reveal--bar.is-visible::after {
    animation: sheen 1.5s ease-in-out 0.45s both;
  }

  /* ---------- hover ---------- */

  .link-btn {
    isolation: isolate;
    overflow: hidden;
    transition: none;
  }

  .link-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: #15599b;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.55s var(--ease-out);
  }

  .link-btn__icon {
    transition: top 0.35s var(--ease-out);
  }

  .underwriter__link img {
    transition: translate 0.3s var(--ease-out);
  }

  .site-footer__sns a[href] img,
  .movie__player:not(:disabled) img {
    transition: scale 0.3s var(--ease-out);
  }

  .movie__player:not(:disabled) .movie__poster {
    transition-duration: 0.6s;
  }

  @media (hover: hover) {
    .link-btn:hover {
      opacity: 1;
    }

    .link-btn:hover::before {
      transform: scaleX(1);
      transform-origin: left;
    }

    .link-btn:hover .link-btn__icon {
      top: calc(50% + 4px);
    }

    .underwriter__link[href]:hover img {
      translate: 2px -2px;
    }

    .site-footer__sns a[href]:hover img,
    .movie__player:not(:disabled):hover .movie__icon {
      scale: 1.08;
    }

    .movie__player:not(:disabled):hover .movie__poster {
      scale: 1.03;
    }
  }

  @keyframes fade-up {
    from {
      opacity: 0;
      transform: translateY(18px);
    }
  }

  @keyframes text-wipe {
    from {
      clip-path: inset(-10% 100% -10% 0);
      transform: translateX(-12px);
    }

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

  @keyframes wheel-sweep {
    from {
      --sweep: 0deg;
    }

    to {
      --sweep: 372deg;
    }
  }

  @keyframes sheen {
    to {
      transform: translateX(100%);
    }
  }
}
