/* ============================================================
   尺八うっちー FX レイヤー
   既存の css/style.css の上に重ねる演出専用ファイル。
   既存のID・クラスは変更せず、見た目と動きだけを足す。
   動きは prefers-reduced-motion で止まる。
   ============================================================ */

:root {
  --fx-ease: cubic-bezier(.22, .8, .24, 1);
  --fx-ink: #0b150f;
}

/* ---------- ヒーロー：時間帯・季節で変わる背景 ---------- */
.hero { isolation: isolate; overflow: hidden; }

/* 既存の .hero-bg の写真を、FXの背景スタックで置き換える */
.hero.fx-on .hero-bg { background: none !important; }

.fx-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--fx-ink);
}

.fx-layer {
  position: absolute;
  inset: -4%;
  background-size: cover;
  background-position: center 40%;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 2.4s ease;
  will-change: opacity, transform;
}

.fx-layer.is-active { opacity: 1; animation: fx-kenburns 38s ease-in-out infinite alternate; }

@keyframes fx-kenburns {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to   { transform: scale(1.16) translate3d(-1.2%, -1.6%, 0); }
}

/* 時間帯による色味（暗くしすぎず、文字の可読性を保つ） */
.fx-tint {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: multiply;
  transition: background 2s ease;
}
.fx-tint[data-tod="dawn"]  { background: linear-gradient(180deg, rgba(255,236,196,.06), rgba(40,62,44,.14)); }
.fx-tint[data-tod="day"]   { background: linear-gradient(180deg, rgba(40,62,44,.05), rgba(26,44,32,.16)); }
.fx-tint[data-tod="dusk"]  { background: linear-gradient(180deg, rgba(160,84,40,.04), rgba(26,34,52,.20)); }
.fx-tint[data-tod="night"] { background: linear-gradient(180deg, rgba(14,24,44,.06), rgba(8,16,14,.18)); }

#fxCanvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* 既存の .hero-overlay は景色が隠れるほど暗いので、FX有効時だけ軽くする。
   文字の可読性は、プロフィールカード側の背景で確保する。 */
.hero.fx-on .hero-overlay {
  z-index: 3;
  background:
    radial-gradient(ellipse 90% 80% at 50% 45%, rgba(10,20,15,0) 0%, rgba(10,20,15,.38) 100%),
    linear-gradient(180deg, rgba(10,20,15,.46) 0%, rgba(10,20,15,.08) 38%, rgba(10,20,15,.12) 62%, rgba(10,20,15,.62) 100%);
}
.hero.fx-on .hero-content { position: relative; z-index: 4; }

/* 景色を見せるため、カードを少し透過させつつ、文字側は濃くして可読性を保つ */
.hero.fx-on .profile-card {
  background: linear-gradient(135deg, rgba(10,20,15,.58), rgba(10,20,15,.40));
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
  box-shadow: 0 30px 90px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.07);
}

/* 下端の溶け込み（次のセクションへ） */
.hero.fx-on::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 140px;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, var(--green-dark, #12221A));
}

/* ---------- ヒーロー：コピーとカウンター ---------- */
.fx-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-family: "Inter", "Noto Sans JP", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--gold-light, #DFC06A);
}
.fx-eyebrow::before {
  content: "";
  width: 34px;
  height: 1px;
  background: currentColor;
  opacity: .8;
}

.fx-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 22px 0 6px;
}
.fx-stat {
  min-width: 128px;
  padding: 12px 16px 11px;
  border: 1px solid var(--border, rgba(196,164,74,.25));
  border-radius: 10px;
  background: rgba(10, 20, 14, .42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.fx-stat b {
  display: block;
  font-family: "Inter", sans-serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--gold-light, #DFC06A);
  font-variant-numeric: tabular-nums;
}
.fx-stat span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #cfd8cf;
  letter-spacing: .04em;
}

/* スクロール誘導 */
.fx-scroll {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 5;
  transform: translateX(-50%);
  width: 22px;
  height: 36px;
  border: 1.5px solid rgba(240,238,232,.55);
  border-radius: 12px;
  opacity: .85;
}
.fx-scroll::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 50%;
  width: 3px;
  height: 7px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--gold-light, #DFC06A);
  animation: fx-wheel 1.8s var(--fx-ease) infinite;
}
@keyframes fx-wheel {
  0%   { transform: translateY(0); opacity: 1; }
  70%  { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ---------- ナビ：スクロールで引き締まる ---------- */
.navbar { transition: background .4s ease, box-shadow .4s ease, padding .3s ease, -webkit-backdrop-filter .4s; }
.navbar.fx-scrolled {
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* 読了の進捗ライン */
.fx-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  z-index: 1000;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--gold, #C4A44A), var(--gold-light, #DFC06A));
  pointer-events: none;
}

/* ---------- 動画セクションの見出し：墨の一滴の波紋 ----------
   画像は 21:9 の水面。細い帯に切ると見せ場の波紋が切れるため、
   見出し領域の背景として大きく敷き、波紋を右寄せにする。 */
.fx-ink {
  position: relative;
  height: clamp(200px, 26vw, 340px);
  margin-top: -1px;
  background: var(--green-dark, #12221A) url("../images/fx/ink.webp") 68% 55% / cover no-repeat;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 34%, #000 66%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 34%, #000 66%, transparent 100%);
}
/* 重ね合わせ(負のマージン)は画面幅で位置がずれやすく崩れの元になるため使わない。
   帯は独立した装飾として単独で表示し、見出しはその下に通常どおり置く。 */
.fx-ink { height: clamp(150px, 20vw, 260px); }

/* 動画セクションに和紙の質感をうっすら */
.videos.section { position: relative; }
.videos.section::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("../images/fx/washi.webp") center / 520px repeat;
  opacity: .035;
  mix-blend-mode: screen;
}
.videos.section > .container { position: relative; z-index: 1; }

/* ---------- 見出し：金の線が伸びる ---------- */
.section-title { position: relative; display: inline-block; }
.section-title::after {
  content: "";
  display: block;
  height: 2px;
  width: 0;
  margin-top: 10px;
  background: linear-gradient(90deg, var(--gold, #C4A44A), transparent);
  transition: width 1.1s var(--fx-ease) .25s;
}
.section-title.visible::after { width: 100%; }

/* ---------- 動画カード：立体感・NEW・出現 ---------- */
.video-grid { perspective: 1200px; }

.video-card {
  position: relative;
  transform-style: preserve-3d;
  transition: transform .35s var(--fx-ease), box-shadow .35s ease, border-color .3s ease;
  will-change: transform;
}
.video-card.fx-in { animation: fx-card-in .7s var(--fx-ease) both; animation-delay: var(--fx-delay, 0ms); }
@keyframes fx-card-in {
  from { opacity: 0; transform: translateY(26px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.video-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(223,192,106,.22), transparent 55%);
  transition: opacity .3s ease;
}
.video-card:hover::after { opacity: 1; }

.fx-new {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  padding: 3px 9px 2px;
  border-radius: 999px;
  font-family: "Inter", sans-serif;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .14em;
  color: #1a2410;
  background: linear-gradient(135deg, #f0d680, #c4a44a);
  box-shadow: 0 2px 10px rgba(196,164,74,.55);
}
.fx-new::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #1a2410;
  animation: fx-pulse 1.6s ease-in-out infinite;
}
@keyframes fx-pulse { 50% { transform: scale(.45); opacity: .5; } }

/* ---------- 浮遊CTA：呼吸 ---------- */
.floating-cta { animation: fx-float 4.6s ease-in-out infinite; }
@keyframes fx-float { 50% { transform: translateY(-5px); } }

/* ---------- モバイル ---------- */
@media (max-width: 768px) {
  .fx-eyebrow { font-size: 11px; letter-spacing: .2em; }
  .fx-eyebrow::before { width: 22px; flex: none; }
  .fx-layer { inset: -2%; background-position: center 30%; }
  .fx-stat { min-width: 108px; padding: 10px 12px 9px; }
  .fx-stat b { font-size: 23px; }
  .fx-scroll { display: none; }
}

/* ---------- 動きを減らす設定の人には止める ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx-layer.is-active { animation: none; transform: scale(1.04); }
  .fx-layer { transition: none; }
  #fxCanvas, .fx-scroll { display: none; }
  .video-card.fx-in { animation: none; }
  .fx-new::before, .floating-cta { animation: none; }
  .section-title::after { transition: none; width: 100%; }
  .video-card { transition: none; }
}
