/* ============================================================
   制作実績の3D（.w3）: three.js の見本 C「実績の画面を3Dで」（2026-11-18。見本 docs/threejs-1117/c-work/c-works3d.src.html）。
   使う所は2つ。どちらも見た目はこのファイル、動きと板の置き方は assets/pages/works3d.js（1つの JS を両方に付ける）
   ・トップの「制作実績」の区画（index.html の section.w3#works）。2026-11-18 に入れた。home.css の後に読む
   ・制作実績の一覧 /works の頭（works.html の section.w3.wk-hero）。2026-11-24 に、トップと同じものを入れた（代表「制作実績ページのFVのここもトップと同じthree.js使ってよ」）。
     works.css の前に読む。頭だけの違い（パンくずと h1・区画の長さ・文字の上の余白）は works.css の「一覧 /works」の段
   2026-11-24 に home.css の最後からこのファイルへ移した（中身はそのまま。トップの見た目は変わらない）
   ============================================================ */

/* ---------- 制作実績（#works）: three.js の見本 C「実績の画面を3Dで」を区画にした（2026-11-18。見本 docs/threejs-1117/c-work/c-works3d.src.html）。
   区画（.w3）はほかの区画と同じ角丸の面（.e-surface）。上の区画の尾に角丸で重なり、下の区画が尾（.e-tail）に重なる。
   スクロールの間だけ舞台（.w3-stage）を画面に止め、絵だけを手前へ流す（動きを減らす設定では止めない）。動きと板の置き方は assets/pages/works3d.js。
   見出しはお知らせの区画と同じ組み方（英字の札 p ＋ h2）、ボタンはサイトのボタン。文字の左端はほかの区画の本文の列（.sl-wrap）にそろえる。
   舞台の地・背景の円・WebGL が使えないときの絵は見本のまま ---------- */
.w3 {
  --w3-s1: #e1f8ff; --w3-s2: #e6f0ff; --w3-s3: #ede7ff;
  --w3-bg: linear-gradient(165deg, var(--w3-s1) 0%, var(--w3-s2) 48%, var(--w3-s3) 100%);
  --w3-gut: 24px;   /* .sl-wrap と同じ左右の余白（e.css の 673〜768px・769px 以上に合わせて下で替える） */
  height: 170vh; height: 170svh;
  overflow: clip;   /* 舞台を区画の上の角丸で切る（hidden にすると舞台が画面に止まらない） */
  /* 区画の地（舞台の外に見えるのは、動きを減らす設定の尾と、スマホでアドレスバーが隠れたときの画面の下の端だけ）。舞台と同じ地にする */
  background: var(--w3-bg) !important;
}
@media (min-width: 673px) and (max-width: 768px) { .w3 { --w3-gut: 32px; } }
@media (min-width: 769px) { .w3 { --w3-gut: max(48px, calc((100% - 1200px) / 2)); } }
/* 舞台が止まって、上の角丸が画面の上へ出きっている間（.is-pinned。works3d.js が付け外し）は角丸を外す。見た目は変わらない。
   角丸の切り抜きは、ソフト描画で絵を描くたびに重い（GPU では差が無い） */
.w3.is-pinned { border-radius: 0; }
.w3-stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; min-height: 500px;
  overflow: hidden; overflow: clip; isolation: isolate;
  display: grid; align-content: start;
  padding: clamp(76px, 11svh, 140px) var(--w3-gut) 0;
  background: var(--w3-bg);
}

/* 背景のグラデーションの円（見えた時に広がり、スクロールとマウスで少しずれる） */
.w3-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.w3-orb {
  position: absolute; display: block; border-radius: 50%;
  width: var(--d); height: var(--d); left: calc(var(--x) - var(--d) / 2); top: calc(var(--y) - var(--d) / 2);
  background: radial-gradient(circle at 40% 38%, var(--c1) 0%, var(--c2) 44%, rgba(255,255,255,0) 70%);
  translate: calc(var(--p, 0) * var(--sx, 0px) + var(--mx, 0) * var(--k, 0px)) calc(var(--p, 0) * var(--sy, 0px) + var(--my, 0) * var(--k, 0px));
}
.w3-orb--1 { --d: 64vmax; --x: 4%; --y: 8%; --c1: rgba(0,166,240,.16); --c2: rgba(42,111,245,.07); --sx: -3vw; --sy: 9vh; --k: -10px; --fx: 3vw; --fy: 4vh; }
.w3-orb--2 { --d: 58vmax; --x: 94%; --y: 4%; --c1: rgba(123,75,255,.22); --c2: rgba(106,63,232,.09); --sx: 4vw; --sy: 14vh; --k: -14px; --fx: -4vw; --fy: 5vh; }
.w3-orb--3 { --d: 66vmax; --x: 74%; --y: 98%; --c1: rgba(42,85,230,.20); --c2: rgba(0,166,240,.08); --sx: -7vw; --sy: -12vh; --k: -18px; --fx: -3vw; --fy: -4vh; }
.w3-orb--4 { --d: 30vmax; --x: 14%; --y: 92%; --c1: rgba(106,63,232,.16); --c2: rgba(42,111,245,.06); --sx: 6vw; --sy: -8vh; --k: -8px; --fx: 4vw; --fy: -3vh; }
.w3-orb--5 { --d: 26vmax; --x: 60%; --y: 34%; --c1: rgba(0,180,255,.20); --c2: rgba(123,75,255,.08); --sx: -6vw; --sy: 10vh; --k: -6px; --fx: -5vw; --fy: 6vh; }

/* WebGL が使えない・three が届かない・描画の場所を失ったとき（.is-nogl）と、JS が動かないときの絵（CSS のグラデーションだけの止まった板） */
.w3-fb { display: none; position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.w3-fb i { position: absolute; display: block; border-radius: 18px;
  background: linear-gradient(150deg, rgba(255,255,255,.96) 0%, rgba(230,240,255,.92) 55%, rgba(237,231,255,.9) 100%);
  box-shadow: 0 0 0 1px rgba(42,111,245,.10), 0 12px 44px -14px rgba(28,42,107,.22); }
.w3-fb i:nth-child(1) { width: 62%; aspect-ratio: 16/10; right: -6%; top: 62%; rotate: -5deg; }
.w3-fb i:nth-child(2) { width: 30%; aspect-ratio: 9/19; left: 6%; top: 54%; rotate: 4deg; }
.w3-fb i:nth-child(3) { width: 52%; aspect-ratio: 16/10; right: 8%; top: 40%; rotate: 3deg; opacity: .8; }
.w3.is-nogl .w3-fb, html:not(.e-js) .w3-fb { display: block; }
.w3.is-nogl .w3-canvas { display: none; }

.w3-canvas { position: absolute; inset: 0; z-index: 2; display: block; width: 100%; height: 100%; pointer-events: none; }

/* 文字（canvas の上）。地を明るくするのは見出しのすぐ周りだけ（お客様の画面には掛けない。ボタンは塗りなので要らない） */
.w3-copy { position: relative; z-index: 3; min-width: 0; }
.w3-copy-in { display: grid; justify-items: start; width: fit-content; max-width: 100%; }
.w3-title { position: relative; }
.w3-title::before { content: ''; position: absolute; z-index: -1; inset: -48% -16%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(247,249,255,.86) 0%, rgba(247,249,255,.55) 52%, rgba(247,249,255,0) 100%); }
.w3-btn { margin-top: clamp(20px, 3.2vh, 30px); }

/* 横に並べる幅（PC・開いた折りたたみの横向き）: 左に文字、右に絵 */
@media (min-width: 800px) and (min-aspect-ratio: 11/10) {
  .w3 { --w3-bg: linear-gradient(118deg, var(--w3-s1) 0%, var(--w3-s2) 46%, var(--w3-s3) 100%); }
  .w3-stage { align-content: center; padding: 0 0 0 var(--w3-gut); }
  .w3-copy { width: clamp(260px, 32vw, 500px); }
  .w3-orb--1 { --x: 8%; --y: 30%; }
  .w3-fb i:nth-child(1) { width: 34%; right: -3%; top: 52%; }
  .w3-fb i:nth-child(2) { width: 13%; left: auto; right: 30%; top: 14%; }
  .w3-fb i:nth-child(3) { width: 30%; right: 13%; top: 18%; }
}

/* 円の動き（JS が動き、動きを減らす設定でないときだけ）。区画が画面の外・タブが裏のとき（.is-off。HTML の最初の状態）は止める */
html.e-motion .w3-orb { animation: w3-orb-in 1.8s var(--e-ease) both, w3-orb-float var(--t, 24s) ease-in-out 1.8s infinite alternate; }
html.e-motion .w3-orb--2 { --t: 28s; animation-delay: .12s, 1.92s; }
html.e-motion .w3-orb--3 { --t: 32s; animation-delay: .24s, 2.04s; }
html.e-motion .w3-orb--4 { --t: 21s; animation-delay: .36s, 2.16s; }
html.e-motion .w3-orb--5 { --t: 26s; animation-delay: .48s, 2.28s; }
html.e-motion .w3.is-off .w3-orb { animation-play-state: paused; }
@keyframes w3-orb-in { from { opacity: 0; transform: scale(.72); } to { opacity: 1; transform: none; } }
@keyframes w3-orb-float { to { transform: translate3d(var(--fx, 3vw), var(--fy, -3vh), 0) scale(1.06); } }

/* 動きを減らす設定: 舞台を画面に止めない（ふつうの区画。絵は出そろった止まった1枚） */
@media (prefers-reduced-motion: reduce) {
  .w3 { height: auto; }
  .w3-stage { position: relative; }
}
