/* トップのファーストビューの背景（2026-12-01）。既定は C（淡い紫の斜めの面。境目は緩い波）。
   比較のため、クエリ ?bg= で替えられる（既存の互換）：?bg=c は既定と同じ、?bg=a / b は従来の案、?bg=bars は従来の既定（ロゴの棒グラフの輪郭）。
   決まりごと：塗りつぶした丸・左縦線・影・グラデーションの陰影は使わない。色は tokens.css の値だけ（直書きしない）。
   波は飾りで、消しても意味は変わらない（aria-hidden 相当：擬似要素、操作を受けない）。
   動き：prefers-reduced-motion: no-preference のときだけ、境目がゆっくり揺れる。止まらない動きは足さない（top-motion.css の決まり）ため、
   3 往復で元の位置に戻って止まる。動きを減らす設定では、初めから止まっている。
   比較の手順は docs/top-bg-compare-20261201.html（localhost で開く）。 */

/* 既定（C）：淡い紫の面の上辺を、緩い波にする。形は SVG のマスクで切り、色は面の背景色（トークン）で付ける。
   マスクは形だけを決める（色を持たない）。外へ 24px はみ出させるのは、揺れたとき端が見えないようにするため。 */
.lp-hero { isolation: isolate; }
.lp-hero::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  top: -12px; bottom: -12px; left: -24px; right: -24px;
  background-color: var(--gs-primary-tint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 66 C14 62 22 72 38 64 S66 46 80 49 S94 41 100 38 L100 100 L0 100 Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 66 C14 62 22 72 38 64 S66 46 80 49 S94 41 100 38 L100 100 L0 100 Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
/* 既定では、棒グラフの輪郭は出さない（面と重ねない）。?bg=bars のときだけ出す */
.lp-hero .lp-hero-bars { display: none; }
[data-hero-bg="bars"] .lp-hero .lp-hero-bars { display: block; }
/* 強制色モード（ハイコントラスト）では、飾りの面を出さない */
@media (forced-colors: active) { .lp-hero::before { display: none; } }

@media (prefers-reduced-motion: no-preference) {
  .lp-hero::before { animation: gs-lp-wave-sway 4s ease-in-out 1 both; }
  .lp-wave--in::before, .lp-wave--end-in.lp-wave--end::after { animation: gs-lp-wave-sway 4s ease-in-out 1 both; }
  @keyframes gs-lp-wave-sway {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50%      { transform: translate3d(14px, -6px, 0); }
  }
}

/* 従来の案を見るとき（?bg=a / b / bars）は、既定の波を出さない */
[data-hero-bg="a"] .lp-hero::before,
[data-hero-bg="b"] .lp-hero::before,
[data-hero-bg="bars"] .lp-hero::before { display: none; }

/* a: 面の切り替え。上を白、下を薄い面にして、ファーストビューの下端を 1px の罫線で区切る（色の境目は平ら） */
[data-hero-bg="a"] .lp-hero {
  background: linear-gradient(to bottom, var(--gs-ground) 0, var(--gs-ground) 55%, var(--gs-surface-1) 55%, var(--gs-surface-1) 100%);
  border-bottom: 1px solid var(--gs-rule);
}

/* b: 方眼。1px の細い罫線を 48px 間隔で敷く（情報を担わない飾り） */
[data-hero-bg="b"] .lp-hero {
  background-color: var(--gs-surface-1);
  background-image:
    linear-gradient(to right, var(--gs-rule) 1px, transparent 1px),
    linear-gradient(to bottom, var(--gs-rule) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
}

/* a・b のとき、既定（C）の棒グラフの非表示を引き継ぐ（案どうしを重ねない） */
[data-hero-bg="a"] .lp-hero .lp-hero-bars,
[data-hero-bg="b"] .lp-hero .lp-hero-bars { display: none; }

/* 主なセクションの波（2026-12-02）。ファーストビューの波（C）を、FAQ まで続ける。
   各セクションの見出しのあたりに、淡い紫（--gs-primary-tint）の帯を敷く。帯の上下の縁は緩い波で、境目がはっきりした直線にならない。
   帯は文字の後ろ（z-index: -1）で、色は文字のトークン（--gs-text・text-2・text-3）が淡い紫の上でも 4.5:1 以上になる値だけを使うため、読みやすさは保たれる。
   波は飾りで、消しても意味は変わらない（擬似要素・操作を受けない）。隣り合うセクションは、形を左右反転（--flip）して、同じ形が並ばない。
   動き：画面に入ったとき一度だけ、4 秒で揺れて元の位置へ戻り止まる（top.html の小さな観察器が lp-wave--in を足す）。
   動きを減らす設定では静止。強制色モードでは出さない。携帯では帯を低くし、横へはみ出さない（左右 24px の余白は overflow-x: clip で切る）。 */
.lp-wave { position: relative; isolation: isolate; overflow-x: clip; }
.lp-wave::before, .lp-wave--end::after {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  left: -24px; right: -24px; height: clamp(180px, 32vw, 320px);
  background-color: var(--gs-primary-tint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 22 C16 14 30 30 48 22 S80 10 100 18 L100 84 C84 92 70 78 50 86 S16 94 0 82 Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 22 C16 14 30 30 48 22 S80 10 100 18 L100 84 C84 92 70 78 50 86 S16 94 0 82 Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.lp-wave::before { top: 0; }
.lp-wave--flip::before, .lp-wave--flip::after {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M100 22 C84 14 70 30 52 22 S20 10 0 18 L0 84 C16 92 30 78 50 86 S84 94 100 82 Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M100 22 C84 14 70 30 52 22 S20 10 0 18 L0 84 C16 92 30 78 50 86 S84 94 100 82 Z'/%3E%3C/svg%3E");
}
/* 最後（FAQ）は、下にも帯を敷き、波が最後の問い合わせの面まで続くようにする */
.lp-wave--end::after { bottom: 0; height: clamp(120px, 22vw, 220px); }
/* 下の帯が画面に入ったことを知る目印（帯と同じ位置・高さ。見えず、操作も受けない） */
.lp-wave-end-mark { position: absolute; left: 0; right: 0; bottom: 0; height: clamp(120px, 22vw, 220px); visibility: hidden; pointer-events: none; }
@media (forced-colors: active) { .lp-wave::before, .lp-wave--end::after { display: none; } }

/* 写真の後ろの入り江、対話を挟む二つの波、導入手順を結ぶ流れ。 */
.lp-inlet.lp-hero::before, .lp-inlet .lp-hero-bars { display: none; }
.lp-inlet .hero-photo { isolation: isolate; }
.inlet-waves { position: absolute; pointer-events: none; z-index: -1; width: 158%; height: 144%; left: -17%; top: -23%; overflow: visible; }
[data-hero-bg="a"] .inlet-waves,
[data-hero-bg="b"] .inlet-waves,
[data-hero-bg="bars"] .inlet-waves { display: none; }
.inlet-waves__sky { opacity: .62; }
.inlet-waves__lilac { opacity: .92; }
@media (prefers-reduced-motion: no-preference) {
  .inlet-waves__sky { animation: inlet-sky 8s ease-in-out infinite alternate; }
  .inlet-waves__lilac { animation: inlet-lilac 6s ease-in-out infinite alternate; }
  @keyframes inlet-sky { from { transform: translate(-8px, 4px); } to { transform: translate(16px, -10px); } }
  @keyframes inlet-lilac { from { transform: translate(6px, -4px); } to { transform: translate(-13px, 9px); } }
}
.lp-dialogue { isolation: isolate; overflow: hidden; }
.dialogue-waves { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .54; z-index: -1; }
.lp-dialogue .proven-hero { background: transparent; border-color: transparent; }
.lp-dialogue .lp-card-sm { background: var(--lp-ground); }
.lp-wave-steps { overflow: hidden; }
/* カード間の余白だけで手順をつなぐ。 */
.lp-wave-steps .lp-step { overflow: visible; }
.lp-wave-steps .lp-step + .lp-step::after {
  content: ""; position: absolute; top: 50%; right: 100%; width: 2rem;
  height: 1px; background: var(--gs-rule); pointer-events: none;
}
/* 波の境界を見出しの前の余白に収める。 */
.lp-wave::before, .lp-wave--end::after { height: 32px; opacity: .68; }
.lp-voice { background: var(--gs-primary-tint); }
.lp-voice::before, #features.lp-wave::before, #plans.lp-wave::before { display: none; }
.lp-dialogue .dialogue-waves { opacity: .24; }
@media (max-width: 639px) {
  .inlet-waves { width: 137%; height: 138%; left: -16%; top: -17%; }
  .lp-dialogue .proven-hero { padding: 28px 0; }
  .lp-wave-steps .lp-step + .lp-step::after {
    top: auto; right: auto; left: 32px; bottom: 100%; width: 1px; height: 1rem;
  }
}
@media (forced-colors: active) { .inlet-waves, .dialogue-waves { display: none; } }

/* FVの水色と藤色を使い、本文を囲む余白ごとに輪郭を描く。 */
.lp-scene { position: relative; isolation: isolate; overflow: clip; }
.lp-scene.lp-wave::before, .lp-scene.lp-wave--end::after { content: none; }
/* 固有の比率で描いた色面。セクションの高さに合わせて引き伸ばさない。 */
.scene-inlet {
  position: absolute; pointer-events: none; z-index: -1;
  width: clamp(140px, 24vw, 370px); height: auto;
  right: 0; top: 8%; opacity: .44;
}
.scene-inlet .ink-sky { fill: var(--gs-chart-dept-2); }
.scene-inlet .ink-lilac { fill: var(--gs-chart-dept-1); }
.scene-inlet .ink-mint { fill: var(--gs-chart-dept-4); }
.scene-inlet .ink-sand { fill: var(--gs-chart-dept-3); }
.scene-inlet .ink-dots { fill: var(--gs-primary-strong); }
.lp-scene--difference .scene-inlet, .lp-scene--cases .scene-inlet { top: auto; bottom: 1rem; }
.lp-scene--purpose .scene-inlet { left: 0; right: auto; top: 21%; opacity: .25; }
.lp-scene--method .scene-inlet { top: 8rem; }
.lp-scene--voice .scene-inlet { left: 0; right: auto; top: 50%; transform: translateY(-50%); }
.lp-scene--pricing .scene-inlet { width: clamp(155px, 29vw, 430px); top: 1rem; }
.lp-scene--contact .scene-inlet { top: auto; bottom: 1rem; opacity: .15; }
/* 導入手順を読み終えた余白にだけ、横に続く一筆の波を置く。 */
.steps-tide { position: absolute; pointer-events: none; left: 0; bottom: 12px; width: 100%; height: 24px; fill: none; stroke: var(--gs-primary); opacity: .46; }
.steps-tide path { stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
@media (max-width: 639px) {
  .scene-inlet { width: 128px; right: -36px; opacity: .34; }
  .lp-scene--voice .scene-inlet { left: -48px; top: auto; bottom: 0; transform: none; }
  .lp-scene--purpose .scene-inlet { left: -38px; }
  .lp-scene--pricing .scene-inlet { width: 148px; right: -39px; top: 0; }
}
@media (forced-colors: active) { .scene-inlet, .steps-tide { display: none; } }
