/*
 * トップの背景動画（Vimeo。Vimeo の情報では 426×240 と小さく、引き伸ばすと粗い）の粗さを目立たなくする重ね。2026-11-21
 * front-page.php の .bgvideo の中の .kh-hero-fx。動画の iframe の上、キャッチフレーズ（h2）の下に重なる。
 * - ::after ：フィルムの粒子（少しずつ動かして、圧縮のにじみを粒子に紛れさせる）
 *   （ドットの網目も試したが、暗くこもって古く見えたのでやめた）
 * - 本体    ：周りを暗くする影と、上（ヘッダー）・下（本文の黒へのつながり）の暗がり
 */
.home-entry .bgvideo iframe {
  /* ほんの少しぼかしてブロックの角を丸め、そのぶんコントラストを足す */
  filter: blur(0.5px) contrast(1.1) saturate(1.1);
}

.kh-hero-fx {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 22%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.6) 100%),
    radial-gradient(ellipse 75% 70% at 50% 50%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.55) 100%),
    rgba(0, 0, 0, 0.12);
}

/* フィルムの粒子 */
.kh-hero-fx::after {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1.6 -0.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  opacity: 0.32;
  mix-blend-mode: overlay;
  animation: kh-hero-grain 0.9s steps(6) infinite;
}

@keyframes kh-hero-grain {
  0% { transform: translate(0, 0); }
  17% { transform: translate(-6%, 4%); }
  33% { transform: translate(5%, -7%); }
  50% { transform: translate(-3%, 8%); }
  67% { transform: translate(8%, 2%); }
  83% { transform: translate(-7%, -5%); }
  100% { transform: translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .kh-hero-fx::after {
    animation: none;
  }
}

/* ---------------------------------------------------------------- スクロールでキャッチフレーズがぼけて消える（2026-11-21）
 * js/hero.js が .home-entry に --kh-hp（0＝いちばん上 〜 1＝消えきる）を書き込む。
 * 一文字ずつ灯る動き（motion.css の .kh-ch）は文字ごと、こちらは見出し全体にかけるので重ならない */
html.kh-js .home-entry > h2 {
  opacity: calc(1 - var(--kh-hp, 0));
  filter: blur(calc(var(--kh-hp, 0) * 14px));
  transform: translate(-50%, calc(-50% - var(--kh-hp, 0) * 48px)) scale(calc(1 + var(--kh-hp, 0) * 0.08));
  will-change: opacity, filter, transform;
}
html.kh-js .home-entry.is-hp-zero > h2 {
  filter: none;
  will-change: auto;
}

/* ---------------------------------------------------------------- 下に続くことを知らせる印：導火線を火花が下りていく */
.kh-scroll-cue {
  position: absolute;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  transform: translateX(-50%);
  color: #fff;
  text-decoration: none;
  opacity: calc(1 - var(--kh-cue, 0));
  transition: opacity 0.2s linear;
}

.kh-scroll-cue__text {
  font-family: var(--font-sub);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  text-transform: uppercase;
  line-height: 1;
}

.kh-scroll-cue__line {
  position: relative;
  display: block;
  width: 1px;
  height: 64px;
  background: rgba(255, 255, 255, 0.28);
  overflow: visible;
}

/* 火花：線の上から下へ、尾を引いて下りる */
.kh-scroll-cue__line::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 22px;
  margin-left: -0.5px;
  background: linear-gradient(to bottom, rgba(255, 210, 150, 0), #ffd296);
  animation: kh-cue-fuse 2.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
.kh-scroll-cue__line::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: #fff6e6;
  box-shadow: 0 0 6px 2px rgba(255, 190, 110, 0.9), 0 0 14px 4px rgba(255, 120, 60, 0.45);
  animation: kh-cue-spark 2.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes kh-cue-fuse {
  0% { transform: translateY(-22px); opacity: 0; }
  15% { opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translateY(64px); opacity: 0; }
}
@keyframes kh-cue-spark {
  0% { transform: translateY(-2px) scale(0.4); opacity: 0; }
  15% { opacity: 1; transform: translateY(8px) scale(1); }
  75% { opacity: 1; }
  100% { transform: translateY(62px) scale(0.6); opacity: 0; }
}

@media (hover: hover) {
  .kh-scroll-cue:hover .kh-scroll-cue__text {
    color: #ffd296;
  }
}

/* 「動きを減らす」設定：火花は止めて、線だけ見せる */
@media (prefers-reduced-motion: reduce) {
  .kh-scroll-cue__line::before,
  .kh-scroll-cue__line::after {
    animation: none;
    opacity: 0;
  }
}

@media only screen and (max-width: 599px) {
  .kh-scroll-cue {
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .kh-scroll-cue__line {
    height: 48px;
  }
  @keyframes kh-cue-fuse {
    0% { transform: translateY(-22px); opacity: 0; }
    15% { opacity: 1; }
    75% { opacity: 1; }
    100% { transform: translateY(48px); opacity: 0; }
  }
  @keyframes kh-cue-spark {
    0% { transform: translateY(-2px) scale(0.4); opacity: 0; }
    15% { opacity: 1; transform: translateY(6px) scale(1); }
    75% { opacity: 1; }
    100% { transform: translateY(46px) scale(0.6); opacity: 0; }
  }
}
