/*! scroll-fx.css : スクロール演出27種の見た目（scroll-fx.js とセット）
 * 方針：
 *  - 初期の隠し状態は html.fx-js が付いた時だけ（JSが動かない／読み込み失敗なら内容は見えたまま）
 *  - prefers-reduced-motion: reduce の端末では大きな動きを止め、ふわっと出る動き（透明→表示）だけ残す（JSは fx-js の代わりに fx-soft を付ける）
 *  - 演出が終わったら .fx-done を付け、要素本来のスタイル（ホバー等）に戻す
 */
:root { --fx-ease: cubic-bezier(.22, .61, .36, 1); }

/* 横スクロールの土台（JS無し・視差効果を減らす設定でも、指で横に送れる） */
[data-fx~="horizontal-scroll"] [data-fx-track] { display: flex; gap: var(--fx-gap, 1rem); overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
[data-fx~="horizontal-scroll"] [data-fx-track] > * { flex: 0 0 auto; width: var(--fx-item-w, min(78vw, 420px)); scroll-snap-align: start; }

/* ページ内ナビの現在地（動きではないので設定に関係なく有効） */
[data-fx~="scrollspy"] a[aria-current] { color: var(--fx-spy-color, #b02a00); font-weight: 700; background-color: var(--fx-spy-bg, #ffe8d6); }

/* マーキーは、JSが動かない・視差効果を減らす設定の時は折り返して全部見せる */
html:not(.fx-js) [data-fx~="marquee"] { display: flex; flex-wrap: wrap; gap: .75rem; }

/* 写真の動き（25・26）は、JSが動かない・視差効果を減らす設定の時は、普通の写真として枠に収めて見せる */
[data-fx~="ken-burns"] img, [data-fx~="slideshow"] img { max-width: 100%; height: auto; }
[data-fx~="ken-burns"] { overflow: hidden; }

/* 文字を分割した時の読み上げ用（見えない） */
.fx-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: no-preference) {

  html.fx-clip { overflow-x: hidden; }
  @supports (overflow: clip) { html.fx-clip, html.fx-clip body { overflow-x: clip; } }

  /* 01 フェードイン */
  .fx-js [data-fx~="fade-in"]:not(.fx-in) { opacity: 0; transform: translate3d(0, var(--fx-dist, 28px), 0); }
  .fx-js [data-fx~="fade-in"].fx-in:not(.fx-done) { opacity: 1; transform: none;
    transition: opacity var(--fx-dur, .8s) var(--fx-ease) var(--fx-delay, 0s), transform var(--fx-dur, .8s) var(--fx-ease) var(--fx-delay, 0s); }

  /* 02 スライドイン（data-fx-from="left|right"） */
  .fx-js [data-fx~="slide-in"]:not(.fx-in) { opacity: 0; transform: translate3d(var(--fx-x, -44px), 0, 0); }
  .fx-js [data-fx~="slide-in"][data-fx-from="right"] { --fx-x: 44px; }
  .fx-js [data-fx~="slide-in"].fx-in:not(.fx-done) { opacity: 1; transform: none;
    transition: opacity var(--fx-dur, .8s) var(--fx-ease) var(--fx-delay, 0s), transform var(--fx-dur, .8s) var(--fx-ease) var(--fx-delay, 0s); }

  /* 03 スタッガー（親に付ける。子が順番に出る） */
  .fx-js [data-fx~="stagger"]:not(.fx-in) > * { opacity: 0; transform: translate3d(0, 22px, 0); }
  .fx-js [data-fx~="stagger"].fx-in:not(.fx-done) > * { opacity: 1; transform: none;
    transition: opacity .7s var(--fx-ease) calc(var(--fx-i, 0) * var(--fx-step, .12s)), transform .7s var(--fx-ease) calc(var(--fx-i, 0) * var(--fx-step, .12s)); }

  /* 04 テキストリビール */
  .fx-js [data-fx~="text-reveal"] .fx-ch { display: inline-block; }
  .fx-js [data-fx~="text-reveal"] .fx-w { display: inline-block; white-space: nowrap; }
  .fx-js [data-fx~="text-reveal"]:not(.fx-in) .fx-ch { opacity: 0; transform: translate3d(0, .75em, 0); }
  .fx-js [data-fx~="text-reveal"].fx-in .fx-ch { opacity: 1; transform: none;
    transition: opacity .55s var(--fx-ease) calc(var(--fx-i, 0) * var(--fx-cstep, 30ms)), transform .7s var(--fx-ease) calc(var(--fx-i, 0) * var(--fx-cstep, 30ms)); }

  /* 05 マスクリビール（data-fx-dir="left|right|up|down"。既定は左から） */
  .fx-js [data-fx~="mask-reveal"]:not(.fx-in) { clip-path: inset(0 100% 0 0); }
  .fx-js [data-fx~="mask-reveal"][data-fx-dir="right"]:not(.fx-in) { clip-path: inset(0 0 0 100%); }
  .fx-js [data-fx~="mask-reveal"][data-fx-dir="up"]:not(.fx-in) { clip-path: inset(100% 0 0 0); }
  .fx-js [data-fx~="mask-reveal"][data-fx-dir="down"]:not(.fx-in) { clip-path: inset(0 0 100% 0); }
  .fx-js [data-fx~="mask-reveal"].fx-in:not(.fx-done) { clip-path: inset(0 0 0 0); transition: clip-path var(--fx-dur, 1.1s) var(--fx-ease) var(--fx-delay, 0s); }

  /* 06 ブラーイン */
  .fx-js [data-fx~="blur-in"]:not(.fx-in) { filter: blur(var(--fx-blur, 16px)); opacity: .15; }
  .fx-js [data-fx~="blur-in"].fx-in:not(.fx-done) { filter: blur(0); opacity: 1;
    transition: filter var(--fx-dur, 1.1s) var(--fx-ease) var(--fx-delay, 0s), opacity var(--fx-dur, 1.1s) var(--fx-ease) var(--fx-delay, 0s); }

  /* 07 タイプライター */
  .fx-js [data-fx~="typewriter"] .fx-tc { visibility: hidden; }
  .fx-js [data-fx~="typewriter"] .fx-tc.fx-on { visibility: visible; }
  .fx-caret { display: inline-block; width: .09em; height: 1em; margin-left: .06em; vertical-align: -.12em; background: currentColor; animation: fx-blink .8s steps(1) infinite; }
  @keyframes fx-blink { 50% { opacity: 0; } }

  /* 08 カウントアップ（数字が踊らない幅） */
  .fx-js [data-fx~="count-up"] { font-variant-numeric: tabular-nums; }

  /* 09 スクロール連動（読了バー） */
  .fx-js [data-fx~="scroll-progress"] { position: fixed; top: 0; left: 0; right: 0; height: var(--fx-bar-h, 4px); z-index: 2147483000; pointer-events: none;
    background: var(--fx-bar-color, #e8590c); transform-origin: 0 50%; transform: scaleX(var(--fx-p, 0)); }

  /* 10 パララックス（背景画像は疑似要素に移して動かす） */
  .fx-js .fx-pbg { position: relative; isolation: isolate; overflow: hidden; background-image: none !important; }
  .fx-js .fx-pbg::before { content: ""; position: absolute; left: 0; right: 0; top: -15%; bottom: -15%; z-index: -1;
    background-image: var(--fx-bgimg); background-size: var(--fx-bgsize, cover); background-position: var(--fx-bgpos, center); background-repeat: var(--fx-bgrep, no-repeat);
    transform: translate3d(0, var(--fx-py, 0px), 0); will-change: transform; }
  .fx-js .fx-pimg { transform: translate3d(0, var(--fx-py, 0px), 0) scale(1.2); will-change: transform; }

  /* 11 スクロールズーム / 12 画像シーケンス / 18 ピン留め+スクラブ / 22 横スクロール：
     縦に長い区画の中で、画面に貼り付くステージが進行度に合わせて変わる */
  .fx-js [data-fx~="scroll-zoom"] { position: relative; height: calc(var(--fx-len, 250) * 1vh); }
  .fx-js [data-fx~="image-sequence"] { position: relative; height: calc(var(--fx-len, 400) * 1vh); }
  .fx-js [data-fx~="pin-scrub"] { position: relative; height: calc(var(--fx-len, 300) * 1vh); }
  .fx-js [data-fx~="horizontal-scroll"] { position: relative; }
  .fx-js :is([data-fx~="scroll-zoom"], [data-fx~="image-sequence"], [data-fx~="pin-scrub"], [data-fx~="horizontal-scroll"]) > .fx-stage {
    position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
  .fx-js [data-fx~="scroll-zoom"] > .fx-stage { display: flex; align-items: center; justify-content: center; }
  .fx-js [data-fx~="scroll-zoom"] .fx-media { width: 100%; height: 100%; object-fit: cover; transform-origin: center; will-change: transform; }
  .fx-js [data-fx~="image-sequence"] > .fx-stage { display: flex; align-items: center; justify-content: center; }
  .fx-js [data-fx~="image-sequence"] canvas { width: 100%; height: 100%; display: block; }
  .fx-js [data-fx~="image-sequence"] .fx-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .fx-js [data-fx~="pin-scrub"] > .fx-stage { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1.2rem; padding: 0 1rem; }
  .fx-js [data-fx~="pin-scrub"] [data-fx-step] { opacity: 0; transform: translate3d(0, 24px, 0); transition: opacity .5s var(--fx-ease), transform .5s var(--fx-ease); }
  .fx-js [data-fx~="pin-scrub"] [data-fx-step].fx-on { opacity: 1; transform: none; }
  .fx-js [data-fx~="pin-scrub"][data-fx-mode="swap"] [data-fx-step] { position: absolute; left: 1rem; right: 1rem; }
  .fx-js [data-fx~="pin-scrub"] .fx-bar { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: var(--fx-bar-color, #e8590c); transform-origin: 0 50%; transform: scaleX(var(--fx-p, 0)); }
  .fx-js [data-fx~="horizontal-scroll"] [data-fx-track] { overflow: visible; width: max-content; min-width: 100%; flex-wrap: nowrap; scroll-snap-type: none; padding: 0 var(--fx-pad, 1rem); will-change: transform; align-items: center; height: 100%; box-sizing: border-box; }
  .fx-js [data-fx~="horizontal-scroll"] [data-fx-track] > * { scroll-snap-align: none; }

  /* 13 SVGラインドロー：JSが stroke-dash を直接動かす */

  /* 14 テキストフィル */
  .fx-js [data-fx~="text-fill"] .fx-fc { opacity: .25; transition: opacity .25s linear; }
  .fx-js [data-fx~="text-fill"] .fx-fc.fx-on { opacity: 1; }

  /* 16 マーキー */
  .fx-js [data-fx~="marquee"] { overflow: hidden; }
  .fx-mq-track { display: flex; width: max-content; will-change: transform; }
  .fx-mq-set { display: flex; flex: none; align-items: center; gap: var(--fx-gap, 2rem); padding-right: var(--fx-gap, 2rem); }
  .fx-mq-set > * { flex: none; }

  /* 17 スティッキー */
  .fx-js [data-fx~="sticky"] { position: sticky; top: var(--fx-top, 0px); z-index: 20; background-color: var(--fx-solid-bg, #fff); }

  /* 19 スクロールテリング */
  .fx-js [data-fx~="scrollytelling"] { display: grid; grid-template-columns: 1fr; position: relative; }
  .fx-js [data-fx~="scrollytelling"] [data-fx-figs] { position: sticky; top: 0; z-index: 3; height: 42vh; background-color: var(--fx-solid-bg, #fff); overflow: hidden; }
  .fx-js [data-fx~="scrollytelling"] [data-fx-fig] { position: absolute; inset: 0; opacity: 0; transition: opacity .5s var(--fx-ease); display: flex; align-items: center; justify-content: center; }
  .fx-js [data-fx~="scrollytelling"] [data-fx-fig].fx-on { opacity: 1; }
  .fx-js [data-fx~="scrollytelling"] [data-fx-fig] img, .fx-js [data-fx~="scrollytelling"] [data-fx-fig] svg { max-width: 100%; max-height: 100%; }
  .fx-js [data-fx~="scrollytelling"] [data-fx-step] { min-height: 60vh; display: flex; flex-direction: column; justify-content: center; padding: 1.5rem 1rem; opacity: .35; transition: opacity .4s; }
  .fx-js [data-fx~="scrollytelling"] [data-fx-step].fx-cur { opacity: 1; }
  @media (min-width: 768px) {
    .fx-js [data-fx~="scrollytelling"] { grid-template-columns: 1fr 1fr; align-items: start; }
    .fx-js [data-fx~="scrollytelling"] [data-fx-figs] { height: 100vh; order: 2; }
    .fx-js [data-fx~="scrollytelling"] [data-fx-steps] { order: 1; }
    .fx-js [data-fx~="scrollytelling"] [data-fx-step] { min-height: 100vh; }
  }

  /* 20 カードスタック（子が順に貼り付いて重なる） */
  .fx-js [data-fx~="stacking-cards"] > * { position: sticky; top: calc(var(--fx-top, 4.5rem) + var(--fx-i, 0) * var(--fx-offset, .9rem)); margin-bottom: var(--fx-gap, 2.5rem); }

  /* 21 スクロールスナップ（ページ全体、または高さを決めた箱の中） */
  html.fx-snap { scroll-snap-type: y mandatory; }
  .fx-snap-box { scroll-snap-type: y mandatory; }
  .fx-js .fx-snap-page > * { min-height: 100vh; min-height: 100svh; scroll-snap-align: start; box-sizing: border-box; }
  .fx-js .fx-snap-box > * { min-height: 100%; scroll-snap-align: start; box-sizing: border-box; }

  /* 23 隠れるヘッダー */
  .fx-js .fx-hh { transition: transform .35s var(--fx-ease); }
  .fx-js .fx-hh.fx-hh-stick { position: sticky; top: 0; z-index: 1000; }
  .fx-js .fx-hh.fx-hidden { transform: translate3d(0, -110%, 0); }

  /* 25 ケンバーンズ（枠の中で写真がゆっくり拡大し続ける。data-fx-zoom="1.12" data-fx-dur="16000"） */
  .fx-js [data-fx~="ken-burns"] { overflow: hidden; }
  .fx-js [data-fx~="ken-burns"] > img, .fx-js [data-fx~="ken-burns"] > picture img, .fx-js [data-fx~="ken-burns"] > video {
    display: block; width: 100%; height: 100%; object-fit: cover; transform-origin: var(--fx-kb-origin, 50% 50%);
    animation: fx-kb var(--fx-kb-dur, 16s) ease-in-out infinite alternate; }
  .fx-js [data-fx~="ken-burns"].fx-paused > img, .fx-js [data-fx~="ken-burns"].fx-paused > picture img, .fx-js [data-fx~="ken-burns"].fx-paused > video { animation-play-state: paused; }
  @keyframes fx-kb { from { transform: scale(1); } to { transform: scale(var(--fx-kb-zoom, 1.12)); } }

  /* 26 スライドショー（子の写真が自動でふわっと入れ替わる。data-fx-interval="4500" data-fx-ratio="16/9"） */
  .fx-js [data-fx~="slideshow"] { position: relative; overflow: hidden; aspect-ratio: var(--fx-ratio, 16 / 9); }
  .fx-js [data-fx~="slideshow"] > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; margin: 0; opacity: 0; transition: opacity var(--fx-fade, 1.2s) var(--fx-ease); }
  .fx-js [data-fx~="slideshow"] > .fx-on { opacity: 1; }

  /* 27 ホバーエフェクト（触れると少し拡大して浮き上がる。スマホは押している間。影は使わない） */
  [data-fx~="hover-lift"] { transition: transform .35s var(--fx-ease); }
  @media (hover: hover) {
    [data-fx~="hover-lift"]:hover, [data-fx~="hover-lift"]:focus-within { transform: translate3d(0, var(--fx-lift, -6px), 0) scale(var(--fx-hover-scale, 1.03)); }
  }
  [data-fx~="hover-lift"]:active { transform: translate3d(0, var(--fx-lift, -6px), 0) scale(var(--fx-hover-scale, 1.03)); }
}

/* 視差効果を減らす設定：移動・拡大・揺れ・貼り付きは止める。ふわっと出る動き（透明→表示）・写真の入れ替えは残す
   （止めすぎると「動きが入っていない」ページに見える。2026-11-30 田口さん指摘・10-29 角崎さんと同型） */
@media (prefers-reduced-motion: reduce) {
  [data-fx] { animation: none !important; }
  html:not(.fx-soft) [data-fx] { transition: none !important; }
  .fx-soft [data-fx]:not([data-fx~="slideshow"]) { transform: none !important; }

  /* 01 02 04 05 06 は、ふわっと出るだけにする */
  .fx-soft :is([data-fx~="fade-in"], [data-fx~="slide-in"], [data-fx~="text-reveal"], [data-fx~="mask-reveal"], [data-fx~="blur-in"]):not(.fx-in) { opacity: 0; }
  .fx-soft :is([data-fx~="fade-in"], [data-fx~="slide-in"], [data-fx~="text-reveal"], [data-fx~="mask-reveal"], [data-fx~="blur-in"]).fx-in:not(.fx-done) { opacity: 1;
    transition: opacity var(--fx-dur, .9s) ease var(--fx-delay, 0s); }

  /* 03 スタッガー：子が順番にふわっと出る（動かさない） */
  .fx-soft [data-fx~="stagger"]:not(.fx-in) > * { opacity: 0; }
  .fx-soft [data-fx~="stagger"].fx-in:not(.fx-done) > * { opacity: 1;
    transition: opacity .7s ease calc(var(--fx-i, 0) * var(--fx-step, .12s)); }

  /* 08 カウントアップ（数字が踊らない幅） */
  .fx-soft [data-fx~="count-up"] { font-variant-numeric: tabular-nums; }

  /* 26 スライドショー：写真がふわっと入れ替わる（動かない） */
  .fx-soft [data-fx~="slideshow"] { position: relative; overflow: hidden; aspect-ratio: var(--fx-ratio, 16 / 9); }
  .fx-soft [data-fx~="slideshow"] > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; margin: 0; opacity: 0; transition: opacity var(--fx-fade, 1.2s) ease; }
  .fx-soft [data-fx~="slideshow"] > .fx-on { opacity: 1; }
}
