/**
 * persist-web.com トップ｜スクロール演出（2026-10-17 v1）
 * 設計書：design_top_motion_20261017.md
 * 演出はすべて html.pm-motion 配下に限定（JS無効・reduced-motion・停止ボタンOFF時は既存の静的表示のまま）
 */

:root {
  --pm-gold: #c9a962;
  --pm-gold-light: #e5d4a1;
  --pm-night: #0a1628;
  --pm-ivory: #faf6ee;
  --pm-sunrise: #e8b98a;
  --pm-dawn: 0;
}

/* ===== FVの収まり（演出と無関係・常に適用／2026-10-18） =====
   既存は余白・文字サイズが横幅だけで決まり、高さの低い画面（例 1470×753）でFVが1,463pxになり
   キャッチコピーが最初の画面で切れていた。高さにも合わせて縮め、1画面に収める。 */
.hero { min-height: 100vh; min-height: 100svh; padding: 0; } /* 全セクション共通の上下192pxの余白がFVにも効いていたため外す */
.hero-content {
  padding-top: calc(var(--header-height) + clamp(16px, 4vh, 64px));
  padding-bottom: clamp(48px, 8vh, 96px);
}
.hero-label { margin-bottom: clamp(16px, 3vh, 40px); }
.hero-title { margin-bottom: clamp(16px, 3vh, 40px); }
.hero-title-main { font-size: clamp(2.75rem, min(8vw, 12.5vh), 7rem); }
.hero-title-sub { margin-top: clamp(8px, 2vh, 24px); }
.hero-description { margin-bottom: clamp(20px, 3.5vh, 48px); }
@media (max-width: 1024px) {
  .hero-content {
    padding-top: calc(var(--header-height) + clamp(8px, 2vh, 32px));
    padding-bottom: clamp(48px, 8vh, 80px);
  }
  .hero-title-main { font-size: clamp(2.5rem, min(11vw, 9vh), 4.5rem); }
  .hero-actions { gap: 12px; }
}

/* ===== 実績：2本の光の年表（常に適用／2026-10-19） =====
   同じ形の4列＋区切り線（テンプレート調）をやめ、2014→2026 の線上に実績を「通過点」として置く。
   金＝パーシスト・青＝お客様。数字に強弱（取引企業数を主役）、左寄せ。 */
.pm-tl { --pm-tl: 1; padding: clamp(80px, 12vh, 128px) 0; }
.pm-tl .stats-bg-gradient {
  background: radial-gradient(55% 90% at 88% 55%, rgba(201, 169, 98, 0.10), transparent 70%),
              radial-gradient(45% 80% at 10% 40%, rgba(45, 90, 172, 0.16), transparent 70%);
}
.pm-tl-head {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 48px;
}
.pm-tl-label {
  font-family: var(--font-accent);
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-gold, #c9a962);
}
.pm-tl-years {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.78);
}
.pm-tl-arrow { display: block; width: 72px; height: 1px; background: linear-gradient(90deg, rgba(229,212,161,0.2), var(--color-gold, #c9a962)); }
.pm-tl-body { position: relative; height: 380px; }
.pm-tl-track { position: absolute; left: 0; right: 0; top: 50%; height: 8px; margin-top: -4px; pointer-events: none; }
.pm-tl-line {
  position: absolute;
  left: 0;
  right: -6vw; /* 右端の外へ＝その先へ */
  height: 2px;
  transform: scaleX(var(--pm-tl));
  transform-origin: left center;
}
.pm-tl-line--gold { top: 0; background: linear-gradient(90deg, rgba(201,169,98,0.15), #c9a962 30%, #e5d4a1); box-shadow: 0 0 10px rgba(201,169,98,0.45); }
.pm-tl-line--blue { top: 6px; background: linear-gradient(90deg, rgba(74,125,212,0.15), #4a7dd4 30%, #8fb0ea); box-shadow: 0 0 10px rgba(74,125,212,0.4); }
.pm-tl-points {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1.55fr 1fr 1fr;
  gap: 0 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pm-tl .stat-item {
  position: relative;
  height: 50%;
  padding: 0 16px 0 0;
  text-align: left;
  display: flex;
  flex-direction: column;
}
.pm-tl .stat-item::after { display: none; }
.pm-tl .stat-content { justify-content: flex-start; margin-bottom: 8px; }
.pm-tl .stat-number { font-size: clamp(3rem, 4.4vw, 4.5rem); }
.pm-tl .stat-label { color: rgba(255, 255, 255, 0.72); letter-spacing: 0.12em; }
.pm-tl .stat-label sup { font-size: 0.7em; margin-left: 2px; color: rgba(229, 212, 161, 0.85); }
.pm-tl .pm-tl-point--up { align-self: start; justify-content: flex-end; padding-bottom: 40px; }
.pm-tl .pm-tl-point--down { align-self: end; justify-content: flex-start; padding-top: 44px; }
.pm-tl .pm-tl-point--main .stat-number { font-size: clamp(5rem, 8.5vw, 8rem); }
.pm-tl .pm-tl-point--main .stat-unit { font-size: clamp(1.25rem, 1.8vw, 1.75rem); }
/* 線上の通過点 */
.pm-tl .stat-item::before {
  content: "";
  position: absolute;
  left: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid #e5d4a1;
  background: #0a1628;
  box-shadow: 0 0 0 4px rgba(201, 169, 98, 0.12);
}
.pm-tl-point--up::before { bottom: -6px; }
.pm-tl-point--down::before { top: -3px; }
.pm-tl-note {
  position: relative;
  margin-top: 32px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.68);
  text-align: right;
}
@media (max-width: 768px) {
  .pm-tl-head { flex-direction: column; gap: 12px; margin-bottom: 32px; }
  .pm-tl-years { font-size: 18px; }
  .pm-tl-body { height: auto; padding-left: 36px; }
  .pm-tl-track { top: 0; bottom: 0; left: 8px; right: auto; width: 8px; height: auto; margin-top: 0; }
  .pm-tl-line { top: 0; bottom: -40px; right: auto; width: 2px; height: auto; transform: scaleY(var(--pm-tl)); transform-origin: center top; }
  .pm-tl-line--gold { left: 0; }
  .pm-tl-line--blue { left: 6px; top: 0; }
  .pm-tl-points { display: flex; flex-direction: column; gap: 40px; height: auto; }
  .pm-tl .stat-item { height: auto; padding: 0; justify-content: flex-start; }
  .pm-tl .pm-tl-point--up, .pm-tl .pm-tl-point--down { padding: 0; align-self: auto; }
  .pm-tl .stat-item::before { left: -32px; top: 0.9em; bottom: auto; }
  .pm-tl .pm-tl-point--main .stat-number { font-size: 4.25rem; }
  .pm-tl-note { text-align: left; }
}
html.pm-motion .pm-tl { --pm-tl: 0; } /* 演出ON時だけ、スクロールで線を伸ばす（JSが値を更新） */

/* ===== 停止ボタン（モードに関係なく常に表示＝再開もできる） ===== */
.pm-toggle {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 1001;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(201, 169, 98, 0.5);
  border-radius: 9999px;
  background: rgba(10, 22, 40, 0.72);
  color: var(--pm-gold-light);
  font-family: var(--font-accent);
  font-size: 11px;
  letter-spacing: 0.12em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pm-toggle-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
}
html.pm-motion .pm-toggle-dot { opacity: 1; }
.pm-toggle:focus-visible { outline: 2px solid var(--pm-gold); outline-offset: 3px; }

/* ===== 静的表示（JS無効・停止・reduced-motion・依存ライブラリ読込失敗） =====
   既存 style.css は登場演出の前提で本文を opacity:0 にしているため、演出OFF時は全部見せる */
html:not(.pm-motion) .reveal-element,
html:not(.pm-motion) .reveal-split > *,
html:not(.pm-motion) .reveal-split-words .word,
html:not(.pm-motion) .philosophy-copy .word {
  opacity: 1 !important;
  transform: none !important;
}
html:not(.pm-motion) *,
html:not(.pm-motion) *::before,
html:not(.pm-motion) *::after {
  animation: none !important;
}
html:not(.pm-motion) { scroll-behavior: auto; }
/* 2026-10-18：style.css の html{scroll-behavior:smooth} が Lenis の毎フレームのスクロールと競合し、
   ホイールの反応が約0.5〜1秒遅れていた（Lenis 公式推奨CSSと同じく、Lenis 稼働中は無効にする） */
html.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.pm-toggle[aria-disabled="true"] { opacity: 0.6; cursor: default; }

/* 演出を飛ばすリンク・読み込み線・地平線・粒子は演出ON時のみ */
.pm-skip,
.pm-loader,
.pm-horizon,
.pm-canvas { display: none; }

/* ===== A. 読み込み：金の線 ===== */
html.pm-motion .pm-loader {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--pm-night);
}
html.pm-motion .pm-loader-line {
  position: absolute;
  left: 8%;
  width: 84%;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, rgba(201,169,98,0) 0%, var(--pm-gold) 18%, var(--pm-gold-light) 82%, rgba(229,212,161,0) 100%);
  transform: scaleX(0);
  transform-origin: left center;
  box-shadow: 0 0 12px rgba(201, 169, 98, 0.6);
}
html.pm-motion.pm-loaded .pm-loader { pointer-events: none; }

/* ===== B. FV：寄り添って昇る2本の光（黒背景の映像を screen 合成＝黒は透明扱い） ===== */
.pm-fv,
.pm-fv-still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: screen;
}
.pm-fv { display: none; }
.pm-fv-still { object-fit: cover; object-position: 62% 50%; opacity: 0.85; }
@media (min-width: 769px) {
  /* 動画（canvas）と同じく、PCは光を本文から離して写真側へ寄せる */
  .pm-fv-still { transform: translateX(10%); }
}
html.pm-motion .pm-fv { display: block; }
html.pm-motion .pm-fv-still { display: none; }

/* ===== B. FV：地平線と粒子 ===== */
html.pm-motion .pm-horizon {
  display: block;
  position: absolute;
  left: 8%;
  width: 84%;
  top: calc(100vh - 56px);
  top: calc(100svh - 56px);
  height: 1px;
  z-index: 1;
  background: linear-gradient(90deg, rgba(201,169,98,0) 0%, var(--pm-gold) 18%, var(--pm-gold-light) 82%, rgba(229,212,161,0) 100%);
  box-shadow: 0 0 12px rgba(201, 169, 98, 0.45);
  transform-origin: left center;
  pointer-events: none;
}
html.pm-motion .pm-canvas {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
}
/* 粒子より前に出す本文 */
html.pm-motion .hero-content,
html.pm-motion .services .container,
html.pm-motion .services-showcase { position: relative; z-index: 2; }

/* 「その先へ」に走る金の光（--pm-shine 0→1） */
html.pm-motion .hero-title .gradient-text {
  background-image: linear-gradient(100deg,
    var(--pm-gold) 0%, var(--pm-gold) 42%,
    #fff6e0 50%,
    var(--pm-gold-light) 58%, var(--pm-gold) 100%);
  background-size: 300% 100%;
  background-position: calc(100% - var(--pm-shine, 0) * 100%) 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

html.pm-motion .pm-skip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 16px;
  font-family: var(--font-accent);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(229, 212, 161, 0.75);
  border-bottom: 1px solid rgba(229, 212, 161, 0.35);
}
html.pm-motion .pm-skip:hover { color: var(--pm-gold-light); }

/* ===== D. サービス：弧のギャラリー ===== */
html.pm-motion .services.pm-arc-on {
  position: relative;
  height: 100vh;
  min-height: 640px;
  overflow: hidden;
  padding: 0;
}
html.pm-motion .services.pm-arc-on > .container:first-child {
  padding-top: calc(var(--header-height-scrolled, 72px) + 32px);
}
html.pm-motion .services.pm-arc-on .section-header {
  margin-bottom: 0;
  text-align: left;
  align-items: flex-start;
}
html.pm-motion .services.pm-arc-on .section-subtitle { margin-left: 0; }
html.pm-motion .services.pm-arc-on .section-title { font-size: clamp(2rem, 3.4vw, 3.25rem); }
/* CTAの入れ物は位置の基準にしない（CTAをセクション右下に置くため） */
html.pm-motion .services.pm-arc-on > .container.pm-cta-wrap { position: static; }
html.pm-motion .services.pm-arc-on .services-showcase {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5vh;
  height: 340px;
  margin: 0;
  padding: 0;
  max-width: none;
  display: block;
}
html.pm-motion .services.pm-arc-on .service-card {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 324px;
  height: 320px;
  margin-left: -162px;
  transform-origin: 50% 1700px;
  will-change: transform, opacity;
  transition: border-color 0.4s, box-shadow 0.4s;
}
html.pm-motion .services.pm-arc-on .service-card:hover { transform: none; }
html.pm-motion .services.pm-arc-on .service-card-inner {
  height: 100%;
  padding: 40px 32px;
}
html.pm-motion .services.pm-arc-on .service-title { font-size: 1.75rem; line-height: 1.45; }
html.pm-motion .services.pm-arc-on .service-description { font-size: 1rem; line-height: 1.9; }
html.pm-motion .services.pm-arc-on .service-description {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s var(--ease-out-expo), transform 0.5s var(--ease-out-expo);
}
html.pm-motion .services.pm-arc-on .service-card.is-current {
  border-color: var(--pm-gold);
  box-shadow: 0 16px 40px rgba(10, 22, 40, 0.12);
}
html.pm-motion .services.pm-arc-on .service-card.is-current .service-description {
  opacity: 1;
  transform: none;
}
html.pm-motion .services.pm-arc-on .service-card.is-current .service-number { color: var(--pm-gold); }
html.pm-motion .services.pm-arc-on .services-cta {
  position: absolute;
  right: 5vw;
  bottom: 3vh;
  margin: 0;
  z-index: 3;
}
.pm-arc-counter { display: none; }
html.pm-motion .services.pm-arc-on .pm-arc-counter {
  display: block;
  position: absolute;
  right: 5vw;
  top: calc(var(--header-height-scrolled, 72px) + 40px);
  z-index: 3;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
}
.pm-arc-counter span { color: var(--color-gray-600, #475569); }

/* ===== E. プロセス：伴走の2本線（金＝パーシスト・青＝お客様）が点を灯す ===== */
html.pm-motion .process-line { width: 8px; margin-left: -3px; background: none; }
html.pm-motion .process-line::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--color-gray-200, #e2e8f0) 0 2px, transparent 2px 6px, var(--color-gray-200, #e2e8f0) 6px 8px);
}
html.pm-motion .process-line-progress {
  position: relative;
  transition: none;
  background: linear-gradient(90deg, var(--pm-gold) 0 2px, transparent 2px 6px, #4a7dd4 6px 8px);
  filter: drop-shadow(0 0 5px rgba(201, 169, 98, 0.45));
}
html.pm-motion .process-line-progress::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--pm-gold-light);
  box-shadow: 0 0 16px 4px rgba(201, 169, 98, 0.7);
}
html.pm-motion .process-item .process-marker { transition: border-color 0.5s, background-color 0.5s, box-shadow 0.5s; }
html.pm-motion .process-item.is-lit .process-marker {
  border-color: var(--pm-gold);
  box-shadow: 0 0 0 6px rgba(201, 169, 98, 0.12);
}
html.pm-motion .process-item.is-lit .process-step { color: var(--pm-gold); }

/* ===== F. 夜明け：明るい面が温まり、CTAに光が昇る ===== */
@supports (background: color-mix(in srgb, red 50%, blue)) {
  html.pm-motion .philosophy,
  html.pm-motion .services,
  html.pm-motion .team {
    background-color: color-mix(in srgb, var(--pm-ivory) calc(var(--pm-dawn) * 100%), #f8fafc);
  }
}
html.pm-motion .cta::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(90% 70% at 50% 100%, rgba(232, 185, 138, 0.5) 0%, rgba(201, 169, 98, 0.22) 38%, rgba(10, 22, 40, 0) 72%);
  opacity: var(--pm-sun, 0);
}
html.pm-motion .cta .container { position: relative; z-index: 2; }

/* ===== G. 細部 ===== */
html.pm-motion .section-label,
html.pm-motion .hero-title-sub {
  display: inline-block;
  transform: skewX(calc(var(--pm-skew, 0) * 1deg));
  transition: transform 0.2s linear;
}
html.pm-motion .team-card-image img { transition: transform 1.2s var(--ease-out-expo), filter 1.2s var(--ease-out-expo); }
html.pm-motion .team-card-image:hover img { transform: scale(1.03); filter: saturate(1.08); }

/* ===== モバイル ===== */
@media (max-width: 768px) {
  .pm-toggle { left: 12px; bottom: 12px; width: 44px; padding: 0; justify-content: center; }
  .pm-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .pm-toggle-dot { width: 8px; height: 8px; }
  html.pm-motion .pm-horizon { top: calc(100vh - 40px); top: calc(100svh - 40px); }
  /* スマホのFVは全面に本文があるため、光を半分の濃さにして読みやすさを優先 */
  .pm-fv, .pm-fv-still { opacity: 0.5; }
  html.pm-motion .services.pm-arc-on .section-subtitle { display: none; }
  html.pm-motion .services.pm-arc-on .services-showcase { bottom: 13vh; height: 310px; }
  html.pm-motion .services.pm-arc-on .service-card {
    width: 256px;
    height: 290px;
    margin-left: -128px;
    transform-origin: 50% 1100px;
  }
  html.pm-motion .services.pm-arc-on .service-card-inner { padding: 20px; }
  html.pm-motion .services.pm-arc-on .service-title { font-size: 1.375rem; line-height: 1.5; margin-bottom: 8px; }
  html.pm-motion .services.pm-arc-on .service-description { font-size: 0.875rem; line-height: 1.8; }
  html.pm-motion .services.pm-arc-on .services-cta { right: auto; left: 50%; transform: translateX(-50%); bottom: 2vh; }
  html.pm-motion .services.pm-arc-on .services-cta .btn-large { padding: 1rem 1.5rem; white-space: nowrap; }
  html.pm-motion .services.pm-arc-on .pm-arc-counter { bottom: auto; top: calc(var(--header-height-scrolled, 72px) + 8px); left: auto; right: 24px; transform: none; font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .pm-loader, .pm-canvas, .pm-horizon { display: none !important; }
}
